Skip to content

Commit 9de4b15

Browse files
committed
"-Xsource:3" (TODO: only apply for scala 2)
1 parent 8c1e925 commit 9de4b15

21 files changed

Lines changed: 154 additions & 23 deletions

File tree

scala/anorm/build.sbt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
resolvers += Resolver.sonatypeCentralSnapshots
22

3+
def scala2OnlyScalacOptions(options: String*) = Def.setting {
4+
CrossVersion.partialVersion(scalaVersion.value) match {
5+
case Some((2, _)) => options
6+
case _ => Seq.empty
7+
}
8+
}
9+
310
lazy val root = (project in file("."))
411
.enablePlugins(PlayScala)
512
//.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
@@ -16,6 +23,6 @@ lazy val root = (project in file("."))
1623
"org.playframework.anorm" %% "anorm" % "2.9.0-M1",
1724
"org.scalatestplus.play" %% "scalatestplus-play" % "8.0.0-M2" % Test,
1825
),
19-
scalacOptions ++= List("-feature", "-Werror"),
26+
scalacOptions ++= List("-feature", "-Werror") ++ scala2OnlyScalacOptions("-Xsource:3").value,
2027
javacOptions ++= List("-Xlint:unchecked", "-Xlint:deprecation", "-Werror"),
2128
)

scala/chatroom/build.sbt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import play.core.PlayVersion.pekkoVersion
22

33
resolvers += Resolver.sonatypeCentralSnapshots
44

5+
def scala2OnlyScalacOptions(options: String*) = Def.setting {
6+
CrossVersion.partialVersion(scalaVersion.value) match {
7+
case Some((2, _)) => options
8+
case _ => Seq.empty
9+
}
10+
}
11+
512
lazy val root = (project in file("."))
613
.enablePlugins(PlayScala)
714
//.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
@@ -29,5 +36,5 @@ lazy val root = (project in file("."))
2936
"-feature",
3037
//"-deprecation", // gets set by Play automatically
3138
"-Werror"
32-
)
39+
) ++ scala2OnlyScalacOptions("-Xsource:3").value
3340
)

scala/compile-di/build.sbt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
resolvers += Resolver.sonatypeCentralSnapshots
22

3+
def scala2OnlyScalacOptions(options: String*) = Def.setting {
4+
CrossVersion.partialVersion(scalaVersion.value) match {
5+
case Some((2, _)) => options
6+
case _ => Seq.empty
7+
}
8+
}
9+
310
lazy val root = (project in file("."))
411
.enablePlugins(PlayScala)
512
//.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
@@ -15,5 +22,5 @@ lazy val root = (project in file("."))
1522
//"-unchecked",
1623
"-feature",
1724
"-Werror"
18-
),
25+
) ++ scala2OnlyScalacOptions("-Xsource:3").value,
1926
)

scala/fileupload/build.sbt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
resolvers += Resolver.sonatypeCentralSnapshots
22

3+
def scala2OnlyScalacOptions(options: String*) = Def.setting {
4+
CrossVersion.partialVersion(scalaVersion.value) match {
5+
case Some((2, _)) => options
6+
case _ => Seq.empty
7+
}
8+
}
9+
310
lazy val root = (project in file("."))
411
.enablePlugins(PlayScala)
512
//.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
@@ -16,5 +23,5 @@ lazy val root = (project in file("."))
1623
scalacOptions ++= Seq(
1724
"-feature",
1825
"-Werror"
19-
),
26+
) ++ scala2OnlyScalacOptions("-Xsource:3").value,
2027
)

scala/forms/build.sbt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
resolvers += Resolver.sonatypeCentralSnapshots
22

3+
def scala2OnlyScalacOptions(options: String*) = Def.setting {
4+
CrossVersion.partialVersion(scalaVersion.value) match {
5+
case Some((2, _)) => options
6+
case _ => Seq.empty
7+
}
8+
}
9+
310
lazy val root = (project in file("."))
411
.enablePlugins(PlayScala)
512
//.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
@@ -15,5 +22,5 @@ lazy val root = (project in file("."))
1522
scalacOptions ++= Seq(
1623
"-feature",
1724
"-Werror"
18-
),
25+
) ++ scala2OnlyScalacOptions("-Xsource:3").value,
1926
)

scala/grpc/build.sbt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ import play.scala.grpc.sample.BuildInfo
66

77
resolvers += Resolver.sonatypeCentralSnapshots
88

9+
def scala2OnlyScalacOptions(options: String*) = Def.setting {
10+
CrossVersion.partialVersion(scalaVersion.value) match {
11+
case Some((2, _)) => options
12+
case _ => Seq.empty
13+
}
14+
}
15+
916
name := "play-scala-grpc-example"
1017
version := "1.0-SNAPSHOT"
1118

@@ -74,7 +81,7 @@ val TestDeps = Seq(
7481

7582
scalaVersion := "2.13.18"
7683
crossScalaVersions := Seq("2.13.18", "3.8.3")
77-
scalacOptions ++= List("-encoding", "utf8", "-deprecation", "-feature", "-unchecked")
84+
scalacOptions ++= List("-encoding", "utf8", "-deprecation", "-feature", "-unchecked") ++ scala2OnlyScalacOptions("-Xsource:3").value
7885

7986
// Make verbose tests
8087
(Test / testOptions) := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v"))

scala/hello-world/build.sbt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
resolvers += Resolver.sonatypeCentralSnapshots
22

3+
def scala2OnlyScalacOptions(options: String*) = Def.setting {
4+
CrossVersion.partialVersion(scalaVersion.value) match {
5+
case Some((2, _)) => options
6+
case _ => Seq.empty
7+
}
8+
}
9+
310
lazy val root = (project in file("."))
411
.enablePlugins(PlayScala)
512
//.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
@@ -16,5 +23,5 @@ lazy val root = (project in file("."))
1623
scalacOptions ++= Seq(
1724
"-feature",
1825
"-Werror"
19-
)
26+
) ++ scala2OnlyScalacOptions("-Xsource:3").value
2027
)

scala/isolated-slick/build.sbt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ lazy val databaseUrl = sys.env.getOrElse("DB_DEFAULT_URL", "jdbc:h2:./test")
88
lazy val databaseUser = sys.env.getOrElse("DB_DEFAULT_USER", "sa")
99
lazy val databasePassword = sys.env.getOrElse("DB_DEFAULT_PASSWORD", "")
1010

11+
def scala2OnlyScalacOptions(options: String*) = Def.setting {
12+
CrossVersion.partialVersion(scalaVersion.value) match {
13+
case Some((2, _)) => options
14+
case _ => Seq.empty
15+
}
16+
}
17+
1118
val FlywayVersion = "11.10.1"
1219

1320
(ThisBuild / version) := "1.1-SNAPSHOT"
@@ -26,7 +33,7 @@ val FlywayVersion = "11.10.1"
2633
"-unchecked",
2734
"-Xlint",
2835
"-Ywarn-numeric-widen"
29-
)
36+
) ++ scala2OnlyScalacOptions("-Xsource:3").value
3037
(ThisBuild / javacOptions) ++= Seq("--release", "17")
3138

3239
lazy val flyway = (project in file("modules/flyway"))

scala/log4j2/build.sbt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ resolvers += Resolver.sonatypeCentralSnapshots
22

33
val log4jVersion = "2.25.0"
44

5+
def scala2OnlyScalacOptions(options: String*) = Def.setting {
6+
CrossVersion.partialVersion(scalaVersion.value) match {
7+
case Some((2, _)) => options
8+
case _ => Seq.empty
9+
}
10+
}
11+
512
lazy val root = (project in file("."))
613
.enablePlugins(PlayScala)
714
//.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
@@ -21,5 +28,5 @@ lazy val root = (project in file("."))
2128
scalacOptions ++= Seq(
2229
"-feature",
2330
"-Werror"
24-
),
31+
) ++ scala2OnlyScalacOptions("-Xsource:3").value,
2532
)

scala/macwire-di/build.sbt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
resolvers += Resolver.sonatypeCentralSnapshots
22

3+
def scala2OnlyScalacOptions(options: String*) = Def.setting {
4+
CrossVersion.partialVersion(scalaVersion.value) match {
5+
case Some((2, _)) => options
6+
case _ => Seq.empty
7+
}
8+
}
9+
310
lazy val root = (project in file("."))
411
.enablePlugins(PlayScala)
512
//.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
@@ -15,5 +22,5 @@ lazy val root = (project in file("."))
1522
scalacOptions ++= Seq(
1623
"-feature",
1724
"-Werror"
18-
),
25+
) ++ scala2OnlyScalacOptions("-Xsource:3").value,
1926
)

0 commit comments

Comments
 (0)