Deactivate cross-compilation except for utils

Lower util projects are used by LM and Zinc
This commit is contained in:
Adrien Piquerez 2023-11-14 12:12:34 +01:00
parent eba41fb3b0
commit 1f33b27b03
7 changed files with 19 additions and 71 deletions

View File

@ -98,7 +98,6 @@ def commonBaseSettings: Seq[Setting[_]] = Def.settings(
(Compile / unmanagedSources / inputFileStamps).dependsOn(Compile / javafmtOnCompile).value, (Compile / unmanagedSources / inputFileStamps).dependsOn(Compile / javafmtOnCompile).value,
Test / unmanagedSources / inputFileStamps := Test / unmanagedSources / inputFileStamps :=
(Test / unmanagedSources / inputFileStamps).dependsOn(Test / javafmtOnCompile).value, (Test / unmanagedSources / inputFileStamps).dependsOn(Test / javafmtOnCompile).value,
crossScalaVersions := List(scala212, scala213),
Test / publishArtifact := false, Test / publishArtifact := false,
run / fork := true, run / fork := true,
) )
@ -112,8 +111,11 @@ def commonSettings: Seq[Setting[_]] =
} }
} }
} }
def utilCommonSettings: Seq[Setting[_]] =
baseSettings :+ (crossScalaVersions := (scala212 :: scala213 :: Nil)) def utilCommonSettings: Seq[Setting[_]] = Def.settings(
baseSettings,
crossScalaVersions := Seq(scala212, scala213, scala3)
)
def minimalSettings: Seq[Setting[_]] = def minimalSettings: Seq[Setting[_]] =
commonSettings ++ customCommands ++ commonSettings ++ customCommands ++
@ -261,7 +263,7 @@ val collectionProj = (project in file("util-collection"))
.settings( .settings(
name := "Collections", name := "Collections",
testedBaseSettings, testedBaseSettings,
utilCommonSettings, baseSettings,
libraryDependencies ++= Seq(sjsonNewScalaJson.value), libraryDependencies ++= Seq(sjsonNewScalaJson.value),
libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, major)) if major <= 12 => Seq() case Some((2, major)) if major <= 12 => Seq()
@ -308,8 +310,7 @@ val logicProj = (project in file("internal") / "util-logic")
// the analysis compiler phases and passed back to sbt. The API structures are defined in a simple // the analysis compiler phases and passed back to sbt. The API structures are defined in a simple
// format from which Java sources are generated by the datatype generator Projproject // format from which Java sources are generated by the datatype generator Projproject
lazy val utilInterface = (project in file("internal") / "util-interface").settings( lazy val utilInterface = (project in file("internal") / "util-interface").settings(
utilCommonSettings, baseSettings,
crossScalaVersions := List(scala212),
javaOnlySettings, javaOnlySettings,
crossPaths := false, crossPaths := false,
autoScalaLibrary := false, autoScalaLibrary := false,
@ -334,7 +335,8 @@ lazy val utilPosition = (project in file("internal") / "util-position")
utilMimaSettings, utilMimaSettings,
) )
lazy val utilCore = project.in(file("internal") / "util-core") lazy val utilCore = project
.in(file("internal") / "util-core")
.settings( .settings(
utilCommonSettings, utilCommonSettings,
name := "Util Core", name := "Util Core",
@ -517,7 +519,6 @@ lazy val testingProj = (project in file("testing"))
lazy val testAgentProj = (project in file("testing") / "agent") lazy val testAgentProj = (project in file("testing") / "agent")
.settings( .settings(
minimalSettings, minimalSettings,
crossScalaVersions := Seq(baseScalaVersion),
crossPaths := false, crossPaths := false,
autoScalaLibrary := false, autoScalaLibrary := false,
Compile / doc / javacOptions := Nil, Compile / doc / javacOptions := Nil,
@ -607,7 +608,6 @@ lazy val scriptedSbtReduxProj = (project in file("scripted-sbt-redux"))
.dependsOn(sbtProj % "compile;test->test", commandProj, utilLogging, utilScripted) .dependsOn(sbtProj % "compile;test->test", commandProj, utilLogging, utilScripted)
.settings( .settings(
baseSettings, baseSettings,
crossScalaVersions := Seq(baseScalaVersion),
name := "Scripted sbt Redux", name := "Scripted sbt Redux",
libraryDependencies ++= Seq(launcherInterface % "provided"), libraryDependencies ++= Seq(launcherInterface % "provided"),
mimaSettings, mimaSettings,
@ -619,7 +619,6 @@ lazy val scriptedSbtOldProj = (project in file("scripted-sbt-old"))
.dependsOn(scriptedSbtReduxProj) .dependsOn(scriptedSbtReduxProj)
.settings( .settings(
baseSettings, baseSettings,
crossScalaVersions := Seq(baseScalaVersion),
name := "Scripted sbt", name := "Scripted sbt",
mimaSettings, mimaSettings,
mimaBinaryIssueFilters ++= Seq( mimaBinaryIssueFilters ++= Seq(
@ -647,7 +646,6 @@ lazy val dependencyTreeProj = (project in file("dependency-tree"))
.settings( .settings(
sbtPlugin := true, sbtPlugin := true,
baseSettings, baseSettings,
crossScalaVersions := Seq(baseScalaVersion),
name := "sbt-dependency-tree", name := "sbt-dependency-tree",
publishMavenStyle := true, publishMavenStyle := true,
// mimaSettings, // mimaSettings,
@ -805,7 +803,7 @@ lazy val commandProj = (project in file("main-command"))
lazy val coreMacrosProj = (project in file("core-macros")) lazy val coreMacrosProj = (project in file("core-macros"))
.dependsOn(collectionProj) .dependsOn(collectionProj)
.settings( .settings(
testedBaseSettings :+ (crossScalaVersions := (scala212 :: scala213 :: Nil)), testedBaseSettings,
name := "Core Macros", name := "Core Macros",
SettingKey[Boolean]("exportPipelining") := false, SettingKey[Boolean]("exportPipelining") := false,
mimaSettings, mimaSettings,
@ -976,7 +974,6 @@ lazy val sbtProj = (project in file("sbt-app"))
if (scalaVersion.value == baseScalaVersion) version.value if (scalaVersion.value == baseScalaVersion) version.value
else version2_13.value else version2_13.value
}, },
crossScalaVersions := Seq(baseScalaVersion),
crossPaths := false, crossPaths := false,
crossTarget := { target.value / scalaVersion.value }, crossTarget := { target.value / scalaVersion.value },
javaOptions ++= Seq("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"), javaOptions ++= Seq("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"),
@ -1002,7 +999,6 @@ lazy val serverTestProj = (project in file("server-test"))
.dependsOn(sbtProj % "compile->test", scriptedSbtReduxProj % "compile->test") .dependsOn(sbtProj % "compile->test", scriptedSbtReduxProj % "compile->test")
.settings( .settings(
testedBaseSettings, testedBaseSettings,
crossScalaVersions := Seq(baseScalaVersion),
bspEnabled := false, bspEnabled := false,
publish / skip := true, publish / skip := true,
// make server tests serial // make server tests serial
@ -1130,8 +1126,7 @@ lazy val sbtBig = (project in file(".big"))
lazy val lowerUtils = (project in (file("internal") / "lower")) lazy val lowerUtils = (project in (file("internal") / "lower"))
.aggregate(lowerUtilProjects.map(p => LocalProject(p.id)): _*) .aggregate(lowerUtilProjects.map(p => LocalProject(p.id)): _*)
.settings( .settings(
publish / skip := true, publish / skip := true
crossScalaVersions := Nil,
) )
lazy val upperModules = (project in (file("internal") / "upper")) lazy val upperModules = (project in (file("internal") / "upper"))
@ -1140,8 +1135,7 @@ lazy val upperModules = (project in (file("internal") / "upper"))
diff Seq(bundledLauncherProj)).map(p => LocalProject(p.id)): _* diff Seq(bundledLauncherProj)).map(p => LocalProject(p.id)): _*
) )
.settings( .settings(
publish / skip := true, publish / skip := true
crossScalaVersions := Nil,
) )
lazy val sbtIgnoredProblems = { lazy val sbtIgnoredProblems = {
@ -1196,7 +1190,6 @@ lazy val vscodePlugin = (project in file("vscode-sbt-scala"))
.settings( .settings(
bspEnabled := false, bspEnabled := false,
crossPaths := false, crossPaths := false,
crossScalaVersions := Seq(baseScalaVersion),
publish / skip := true, publish / skip := true,
Compile / compile := { Compile / compile := {
val _ = update.value val _ = update.value
@ -1278,8 +1271,7 @@ def allProjects =
// These need to be cross published to 2.12 and 2.13 for Zinc // These need to be cross published to 2.12 and 2.13 for Zinc
lazy val lowerUtilProjects = lazy val lowerUtilProjects =
Seq( Seq(
collectionProj, utilCore,
coreMacrosProj,
utilCache, utilCache,
utilControl, utilControl,
utilInterface, utilInterface,

View File

@ -6,7 +6,7 @@
* Licensed under Apache License 2.0 (see LICENSE) * Licensed under Apache License 2.0 (see LICENSE)
*/ */
package sbt.internal.util package sbt.internal.util.appmacro
import scala.language.experimental.macros import scala.language.experimental.macros
import scala.reflect.macros.blackbox import scala.reflect.macros.blackbox
@ -33,6 +33,6 @@ object StringTypeTag {
} }
val key = Literal(Constant(typeToString(tpe))) val key = Literal(Constant(typeToString(tpe)))
q"new sbt.internal.util.StringTypeTag[$tpe]($key)" q"new sbt.internal.util.appmacro.StringTypeTag[$tpe]($key)"
} }
} }

View File

@ -5,7 +5,7 @@
* Licensed under Apache License 2.0 (see LICENSE) * Licensed under Apache License 2.0 (see LICENSE)
*/ */
package sbt.internal.util package sbt.internal.util.appmacro
final class StringTypeTag[A](val key: String): final class StringTypeTag[A](val key: String):
override def toString(): String = key override def toString(): String = key

View File

@ -10,7 +10,7 @@ package sbt.internal.util
import sbt.internal.util.codec.JsonProtocol._ import sbt.internal.util.codec.JsonProtocol._
import sbt.util._ import sbt.util._
import sjsonnew.JsonFormat import sjsonnew.JsonFormat
import sbt.internal.util.StringTypeTag import sbt.internal.util.appmacro.StringTypeTag
private[sbt] trait MiniLogger { private[sbt] trait MiniLogger {
def log[T](level: Level.Value, message: ObjectEvent[T]): Unit def log[T](level: Level.Value, message: ObjectEvent[T]): Unit

View File

@ -12,7 +12,7 @@ import org.apache.logging.log4j.core.layout.PatternLayout
import org.apache.logging.log4j.core.{ LoggerContext => XLoggerContext } import org.apache.logging.log4j.core.{ LoggerContext => XLoggerContext }
import org.apache.logging.log4j.{ LogManager => XLogManager } import org.apache.logging.log4j.{ LogManager => XLogManager }
import sbt.internal.util.{ Appender, ManagedLogger, TraceEvent, SuccessEvent, Util } import sbt.internal.util.{ Appender, ManagedLogger, TraceEvent, SuccessEvent, Util }
import sbt.internal.util.StringTypeTag import sbt.internal.util.appmacro.StringTypeTag
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
import scala.collection.concurrent import scala.collection.concurrent

View File

@ -1,44 +0,0 @@
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package sbt.util
import sbt.internal.util._
import sbt.internal.util.appmacro.StringTypeTag
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
class LogExchangeSpec extends AnyFlatSpec with Matchers {
import LogExchange._
checkTypeTag("stringTypeTagThrowable", stringTypeTagThrowable, StringTypeTag[Throwable])
checkTypeTag(
"stringTypeTagTraceEvent",
stringTypeTagTraceEvent,
StringTypeTag[TraceEvent]
)
checkTypeTag(
"stringTypeTagSuccessEvent",
stringTypeTagSuccessEvent,
StringTypeTag[SuccessEvent]
)
private def checkTypeTag[A](name: String, inc: StringTypeTag[A], exp: StringTypeTag[A]): Unit =
s"LogExchange.$name" should s"match real StringTypeTag[$exp]" in {
val incomingString = inc.key
val expectedString = exp.key
if ((incomingString startsWith "scala.") || (expectedString startsWith "scala.")) {
// > historically [Scala] has been inconsistent whether `scala.` is included, or not
// > would it be hard to make the test accept either result?
// https://github.com/scala/community-builds/pull/758#issuecomment-409760633
assert((incomingString stripPrefix "scala.") == (expectedString stripPrefix "scala."))
} else {
assert(incomingString == expectedString)
}
}
}

View File

@ -92,7 +92,7 @@ class ManagedLoggerSpec extends AnyFlatSpec with Matchers {
} { } {
pool.submit(new Runnable { pool.submit(new Runnable {
def run(): Unit = { def run(): Unit = {
val stringTypeTag = StringTypeTag[List[Int]] val stringTypeTag = implicitly[StringTypeTag[List[Int]]]
val log = newLogger(s"foo$i") val log = newLogger(s"foo$i")
context.addAppender(s"foo$i", asyncStdout -> Level.Info) context.addAppender(s"foo$i", asyncStdout -> Level.Info)
if (i % 100 == 0) { if (i % 100 == 0) {