Skip to content

Commit 425f715

Browse files
committed
Cross-compile to Scala 2.11
1 parent c86ddad commit 425f715

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

.ci_scripts/validate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ false
1515

1616
echo "[INFO] Running tests" >> /dev/stdout
1717

18-
sbt ++$TRAVIS_SCALA_VERSION testOnly
18+
sbt ++$TRAVIS_SCALA_VERSION test

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
sudo: false
22
language: scala
3+
scala:
4+
- 2.12.7
5+
- 2.11.12
36
jdk:
47
- oraclejdk8
5-
scala: 2.12.7
68
cache:
79
directories:
810
- $HOME/.ivy2

build.sbt

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ name := "query-monad-code"
22

33
version := "1.0-SNAPSHOT"
44

5-
scalaVersion in ThisBuild := "2.12.7"
5+
ThisBuild / scalaVersion := "2.12.7"
6+
ThisBuild / crossScalaVersions := Seq("2.11.12", "2.12.7")
67

7-
// Common values
8-
val commonSettings = Seq(
9-
organization := "com.zengularity",
10-
crossPaths := false,
11-
scalacOptions ++= Seq(
8+
def scalacOptionsVersion(scalaVersion: String) = {
9+
val defaultOptions = Seq(
1210
"-deprecation", // Emit warning and location for usages of deprecated APIs.
1311
"-encoding",
1412
"utf-8", // Specify character encoding used by source files.
@@ -21,15 +19,32 @@ val commonSettings = Seq(
2119
"-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
2220
"-Ypartial-unification", // Enable partial unification in type constructor inference
2321
"-Ywarn-dead-code", // Warn when dead code is identified.
24-
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
2522
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
2623
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`.
2724
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
2825
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit.
2926
"-Ywarn-numeric-widen", // Warn when numerics are widened.
3027
"-Ywarn-unused", // Warn if unused.
3128
"-Ywarn-value-discard" // Warn when non-Unit expression results are unused.
32-
),
29+
)
30+
val v211Options = Seq(
31+
"-Xsource:2.12" // See https://github.com/scala/scala/releases/tag/v2.11.11
32+
)
33+
val v212Options = Seq(
34+
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
35+
)
36+
37+
CrossVersion.partialVersion(scalaVersion) match {
38+
case Some((2L, 11L)) => defaultOptions ++ v211Options
39+
case _ => defaultOptions ++ v212Options
40+
}
41+
}
42+
43+
// Common values
44+
def commonSettings = Seq(
45+
organization := "com.zengularity",
46+
crossPaths := false,
47+
scalacOptions ++= scalacOptionsVersion(scalaVersion.value),
3348
scalacOptions in (Compile, console) ~= (_.filterNot(
3449
Set(
3550
"-Ywarn-unused:imports",

0 commit comments

Comments
 (0)