From 755466a295f1ff360a9ee18aaa8ab7a723fca4ea Mon Sep 17 00:00:00 2001 From: darken Date: Thu, 5 Aug 2021 14:03:53 +0200 Subject: [PATCH] Fixing JitPack build issues --- build.gradle | 10 +---- jitpack.yml | 2 + publish-to-bintray.gradle | 91 --------------------------------------- tracker/build.gradle | 85 +++++++++++++++--------------------- 4 files changed, 38 insertions(+), 150 deletions(-) create mode 100644 jitpack.yml delete mode 100644 publish-to-bintray.gradle diff --git a/build.gradle b/build.gradle index f099745b..ecebf4b7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,10 @@ buildscript { repositories { google() - maven { - url "https://plugins.gradle.org/m2/" - } + maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath 'com.android.tools.build:gradle:7.0.0' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath 'com.dicedmelon.gradle:jacoco-android:0.1.5' } } @@ -16,9 +12,7 @@ buildscript { allprojects { repositories { google() - maven { - url "https://plugins.gradle.org/m2/" - } + maven { url "https://plugins.gradle.org/m2/" } } ext { globalMinSdkVersion = 14 diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 00000000..46c85291 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +jdk: + - openjdk11 \ No newline at end of file diff --git a/publish-to-bintray.gradle b/publish-to-bintray.gradle deleted file mode 100644 index 5379e417..00000000 --- a/publish-to-bintray.gradle +++ /dev/null @@ -1,91 +0,0 @@ -apply plugin: 'com.github.dcendents.android-maven' - -group = publishedGroupId -version = libraryVersion - -install { - repositories.mavenInstaller { - pom.project { - packaging 'aar' - name libraryName - description libraryDescription - url siteUrl - - artifactId artifact - groupId publishedGroupId - version libraryVersion - - licenses { - license { - name licenseName - url licenseUrl - distribution 'repo' - } - } - scm { - connection gitUrl - url siteUrl - } - developers { - developer { - id developerId - name developerName - email developerEmail - } - } - } - } -} - -apply plugin: "com.jfrog.bintray" - -if (project.hasProperty("android")) { - // Android libraries - task sourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.srcDirs - } - - task javadoc(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - classpath += configurations.compile - } -} else { - // Java libraries - task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource - } -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -artifacts { - archives javadocJar - archives sourcesJar -} - -bintray { - user = bintrayUser - key = bintrayApiKey - configurations = ['archives'] - pkg { - repo = bintrayRepo - name = bintrayName - desc = libraryDescription - - dryRun = false - publish = true - // override = true - - userOrg = user - licenses = allLicenses - vcsUrl = gitUrl - - publicDownloadNumbers = true - } -} diff --git a/tracker/build.gradle b/tracker/build.gradle index ca2998f7..c4d0c7be 100644 --- a/tracker/build.gradle +++ b/tracker/build.gradle @@ -1,8 +1,9 @@ apply plugin: 'com.android.library' +apply plugin: 'maven-publish' def versionMajor = 4 def versionMinor = 1 -def versionPatch = 2 +def versionPatch = 4 def myVersionCode = versionMajor * 10000 + versionMinor * 100 + versionPatch def myVersionName = "${versionMajor}.${versionMinor}.${versionPatch}" @@ -14,6 +15,13 @@ android { targetSdkVersion project.ext.globalTargetSdkVersion } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + testOptions.unitTests.includeAndroidResources = true } @@ -37,23 +45,6 @@ dependencies { testImplementation 'org.robolectric:robolectric:4.3.1' } -/** - * JAR - */ -task clearJar(type: Delete) { - delete fileTree(dir: "jar", exclude: "dont_delete.txt") -} - -task makeJar(type: Copy) { - from('build/intermediates/bundles/release/') - into('jar/') - include('classes.jar') - def fileName = 'MatomoAndroidSdk-' + 'git rev-parse --short HEAD'.execute().text.trim() + '.jar' - rename('classes.jar', fileName) -} - -makeJar.dependsOn(clearJar, build) - /** * Coverage */ @@ -91,37 +82,29 @@ android.libraryVariants.all { variant -> } } -def credentialsFile = new File(System.properties['user.home'], ".bintray/bintray.properties") -ext { - if (credentialsFile.canRead()) { - Properties props = new Properties() - props.load(new FileInputStream(credentialsFile)) - bintrayUser = props['bintray.user'] - bintrayApiKey = props['bintray.apikey'] +afterEvaluate { + publishing { + publications { + release(MavenPublication) { + from components.release + + groupId = 'org.matomo.sdk' + artifactId = 'tracker' + version = myVersionName + + pom { + name = 'Matomo SDK for Android' + description = 'SDK for Android to measure your apps with Matomo' + url = 'https://github.com/matomo-org/matomo-sdk-android' + + licenses { + license { + name = 'BSD-3 Clause' + url = 'https://github.com/matomo-org/matomo-sdk-android/blob/master/LICENSE' + } + } + } + } + } } - - bintrayRepo = 'maven' - bintrayName = 'matomo-sdk-android' - - publishedGroupId = 'org.matomo.sdk' - libraryName = 'Matomo SDK for Android' - artifact = 'tracker' - - libraryDescription = 'SDK for Android to measure your apps with Matomo' - - siteUrl = 'https://github.com/matomo-org/matomo-sdk-android' - gitUrl = 'https://github.com/matomo-org/matomo-sdk-android.git' - - libraryVersion = myVersionName - - developerId = 'darken' - developerName = 'Matthias Urhahn' - developerEmail = 'darken@darken.eu' - - licenseName = 'BSD-3 Clause' - licenseUrl = 'https://github.com/matomo-org/matomo-sdk-android/blob/master/LICENSE' - allLicenses = ["BSD 3-Clause"] -} -if (credentialsFile.canRead()) { - apply from: '../publish-to-bintray.gradle' -} +} \ No newline at end of file