Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Remove compilerVersionDependentScalacOptions #1468

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 8 additions & 54 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ 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" =>
Expand All @@ -103,27 +102,6 @@ def baseSettings: Seq[Setting[?]] = Seq(
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",
)
)
eed3si9n marked this conversation as resolved.
Show resolved Hide resolved
}
}
)

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

Expand Down Expand Up @@ -261,21 +239,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 +287,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 +358,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 +425,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 +478,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 +504,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 +537,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 +569,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