Skip to content

Commit

Permalink
Remove compilerVersionDependentScalacOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Friendseeker committed Oct 18, 2024
1 parent 41dd74e commit 7ea4819
Showing 1 changed file with 9 additions and 62 deletions.
71 changes: 9 additions & 62 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -87,43 +87,14 @@ def baseSettings: Seq[Setting[?]] = Seq(
testFrameworks += new TestFramework("verify.runner.Framework"),
compile / javacOptions ++= Seq("-Xlint", "-Xlint:-serial"),
Test / publishArtifact := false,
scalacOptions ++= Seq("-YdisableFlatCpCaching"),
scalacOptions += {
scalaBinaryVersion.value match {
case "2.10" | "2.11" =>
"-target:jvm-1.8"
case _ =>
"-release:8"
}
},
scalacOptions ++= Seq("-release:8"),
semanticdbCompilerPlugin := {
("org.scalameta" % "semanticdb-scalac" % semanticdbVersion.value)
.cross(CrossVersion.full)
},
ideSkipProject := scalaVersion.value != defaultScalaVersion,
)

def compilerVersionDependentScalacOptions: Seq[Setting[?]] = Seq(
scalacOptions := {
scalaBinaryVersion.value match {
case "2.12" | "2.13" =>
scalacOptions.value ++ List(
"-opt-inline-from:<sources>",
"-opt:l:inline",
"-Yopt-inline-heuristics:at-inline-annotated"
)
case _ =>
scalacOptions.value.filterNot(
Set(
"-Xfatal-warnings",
"-deprecation",
"-YdisableFlatCpCaching",
)
)
}
}
)

def addBaseSettingsAndTestDeps(p: Project): Project =
p.settings(baseSettings).configure(addTestDependencies)

Expand Down Expand Up @@ -261,21 +232,11 @@ lazy val zincPersist = (projectMatrix in internalPath / "zinc-persist")
.dependsOn(zincCore, zincCompileCore, zincCore % "test->test")
.settings(
name := "zinc Persist",
libraryDependencies += sbinary,
libraryDependencies ++= {
scalaPartialVersion.value match {
case Some((major, minor)) if major == 3 || minor >= 13 =>
List("org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4")
case _ =>
List()
}
},
libraryDependencies ++= List(
sbinary,
"org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4",
),
compileOrder := sbt.CompileOrder.Mixed,
Compile / scalacOptions ++= (scalaVersion.value match {
case VersionNumber(Seq(2, 12, _*), _, _) =>
List("-Ywarn-unused:-imports,-locals,-implicits,-explicits,-privates")
case _ => Nil
}),
Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat,
mimaSettings,
mimaBinaryIssueFilters ++= ZincBuildUtil.excludeInternalProblems,
Expand Down Expand Up @@ -319,17 +280,10 @@ lazy val zincCore = (projectMatrix in internalPath / "zinc-core")
exclude[ReversedMissingMethodProblem]("xsbti.*"),
exclude[MissingClassProblem]("xsbti.*"),
),
libraryDependencies ++= {
scalaPartialVersion.value match {
case Some((major, minor)) if major == 3 || minor >= 13 =>
List(
"org.scala-lang" % "scala-reflect" % scala213,
"org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4"
)
case _ =>
List()
}
},
libraryDependencies ++= List(
"org.scala-lang" % "scala-reflect" % scala213,
"org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4"
),
)
.jvmPlatform(scalaVersions = scala3_only)
.configure(addBaseSettingsAndTestDeps, addSbtIO, addSbtUtilLogging, addSbtUtilRelation)
Expand Down Expand Up @@ -397,8 +351,6 @@ lazy val compilerInterface = (projectMatrix in internalPath / "compiler-interfac
baseSettings,
name := "Compiler Interface",
scalaVersion := scala3,
crossScalaVersions := Seq(scala3),
compilerVersionDependentScalacOptions,
libraryDependencies ++= Seq(scalatest % Test),
exportJars := true,
Compile / resourceGenerators += Def.task {
Expand Down Expand Up @@ -466,7 +418,6 @@ lazy val compilerBridge = (projectMatrix in internalPath / "compiler-bridge")
semanticdbEnabled.value && !scalaVersion.value.startsWith("2.10")
},
baseSettings,
compilerVersionDependentScalacOptions,
// We need this for import Compat._
Compile / scalacOptions --= Seq("-Ywarn-unused-import", "-Xfatal-warnings"),
Compile / scalacOptions ++= (scalaVersion.value match {
Expand Down Expand Up @@ -520,7 +471,6 @@ lazy val compilerBridgeTest = (projectMatrix in internalPath / "compiler-bridge-
name := "Compiler Bridge Test",
baseSettings,
scalaVersion := scala3,
compilerVersionDependentScalacOptions,
// we need to fork because in unit tests we set usejavacp = true which means
// we are expecting all of our dependencies to be on classpath so Scala compiler
// can use them while constructing its own classpath for compilation
Expand All @@ -547,7 +497,6 @@ lazy val zincApiInfo = (projectMatrix in internalPath / "zinc-apiinfo")
)
.settings(
name := "zinc ApiInfo",
compilerVersionDependentScalacOptions,
mimaSettings,
mimaBinaryIssueFilters ++= Seq(
exclude[IncompatibleMethTypeProblem]("xsbt.api.HashAPI.hashTypeParameters"),
Expand Down Expand Up @@ -581,7 +530,6 @@ lazy val zincClasspath = (projectMatrix in internalPath / "zinc-classpath")
.dependsOn(compilerInterface)
.settings(
name := "zinc Classpath",
compilerVersionDependentScalacOptions,
libraryDependencies ++= Seq(
// scalaCompiler.value,
launcherInterface
Expand Down Expand Up @@ -614,7 +562,6 @@ lazy val zincClassfile = (projectMatrix in internalPath / "zinc-classfile")
.dependsOn(compilerInterface, zincTesting % Test)
.settings(
name := "zinc Classfile",
compilerVersionDependentScalacOptions,
Compile / headerSources ~= { xs =>
val excluded = Set("ZipCentralDir.java", "ZipConstants.java", "ZipUtils.java")
xs filter { x =>
Expand Down

0 comments on commit 7ea4819

Please sign in to comment.