mirror of https://github.com/sbt/sbt.git
Merge pull request #8310 from eed3si9n/wip/fix-conraband
[2.x] fix: Set contrabandScala3enum to false
This commit is contained in:
commit
e99d0d9258
61
build.sbt
61
build.sbt
|
|
@ -117,7 +117,7 @@ def testedBaseSettings: Seq[Setting[?]] =
|
|||
|
||||
val sbt20Plus =
|
||||
Seq(
|
||||
"2.0.0-RC5",
|
||||
"2.0.0-RC4",
|
||||
)
|
||||
val mimaSettings = mimaSettingsSince(sbt20Plus)
|
||||
def mimaSettingsSince(versions: Seq[String]): Seq[Def.Setting[?]] = Def settings (
|
||||
|
|
@ -141,6 +141,14 @@ def mimaSettingsSince(versions: Seq[String]): Seq[Def.Setting[?]] = Def settings
|
|||
),
|
||||
)
|
||||
|
||||
val contrabandSettings: Seq[Def.Setting[?]] = Seq(
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / contrabandScala3enum := false,
|
||||
Compile / generateContrabands / contrabandFormatsForType := DatatypeConfig.getFormats,
|
||||
)
|
||||
|
||||
val scriptedSbtMimaSettings = Def.settings(mimaPreviousArtifacts := Set())
|
||||
|
||||
lazy val sbtRoot: Project = (project in file("."))
|
||||
|
|
@ -315,10 +323,7 @@ lazy val utilLogging = project
|
|||
sjsonNewScalaJson.value,
|
||||
),
|
||||
testDependencies,
|
||||
Compile / generateContrabands / contrabandCodecsDependencies := List(sjsonNewCore.value),
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
contrabandSettings,
|
||||
Compile / generateContrabands / contrabandFormatsForType := { tpe =>
|
||||
val old = (Compile / generateContrabands / contrabandFormatsForType).value
|
||||
val name = tpe.removeTypeParameters.name
|
||||
|
|
@ -358,12 +363,10 @@ lazy val utilCache = project
|
|||
sjsonNewScalaJson.value,
|
||||
sjsonNewMurmurhash.value
|
||||
),
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / contrabandFormatsForType := ContrabandConfig.getFormats,
|
||||
contrabandSettings,
|
||||
mimaSettings,
|
||||
mimaBinaryIssueFilters ++= Seq(
|
||||
exclude[MissingClassProblem]("sbt.internal.util.ActionCacheError*"),
|
||||
),
|
||||
Test / fork := true,
|
||||
)
|
||||
|
|
@ -411,10 +414,7 @@ lazy val testingProj = (project in file("testing"))
|
|||
sjsonNewCore.value,
|
||||
),
|
||||
conflictWarning := ConflictWarning.disable,
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / contrabandFormatsForType := ContrabandConfig.getFormats,
|
||||
contrabandSettings,
|
||||
mimaSettings,
|
||||
mimaBinaryIssueFilters ++= Vector(
|
||||
),
|
||||
|
|
@ -476,9 +476,7 @@ lazy val runProj = (project in file("run"))
|
|||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Run",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
contrabandSettings,
|
||||
mimaSettings,
|
||||
mimaBinaryIssueFilters ++= Seq(
|
||||
)
|
||||
|
|
@ -537,10 +535,7 @@ lazy val actionsProj = (project in file("main-actions"))
|
|||
name := "Actions",
|
||||
libraryDependencies += sjsonNewScalaJson.value,
|
||||
libraryDependencies ++= Seq(gigahorseApacheHttp, jline3Terminal),
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / contrabandFormatsForType := ContrabandConfig.getFormats,
|
||||
contrabandSettings,
|
||||
// Test / fork := true,
|
||||
Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat,
|
||||
mimaSettings,
|
||||
|
|
@ -564,10 +559,7 @@ lazy val protocolProj = (project in file("protocol"))
|
|||
name := "Protocol",
|
||||
libraryDependencies ++= Seq(sjsonNewScalaJson.value, sjsonNewCore.value, ipcSocket),
|
||||
Compile / scalacOptions += "-source:3.7",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / contrabandFormatsForType := ContrabandConfig.getFormats,
|
||||
contrabandSettings,
|
||||
mimaSettings,
|
||||
mimaBinaryIssueFilters ++= Seq(
|
||||
)
|
||||
|
|
@ -586,10 +578,7 @@ lazy val commandProj = (project in file("main-command"))
|
|||
sjsonNewScalaJson.value,
|
||||
templateResolverApi
|
||||
),
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / contrabandFormatsForType := ContrabandConfig.getFormats,
|
||||
contrabandSettings,
|
||||
mimaSettings,
|
||||
mimaBinaryIssueFilters ++= Vector(
|
||||
),
|
||||
|
|
@ -713,9 +702,7 @@ lazy val mainProj = (project in file("main"))
|
|||
case v if v.startsWith("2.12.") => List()
|
||||
case _ => List(scalaPar)
|
||||
}),
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
contrabandSettings,
|
||||
Test / testOptions += Tests
|
||||
.Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"),
|
||||
SettingKey[Boolean]("usePipelining") := false,
|
||||
|
|
@ -723,6 +710,8 @@ lazy val mainProj = (project in file("main"))
|
|||
Compile / doc / sources := Nil,
|
||||
mimaSettings,
|
||||
mimaBinaryIssueFilters ++= Vector(
|
||||
exclude[MissingClassProblem]("sbt.internal.*"),
|
||||
exclude[MissingFieldProblem]("sbt.internal.server.NetworkChannel.*"),
|
||||
),
|
||||
)
|
||||
.dependsOn(lmCore, lmIvy, lmCoursierShadedPublishing)
|
||||
|
|
@ -1142,10 +1131,7 @@ lazy val lmCore = (project in file("lm-core"))
|
|||
case v if v.startsWith("2.12.") => List("-Ywarn-unused:-locals,-explicits,-privates")
|
||||
case _ => List()
|
||||
}),
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / contrabandFormatsForType := DatatypeConfig.getFormats,
|
||||
contrabandSettings,
|
||||
// WORKAROUND sbt/sbt#2205 include managed sources in packageSrc
|
||||
Compile / packageSrc / mappings ++= {
|
||||
val srcs = (Compile / managedSources).value
|
||||
|
|
@ -1177,10 +1163,7 @@ lazy val lmIvy = (project in file("lm-ivy"))
|
|||
scalacheck % Test,
|
||||
scalaVerify % Test,
|
||||
),
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / contrabandFormatsForType := DatatypeConfig.getFormats,
|
||||
contrabandSettings,
|
||||
Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat,
|
||||
mimaSettings,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,12 +5,11 @@
|
|||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.util
|
||||
/** value for logging options like color */
|
||||
enum LogOption {
|
||||
|
||||
case Always
|
||||
case Never
|
||||
case Auto
|
||||
}
|
||||
sealed abstract class LogOption extends Serializable
|
||||
object LogOption {
|
||||
|
||||
|
||||
case object Always extends LogOption
|
||||
case object Never extends LogOption
|
||||
case object Auto extends LogOption
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,13 +11,12 @@ package sbt.librarymanagement
|
|||
* `Quiet` only displays errors.
|
||||
* `Default` uses the current log level of `update` task.
|
||||
*/
|
||||
enum UpdateLogging {
|
||||
|
||||
case Full
|
||||
case DownloadOnly
|
||||
case Quiet
|
||||
case Default
|
||||
}
|
||||
sealed abstract class UpdateLogging extends Serializable
|
||||
object UpdateLogging {
|
||||
|
||||
|
||||
case object Full extends UpdateLogging
|
||||
case object DownloadOnly extends UpdateLogging
|
||||
case object Quiet extends UpdateLogging
|
||||
case object Default extends UpdateLogging
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@
|
|||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.sona
|
||||
enum DeploymentState {
|
||||
|
||||
case PENDING
|
||||
case VALIDATING
|
||||
case VALIDATED
|
||||
case PUBLISHING
|
||||
case PUBLISHED
|
||||
case FAILED
|
||||
}
|
||||
sealed abstract class DeploymentState extends Serializable
|
||||
object DeploymentState {
|
||||
|
||||
|
||||
case object PENDING extends DeploymentState
|
||||
case object VALIDATING extends DeploymentState
|
||||
case object VALIDATED extends DeploymentState
|
||||
case object PUBLISHING extends DeploymentState
|
||||
case object PUBLISHED extends DeploymentState
|
||||
case object FAILED extends DeploymentState
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,10 @@
|
|||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt
|
||||
enum ConnectionType {
|
||||
/** This uses Unix domain socket on POSIX, and named pipe on Windows. */
|
||||
case Local
|
||||
case Tcp
|
||||
}
|
||||
sealed abstract class ConnectionType extends Serializable
|
||||
object ConnectionType {
|
||||
|
||||
/** This uses Unix domain socket on POSIX, and named pipe on Windows. */
|
||||
case object Local extends ConnectionType
|
||||
case object Tcp extends ConnectionType
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt
|
||||
enum ServerAuthentication {
|
||||
|
||||
case Token
|
||||
}
|
||||
sealed abstract class ServerAuthentication extends Serializable
|
||||
object ServerAuthentication {
|
||||
|
||||
|
||||
case object Token extends ServerAuthentication
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
import sbt.contraband.ast.*
|
||||
import sbt.contraband.CodecCodeGen
|
||||
|
||||
object ContrabandConfig {
|
||||
|
||||
/** Extract the only type parameter from a TpeRef */
|
||||
def oneArg(tpe: Type): Type = {
|
||||
val pat = s"""${tpe.removeTypeParameters.name}[<\\[](.+?)[>\\]]""".r
|
||||
val pat(arg0) = tpe.name
|
||||
NamedType(arg0 split '.' toList)
|
||||
}
|
||||
|
||||
/** Extract the two type parameters from a TpeRef */
|
||||
def twoArgs(tpe: Type): List[Type] = {
|
||||
val pat = s"""${tpe.removeTypeParameters.name}[<\\[](.+?), (.+?)[>\\]]""".r
|
||||
val pat(arg0, arg1) = tpe.name
|
||||
NamedType(arg0 split '.' toList) :: NamedType(arg1 split '.' toList) :: Nil
|
||||
}
|
||||
|
||||
/** Codecs that were manually written. */
|
||||
val myCodecs: PartialFunction[String, Type => List[String]] = {
|
||||
// TODO: These are handled by BasicJsonProtocol, and sbt-contraband should handle them by default, imo
|
||||
case "Option" | "Set" | "scala.Vector" => { tpe =>
|
||||
getFormats(oneArg(tpe))
|
||||
}
|
||||
case "Map" | "Tuple2" | "scala.Tuple2" => { tpe =>
|
||||
twoArgs(tpe).flatMap(getFormats)
|
||||
}
|
||||
case "Int" | "Long" => { _ =>
|
||||
Nil
|
||||
}
|
||||
case "sbt.testing.Status" => { _ =>
|
||||
"sbt.internal.testing.StatusFormats" :: Nil
|
||||
}
|
||||
case "scalajson.ast.unsafe.JValue" | "sjsonnew.shaded.scalajson.ast.unsafe.JValue" => { _ =>
|
||||
"sbt.internal.util.codec.JValueFormats" :: Nil
|
||||
}
|
||||
case "xsbti.HashedVirtualFileRef" => { _ =>
|
||||
"sbt.internal.util.codec.HashedVirtualFileRefFormats" :: Nil
|
||||
}
|
||||
case "java.nio.ByteBuffer" => { _ =>
|
||||
"sbt.internal.util.codec.ByteBufferFormats" :: Nil
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the list of formats required to encode the given `TpeRef`. */
|
||||
val getFormats: Type => List[String] =
|
||||
CodecCodeGen.extensibleFormatsForType {
|
||||
case tpe: Type if myCodecs isDefinedAt tpe.removeTypeParameters.name =>
|
||||
myCodecs(tpe.removeTypeParameters.name)(tpe)
|
||||
case other => CodecCodeGen.formatsForType(other)
|
||||
}
|
||||
}
|
||||
|
|
@ -62,6 +62,22 @@ object DatatypeConfig {
|
|||
"sbt.librarymanagement.ConfigRefFormats" :: Nil
|
||||
}
|
||||
|
||||
case "sbt.testing.Status" => { _ =>
|
||||
"sbt.internal.testing.StatusFormats" :: Nil
|
||||
}
|
||||
|
||||
case "scalajson.ast.unsafe.JValue" | "sjsonnew.shaded.scalajson.ast.unsafe.JValue" => { _ =>
|
||||
"sbt.internal.util.codec.JValueFormats" :: Nil
|
||||
}
|
||||
|
||||
case "xsbti.HashedVirtualFileRef" => { _ =>
|
||||
"sbt.internal.util.codec.HashedVirtualFileRefFormats" :: Nil
|
||||
}
|
||||
|
||||
case "java.nio.ByteBuffer" => { _ =>
|
||||
"sbt.internal.util.codec.ByteBufferFormats" :: Nil
|
||||
}
|
||||
|
||||
// TODO: These are handled by BasicJsonProtocol, and sbt-datatype should handle them by default, imo
|
||||
case "Option" | "Set" | "scala.Vector" => { tpe =>
|
||||
getFormats(oneArg(tpe))
|
||||
|
|
|
|||
|
|
@ -5,13 +5,12 @@
|
|||
// DO NOT EDIT MANUALLY
|
||||
package sbt.protocol.testing
|
||||
/** Testing result */
|
||||
enum TestResult {
|
||||
|
||||
case Empty
|
||||
case Passed
|
||||
case Failed
|
||||
case Error
|
||||
}
|
||||
sealed abstract class TestResult extends Serializable
|
||||
object TestResult {
|
||||
|
||||
|
||||
case object Empty extends TestResult
|
||||
case object Passed extends TestResult
|
||||
case object Failed extends TestResult
|
||||
case object Error extends TestResult
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue