From c927219480ffed2887a6a3347702eeea6b2ca067 Mon Sep 17 00:00:00 2001 From: Sabin Date: Fri, 18 Feb 2022 14:56:02 +1300 Subject: [PATCH 01/11] migration to maven central --- .github/workflows/publish.yml | 39 +++++++++ build.gradle | 37 ++++++++- common.gradle | 14 ++-- googlemaps/build.gradle | 14 ++-- gradle.properties | 28 +++++-- gradle/wrapper/gradle-wrapper.properties | 6 +- mapbox/build.gradle | 16 ++-- mapme/build.gradle | 19 +++-- publish-root.gradle | 38 +++++++++ publishing.gradle | 100 ++++++++++++++++++----- sample/build.gradle | 22 ++--- 11 files changed, 255 insertions(+), 78 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 publish-root.gradle diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..2b7a63b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,39 @@ +name: Publish + +on: + push: + branches: + - main + - 'releases/**' + +jobs: + publish: + name: Release build and publish + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: 11 + + # Builds the release artifacts of the library + - name: Release build + run: ./gradlew assembleRelease -x :googlemaps:assembleRelease -x :mapbox:assembleRelease -x :mapme:assembleRelease + + # Generates other artifacts + - name: Source jar and dokka + run: ./gradlew androidSourcesJar javadocJar + + # Runs upload, and then closes & releases the repository + - name: Publish to MavenCentral + run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} diff --git a/build.gradle b/build.gradle index 21c7ac5..e2b1862 100644 --- a/build.gradle +++ b/build.gradle @@ -1,17 +1,50 @@ +apply plugin: 'io.github.gradle-nexus.publish-plugin' +apply plugin: 'org.jetbrains.dokka' + buildscript { apply from: 'common.gradle' repositories { + maven { url "https://plugins.gradle.org/m2/" } google() jcenter() - mavenLocal() + mavenCentral() } dependencies { classpath "com.android.tools.build:gradle:$gradle_version" - classpath "digital.wup:android-maven-publish:$android_maven_version" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'io.github.gradle-nexus:publish-plugin:1.1.0' + classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.6.10' + } +} + +allprojects { + repositories { + google() + jcenter() + } + + afterEvaluate { + // Common library module configurations + if (plugins.hasPlugin("com.android.library") || plugins.hasPlugin("com.android.application")) { + android.compileSdkVersion = project.ext.compileSdk + + + android.defaultConfig { + minSdkVersion project.ext.minSdk + targetSdkVersion project.ext.compileSdk + vectorDrawables.useSupportLibrary = true + } + + android.compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + } } } task clean(type: Delete) { delete rootProject.buildDir } +apply from: "${rootDir}/publish-root.gradle" \ No newline at end of file diff --git a/common.gradle b/common.gradle index 70ab3de..2ee7841 100644 --- a/common.gradle +++ b/common.gradle @@ -1,16 +1,20 @@ ext.version = "1.2.0" ext.group = "nz.co.trademe.mapme" -ext.repo = "MapMe" +ext.repo = "mapme" ext.org = "trademe" ext.scm = 'https://github.com/TradeMe/MapMe.git' +ext.url = 'https://github.com/TradeMe/MapMe' ext.description = 'MapMe is an Android library that brings the adapter pattern to Maps, simplifying the management of markers and annotations.' -ext.compileSdk = 28 +ext.connection = 'scm:git:github.com/TradeMe/MapMe.git' +ext.developerConnection = 'scm:git:ssh://github.com/TradeMe/MapMe.git' + +ext.compileSdk = 31 ext.minSdk = 15 -ext.buildTools = "28.0.3" -ext.kotlin_version = '1.2.71' +ext.buildTools = "29.0.3" +ext.kotlin_version = '1.5.0' ext.dokka_version = '0.9.15' -ext.gradle_version = '3.2.0' +ext.gradle_version = '7.0.1' ext.mapbox_version = '6.4.0' ext.google_play_services_version = '15.0.1' ext.androidx_version = '1.0.0' diff --git a/googlemaps/build.gradle b/googlemaps/build.gradle index 192c7f7..9114538 100644 --- a/googlemaps/build.gradle +++ b/googlemaps/build.gradle @@ -21,12 +21,12 @@ apply plugin: 'kotlin-android' apply from: '../publishing.gradle' android { - compileSdkVersion compileSdk + compileSdkVersion project.ext.compileSdk buildToolsVersion buildTools defaultConfig { - minSdkVersion minSdk - targetSdkVersion compileSdk + minSdkVersion project.ext.minSdk + targetSdkVersion project.ext.compileSdk testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -49,12 +49,12 @@ repositories { } dependencies { - compile "com.google.android.gms:play-services-maps:$google_play_services_version" - compile "androidx.appcompat:appcompat:$androidx_version" + implementation "com.google.android.gms:play-services-maps:$google_play_services_version" + implementation "androidx.appcompat:appcompat:$androidx_version" - compile project(':mapme') + implementation project(':mapme') - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } diff --git a/gradle.properties b/gradle.properties index cde633c..23339e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx1536m -#Disables an error with Gradle that is fixed in Gradle 4.4 but an error is still thrown with AGP 3.0.1 -#error will be removed in 3.1.0 -#See https://d.android.com/r/tools/buildscript-classpath-check.html -android.enableBuildScriptClasspathCheck=false - -# Bintray credentials - When publishing, ensure changes to this file are not added to source control -BINTRAY_USERNAME=INSERT_USERNAME_HERE -BINTRAY_API_KEY=INSERT_KEY_HERE +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true -android.enableJetifier=true \ No newline at end of file +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2c8e4e3..7631fb2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Mar 10 13:26:55 NZDT 2017 +#Fri Feb 18 14:17:21 NZDT 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/mapbox/build.gradle b/mapbox/build.gradle index 9e94e07..2ea3447 100644 --- a/mapbox/build.gradle +++ b/mapbox/build.gradle @@ -21,12 +21,12 @@ apply plugin: 'kotlin-android' apply from: '../publishing.gradle' android { - compileSdkVersion compileSdk + compileSdkVersion project.ext.compileSdk buildToolsVersion buildTools defaultConfig { - minSdkVersion minSdk - targetSdkVersion compileSdk + minSdkVersion project.ext.minSdk + targetSdkVersion project.ext.compileSdk testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -42,10 +42,6 @@ android { lintConfig new File(rootProject.projectDir, "lint.xml") } - compileOptions { - sourceCompatibility 1.8 - targetCompatibility 1.8 - } } repositories { @@ -54,11 +50,11 @@ repositories { } dependencies { - compile("com.mapbox.mapboxsdk:mapbox-android-sdk:$mapbox_version@aar") { + implementation("com.mapbox.mapboxsdk:mapbox-android-sdk:$mapbox_version@aar") { transitive = true } - compile project(':mapme') + implementation project(':mapme') - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } \ No newline at end of file diff --git a/mapme/build.gradle b/mapme/build.gradle index 26f6964..acdedf8 100644 --- a/mapme/build.gradle +++ b/mapme/build.gradle @@ -1,6 +1,7 @@ buildscript { apply from: '../common.gradle' repositories { + maven { url "https://plugins.gradle.org/m2/" } google() jcenter() mavenLocal() @@ -25,12 +26,12 @@ apply from: '../publishing.gradle' android { - compileSdkVersion compileSdk + compileSdkVersion project.ext.compileSdk buildToolsVersion buildTools defaultConfig { - minSdkVersion minSdk - targetSdkVersion compileSdk + minSdkVersion project.ext.minSdk + targetSdkVersion project.ext.compileSdk testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -62,13 +63,13 @@ repositories { } dependencies { - testCompile 'junit:junit:4.12' - testCompile "org.mockito:mockito-core:2.7.22" - testCompile "com.nhaarman:mockito-kotlin:1.4.0" - testCompile 'org.amshove.kluent:kluent:1.20' + testImplementation 'junit:junit:4.12' + testImplementation "org.mockito:mockito-core:2.7.22" + testImplementation "com.nhaarman:mockito-kotlin:1.4.0" + testImplementation 'org.amshove.kluent:kluent:1.20' - compile "androidx.recyclerview:recyclerview:$androidx_version" - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation "androidx.recyclerview:recyclerview:$androidx_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } diff --git a/publish-root.gradle b/publish-root.gradle new file mode 100644 index 0000000..6532af8 --- /dev/null +++ b/publish-root.gradle @@ -0,0 +1,38 @@ + +// Create variables with empty default values +ext["signing.keyId"] = '' +ext["signing.password"] = '' +ext["signing.key"] = '' +ext["ossrhUsername"] = '' +ext["ossrhPassword"] = '' +ext["sonatypeStagingProfileId"] = '' + +File secretPropsFile = project.rootProject.file('local.properties') +if (secretPropsFile.exists()) { + // Read local.properties file first if it exists + Properties p = new Properties() + new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) } + p.each { name, value -> ext[name] = value } +} else { + // Use system environment variables + ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') + ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') + ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') + ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') + ext["signing.password"] = System.getenv('SIGNING_PASSWORD') + ext["signing.key"] = System.getenv('SIGNING_KEY') + ext["snapshot"] = System.getenv('SNAPSHOT') +} + +// Set up Sonatype repository +nexusPublishing { + repositories { + sonatype { + stagingProfileId = sonatypeStagingProfileId + username = ossrhUsername + password = ossrhPassword + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + } + } +} \ No newline at end of file diff --git a/publishing.gradle b/publishing.gradle index b61cd46..eb19f05 100644 --- a/publishing.gradle +++ b/publishing.gradle @@ -1,37 +1,93 @@ -if (project.plugins.hasPlugin("com.android.library")) { - apply plugin: 'digital.wup.android-maven-publish' +apply plugin: 'maven-publish' +apply plugin: 'signing' +apply plugin: 'org.jetbrains.dokka' - project.afterEvaluate { - task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - } +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + if (project.plugins.findPlugin("com.android.library")) { + + // For Android libraries + from android.sourceSets.main.java.srcDirs + from android.sourceSets.main.kotlin.srcDirs + } else { + from sourceSets.main.java.srcDirs + from sourceSets.main.kotlin.srcDirs } + +} +task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { + archiveClassifier.set('javadoc') + from dokkaJavadoc.outputDirectory +} + +artifacts { + archives androidSourcesJar + archives javadocJar +} + + +afterEvaluate { publishing { + publications { - aar(MavenPublication) { - from project.components.android - artifact project.sourcesJar { - // not required, includes sourcesJar with correct classifier - classifier "sources" - } + release(MavenPublication) { groupId project.ext.group - artifactId project.name + artifactId project.ext.repo version project.ext.version - } - } - repositories { - maven { - name 'Bintray' - url "https://api.bintray.com/maven/${project.org}/${project.repo}/${project.name}/;publish=1" + if (project.plugins.findPlugin("com.android.library")) { + from components.release + } else { + from components.java + } + + artifact androidSourcesJar + artifact javadocJar + + // metadata + pom { + name = project.ext.repo + description = 'SDK' + url = project.ext.url + licenses { + license { + name = 'MapMe License' + url = 'https://github.com/sabintrademe/MapMe/blob/master/LICENSE' + } + } + developers { + developer { + id = 'sabinmj' + name = 'Sabin' + email = 'sabin.mj@gmail.com' + } + // Add all other devs here... + } + + // Version control info - if you're using GitHub, follow the + // format as seen here + scm { + connection = project.ext.connection + developerConnection = project.ext.developerConnection + url = project.ext.url - credentials { - username BINTRAY_USERNAME - password BINTRAY_API_KEY + } } } } } +} +signing { + useInMemoryPgpKeys( + rootProject.ext["signing.keyId"], + rootProject.ext["signing.key"], + rootProject.ext["signing.password"], + ) + sign publishing.publications +} +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index 8a03314..8e8cf4d 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -16,12 +16,12 @@ apply plugin: 'kotlin-android' apply from: '../common.gradle' android { - compileSdkVersion compileSdk + compileSdkVersion project.ext.compileSdk buildToolsVersion buildTools defaultConfig { applicationId "nz.co.trademe.mapme.sample" minSdkVersion 21 - targetSdkVersion compileSdk + targetSdkVersion project.ext.compileSdk versionCode 1 versionName "1.0" @@ -70,18 +70,18 @@ repositories { } dependencies { - compile 'com.jakewharton.timber:timber:4.5.1' - compile 'com.squareup.picasso:picasso:2.5.2' + implementation 'com.jakewharton.timber:timber:4.5.1' + implementation 'com.squareup.picasso:picasso:2.5.2' - compile "androidx.appcompat:appcompat:$androidx_version" - compile "com.google.android.material:material:$androidx_version" + implementation "androidx.appcompat:appcompat:$androidx_version" + implementation "com.google.android.material:material:$androidx_version" - compile "com.google.android.gms:play-services-maps:$google_play_services_version" + implementation "com.google.android.gms:play-services-maps:$google_play_services_version" - compile 'com.mapbox.mapboxsdk:mapbox-android-services:2.2.3' + implementation 'com.mapbox.mapboxsdk:mapbox-android-services:2.2.3' - compile project(':googlemaps') - compile project(':mapbox') + implementation project(':googlemaps') + implementation project(':mapbox') - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } \ No newline at end of file From ed071abe0b82c74eca02717b1d8fe03d55e84531 Mon Sep 17 00:00:00 2001 From: Sabin Date: Tue, 22 Feb 2022 13:35:26 +1300 Subject: [PATCH 02/11] dependency fixes --- build.gradle | 19 ---------------- common.gradle | 6 ++--- googlemaps/build.gradle | 6 ++--- gradle.properties | 28 ++++++++---------------- gradle/wrapper/gradle-wrapper.properties | 6 ++--- mapbox/build.gradle | 12 ++++++---- mapme/build.gradle | 7 +++--- sample/build.gradle | 23 +++++++++---------- 8 files changed, 41 insertions(+), 66 deletions(-) diff --git a/build.gradle b/build.gradle index e2b1862..d95e577 100644 --- a/build.gradle +++ b/build.gradle @@ -23,25 +23,6 @@ allprojects { google() jcenter() } - - afterEvaluate { - // Common library module configurations - if (plugins.hasPlugin("com.android.library") || plugins.hasPlugin("com.android.application")) { - android.compileSdkVersion = project.ext.compileSdk - - - android.defaultConfig { - minSdkVersion project.ext.minSdk - targetSdkVersion project.ext.compileSdk - vectorDrawables.useSupportLibrary = true - } - - android.compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - } - } } task clean(type: Delete) { diff --git a/common.gradle b/common.gradle index 2ee7841..47318fc 100644 --- a/common.gradle +++ b/common.gradle @@ -9,12 +9,12 @@ ext.description = 'MapMe is an Android library that brings the adapter pattern t ext.connection = 'scm:git:github.com/TradeMe/MapMe.git' ext.developerConnection = 'scm:git:ssh://github.com/TradeMe/MapMe.git' -ext.compileSdk = 31 -ext.minSdk = 15 +ext.compileSdk = 30 +ext.minSdk = 19 ext.buildTools = "29.0.3" ext.kotlin_version = '1.5.0' ext.dokka_version = '0.9.15' -ext.gradle_version = '7.0.1' +ext.gradle_version = '4.0.1' ext.mapbox_version = '6.4.0' ext.google_play_services_version = '15.0.1' ext.androidx_version = '1.0.0' diff --git a/googlemaps/build.gradle b/googlemaps/build.gradle index 9114538..19d1baf 100644 --- a/googlemaps/build.gradle +++ b/googlemaps/build.gradle @@ -21,12 +21,12 @@ apply plugin: 'kotlin-android' apply from: '../publishing.gradle' android { - compileSdkVersion project.ext.compileSdk + compileSdkVersion compileSdk buildToolsVersion buildTools defaultConfig { - minSdkVersion project.ext.minSdk - targetSdkVersion project.ext.compileSdk + minSdkVersion minSdk + targetSdkVersion compileSdk testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/gradle.properties b/gradle.properties index 23339e0..cde633c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,21 +1,11 @@ -# Project-wide Gradle settings. -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx1536m -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true -# AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app's APK -# https://developer.android.com/topic/libraries/support-library/androidx-rn +#Disables an error with Gradle that is fixed in Gradle 4.4 but an error is still thrown with AGP 3.0.1 +#error will be removed in 3.1.0 +#See https://d.android.com/r/tools/buildscript-classpath-check.html +android.enableBuildScriptClasspathCheck=false + +# Bintray credentials - When publishing, ensure changes to this file are not added to source control +BINTRAY_USERNAME=INSERT_USERNAME_HERE +BINTRAY_API_KEY=INSERT_KEY_HERE android.useAndroidX=true -# Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true -# Kotlin code style for this project: "official" or "obsolete": -kotlin.code.style=official +android.enableJetifier=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7631fb2..0c931fc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Feb 18 14:17:21 NZDT 2022 +#Fri Mar 10 13:26:55 NZDT 2017 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip distributionPath=wrapper/dists -zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip diff --git a/mapbox/build.gradle b/mapbox/build.gradle index 2ea3447..276fc98 100644 --- a/mapbox/build.gradle +++ b/mapbox/build.gradle @@ -21,12 +21,12 @@ apply plugin: 'kotlin-android' apply from: '../publishing.gradle' android { - compileSdkVersion project.ext.compileSdk + compileSdkVersion compileSdk buildToolsVersion buildTools defaultConfig { - minSdkVersion project.ext.minSdk - targetSdkVersion project.ext.compileSdk + minSdkVersion minSdk + targetSdkVersion compileSdk testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -42,6 +42,10 @@ android { lintConfig new File(rootProject.projectDir, "lint.xml") } + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } } repositories { @@ -50,7 +54,7 @@ repositories { } dependencies { - implementation("com.mapbox.mapboxsdk:mapbox-android-sdk:$mapbox_version@aar") { + compile("com.mapbox.mapboxsdk:mapbox-android-sdk:$mapbox_version@aar") { transitive = true } diff --git a/mapme/build.gradle b/mapme/build.gradle index acdedf8..42f3042 100644 --- a/mapme/build.gradle +++ b/mapme/build.gradle @@ -1,7 +1,6 @@ buildscript { apply from: '../common.gradle' repositories { - maven { url "https://plugins.gradle.org/m2/" } google() jcenter() mavenLocal() @@ -26,12 +25,12 @@ apply from: '../publishing.gradle' android { - compileSdkVersion project.ext.compileSdk + compileSdkVersion compileSdk buildToolsVersion buildTools defaultConfig { - minSdkVersion project.ext.minSdk - targetSdkVersion project.ext.compileSdk + minSdkVersion minSdk + targetSdkVersion compileSdk testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/sample/build.gradle b/sample/build.gradle index 8e8cf4d..d03767e 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -16,12 +16,12 @@ apply plugin: 'kotlin-android' apply from: '../common.gradle' android { - compileSdkVersion project.ext.compileSdk + compileSdkVersion compileSdk buildToolsVersion buildTools defaultConfig { applicationId "nz.co.trademe.mapme.sample" minSdkVersion 21 - targetSdkVersion project.ext.compileSdk + targetSdkVersion compileSdk versionCode 1 versionName "1.0" @@ -70,18 +70,19 @@ repositories { } dependencies { - implementation 'com.jakewharton.timber:timber:4.5.1' - implementation 'com.squareup.picasso:picasso:2.5.2' + implementation project(path: ':mapme') + compile 'com.jakewharton.timber:timber:4.5.1' + compile 'com.squareup.picasso:picasso:2.5.2' - implementation "androidx.appcompat:appcompat:$androidx_version" - implementation "com.google.android.material:material:$androidx_version" + compile "androidx.appcompat:appcompat:$androidx_version" + compile "com.google.android.material:material:$androidx_version" - implementation "com.google.android.gms:play-services-maps:$google_play_services_version" + compile "com.google.android.gms:play-services-maps:$google_play_services_version" - implementation 'com.mapbox.mapboxsdk:mapbox-android-services:2.2.3' + compile 'com.mapbox.mapboxsdk:mapbox-android-services:2.2.3' - implementation project(':googlemaps') - implementation project(':mapbox') + compile project(':googlemaps') + compile project(':mapbox') - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } \ No newline at end of file From a27f9da0999eae399fa5db62db4068c0734ab4c1 Mon Sep 17 00:00:00 2001 From: Sabin Date: Tue, 22 Feb 2022 15:11:29 +1300 Subject: [PATCH 03/11] dependency fixes --- googlemaps/build.gradle | 8 ++++---- mapbox/build.gradle | 4 ++-- mapme/build.gradle | 12 ++++++------ sample/build.gradle | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/googlemaps/build.gradle b/googlemaps/build.gradle index 19d1baf..192c7f7 100644 --- a/googlemaps/build.gradle +++ b/googlemaps/build.gradle @@ -49,12 +49,12 @@ repositories { } dependencies { - implementation "com.google.android.gms:play-services-maps:$google_play_services_version" - implementation "androidx.appcompat:appcompat:$androidx_version" + compile "com.google.android.gms:play-services-maps:$google_play_services_version" + compile "androidx.appcompat:appcompat:$androidx_version" - implementation project(':mapme') + compile project(':mapme') - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } diff --git a/mapbox/build.gradle b/mapbox/build.gradle index 276fc98..9e94e07 100644 --- a/mapbox/build.gradle +++ b/mapbox/build.gradle @@ -58,7 +58,7 @@ dependencies { transitive = true } - implementation project(':mapme') + compile project(':mapme') - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } \ No newline at end of file diff --git a/mapme/build.gradle b/mapme/build.gradle index 42f3042..26f6964 100644 --- a/mapme/build.gradle +++ b/mapme/build.gradle @@ -62,13 +62,13 @@ repositories { } dependencies { - testImplementation 'junit:junit:4.12' - testImplementation "org.mockito:mockito-core:2.7.22" - testImplementation "com.nhaarman:mockito-kotlin:1.4.0" - testImplementation 'org.amshove.kluent:kluent:1.20' + testCompile 'junit:junit:4.12' + testCompile "org.mockito:mockito-core:2.7.22" + testCompile "com.nhaarman:mockito-kotlin:1.4.0" + testCompile 'org.amshove.kluent:kluent:1.20' - implementation "androidx.recyclerview:recyclerview:$androidx_version" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + compile "androidx.recyclerview:recyclerview:$androidx_version" + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } diff --git a/sample/build.gradle b/sample/build.gradle index d03767e..09ec390 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -70,7 +70,7 @@ repositories { } dependencies { - implementation project(path: ':mapme') + compile project(path: ':mapme') compile 'com.jakewharton.timber:timber:4.5.1' compile 'com.squareup.picasso:picasso:2.5.2' From 12a95cd28cfbf7fb93882bead48e99aa41f5bf4b Mon Sep 17 00:00:00 2001 From: Sabin Date: Wed, 23 Feb 2022 17:37:21 +1300 Subject: [PATCH 04/11] snapshot fixes --- .github/workflows/publish.yml | 16 ++++++------- .github/workflows/snapshot.yml | 42 ++++++++++++++++++++++++++++++++++ googlemaps/build.gradle | 4 +++- mapbox/build.gradle | 3 ++- mapme/build.gradle | 3 ++- publish-root.gradle | 7 ++++++ publishing.gradle | 6 ++--- 7 files changed, 67 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/snapshot.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2b7a63b..1bd697c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: # Builds the release artifacts of the library - name: Release build - run: ./gradlew assembleRelease -x :googlemaps:assembleRelease -x :mapbox:assembleRelease -x :mapme:assembleRelease + run: ./gradlew googlemaps:assembleRelease -x :mapbox:assembleRelease -x :mapme:assembleRelease # Generates other artifacts - name: Source jar and dokka @@ -30,10 +30,10 @@ jobs: # Runs upload, and then closes & releases the repository - name: Publish to MavenCentral run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository - env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} +env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml new file mode 100644 index 0000000..8be093f --- /dev/null +++ b/.github/workflows/snapshot.yml @@ -0,0 +1,42 @@ +name: Publish Snapshot builds + + +on: + push: + branches: + - development + - 'snapshot/**' + + + + +jobs: + publish: + name: Snapshot build and publish + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: 11 + - name: Release build + + run: ./gradlew googlemaps:assembleRelease -x :mapbox:assembleRelease -x :mapme:assembleRelease + - name: Source jar and dokka + run: ./gradlew androidSourcesJar javadocJar + - name: Publish to MavenCentral + run: ./gradlew publishReleasePublicationToSonatypeRepository + + + +env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + SNAPSHOT: true \ No newline at end of file diff --git a/googlemaps/build.gradle b/googlemaps/build.gradle index 192c7f7..4824cbc 100644 --- a/googlemaps/build.gradle +++ b/googlemaps/build.gradle @@ -13,9 +13,11 @@ buildscript { apply from: '../common.gradle' ext { - name = "MapMe GoogleMaps" + PUBLISH_VERSION = rootVersionName + ARTIFACT_ID = "googlemaps" } + apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply from: '../publishing.gradle' diff --git a/mapbox/build.gradle b/mapbox/build.gradle index 9e94e07..0d776ca 100644 --- a/mapbox/build.gradle +++ b/mapbox/build.gradle @@ -13,7 +13,8 @@ buildscript { apply from: '../common.gradle' ext { - name = "MapMe Mapbox" + PUBLISH_VERSION = rootVersionName + ARTIFACT_ID = "mapbox" } apply plugin: 'com.android.library' diff --git a/mapme/build.gradle b/mapme/build.gradle index 26f6964..f65a934 100644 --- a/mapme/build.gradle +++ b/mapme/build.gradle @@ -15,7 +15,8 @@ buildscript { apply from: '../common.gradle' ext { - name = "MapMe" + PUBLISH_VERSION = rootVersionName + ARTIFACT_ID = "mapme" } diff --git a/publish-root.gradle b/publish-root.gradle index 6532af8..c71c885 100644 --- a/publish-root.gradle +++ b/publish-root.gradle @@ -24,10 +24,17 @@ if (secretPropsFile.exists()) { ext["snapshot"] = System.getenv('SNAPSHOT') } +if (snapshot) { + ext["rootVersionName"] = project.ext.version + "-SNAPSHOT" +} else { + ext["rootVersionName"] = project.ext.version +} + // Set up Sonatype repository nexusPublishing { repositories { sonatype { + version = rootVersionName stagingProfileId = sonatypeStagingProfileId username = ossrhUsername password = ossrhPassword diff --git a/publishing.gradle b/publishing.gradle index eb19f05..882d57d 100644 --- a/publishing.gradle +++ b/publishing.gradle @@ -34,8 +34,8 @@ afterEvaluate { publications { release(MavenPublication) { groupId project.ext.group - artifactId project.ext.repo - version project.ext.version + artifactId ARTIFACT_ID + version PUBLISH_VERSION if (project.plugins.findPlugin("com.android.library")) { from components.release @@ -48,7 +48,7 @@ afterEvaluate { // metadata pom { - name = project.ext.repo + name = ARTIFACT_ID description = 'SDK' url = project.ext.url licenses { From 2aa07f877c2059022d70494c5739fd8fceda8f03 Mon Sep 17 00:00:00 2001 From: Sabin Date: Mon, 28 Feb 2022 09:35:50 +1300 Subject: [PATCH 05/11] snapshot fixes --- .github/workflows/publish.yml | 1 + publish-root.gradle | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1bd697c..816dfb2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -37,3 +37,4 @@ env: SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }} SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + SNAPSHOT: false \ No newline at end of file diff --git a/publish-root.gradle b/publish-root.gradle index c71c885..ae9c612 100644 --- a/publish-root.gradle +++ b/publish-root.gradle @@ -24,7 +24,7 @@ if (secretPropsFile.exists()) { ext["snapshot"] = System.getenv('SNAPSHOT') } -if (snapshot) { +if (Boolean.parseBoolean(snapshot)) { ext["rootVersionName"] = project.ext.version + "-SNAPSHOT" } else { ext["rootVersionName"] = project.ext.version @@ -34,7 +34,9 @@ if (snapshot) { nexusPublishing { repositories { sonatype { - version = rootVersionName + useStaging.set(provider { + !Boolean.parseBoolean(snapshot) + }) stagingProfileId = sonatypeStagingProfileId username = ossrhUsername password = ossrhPassword From 5d0b27ecfb6ad7ce4febe7293c8bfa43e3e1cef6 Mon Sep 17 00:00:00 2001 From: Sabin Date: Mon, 28 Feb 2022 10:24:05 +1300 Subject: [PATCH 06/11] version update --- common.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.gradle b/common.gradle index 47318fc..30a8548 100644 --- a/common.gradle +++ b/common.gradle @@ -1,4 +1,4 @@ -ext.version = "1.2.0" +ext.version = "1.2.1" ext.group = "nz.co.trademe.mapme" ext.repo = "mapme" ext.org = "trademe" From 45c8d85358021c8edb290fae96cf24670073ef38 Mon Sep 17 00:00:00 2001 From: Sabin Date: Fri, 11 Mar 2022 16:38:54 +1300 Subject: [PATCH 07/11] MP 178 developer details update --- publishing.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publishing.gradle b/publishing.gradle index 882d57d..09b3d61 100644 --- a/publishing.gradle +++ b/publishing.gradle @@ -60,8 +60,8 @@ afterEvaluate { developers { developer { id = 'sabinmj' - name = 'Sabin' - email = 'sabin.mj@gmail.com' + name = 'Sabin Mulakukodiyan' + email = 'sabin.mulakukodiyan@trademe.co.nz' } // Add all other devs here... } From e5ebd800bcf739fcdad43823801938ca374c3e29 Mon Sep 17 00:00:00 2001 From: Sabin Date: Wed, 23 Mar 2022 09:13:21 +1300 Subject: [PATCH 08/11] MP- 178 credentials made optional --- publish-root.gradle | 1 + publishing.gradle | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/publish-root.gradle b/publish-root.gradle index ae9c612..a54f1ab 100644 --- a/publish-root.gradle +++ b/publish-root.gradle @@ -6,6 +6,7 @@ ext["signing.key"] = '' ext["ossrhUsername"] = '' ext["ossrhPassword"] = '' ext["sonatypeStagingProfileId"] = '' +ext["snapshot"] = 'true' File secretPropsFile = project.rootProject.file('local.properties') if (secretPropsFile.exists()) { diff --git a/publishing.gradle b/publishing.gradle index 09b3d61..d8127dd 100644 --- a/publishing.gradle +++ b/publishing.gradle @@ -80,12 +80,14 @@ afterEvaluate { } } signing { - useInMemoryPgpKeys( - rootProject.ext["signing.keyId"], - rootProject.ext["signing.key"], - rootProject.ext["signing.password"], - ) - sign publishing.publications + if (rootProject.ext["signing.keyId"] && rootProject.ext["signing.key"] && rootProject.ext["signing.password"]) { + useInMemoryPgpKeys( + rootProject.ext["signing.keyId"], + rootProject.ext["signing.key"], + rootProject.ext["signing.password"], + ) + sign publishing.publications + } } java { sourceCompatibility = JavaVersion.VERSION_1_8 From 22df86a601012b9d4e2f22704a0b8130c4c4e08a Mon Sep 17 00:00:00 2001 From: Sabin Date: Mon, 28 Mar 2022 15:08:59 +1300 Subject: [PATCH 09/11] MP- 178 Readme and changelog update --- CHANGELOG.md | 4 ++++ README.md | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d44ad32..7732653 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ Change Log ========== +Version 1.2.1 *(28-03-2022)* +---------------------------- + +* Migration to maven central Version 1.2.0 *(25-10-2018)* ---------------------------- diff --git a/README.md b/README.md index 13efec7..e76ec18 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,13 @@ Download ```groovy //base dependency -compile 'nz.co.trademe.mapme:mapme:1.2.0' +compile 'nz.co.trademe.mapme:mapme:1.2.1' //for Google Maps support -compile 'nz.co.trademe.mapme:googlemaps:1.2.0' +compile 'nz.co.trademe.mapme:googlemaps:1.2.1' //for Mapbox support -compile 'nz.co.trademe.mapme:mapbox:1.2.0' +compile 'nz.co.trademe.mapme:mapbox:1.2.1' ``` From e38935d2827713ef74c90968d4709dd162bbc9e1 Mon Sep 17 00:00:00 2001 From: Sabin Date: Wed, 30 Mar 2022 16:43:09 +1300 Subject: [PATCH 10/11] MP- 178 pipeline trigger branch name change --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 816dfb2..373baf5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,7 +4,7 @@ on: push: branches: - main - - 'releases/**' + - 'release/**' jobs: publish: From bd96d728762754a292dec050973b0e0d7efe5fe7 Mon Sep 17 00:00:00 2001 From: Sabin Date: Thu, 31 Mar 2022 09:12:03 +1300 Subject: [PATCH 11/11] MP- 178 branch name fix --- .github/workflows/publish.yml | 3 +-- .github/workflows/snapshot.yml | 7 +------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 373baf5..e1e9a85 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,8 +3,7 @@ name: Publish on: push: branches: - - main - - 'release/**' + - master jobs: publish: diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 8be093f..964b4e4 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -4,12 +4,7 @@ name: Publish Snapshot builds on: push: branches: - - development - - 'snapshot/**' - - - - + - 'release/**' jobs: publish: name: Snapshot build and publish