From b976c3c1da400fd5e0824c4455400be2d8d741dc Mon Sep 17 00:00:00 2001 From: Artur Stepniewski Date: Fri, 13 Apr 2018 11:53:13 +0200 Subject: [PATCH] Add snapshot publishing (#43) --- .travis.yml | 2 +- README.md | 3 +++ build.gradle | 27 +++++++++++++++++++++--- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index e290f30..ca2e6dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ cache: directories: - "$HOME/.gradle/caches/" script: -- "./gradlew build jacocoTestReport" +- "./gradlew build jacocoTestReport publishSnapshot" after_success: - bash <(curl -s https://codecov.io/bash) deploy: diff --git a/README.md b/README.md index 8bfdb90..5c7f8d1 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ android { } } ``` +Snapshots of the development version are available in [JFrog's `snapshots` repository][snapshots]. The above configuration will create a `JacocoReport` task for each variant and an additional `jacocoTestReport` task that runs all of them. ``` @@ -86,3 +87,5 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` + +[snapshots]: https://oss.jfrog.org/artifactory/oss-snapshot-local/com/dicedmelon/gradle/jacoco-android \ No newline at end of file diff --git a/build.gradle b/build.gradle index d58893a..300d9cb 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id 'maven-publish' id 'jacoco' id 'pl.allegro.tech.build.axion-release' version '1.9.0' + id "com.jfrog.artifactory" version '4.7.1' id 'com.jfrog.bintray' version '1.8.0' } @@ -66,10 +67,11 @@ publishing { } } +def credentials = (project.hasProperty('bintray.credentials') ? + project.property('bintray.credentials') : + System.getenv('BINTRAY_CREDENTIALS') ?: '').split(':') + bintray { - def credentials = (project.hasProperty('bintray.credentials') ? - project.property('bintray.credentials') : System.getenv('BINTRAY_CREDENTIALS') ?: '').split( - ':') user = credentials.first() key = credentials.last() publications = ['plugin'] @@ -84,3 +86,22 @@ bintray { } } } + +artifactory { + contextUrl = "http://oss.jfrog.org" + publish { + repository { + repoKey = "oss-snapshot-local" + username = credentials.first() + password = credentials.last() + } + defaults { + publications("plugin") + } + } + clientConfig.info.setBuildNumber(System.getProperty("build.number")) +} + +task publishSnapshot() { + if (version.endsWith("-SNAPSHOT")) dependsOn artifactoryPublish +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1b6b375..745d027 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=9af7345c199f1731c187c96d3fe3d31f5405192a42046bafa71d846c3d9adacb -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionSha256Sum=98bd5fd2b30e070517e03c51cbb32beee3e2ee1a84003a5a5d748996d4b1b915 +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists