@@ -8,22 +8,86 @@ val jacksonVersion = "2.11.3"
8
8
val mockitoScalaVersion = " 1.16.0"
9
9
val junitVersion = " 4.13.1"
10
10
11
+ scalaVersion := scala213
12
+
13
+ // Source: https://nathankleyn.com/2019/05/13/recommended-scalac-flags-for-2-13/
14
+ lazy val scalacOptions213 = Seq (
15
+ " -deprecation" , // Emit warning and location for usages of deprecated APIs.
16
+ " -explaintypes" , // Explain type errors in more detail.
17
+ " -feature" , // Emit warning and location for usages of features that should be imported explicitly.
18
+ " -language:existentials" , // Existential types (besides wildcard types) can be written and inferred
19
+ " -language:experimental.macros" , // Allow macro definition (besides implementation and application)
20
+ " -language:higherKinds" , // Allow higher-kinded types
21
+ " -language:implicitConversions" , // Allow definition of implicit functions called views
22
+ " -unchecked" , // Enable additional warnings where generated code depends on assumptions.
23
+ " -Xcheckinit" , // Wrap field accessors to throw an exception on uninitialized access.
24
+ " -Xfatal-warnings" , // Fail the compilation if there are any warnings.
25
+ " -Xlint:adapted-args" , // Warn if an argument list is modified to match the receiver.
26
+ " -Xlint:constant" , // Evaluation of a constant arithmetic expression results in an error.
27
+ " -Xlint:delayedinit-select" , // Selecting member of DelayedInit.
28
+ " -Xlint:doc-detached" , // A Scaladoc comment appears to be detached from its element.
29
+ " -Xlint:inaccessible" , // Warn about inaccessible types in method signatures.
30
+ " -Xlint:infer-any" , // Warn when a type argument is inferred to be `Any`.
31
+ " -Xlint:missing-interpolator" , // A string literal appears to be missing an interpolator id.
32
+ // "-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
33
+ " -Xlint:nullary-unit" , // Warn when nullary methods return Unit.
34
+ " -Xlint:option-implicit" , // Option.apply used implicit view.
35
+ " -Xlint:package-object-classes" , // Class or object defined in package object.
36
+ " -Xlint:poly-implicit-overload" , // Parameterized overloaded implicit methods are not visible as view bounds.
37
+ " -Xlint:private-shadow" , // A private field (or class parameter) shadows a superclass field.
38
+ " -Xlint:stars-align" , // Pattern sequence wildcard must align with sequence component.
39
+ " -Xlint:type-parameter-shadow" , // A local type parameter shadows a type already in scope.
40
+ " -Ywarn-dead-code" , // Warn when dead code is identified.
41
+ " -Ywarn-extra-implicit" , // Warn when more than one implicit parameter section is defined.
42
+ " -Ywarn-numeric-widen" , // Warn when numerics are widened.
43
+ " -Ywarn-unused:implicits" , // Warn if an implicit parameter is unused.
44
+ " -Ywarn-unused:imports" , // Warn if an import selector is not referenced.
45
+ " -Ywarn-unused:locals" , // Warn if a local definition is unused.
46
+ " -Ywarn-unused:params" , // Warn if a value parameter is unused.
47
+ " -Ywarn-unused:patvars" , // Warn if a variable bound in a pattern is unused.
48
+ " -Ywarn-unused:privates" , // Warn if a private member is unused.
49
+ " -Ywarn-value-discard" , // Warn when non-Unit expression results are unused.
50
+ " -Ybackend-parallelism" , " 8" , // Enable paralellisation — change to desired number!
51
+ " -Ycache-plugin-class-loader:last-modified" , // Enables caching of classloaders for compiler plugins
52
+ " -Ycache-macro-class-loader:last-modified" , // and macro definitions. This can lead to performance improvements.
53
+ )
54
+
55
+ val scalacOptions212 = Seq (
56
+ " -deprecation" , // Emit warning and location for usages of deprecated APIs.
57
+ " -encoding" , " utf-8" , // Specify character encoding used by source files.
58
+ " -feature" , // Emit warning and location for usages of features that should be imported explicitly.
59
+ " -language:implicitConversions" , // Allow definition of implicit functions called views
60
+ )
61
+
62
+ val scalacOptions211 = Seq (
63
+ " -deprecation" ,
64
+ " -encoding" , " UTF-8" , // yes, this is 2 args
65
+ " -feature" ,
66
+ " -language:implicitConversions"
67
+ )
68
+
11
69
lazy val commonSettings = Seq (
12
70
organization := " io.cucumber" ,
13
- scalaVersion := scala213,
14
- libraryDependencies += " com.novocode" % " junit-interface" % " 0.11" % Test
71
+ libraryDependencies += " com.novocode" % " junit-interface" % " 0.11" % Test ,
72
+ scalacOptions += " -target:jvm-1.8" ,
73
+ scalacOptions ++= {
74
+ CrossVersion .partialVersion(scalaVersion.value) match {
75
+ case Some ((2 , 11 )) => scalacOptions211
76
+ case Some ((2 , 12 )) => scalacOptions212
77
+ case Some ((2 , 13 )) => scalacOptions213
78
+ case _ => Seq ()
79
+ }
80
+ },
15
81
)
16
82
17
- lazy val root = project
18
- .in(file(" ." ))
83
+ lazy val root = (project in file(" ." ))
19
84
.settings(commonSettings)
20
85
.aggregate(
21
- cucumberScala,
22
- examples
86
+ cucumberScala.projectRefs ++
87
+ examples.projectRefs : _*
23
88
)
24
89
25
- lazy val cucumberScala = project
26
- .in(file(" cucumber-scala" ))
90
+ lazy val cucumberScala = (projectMatrix in file(" cucumber-scala" ))
27
91
.settings(commonSettings)
28
92
.settings(
29
93
name := " cucumber-scala" ,
@@ -37,11 +101,25 @@ lazy val cucumberScala = project
37
101
" junit" % " junit" % junitVersion % Test ,
38
102
" io.cucumber" % " cucumber-junit" % cucumberVersion % Test ,
39
103
" org.mockito" %% " mockito-scala" % mockitoScalaVersion % Test
40
- )
104
+ ),
105
+ libraryDependencies ++= {
106
+ CrossVersion .partialVersion(scalaVersion.value) match {
107
+ case Some ((2 , n)) if n <= 12 => List (" org.scala-lang.modules" %% " scala-collection-compat" % " 2.2.0" )
108
+ case _ => Nil
109
+ }
110
+ },
111
+ unmanagedSourceDirectories in Compile ++= {
112
+ val sourceDir = (sourceDirectory in Compile ).value
113
+ CrossVersion .partialVersion(scalaVersion.value) match {
114
+ case Some ((2 , n)) if n <= 11 => Seq (sourceDir / " scala-2.11" )
115
+ case _ => Seq ()
116
+ }
117
+ },
118
+ scalacOptions ++= Seq ()
41
119
)
120
+ .jvmPlatform(scalaVersions = Seq (scala213, scala212, scala211))
42
121
43
- lazy val examples = project
44
- .in(file(" examples" ))
122
+ lazy val examples = (projectMatrix in file(" examples" ))
45
123
.settings(commonSettings)
46
124
.settings(
47
125
name := " scala-examples" ,
@@ -51,15 +129,16 @@ lazy val examples = project
51
129
)
52
130
)
53
131
.dependsOn(cucumberScala % Test )
54
-
55
- // TODO cross build
132
+ .jvmPlatform(scalaVersions = Seq (scala213, scala212))
56
133
57
134
// TODO code generation for i18n
58
135
59
- // TODO scla compiler flags
60
-
61
136
// TODO OSS publish settings
62
137
// But not the examples
63
138
64
139
// TODO src jar ?
65
- // TODO javadoc jar
140
+ // TODO javadoc jar
141
+
142
+ // TODO Travis
143
+
144
+ // TODO Makefile
0 commit comments