mirror of https://github.com/sbt/sbt.git
Fix build
This commit is contained in:
parent
9cadbbb453
commit
339e707300
88
build.sbt
88
build.sbt
|
|
@ -1,5 +1,4 @@
|
|||
import Dependencies._
|
||||
import Util._
|
||||
import com.typesafe.tools.mima.core.ProblemFilters._
|
||||
import com.typesafe.tools.mima.core._
|
||||
import local.Scripted
|
||||
|
|
@ -13,7 +12,7 @@ ThisBuild / version := {
|
|||
val v = "2.0.0-SNAPSHOT"
|
||||
nightlyVersion.getOrElse(v)
|
||||
}
|
||||
ThisBuild / version2_13 := "2.0.0-SNAPSHOT"
|
||||
ThisBuild / Utils.version2_13 := "2.0.0-SNAPSHOT"
|
||||
ThisBuild / versionScheme := Some("early-semver")
|
||||
ThisBuild / scalafmtOnCompile := !(Global / insideCI).value
|
||||
ThisBuild / Test / scalafmtOnCompile := !(Global / insideCI).value
|
||||
|
|
@ -48,7 +47,7 @@ ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml"
|
|||
Global / semanticdbEnabled := !(Global / insideCI).value
|
||||
// Change main/src/main/scala/sbt/plugins/SemanticdbPlugin.scala too, if you change this.
|
||||
Global / semanticdbVersion := "4.7.8"
|
||||
Global / excludeLintKeys += componentID
|
||||
Global / excludeLintKeys += Utils.componentID
|
||||
Global / excludeLintKeys += scriptedBufferLog
|
||||
Global / excludeLintKeys += checkPluginCross
|
||||
ThisBuild / evictionErrorLevel := Level.Info
|
||||
|
|
@ -65,13 +64,13 @@ def commonSettings: Seq[Setting[_]] = Def.settings(
|
|||
)
|
||||
),
|
||||
scalaVersion := baseScalaVersion,
|
||||
componentID := None,
|
||||
Utils.componentID := None,
|
||||
resolvers += Resolver.typesafeIvyRepo("releases").withName("typesafe-sbt-build-ivy-releases"),
|
||||
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
|
||||
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
|
||||
testFrameworks += TestFramework("hedgehog.sbt.Framework"),
|
||||
testFrameworks += TestFramework("verify.runner.Framework"),
|
||||
Global / concurrentRestrictions += Util.testExclusiveRestriction,
|
||||
Global / concurrentRestrictions += Utils.testExclusiveRestriction,
|
||||
Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
||||
Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "2"),
|
||||
compile / javacOptions ++= Seq("-Xlint", "-Xlint:-serial"),
|
||||
|
|
@ -113,11 +112,10 @@ def utilCommonSettings: Seq[Setting[_]] = Def.settings(
|
|||
)
|
||||
|
||||
def minimalSettings: Seq[Setting[_]] =
|
||||
commonSettings ++ customCommands ++
|
||||
publishPomSettings
|
||||
commonSettings ++ customCommands ++ Utils.publishPomSettings
|
||||
|
||||
def baseSettings: Seq[Setting[_]] =
|
||||
minimalSettings ++ Seq(projectComponent) ++ baseScalacOptions ++ Licensed.settings
|
||||
minimalSettings ++ Seq(Utils.projectComponent) ++ Utils.baseScalacOptions ++ Licensed.settings
|
||||
|
||||
def testedBaseSettings: Seq[Setting[_]] =
|
||||
baseSettings ++ testDependencies
|
||||
|
|
@ -199,12 +197,12 @@ lazy val sbtRoot: Project = (project in file("."))
|
|||
|!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!""".stripMargin
|
||||
else "")
|
||||
},
|
||||
Util.baseScalacOptions,
|
||||
Utils.baseScalacOptions,
|
||||
Docs.settings,
|
||||
scalacOptions += "-Ymacro-expand:none", // for both sxr and doc
|
||||
Util.publishPomSettings,
|
||||
Utils.publishPomSettings,
|
||||
otherRootSettings,
|
||||
dontPublish,
|
||||
Utils.noPublish,
|
||||
publishLocal := {},
|
||||
Global / commands += Command
|
||||
.single("sbtOn")((state, dir) => s"sbtProj/test:runMain sbt.RunFromSourceMain $dir" :: state),
|
||||
|
|
@ -308,7 +306,7 @@ val logicProj = (project in file("internal") / "util-logic")
|
|||
// format from which Java sources are generated by the datatype generator Projproject
|
||||
lazy val utilInterface = (project in file("internal") / "util-interface").settings(
|
||||
baseSettings,
|
||||
javaOnlySettings,
|
||||
Utils.javaOnlySettings,
|
||||
crossPaths := false,
|
||||
autoScalaLibrary := false,
|
||||
Compile / doc / javacOptions := Nil,
|
||||
|
|
@ -342,7 +340,7 @@ lazy val utilCore = project
|
|||
Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value)
|
||||
} else Seq.empty
|
||||
},
|
||||
Util.keywordsSettings,
|
||||
Utils.keywordsSettings,
|
||||
utilMimaSettings
|
||||
)
|
||||
|
||||
|
|
@ -570,7 +568,7 @@ lazy val stdTaskProj = (project in file("tasks-standard"))
|
|||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Task System",
|
||||
testExclusive,
|
||||
Utils.testExclusive,
|
||||
mimaSettings,
|
||||
mimaBinaryIssueFilters ++= Seq(
|
||||
// unused private[sbt]
|
||||
|
|
@ -960,7 +958,7 @@ lazy val sbtProj = (project in file("sbt-app"))
|
|||
normalizedName := "sbt",
|
||||
version := {
|
||||
if (scalaVersion.value == baseScalaVersion) version.value
|
||||
else version2_13.value
|
||||
else Utils.version2_13.value
|
||||
},
|
||||
crossPaths := false,
|
||||
crossTarget := { target.value / scalaVersion.value },
|
||||
|
|
@ -987,7 +985,7 @@ lazy val serverTestProj = (project in file("server-test"))
|
|||
.dependsOn(sbtProj % "compile->test", scriptedSbtProj % "compile->test")
|
||||
.settings(
|
||||
testedBaseSettings,
|
||||
dontPublish,
|
||||
Utils.noPublish,
|
||||
// make server tests serial
|
||||
Test / watchTriggers += baseDirectory.value.toGlob / "src" / "server-test" / **,
|
||||
Test / parallelExecution := false,
|
||||
|
|
@ -1033,7 +1031,7 @@ lazy val sbtClientProj = (project in file("client"))
|
|||
.dependsOn(commandProj)
|
||||
.settings(
|
||||
commonSettings,
|
||||
dontPublish,
|
||||
Utils.noPublish,
|
||||
name := "sbt-client",
|
||||
mimaPreviousArtifacts := Set.empty,
|
||||
crossPaths := false,
|
||||
|
|
@ -1118,7 +1116,7 @@ lazy val sbtBig = (project in file(".big"))
|
|||
lazy val lowerUtils = (project in (file("internal") / "lower"))
|
||||
.aggregate(lowerUtilProjects.map(p => LocalProject(p.id)): _*)
|
||||
.settings(
|
||||
dontPublish
|
||||
Utils.noPublish
|
||||
)
|
||||
|
||||
lazy val upperModules = (project in (file("internal") / "upper"))
|
||||
|
|
@ -1127,7 +1125,7 @@ lazy val upperModules = (project in (file("internal") / "upper"))
|
|||
diff Seq(bundledLauncherProj)).map(p => LocalProject(p.id)): _*
|
||||
)
|
||||
.settings(
|
||||
dontPublish
|
||||
Utils.noPublish
|
||||
)
|
||||
|
||||
lazy val sbtIgnoredProblems = {
|
||||
|
|
@ -1377,7 +1375,7 @@ lazy val lmCore = (project in file("lm-core"))
|
|||
),
|
||||
Compile / resourceGenerators += Def
|
||||
.task(
|
||||
Util.generateVersionFile(
|
||||
Utils.generateVersionFile(
|
||||
version.value,
|
||||
resourceManaged.value,
|
||||
streams.value,
|
||||
|
|
@ -1439,7 +1437,7 @@ def sbtCoursierSettings: Seq[Setting[_]] = Def.settings(
|
|||
),
|
||||
scalafixDependencies += "net.hamnaberg" %% "dataclass-scalafix" % dataclassScalafixVersion,
|
||||
assemblyMergeStrategy := {
|
||||
case PathList("lmcoursier", "internal", "shaded", "org", "fusesource", xs @ _*) => MergeStrategy.first
|
||||
case PathList("lmcoursier", "internal", "shaded", "org", "fusesource", _*) => MergeStrategy.first
|
||||
// case PathList("lmcoursier", "internal", "shaded", "package.class") => MergeStrategy.first
|
||||
// case PathList("lmcoursier", "internal", "shaded", "package$.class") => MergeStrategy.first
|
||||
case PathList("com", "github") => MergeStrategy.discard
|
||||
|
|
@ -1453,7 +1451,7 @@ def sbtCoursierSettings: Seq[Setting[_]] = Def.settings(
|
|||
case PathList("scala") => MergeStrategy.discard
|
||||
case PathList("sjsonnew") => MergeStrategy.discard
|
||||
case PathList("xsbti") => MergeStrategy.discard
|
||||
case PathList("META-INF", "native", xs @ _*) => MergeStrategy.first
|
||||
case PathList("META-INF", "native", _*) => MergeStrategy.first
|
||||
case x =>
|
||||
val oldStrategy = (ThisBuild / assemblyMergeStrategy).value
|
||||
oldStrategy(x)
|
||||
|
|
@ -1483,32 +1481,25 @@ lazy val definitions = project
|
|||
scalaVersion := scala3,
|
||||
crossScalaVersions := Seq(scala212, scala213, scala3),
|
||||
libraryDependencies ++= Seq(
|
||||
coursierDep,
|
||||
coursier,
|
||||
"net.hamnaberg" %% "dataclass-annotation" % dataclassScalafixVersion % Provided,
|
||||
lmIvy.value % Provided,
|
||||
),
|
||||
conflictWarning := ConflictWarning.disable,
|
||||
dontPublish,
|
||||
Utils.noPublish,
|
||||
)
|
||||
.dependsOn(lmIvy % "provided")
|
||||
|
||||
lazy val lmCoursier = project
|
||||
.in(file("lm-coursier"))
|
||||
.settings(
|
||||
shared,
|
||||
crossScalaVersions := Seq(scala212, scala213, scala3),
|
||||
Mima.settings,
|
||||
Mima.lmCoursierFilters,
|
||||
libraryDependencies ++= Seq(
|
||||
coursierDep,
|
||||
coursierSbtMavenRepoDep,
|
||||
coursier,
|
||||
coursierSbtMavenRepo,
|
||||
"io.get-coursier.jniutils" % "windows-jni-utils-lmcoursier" % jniUtilsVersion,
|
||||
"net.hamnaberg" %% "dataclass-annotation" % dataclassScalafixVersion % Provided,
|
||||
|
||||
// We depend on librarymanagement-ivy rather than just
|
||||
// librarymanagement-core to handle the ModuleDescriptor passed
|
||||
// to DependencyResolutionInterface.update, which is an
|
||||
// IvySbt#Module (seems DependencyResolutionInterface.moduleDescriptor is ignored).
|
||||
lmIvy.value,
|
||||
"org.scalatest" %% "scalatest" % "3.2.19" % Test
|
||||
),
|
||||
excludeDependencies ++= coursierExcludedDependencies,
|
||||
|
|
@ -1523,6 +1514,13 @@ lazy val lmCoursier = project
|
|||
},
|
||||
Compile / sourceGenerators += dataclassGen(definitions).taskValue,
|
||||
)
|
||||
.dependsOn(
|
||||
// We depend on librarymanagement-ivy rather than just
|
||||
// librarymanagement-core to handle the ModuleDescriptor passed
|
||||
// to DependencyResolutionInterface.update, which is an
|
||||
// IvySbt#Module (seems DependencyResolutionInterface.moduleDescriptor is ignored).
|
||||
lmIvy
|
||||
)
|
||||
|
||||
lazy val lmCoursierShadedPublishing = project
|
||||
.in(file("lm-coursier/target/shaded-publishing-module"))
|
||||
|
|
@ -1535,7 +1533,6 @@ lazy val lmCoursierShadedPublishing = project
|
|||
lazy val lmCoursierShaded = project
|
||||
.in(file("lm-coursier/target/shaded-module"))
|
||||
.settings(
|
||||
shared,
|
||||
crossScalaVersions := Seq(scala212, scala213, scala3),
|
||||
Mima.settings,
|
||||
Mima.lmCoursierFilters,
|
||||
|
|
@ -1583,17 +1580,17 @@ lazy val lmCoursierShaded = project
|
|||
yield ShadeRule.rename(ns + ".**" -> s"lmcoursier.internal.shaded.$ns.@1").inAll
|
||||
},
|
||||
libraryDependencies ++= Seq(
|
||||
coursierDep,
|
||||
coursierSbtMavenRepoDep,
|
||||
coursier,
|
||||
coursierSbtMavenRepo,
|
||||
"io.get-coursier.jniutils" % "windows-jni-utils-lmcoursier" % jniUtilsVersion,
|
||||
"net.hamnaberg" %% "dataclass-annotation" % dataclassScalafixVersion % Provided,
|
||||
lmIvy.value % Provided,
|
||||
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
|
||||
),
|
||||
excludeDependencies ++= excludedDependencies,
|
||||
excludeDependencies ++= coursierExcludedDependencies,
|
||||
conflictWarning := ConflictWarning.disable,
|
||||
dontPublish,
|
||||
Utils.noPublish,
|
||||
)
|
||||
.dependsOn(lmIvy % "provided")
|
||||
|
||||
lazy val customProtocolForTest212 = project
|
||||
.in(file("lm-coursier/custom-protocol-for-test-2-12"))
|
||||
|
|
@ -1603,7 +1600,7 @@ lazy val customProtocolForTest212 = project
|
|||
organization := "org.example",
|
||||
moduleName := "customprotocol-handler",
|
||||
version := "0.1.0",
|
||||
dontPublish
|
||||
Utils.noPublish
|
||||
)
|
||||
|
||||
lazy val customProtocolForTest213 = project
|
||||
|
|
@ -1614,7 +1611,7 @@ lazy val customProtocolForTest213 = project
|
|||
organization := "org.example",
|
||||
moduleName := "customprotocol-handler",
|
||||
version := "0.1.0",
|
||||
dontPublish
|
||||
Utils.noPublish
|
||||
)
|
||||
|
||||
lazy val customProtocolJavaForTest = project
|
||||
|
|
@ -1624,10 +1621,5 @@ lazy val customProtocolJavaForTest = project
|
|||
organization := "org.example",
|
||||
moduleName := "customprotocoljava-handler",
|
||||
version := "0.1.0",
|
||||
dontPublish
|
||||
Utils.noPublish
|
||||
)
|
||||
|
||||
lazy val dontPublish = Seq(
|
||||
publish := {},
|
||||
publish / skip := true,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -68,9 +68,6 @@ object Dependencies {
|
|||
def addSbtZinc = addSbtModule(sbtZincPath, "zinc", zinc)
|
||||
def addSbtZincCompileCore = addSbtModule(sbtZincPath, "zincCompileCore", zincCompileCore)
|
||||
|
||||
// val lmCoursierShaded = "io.get-coursier" %% "lm-coursier-shaded" % "2.0.10"
|
||||
val lmCoursierShaded = "org.scala-sbt" %% "librarymanagement-coursier" % "2.0.0-alpha8"
|
||||
|
||||
lazy val sjsonNewVersion = "0.14.0-M1"
|
||||
def sjsonNew(n: String) = Def.setting(
|
||||
"com.eed3si9n" %% n % sjsonNewVersion
|
||||
|
|
@ -141,8 +138,30 @@ object Dependencies {
|
|||
val zeroAllocationHashing = "net.openhft" % "zero-allocation-hashing" % "0.10.1"
|
||||
val ivy = "org.scala-sbt.ivy" % "ivy" % "2.3.0-sbt-396a783bba347016e7fe30dacc60d355be607fe2"
|
||||
|
||||
// lm dependencies
|
||||
val jsch = "com.github.mwiede" % "jsch" % "0.2.17" intransitive ()
|
||||
val scalaTest = "org.scalatest" %% "scalatest" % "3.2.18"
|
||||
val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.15.3"
|
||||
val gigahorseApacheHttp = "com.eed3si9n" %% "gigahorse-apache-http" % "0.7.0"
|
||||
|
||||
// lm-coursier dependencies
|
||||
val dataclassScalafixVersion = "0.1.0"
|
||||
val coursierVersion = "2.1.13"
|
||||
|
||||
val coursier = ("io.get-coursier" %% "coursier" % coursierVersion)
|
||||
.cross(CrossVersion.for3Use2_13)
|
||||
.exclude("org.codehaus.plexus", "plexus-archiver")
|
||||
.exclude("org.codehaus.plexus", "plexus-container-default")
|
||||
|
||||
val coursierSbtMavenRepo = ("io.get-coursier" %% "coursier-sbt-maven-repository" % coursierVersion)
|
||||
.cross(CrossVersion.for3Use2_13)
|
||||
|
||||
val coursierExcludedDependencies = Seq(
|
||||
ExclusionRule("org.scala-lang.modules", "scala-xml_2.13"),
|
||||
ExclusionRule("org.scala-lang.modules", "scala-collection-compat_2.13"),
|
||||
)
|
||||
|
||||
// FIXME Ideally, we should depend on the same version of io.get-coursier.jniutils:windows-jni-utils that
|
||||
// io.get-coursier::coursier depends on.
|
||||
val jniUtilsVersion = "0.3.3"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,105 +0,0 @@
|
|||
|
||||
import java.util.Locale
|
||||
|
||||
import sbt._
|
||||
import sbt.Keys._
|
||||
import sbt.ScriptedPlugin.autoImport.{scriptedBufferLog, scriptedLaunchOpts}
|
||||
|
||||
import com.jsuereth.sbtpgp._
|
||||
|
||||
object Settings {
|
||||
|
||||
def scala212 = "2.12.20"
|
||||
def scala213 = "2.13.15"
|
||||
def scala3 = "3.3.4"
|
||||
|
||||
def targetSbtVersion = "1.2.8"
|
||||
|
||||
private lazy val isAtLeastScala213 = Def.setting {
|
||||
import Ordering.Implicits._
|
||||
CrossVersion.partialVersion(scalaVersion.value).exists(_ >= (2, 13))
|
||||
}
|
||||
|
||||
lazy val shared = Seq(
|
||||
resolvers ++= Resolver.sonatypeOssRepos("releases"),
|
||||
crossScalaVersions := Seq(scala212),
|
||||
scalaVersion := scala3,
|
||||
scalacOptions ++= Seq(
|
||||
"-feature",
|
||||
"-deprecation",
|
||||
"-language:higherKinds",
|
||||
"-language:implicitConversions"
|
||||
),
|
||||
libraryDependencies ++= {
|
||||
if (isAtLeastScala213.value) Nil
|
||||
else Seq(compilerPlugin("org.scalamacros" % s"paradise" % "2.1.1" cross CrossVersion.full))
|
||||
},
|
||||
scalacOptions ++= {
|
||||
if (isAtLeastScala213.value) Seq("-Ymacro-annotations")
|
||||
else Nil
|
||||
},
|
||||
libraryDependencySchemes ++= {
|
||||
val sv = scalaVersion.value
|
||||
if (sv.startsWith("2.13."))
|
||||
Seq("org.scala-lang.modules" %% "scala-xml" % "always")
|
||||
else
|
||||
Nil
|
||||
}
|
||||
) ++ {
|
||||
val prop = sys.props.getOrElse("publish.javadoc", "").toLowerCase(Locale.ROOT)
|
||||
if (prop == "0" || prop == "false")
|
||||
Seq(
|
||||
Compile / doc / sources := Seq.empty,
|
||||
Compile / packageDoc / publishArtifact := false
|
||||
)
|
||||
else
|
||||
Nil
|
||||
}
|
||||
|
||||
lazy val plugin =
|
||||
shared ++
|
||||
Seq(
|
||||
// https://github.com/sbt/sbt/issues/5049#issuecomment-528960415
|
||||
dependencyOverrides := "org.scala-sbt" % "sbt" % targetSbtVersion :: Nil,
|
||||
scriptedLaunchOpts ++= Seq(
|
||||
"-Xmx1024M",
|
||||
"-Dplugin.name=" + name.value,
|
||||
"-Dplugin.version=" + version.value,
|
||||
"-Dsbttest.base=" + (sourceDirectory.value / "sbt-test").getAbsolutePath,
|
||||
"-Dcoursier.sbt-launcher.add-plugin=false"
|
||||
),
|
||||
scriptedBufferLog := false,
|
||||
sbtPlugin := true,
|
||||
pluginCrossBuild / sbtVersion := targetSbtVersion
|
||||
)
|
||||
|
||||
lazy val generatePropertyFile =
|
||||
Compile / resourceGenerators += Def.task {
|
||||
import sys.process._
|
||||
|
||||
val dir = (Compile / classDirectory).value / "coursier"
|
||||
val ver = version.value
|
||||
|
||||
val f = dir / "sbtcoursier.properties"
|
||||
dir.mkdirs()
|
||||
|
||||
val p = new java.util.Properties
|
||||
|
||||
p.setProperty("version", ver)
|
||||
p.setProperty("commit-hash", Seq("git", "rev-parse", "HEAD").!!.trim)
|
||||
|
||||
val w = new java.io.FileOutputStream(f)
|
||||
p.store(w, "sbt-coursier properties")
|
||||
w.close()
|
||||
|
||||
state.value.log.info(s"Wrote $f")
|
||||
|
||||
Seq(f)
|
||||
}
|
||||
|
||||
lazy val dontPublish = Seq(
|
||||
publish := {},
|
||||
publish / skip := true,
|
||||
)
|
||||
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ import Keys._
|
|||
|
||||
import sbt.internal.inc.Analysis
|
||||
|
||||
object Util {
|
||||
object Utils {
|
||||
val version2_13 = settingKey[String]("version number")
|
||||
val ExclusiveTest: Tags.Tag = Tags.Tag("exclusive-test")
|
||||
|
||||
|
|
@ -12,7 +12,10 @@ object Util {
|
|||
val scalaKeywords: TaskKey[Set[String]] = taskKey[Set[String]]("")
|
||||
val generateKeywords: TaskKey[File] = taskKey[File]("")
|
||||
|
||||
def noPublishSettings: Seq[Setting[_]] = Seq(publish := {})
|
||||
lazy val noPublish = Seq(
|
||||
publish := {},
|
||||
publish / skip := true,
|
||||
)
|
||||
|
||||
def crossBuild: Seq[Setting[_]] =
|
||||
Seq(
|
||||
Loading…
Reference in New Issue