@@ -15,37 +15,44 @@ object Common {
15
15
scalaVersion := Dependencies .scalaVersion,
16
16
scalacOptions ++= Seq (
17
17
" -deprecation" , // Emit warning and location for usages of deprecated APIs.
18
- " -feature" , // Emit warning and location for usages of features that should be imported explicitly.
19
- " -unchecked" , // Enable additional warnings where generated code depends on assumptions.
18
+ " -feature" , // Emit warning and location for usages of features that should be imported explicitly.
19
+ " -unchecked" , // Enable additional warnings where generated code depends on assumptions.
20
20
// "-Xfatal-warnings", // Fail the compilation if there are any warnings.
21
- " -Xlint" , // Enable recommended additional warnings.
22
- " -Ywarn-adapted-args" , // Warn if an argument list is modified to match the receiver.
23
- " -Ywarn-dead-code" , // Warn when dead code is identified.
24
- " -Ywarn-inaccessible" , // Warn about inaccessible types in method signatures.
21
+ " -Xlint" , // Enable recommended additional warnings.
22
+ " -Ywarn-adapted-args" , // Warn if an argument list is modified to match the receiver.
23
+ " -Ywarn-dead-code" , // Warn when dead code is identified.
24
+ " -Ywarn-inaccessible" , // Warn about inaccessible types in method signatures.
25
25
" -Ywarn-nullary-override" , // Warn when non-nullary overrides nullary, e.g. def foo() over def foo.
26
- " -Ywarn-numeric-widen" // Warn when numerics are widened.
26
+ " -Ywarn-numeric-widen" // Warn when numerics are widened.
27
27
),
28
28
scalacOptions in Test ~= { options ⇒
29
29
options filterNot (_ == " -Ywarn-dead-code" ) // Allow dead code in tests (to support using mockito).
30
30
},
31
31
parallelExecution in Test := false ,
32
32
fork in Test := true ,
33
33
javaOptions += " -Xmx1G" ,
34
-
35
34
// Redirect logs from ElasticSearch (which uses log4j2) to slf4j
36
35
libraryDependencies += " org.apache.logging.log4j" % " log4j-to-slf4j" % " 2.9.1" ,
37
36
excludeDependencies += " org.apache.logging.log4j" % " log4j-core"
38
37
)
39
38
40
39
val stableVersion : Regex = " (\\ d+\\ .\\ d+\\ .\\ d+)-(\\ d+)" .r
41
- val betaVersion : Regex = " (\\ d+\\ .\\ d+\\ .\\ d+)-[Rr][Cc](\\ d+)" .r
40
+ val betaVersion : Regex = " (\\ d+\\ .\\ d+\\ .\\ d+)-[Rr][Cc](\\ d+)-(\\ d+)" .r
41
+
42
42
object snapshotVersion {
43
- def unapplySeq (version : String ): Option [List [String ]] = {
44
- if (version.endsWith(" -SNAPSHOT" )) {
45
- val v = version.dropRight(9 )
46
- stableVersion.unapplySeq(v) orElse betaVersion.unapplySeq(v)
47
- }
43
+
44
+ def unapply (version : String ): Option [String ] =
45
+ if (version.endsWith(" -SNAPSHOT" )) Some (version.dropRight(9 ))
48
46
else None
49
- }
50
47
}
51
- }
48
+
49
+ def versionUsage (version : String ): Nothing =
50
+ sys.error(
51
+ s " Invalid version: $version\n " +
52
+ " The accepted formats for version are:\n " +
53
+ " - 1.2.3-4\n " +
54
+ " - 1.2.3-RC4-5\n " +
55
+ " - 1.2.3-4-SNAPSHOT\n " +
56
+ " - 1.2.3-RC4-5-SNAPSHOT"
57
+ )
58
+ }
0 commit comments