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,
Test / unmanagedSources / inputFileStamps :=
(Test / unmanagedSources / inputFileStamps).dependsOn(Test / javafmtOnCompile).value,
crossScalaVersions := List(scala212, scala213),
Test / publishArtifact := false,
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[_]] =
commonSettings ++ customCommands ++
@ -261,7 +263,7 @@ val collectionProj = (project in file("util-collection"))
.settings(
name := "Collections",
testedBaseSettings,
utilCommonSettings,
baseSettings,
libraryDependencies ++= Seq(sjsonNewScalaJson.value),
libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
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
// format from which Java sources are generated by the datatype generator Projproject
lazy val utilInterface = (project in file("internal") / "util-interface").settings(
utilCommonSettings,
crossScalaVersions := List(scala212),
baseSettings,
javaOnlySettings,
crossPaths := false,
autoScalaLibrary := false,
@ -334,7 +335,8 @@ lazy val utilPosition = (project in file("internal") / "util-position")
utilMimaSettings,
)
lazy val utilCore = project.in(file("internal") / "util-core")
lazy val utilCore = project
.in(file("internal") / "util-core")
.settings(
utilCommonSettings,
name := "Util Core",
@ -517,7 +519,6 @@ lazy val testingProj = (project in file("testing"))
lazy val testAgentProj = (project in file("testing") / "agent")
.settings(
minimalSettings,
crossScalaVersions := Seq(baseScalaVersion),
crossPaths := false,
autoScalaLibrary := false,
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)
.settings(
baseSettings,
crossScalaVersions := Seq(baseScalaVersion),
name := "Scripted sbt Redux",
libraryDependencies ++= Seq(launcherInterface % "provided"),
mimaSettings,
@ -619,7 +619,6 @@ lazy val scriptedSbtOldProj = (project in file("scripted-sbt-old"))
.dependsOn(scriptedSbtReduxProj)
.settings(
baseSettings,
crossScalaVersions := Seq(baseScalaVersion),
name := "Scripted sbt",
mimaSettings,
mimaBinaryIssueFilters ++= Seq(
@ -647,7 +646,6 @@ lazy val dependencyTreeProj = (project in file("dependency-tree"))
.settings(
sbtPlugin := true,
baseSettings,
crossScalaVersions := Seq(baseScalaVersion),
name := "sbt-dependency-tree",
publishMavenStyle := true,
// mimaSettings,
@ -805,7 +803,7 @@ lazy val commandProj = (project in file("main-command"))
lazy val coreMacrosProj = (project in file("core-macros"))
.dependsOn(collectionProj)
.settings(
testedBaseSettings :+ (crossScalaVersions := (scala212 :: scala213 :: Nil)),
testedBaseSettings,
name := "Core Macros",
SettingKey[Boolean]("exportPipelining") := false,
mimaSettings,
@ -976,7 +974,6 @@ lazy val sbtProj = (project in file("sbt-app"))
if (scalaVersion.value == baseScalaVersion) version.value
else version2_13.value
},
crossScalaVersions := Seq(baseScalaVersion),
crossPaths := false,
crossTarget := { target.value / scalaVersion.value },
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")
.settings(
testedBaseSettings,
crossScalaVersions := Seq(baseScalaVersion),
bspEnabled := false,
publish / skip := true,
// make server tests serial
@ -1130,8 +1126,7 @@ lazy val sbtBig = (project in file(".big"))
lazy val lowerUtils = (project in (file("internal") / "lower"))
.aggregate(lowerUtilProjects.map(p => LocalProject(p.id)): _*)
.settings(
publish / skip := true,
crossScalaVersions := Nil,
publish / skip := true
)
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)): _*
)
.settings(
publish / skip := true,
crossScalaVersions := Nil,
publish / skip := true
)
lazy val sbtIgnoredProblems = {
@ -1196,7 +1190,6 @@ lazy val vscodePlugin = (project in file("vscode-sbt-scala"))
.settings(
bspEnabled := false,
crossPaths := false,
crossScalaVersions := Seq(baseScalaVersion),
publish / skip := true,
Compile / compile := {
val _ = update.value
@ -1278,8 +1271,7 @@ def allProjects =
// These need to be cross published to 2.12 and 2.13 for Zinc
lazy val lowerUtilProjects =
Seq(
collectionProj,
coreMacrosProj,
utilCore,
utilCache,
utilControl,
utilInterface,

View File

@ -6,7 +6,7 @@
* Licensed under Apache License 2.0 (see LICENSE)
*/
package sbt.internal.util
package sbt.internal.util.appmacro
import scala.language.experimental.macros
import scala.reflect.macros.blackbox
@ -33,6 +33,6 @@ object StringTypeTag {
}
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)
*/
package sbt.internal.util
package sbt.internal.util.appmacro
final class StringTypeTag[A](val key: String):
override def toString(): String = key

View File

@ -10,7 +10,7 @@ package sbt.internal.util
import sbt.internal.util.codec.JsonProtocol._
import sbt.util._
import sjsonnew.JsonFormat
import sbt.internal.util.StringTypeTag
import sbt.internal.util.appmacro.StringTypeTag
private[sbt] trait MiniLogger {
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.{ LogManager => XLogManager }
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 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 {
def run(): Unit = {
val stringTypeTag = StringTypeTag[List[Int]]
val stringTypeTag = implicitly[StringTypeTag[List[Int]]]
val log = newLogger(s"foo$i")
context.addAppender(s"foo$i", asyncStdout -> Level.Info)
if (i % 100 == 0) {