Skip to content

Commit 6ecaa0f

Browse files
authored
Merge pull request #316 from mockito/sf
Migrated to new Shipkit libraries
2 parents 118e0eb + 3ececd8 commit 6ecaa0f

File tree

5 files changed

+70
-50
lines changed

5 files changed

+70
-50
lines changed

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ branches:
1616
except:
1717
- /^v\d/
1818

19-
#Build and perform release (if needed)
19+
2020
script:
21-
- ./gradlew build -s && ./gradlew ciPerformRelease
21+
# To validate changes, we run building and bintray upload in dry run. This happens on every build, even PRs.
22+
# To publish, we perform github release and perform bintray upload (no dry run). This only for main branch builds.
23+
- >
24+
./gradlew resolveVersion
25+
&& ./gradlew build bintrayUpload -PbintrayDryRun
26+
&& if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "release/1.x" ];
27+
then ./gradlew bintrayUpload githubRelease; fi

build.gradle

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,26 @@ buildscript {
55
}
66

77
dependencies {
8-
classpath "org.shipkit:shipkit:2.0.26"
8+
//Using buildscript.classpath so that we can resolve plugins from maven local, during local testing
9+
classpath "org.shipkit:shipkit-auto-version:0.+"
10+
classpath "org.shipkit:shipkit-changelog:0.+"
11+
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+"
912
}
1013
}
1114

12-
apply plugin: "org.shipkit.single-project"
15+
apply from: "gradle/shipkit.gradle"
16+
17+
task resolveVersion {
18+
description = "Resolves version in the 'version.properties' file for the SBT build."
19+
doLast {
20+
file("version.properties").text = "version=$version"
21+
}
22+
}
1323

1424
task build(type: Exec) {
1525
commandLine "./build.sh"
1626
}
1727

18-
//Performing hard to reverse release operation (git push) as late as possible
19-
gitPush.mustRunAfter build
20-
2128
task clean(type: Exec) {
2229
commandLine "./clean.sh"
2330
}

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ lazy val commonSettings =
1919
v
2020
}.get)
2121
source.close
22-
version.get
22+
version.get.replace(".*", "-SNAPSHOT")
2323
},
2424
crossScalaVersions := Seq(currentScalaVersion, "2.12.12", "2.11.12"),
2525
scalafmtOnCompile := true,

gradle/shipkit.gradle

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,51 @@
1-
shipkit {
2-
gitHub.repository = "mockito/mockito-scala"
3-
gitHub.readOnlyAuthToken = "a0a4c0f41c200f7c653323014d6a72a127764e17"
4-
gitHub.writeAuthToken = System.getenv("GH_WRITE_TOKEN")
1+
apply plugin: "org.shipkit.shipkit-auto-version"
2+
apply plugin: "org.shipkit.shipkit-changelog"
3+
apply plugin: "org.shipkit.shipkit-gh-release"
4+
5+
tasks.named("generateChangelog") {
6+
previousRevision = "v" + project.ext.'shipkit-auto-version.previous-version'
7+
readOnlyToken = "a0a4c0f41c200f7c653323014d6a72a127764e17"
8+
repository = "mockito/mockito-scala"
9+
}
10+
11+
tasks.named("githubRelease") {
12+
def genTask = tasks.named("generateChangelog").get()
13+
dependsOn genTask
14+
repository = genTask.repository
15+
changelog = genTask.outputFile
16+
writeToken = System.getenv("GH_WRITE_TOKEN")
517
}
618

7-
//all contents of this directory will be uploaded to Bintray
8-
ext.releaseSpec = fileTree("target/dist")
9-
10-
allprojects {
11-
plugins.withId("org.shipkit.bintray") {
12-
13-
//Bintray configuration is handled by JFrog Bintray Gradle Plugin
14-
//For reference see the official documentation: https://github.com/bintray/gradle-bintray-plugin
15-
bintray {
16-
17-
key = System.getenv("BINTRAY_API_KEY")
18-
19-
pkg {
20-
repo = 'maven'
21-
user = 'szczepiq'
22-
name = 'mockito-scala'
23-
userOrg = 'mockito'
24-
licenses = ['MIT']
25-
labels = ['mocks', 'tdd', 'unit tests']
26-
publish = true //can be changed to 'false' for testing
27-
28-
filesSpec {
29-
from releaseSpec
30-
into '.'
31-
}
32-
33-
version {
34-
mavenCentralSync {
35-
sync = true
36-
user = System.env.NEXUS_TOKEN_USER
37-
password = System.env.NEXUS_TOKEN_PWD
38-
}
39-
}
19+
apply plugin: 'com.jfrog.bintray'
20+
21+
//Bintray configuration is handled by JFrog Bintray Gradle Plugin
22+
//For reference see the official documentation: https://github.com/bintray/gradle-bintray-plugin
23+
bintray {
24+
25+
key = System.getenv("BINTRAY_API_KEY")
26+
27+
pkg {
28+
repo = 'maven'
29+
user = 'szczepiq'
30+
name = 'mockito-scala'
31+
userOrg = 'mockito'
32+
licenses = ['MIT']
33+
labels = ['mocks', 'tdd', 'unit tests']
34+
publish = true // can be changed to 'false' for testing
35+
dryRun = project.hasProperty("bintrayDryRun")
36+
37+
filesSpec {
38+
// all contents of this directory will be uploaded to Bintray
39+
from fileTree("target/dist")
40+
into '.'
41+
}
42+
43+
version {
44+
mavenCentralSync {
45+
sync = false // TODO: true
46+
user = System.env.NEXUS_TOKEN_USER
47+
password = System.env.NEXUS_TOKEN_PWD
4048
}
4149
}
4250
}
43-
}
51+
}

version.properties

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#Version of the produced binaries. This file is intended to be checked-in.
2-
#It will be automatically bumped by release automation.
3-
version=1.16.4
4-
previousVersion=1.16.3
1+
# The version is inferred by shipkit-auto-version Gradle plugin
2+
# More: https://github.com/shipkit/shipkit-auto-version
3+
version=1.16.*

0 commit comments

Comments
 (0)