From 4ea455b2a890359aede604096fe882d61f36d737 Mon Sep 17 00:00:00 2001 From: Anubhav Gupta Date: Mon, 4 Jul 2022 20:08:54 +0530 Subject: [PATCH] Updated publishMavenLocal script and add steps in Contribution.md (#29) * updated publishMaven script and steps in contribution.md * update publishMavenLocal * added print publishversion Co-authored-by: Anubhav Gupta --- CONTRIBUTION.md | 18 +++++++++++------- gradle/publish-module.gradle | 15 +++++++++------ gradle/script-ext.gradle | 1 + scripts/publishMavenLocal.sh | 16 +++++++--------- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTION.md b/CONTRIBUTION.md index 2cf2c491..f194ba54 100644 --- a/CONTRIBUTION.md +++ b/CONTRIBUTION.md @@ -4,25 +4,29 @@ It is licensed using the [MIT License][2]. We appreciate pull requests; here are our guidelines: -1. [File an issue][3] +1. [File an issue][3] (if there isn't one already). If your patch is going to be large it might be a good idea to get the discussion started early. We are happy to discuss it in a new issue beforehand, and you can always email about future work. -2. DO follow our coding style (as described below). +2. Please also make sure your code compiles by running `./gradlew assembleDebug` -3. DO run spotlessApply task (`./gradlew spotlessApply`) before submitting a pull request +3. If you want to test locally you can publish artifacts locally using `./scripts/publishMavenLocal.sh` -4. DO include tests when adding new features. When fixing bugs, start with adding a test that highlights how the current behavior is broken. +4. DO follow our coding style (as described below). -5. We use the [binary-compatibility-validator plugin][] for tracking the binary compatibility of the APIs we ship. If your change implies changes to any public API, run `./gradlew apiDump` to generate the updated API dumps and commit those changes. +5. DO run spotlessApply task (`./gradlew spotlessApply`) before submitting a pull request -5. We ask that you squash all the commits together before +6. DO include tests when adding new features. When fixing bugs, start with adding a test that highlights how the current behavior is broken. + +7. We use the [binary-compatibility-validator plugin][9] for tracking the binary compatibility of the APIs we ship. If your change implies changes to any public API, run `./gradlew apiDump` to generate the updated API dumps and commit those changes. + +8. We ask that you squash all the commits together before pushing and that your commit message references the bug. -6. DON'T surprise us with big pull requests. Instead, file an issue and start a discussion so we can agree on a direction before you invest a large amount of time. +9. DON'T surprise us with big pull requests. Instead, file an issue and start a discussion so we can agree on a direction before you invest a large amount of time. ## Coding Style diff --git a/gradle/publish-module.gradle b/gradle/publish-module.gradle index 8af9e33d..de54f48a 100644 --- a/gradle/publish-module.gradle +++ b/gradle/publish-module.gradle @@ -81,10 +81,13 @@ afterEvaluate { } signing { - useInMemoryPgpKeys( - rootProject.ext["signing.keyId"], - rootProject.ext["signing.key"], - rootProject.ext["signing.password"], - ) - sign publishing.publications + def isLocal = project.hasProperty("IS_LOCAL") && (project.findProperty("IS_LOCAL") == "true") + if (!isLocal) { + useInMemoryPgpKeys( + rootProject.ext["signing.keyId"], + rootProject.ext["signing.key"], + rootProject.ext["signing.password"], + ) + sign publishing.publications + } } \ No newline at end of file diff --git a/gradle/script-ext.gradle b/gradle/script-ext.gradle index 5275f3c1..1b5b7237 100644 --- a/gradle/script-ext.gradle +++ b/gradle/script-ext.gradle @@ -1,4 +1,5 @@ ext { gitVersionCode = grgit.tag.list().size() gitVersionName = grgit.describe(tags: true, always: true) + println("version : $gitVersionName") } diff --git a/scripts/publishMavenLocal.sh b/scripts/publishMavenLocal.sh index 8e92a719..661d826b 100755 --- a/scripts/publishMavenLocal.sh +++ b/scripts/publishMavenLocal.sh @@ -1,15 +1,13 @@ #!/bin/sh echo "Publishing Libraries to Maven Local..." -echo "is ci value is : $PIS_CI" -echo "present directory : $pwd" -./gradlew :paho:assemble -PIS_CI=:$1 :courier-core:assemble -PIS_CI=:$1 :courier-core-android:assemble -PIS_CI=:$1 --parallel --daemon && ./gradlew :paho:publishToMavenLocal -PIS_CI=:$1 :courier-core:publishToMavenLocal -PIS_CI=:$1 :courier-core-android:publishToMavenLocal -PIS_CI=:$1 --parallel --daemon -./gradlew :mqtt-pingsender:assemble -PIS_CI=:$1 && ./gradlew :mqtt-pingsender:publishToMavenLocal -PIS_CI=:$1 -./gradlew :workmanager-pingsender:assemble -PIS_CI=:$1 :workmanager-2.6.0-pingsender:assemble -PIS_CI=:$1 :alarm-pingsender:assemble -PIS_CI=:$1 :timer-pingsender:assemble -PIS_CI=:$1 --parallel --daemon && ./gradlew :workmanager-pingsender:publishToMavenLocal -PIS_CI=:$1 :workmanager-2.6.0-pingsender:publishToMavenLocal -PIS_CI=:$1 :alarm-pingsender:publishToMavenLocal -PIS_CI=:$1 :timer-pingsender:publishToMavenLocal -PIS_CI=:$1 --parallel --daemon -./gradlew :network-tracker:assembleRelease -PIS_CI=:$1 :adaptive-keep-alive:assemble -PIS_CI=:$1 :courier-message-adapter-gson:assemble -PIS_CI=:$1 :courier-message-adapter-protobuf:assemble -PIS_CI=:$1 :courier-message-adapter-moshi:assemble -PIS_CI=:$1 :courier-stream-adapter-rxjava:assemble -PIS_CI=:$1 :courier-stream-adapter-rxjava2:assemble -PIS_CI=:$1 :courier-stream-adapter-coroutines:assemble -PIS_CI=:$1 :courier:assembleRelease -PIS_CI=:$1 :app-state-manager:assembleRelease -PIS_CI=:$1 --parallel --daemon && ./gradlew :network-tracker:publishToMavenLocal -PIS_CI=:$1 :adaptive-keep-alive:publishToMavenLocal -PIS_CI=:$1 :courier-message-adapter-gson:publishToMavenLocal -PIS_CI=:$1 :courier-message-adapter-moshi:publishToMavenLocal -PIS_CI=:$1 :courier-message-adapter-protobuf:publishToMavenLocal -PIS_CI=:$1 :courier-stream-adapter-rxjava:publishToMavenLocal -PIS_CI=:$1 :courier-stream-adapter-rxjava2:publishToMavenLocal -PIS_CI=:$1 :courier-stream-adapter-coroutines:publishToMavenLocal -PIS_CI=:$1 :courier:publishToMavenLocal -PIS_CI=:$1 :app-state-manager:publishToMavenLocal -PIS_CI=:$1 --parallel --daemon -./gradlew :mqtt-client:assembleRelease -PIS_CI=:$1 --parallel --daemon && ./gradlew :mqtt-client:publishToMavenLocal -PIS_CI=:$1 --parallel --daemon -./gradlew :courier:assembleRelease -PIS_CI=:$1 :courier-auth-http:assembleRelease -PIS_CI=:$1 --parallel --daemon && ./gradlew :courier:publishToMavenLocal -PIS_CI=:$1 :courier-auth-http:publishToMavenLocal -PIS_CI=:$1 --parallel --daemon -./gradlew :chuck-mqtt:assembleRelease -PIS_CI=:$1 :chuck-mqtt-no-ops:assembleRelease --parallel --daemon && ./gradlew :chuck-mqtt:publishToMavenLocal -PIS_CI=:$1 :chuck-mqtt-no-ops:publishToMavenLocal -PIS_CI=:$1 --parallel --daemon +./gradlew :paho:assemble :courier-core:assemble :courier-core-android:assemble --parallel --daemon && ./gradlew :paho:publishToMavenLocal -PIS_LOCAL=true :courier-core:publishToMavenLocal -PIS_LOCAL=true :courier-core-android:publishToMavenLocal -PIS_LOCAL=true --parallel --daemon +./gradlew :mqtt-pingsender:assemble && ./gradlew :mqtt-pingsender:publishToMavenLocal -PIS_LOCAL=true +./gradlew :workmanager-pingsender:assemble :workmanager-2.6.0-pingsender:assemble :alarm-pingsender:assemble :timer-pingsender:assemble --parallel --daemon && ./gradlew :workmanager-pingsender:publishToMavenLocal -PIS_LOCAL=true :workmanager-2.6.0-pingsender:publishToMavenLocal -PIS_LOCAL=true :alarm-pingsender:publishToMavenLocal -PIS_LOCAL=true :timer-pingsender:publishToMavenLocal -PIS_LOCAL=true --parallel --daemon +./gradlew :network-tracker:assemble :adaptive-keep-alive:assemble :courier-message-adapter-gson:assemble :courier-message-adapter-protobuf:assemble :courier-message-adapter-moshi:assemble :courier-stream-adapter-rxjava:assemble :courier-stream-adapter-rxjava2:assemble :courier-stream-adapter-coroutines:assemble :courier:assemble :app-state-manager:assemble --parallel --daemon && ./gradlew :network-tracker:publishToMavenLocal -PIS_LOCAL=true :adaptive-keep-alive:publishToMavenLocal -PIS_LOCAL=true :courier-message-adapter-gson:publishToMavenLocal -PIS_LOCAL=true :courier-message-adapter-moshi:publishToMavenLocal -PIS_LOCAL=true :courier-message-adapter-protobuf:publishToMavenLocal -PIS_LOCAL=true :courier-stream-adapter-rxjava:publishToMavenLocal -PIS_LOCAL=true :courier-stream-adapter-rxjava2:publishToMavenLocal -PIS_LOCAL=true :courier-stream-adapter-coroutines:publishToMavenLocal -PIS_LOCAL=true :courier:publishToMavenLocal -PIS_LOCAL=true :app-state-manager:publishToMavenLocal -PIS_LOCAL=true --parallel --daemon +./gradlew :mqtt-client:assemble --parallel --daemon && ./gradlew :mqtt-client:publishToMavenLocal -PIS_LOCAL=true --parallel --daemon +./gradlew :courier:assemble :courier-auth-http:assemble --parallel --daemon && ./gradlew :courier:publishToMavenLocal -PIS_LOCAL=true :courier-auth-http:publishToMavenLocal -PIS_LOCAL=true --parallel --daemon +./gradlew :chuck-mqtt:assemble :chuck-mqtt-no-ops:assembleRelease --parallel --daemon && ./gradlew :chuck-mqtt:publishToMavenLocal -PIS_LOCAL=true :chuck-mqtt-no-ops:publishToMavenLocal -PIS_LOCAL=true --parallel --daemon status=$? if [ "$status" = 0 ] ; then