Skip to content

Commit ab520f4

Browse files
authored
Merge pull request #239 from eyedol/232-integrate-snapshot
Use JFrog's artifactory plugin to upload snaphots
2 parents 05c504e + 3a8e08c commit ab520f4

File tree

8 files changed

+65
-1
lines changed

8 files changed

+65
-1
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ branches:
2525

2626
script: ./gradlew check --stacktrace
2727

28+
after_success:
29+
- "./deploy_snapshot.sh"
30+
2831
deploy:
2932
provider: script
3033
script: ./release.sh

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ buildscript {
147147
}
148148
```
149149

150+
Snapshots of the development version are available in [JFrog's snapshots repository](https://oss.jfrog.org/oss-snapshot-local/)).
151+
Add the repo below to download `SNAPSHOT` releases.
152+
153+
```groovy
154+
repositories {
155+
jcenter()
156+
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
157+
}
158+
```
159+
150160
And on your **app module** `build.gradle`:
151161

152162
`${latest.version}` is [![Download](https://api.bintray.com/packages/hotchemi/maven/permissionsdispatcher/images/download.svg)](https://bintray.com/hotchemi/maven/permissionsdispatcher/_latestVersion)

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ buildscript {
88
classpath "com.neenbedankt.gradle.plugins:android-apt:$APT_PLUGIN_VERSION"
99
classpath "com.novoda:bintray-release:$BINTRAY_PLUGIN_VERSION"
1010
classpath "com.netflix.nebula:gradle-extra-configurations-plugin:$CONFIG_PLUGIN_VERSION"
11+
// Need this to publish SNAPSHOTs to JFrog
12+
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:$JFROG_PLUGIN_VERSION"
1113
}
1214
}
1315

deploy_snapshot.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
#
3+
# Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo.
4+
#
5+
# Adapted from https://coderwall.com/p/9b_lfq and
6+
# http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/
7+
8+
SLUG="hotchemi/PermissionsDispatcher"
9+
JDK="oraclejdk8"
10+
BRANCH="master"
11+
12+
set -e
13+
14+
if [ "$TRAVIS_REPO_SLUG" != "$SLUG" ]; then
15+
echo "Skipping snapshot deployment: wrong repository. Expected '$SLUG' but was '$TRAVIS_REPO_SLUG'."
16+
elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then
17+
echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'."
18+
elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
19+
echo "Skipping snapshot deployment: was pull request."
20+
elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
21+
echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'."
22+
else
23+
echo "Deploying snapshot..."
24+
./gradlew artifactoryPublish
25+
echo "Snapshot deployed!"
26+
fi

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ USER = hotchemi
55
GROUP_ID = com.github.hotchemi
66
ARTIFACT_ID_LIBRARY = permissionsdispatcher
77
ARTIFACT_ID_PROCESSOR = permissionsdispatcher-processor
8-
VERSION = 2.3.0
8+
VERSION = 2.3.0-SNAPSHOT
99
DESCRIPTION = Annotation-based library for generating runtime permissions dispatcher.
1010
WEBSITE = https://github.com/hotchemi/PermissionsDispatcher
1111
LICENCES = ['Apache-2.0']
@@ -16,6 +16,7 @@ KOTLIN_VERSION=1.0.5
1616
APT_PLUGIN_VERSION=1.8
1717
BINTRAY_PLUGIN_VERSION=0.3.4
1818
CONFIG_PLUGIN_VERSION=2.2.2
19+
JFROG_PLUGIN_VERSION=4.1.1
1920

2021
# Dependency versions
2122
SUPPORT_LIBRARY_VERSION=23.1.1
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apply plugin: 'com.jfrog.artifactory'
2+
3+
artifactory {
4+
contextUrl = 'https://oss.jfrog.org/artifactory'
5+
publish {
6+
repository {
7+
// The Artifactory repository key to publish to
8+
repoKey = VERSION.endsWith('SNAPSHOT') ? 'oss-snapshot-local' : 'oss-release-local'
9+
username = System.getenv('bintrayUser') // The publisher user name
10+
password = System.getenv('bintrayKey') // The publisher password
11+
maven = true
12+
}
13+
defaults {
14+
publishArtifacts = true
15+
publications('maven')
16+
}
17+
}
18+
}

library/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,5 @@ project.afterEvaluate {
9393
def compileLintTask = project.tasks.find { it.name == 'compileLint' }
9494
compileLintTask.dependsOn(copyLintJar)
9595
}
96+
97+
apply from: rootProject.file('gradle/gradle-artifactory-upload.gradle')

processor/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,5 @@ publish {
8686
website = WEBSITE
8787
licences = LICENCES
8888
}
89+
90+
apply from: rootProject.file('gradle/gradle-artifactory-upload.gradle')

0 commit comments

Comments
 (0)