Skip to content

Commit 79f92a4

Browse files
committed
Removed project/Helpers in favour of sbt.IO+sbt.using.Using for file and Option instead of Try when querying environment variables
1 parent 8bf92f8 commit 79f92a4

File tree

2 files changed

+10
-25
lines changed

2 files changed

+10
-25
lines changed

build.sbt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
import scala.io.Source
22
import scala.language.postfixOps
3-
import scala.util.Try
4-
import Helpers._
3+
import sbt.io.Using
54

65
val currentScalaVersion = "2.13.6"
76

8-
ThisBuild / scalaVersion := currentScalaVersion
9-
107
inThisBuild(Seq(
8+
scalaVersion := currentScalaVersion,
9+
//Load version from the file so that Gradle/Shipkit and SBT use the same version
1110
version := sys.env
1211
.get("PROJECT_VERSION")
1312
.filter(_.trim.nonEmpty)
14-
.toTry.recoverWith { case _ =>
15-
withSource(Source.fromFile(baseDirectory.value / "version.properties")) { source =>
16-
source.getLines.collectFirst { case VersionRE(v) => v } get
13+
.orElse {
14+
lazy val VersionRE = """^version=(.+)$""".r
15+
Using.file(Source.fromFile)(baseDirectory.value / "version.properties") {
16+
_.getLines.collectFirst { case VersionRE(v) => v }
1717
}
1818
}
1919
.map { _.replace(".*", "-SNAPSHOT") }
2020
.get
21-
))
21+
)
22+
)
2223

23-
lazy val commonSettings: Seq[Setting[_]] =
24+
lazy val commonSettings =
2425
Seq(
2526
organization := "org.mockito",
2627
//Load version from the file so that Gradle/Shipkit and SBT use the same version

project/Helpers.scala

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)