Skip to content

Commit

Permalink
Merge pull request #321 from mockito/sf
Browse files Browse the repository at this point in the history
Fixed the CI releases
  • Loading branch information
mockitoguy authored Nov 26, 2020
2 parents 6ecaa0f + 66b3eaa commit 0899508
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ script:
# To validate changes, we run building and bintray upload in dry run. This happens on every build, even PRs.
# To publish, we perform github release and perform bintray upload (no dry run). This only for main branch builds.
- >
./gradlew resolveVersion
&& ./gradlew build bintrayUpload -PbintrayDryRun
./gradlew build bintrayUpload -PbintrayDryRun
&& if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "release/1.x" ];
then ./gradlew bintrayUpload githubRelease; fi
9 changes: 2 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ buildscript {

apply from: "gradle/shipkit.gradle"

task resolveVersion {
description = "Resolves version in the 'version.properties' file for the SBT build."
doLast {
file("version.properties").text = "version=$version"
}
}

task build(type: Exec) {
commandLine "./build.sh"
environment "PROJECT_VERSION", version
}

task clean(type: Exec) {
commandLine "./clean.sh"
environment "PROJECT_VERSION", version
}
19 changes: 12 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ lazy val commonSettings =
organization := "org.mockito",
//Load version from the file so that Gradle/Shipkit and SBT use the same version
version := {
val pattern = """^version=(.+)$""".r
val source = Source.fromFile("version.properties")
val version = Try(source.getLines.collectFirst { case pattern(v) =>
v
}.get)
source.close
version.get.replace(".*", "-SNAPSHOT")
val versionFromEnv = System.getenv("PROJECT_VERSION")
if (versionFromEnv != null && !versionFromEnv.trim().isEmpty()) {
versionFromEnv
} else {
val pattern = """^version=(.+)$""".r
val source = Source.fromFile("version.properties")
val version = Try(source.getLines.collectFirst { case pattern(v) =>
v
}.get)
source.close
version.get.replace(".*", "-SNAPSHOT")
}
},
crossScalaVersions := Seq(currentScalaVersion, "2.12.12", "2.11.12"),
scalafmtOnCompile := true,
Expand Down

0 comments on commit 0899508

Please sign in to comment.