mirror of https://github.com/sbt/sbt.git
Merge pull request #7880 from adpi2/2.x-settings
[2.x] Reduce creation of `Setting` and `Initialize`
This commit is contained in:
commit
661f1fa216
|
|
@ -20,11 +20,11 @@ object DependencyTreePlugin extends AutoPlugin {
|
||||||
val configurations = Vector(Compile, Test, IntegrationTest, Runtime, Provided, Optional)
|
val configurations = Vector(Compile, Test, IntegrationTest, Runtime, Provided, Optional)
|
||||||
|
|
||||||
// MiniDependencyTreePlugin provides baseBasicReportingSettings for Compile and Test
|
// MiniDependencyTreePlugin provides baseBasicReportingSettings for Compile and Test
|
||||||
override def projectSettings: Seq[Def.Setting[?]] =
|
override lazy val projectSettings: Seq[Def.Setting[?]] =
|
||||||
((configurations diff Vector(Compile, Test)) flatMap { config =>
|
configurations.diff(Vector(Compile, Test)).flatMap { config =>
|
||||||
inConfig(config)(DependencyTreeSettings.baseBasicReportingSettings)
|
inConfig(config)(DependencyTreeSettings.baseBasicReportingSettings)
|
||||||
}) ++
|
} ++
|
||||||
(configurations flatMap { config =>
|
configurations.flatMap { config =>
|
||||||
inConfig(config)(DependencyTreeSettings.baseFullReportingSettings)
|
inConfig(config)(DependencyTreeSettings.baseFullReportingSettings)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,10 +154,9 @@ object Previous {
|
||||||
|
|
||||||
/** Public as a macro implementation detail. Do not call directly. */
|
/** Public as a macro implementation detail. Do not call directly. */
|
||||||
def runtime[T](skey: TaskKey[T])(implicit format: JsonFormat[T]): Initialize[Task[Option[T]]] = {
|
def runtime[T](skey: TaskKey[T])(implicit format: JsonFormat[T]): Initialize[Task[Option[T]]] = {
|
||||||
val inputs = (Global / cache)
|
type Inputs = (Task[Previous], ScopedKey[Task[T]], References)
|
||||||
.zip(Def.validated(skey, selfRefOk = true))
|
val inputs = (Global / cache, Def.validated(skey, selfRefOk = true), Global / references)
|
||||||
.zip(Global / references)
|
Def.app[Inputs, Task[Option[T]]](inputs) { case (prevTask, resolved, refs) =>
|
||||||
inputs { case ((prevTask, resolved), refs) =>
|
|
||||||
val key = Key(resolved, resolved)
|
val key = Key(resolved, resolved)
|
||||||
refs.recordReference(key, format) // always evaluated on project load
|
refs.recordReference(key, format) // always evaluated on project load
|
||||||
prevTask.map(_.get(key)) // evaluated if this task is evaluated
|
prevTask.map(_.get(key)) // evaluated if this task is evaluated
|
||||||
|
|
@ -168,14 +167,17 @@ object Previous {
|
||||||
def runtimeInEnclosingTask[T](skey: TaskKey[T])(implicit
|
def runtimeInEnclosingTask[T](skey: TaskKey[T])(implicit
|
||||||
format: JsonFormat[T]
|
format: JsonFormat[T]
|
||||||
): Initialize[Task[Option[T]]] = {
|
): Initialize[Task[Option[T]]] = {
|
||||||
val inputs = (Global / cache)
|
type Inputs = (Task[Previous], ScopedKey[Task[T]], References, ScopedKey[?])
|
||||||
.zip(Def.validated(skey, selfRefOk = true))
|
val inputs = (
|
||||||
.zip(Global / references)
|
Global / cache,
|
||||||
.zip(Def.resolvedScoped)
|
Def.validated(skey, selfRefOk = true),
|
||||||
inputs { case (((prevTask, resolved), refs), inTask) =>
|
Global / references,
|
||||||
|
Def.resolvedScoped
|
||||||
|
)
|
||||||
|
Def.app[Inputs, Task[Option[T]]](inputs) { case (prevTask, resolved, refs, inTask) =>
|
||||||
val key = Key(resolved, inTask.asInstanceOf[ScopedKey[Task[Any]]])
|
val key = Key(resolved, inTask.asInstanceOf[ScopedKey[Task[Any]]])
|
||||||
refs.recordReference(key, format) // always evaluated on project load
|
refs.recordReference(key, format) // always evaluated on project load
|
||||||
prevTask.map(_.get(key)) // evaluated if this task is evaluated
|
prevTask.map(_.get(key))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import sbt.Project.{
|
||||||
// sbtRichTaskPromise
|
// sbtRichTaskPromise
|
||||||
}
|
}
|
||||||
import sbt.ProjectExtra.*
|
import sbt.ProjectExtra.*
|
||||||
import sbt.Scope.{ GlobalScope, ThisScope, fillTaskAxis }
|
import sbt.Scope.{ GlobalScope, ThisBuildScope, ThisScope, fillTaskAxis }
|
||||||
import sbt.State.StateOpsImpl
|
import sbt.State.StateOpsImpl
|
||||||
import sbt.coursierint._
|
import sbt.coursierint._
|
||||||
import sbt.internal.CommandStrings.ExportStream
|
import sbt.internal.CommandStrings.ExportStream
|
||||||
|
|
@ -156,9 +156,9 @@ object Defaults extends BuildCommon {
|
||||||
private[sbt] def globalDefaults(ss: Seq[Setting[?]]): Seq[Setting[?]] =
|
private[sbt] def globalDefaults(ss: Seq[Setting[?]]): Seq[Setting[?]] =
|
||||||
Def.defaultSettings(inScope(GlobalScope)(ss))
|
Def.defaultSettings(inScope(GlobalScope)(ss))
|
||||||
|
|
||||||
def buildCore: Seq[Setting[?]] = thisBuildCore ++ globalCore
|
lazy val buildCore: Seq[Setting[?]] = thisBuildCore ++ globalCore
|
||||||
def thisBuildCore: Seq[Setting[?]] =
|
private def thisBuildCore: Seq[Setting[?]] =
|
||||||
inScope(GlobalScope.copy(project = Select(ThisBuild)))(
|
inScope(ThisBuildScope)(
|
||||||
Seq(
|
Seq(
|
||||||
managedDirectory := baseDirectory.value / "lib_managed"
|
managedDirectory := baseDirectory.value / "lib_managed"
|
||||||
)
|
)
|
||||||
|
|
@ -652,8 +652,6 @@ object Defaults extends BuildCommon {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
// This exists for binary compatibility and probably never should have been public.
|
|
||||||
def addBaseSources: Seq[Def.Setting[Task[Seq[File]]]] = Nil
|
|
||||||
lazy val outputConfigPaths: Seq[Setting[?]] = Seq(
|
lazy val outputConfigPaths: Seq[Setting[?]] = Seq(
|
||||||
classDirectory := target.value / (prefix(configuration.value.name) + "classes"),
|
classDirectory := target.value / (prefix(configuration.value.name) + "classes"),
|
||||||
backendOutput := {
|
backendOutput := {
|
||||||
|
|
@ -717,13 +715,21 @@ object Defaults extends BuildCommon {
|
||||||
},
|
},
|
||||||
crossSbtVersions := Vector((pluginCrossBuild / sbtVersion).value),
|
crossSbtVersions := Vector((pluginCrossBuild / sbtVersion).value),
|
||||||
crossTarget := target.value,
|
crossTarget := target.value,
|
||||||
scalaCompilerBridgeBinaryJar := Def.settingDyn {
|
scalaCompilerBridgeBinaryJar := {
|
||||||
val sv = scalaVersion.value
|
val sv = scalaVersion.value
|
||||||
val managed = managedScalaInstance.value
|
val managed = managedScalaInstance.value
|
||||||
val hasSbtBridge = ScalaArtifacts.isScala3(sv) || ZincLmUtil.hasScala2SbtBridge(sv)
|
val hasSbtBridge = ScalaArtifacts.isScala3(sv) || ZincLmUtil.hasScala2SbtBridge(sv)
|
||||||
if (hasSbtBridge && managed) fetchBridgeBinaryJarTask(sv)
|
if hasSbtBridge && managed then
|
||||||
else Def.task[Option[File]](None)
|
val jar = ZincLmUtil.fetchDefaultBridgeModule(
|
||||||
}.value,
|
sv,
|
||||||
|
dependencyResolution.value,
|
||||||
|
updateConfiguration.value,
|
||||||
|
(update / unresolvedWarningConfiguration).value,
|
||||||
|
streams.value.log
|
||||||
|
)
|
||||||
|
Some(jar)
|
||||||
|
else None
|
||||||
|
},
|
||||||
scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeSourceModule(scalaVersion.value),
|
scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeSourceModule(scalaVersion.value),
|
||||||
auxiliaryClassFiles ++= {
|
auxiliaryClassFiles ++= {
|
||||||
if (ScalaArtifacts.isScala3(scalaVersion.value)) List(TastyFiles.instance)
|
if (ScalaArtifacts.isScala3(scalaVersion.value)) List(TastyFiles.instance)
|
||||||
|
|
@ -736,7 +742,6 @@ object Defaults extends BuildCommon {
|
||||||
classpathOptions := ClasspathOptionsUtil.noboot(scalaVersion.value),
|
classpathOptions := ClasspathOptionsUtil.noboot(scalaVersion.value),
|
||||||
console / classpathOptions := ClasspathOptionsUtil.replNoboot(scalaVersion.value),
|
console / classpathOptions := ClasspathOptionsUtil.replNoboot(scalaVersion.value),
|
||||||
)
|
)
|
||||||
// must be a val: duplication detected by object identity
|
|
||||||
private lazy val compileBaseGlobal: Seq[Setting[?]] = globalDefaults(
|
private lazy val compileBaseGlobal: Seq[Setting[?]] = globalDefaults(
|
||||||
Seq(
|
Seq(
|
||||||
auxiliaryClassFiles :== Nil,
|
auxiliaryClassFiles :== Nil,
|
||||||
|
|
@ -812,18 +817,6 @@ object Defaults extends BuildCommon {
|
||||||
if (plugin) scalaBase / ("sbt-" + sbtv) else scalaBase
|
if (plugin) scalaBase / ("sbt-" + sbtv) else scalaBase
|
||||||
}
|
}
|
||||||
|
|
||||||
private def fetchBridgeBinaryJarTask(scalaVersion: String): Initialize[Task[Option[File]]] =
|
|
||||||
Def.task {
|
|
||||||
val bridgeJar = ZincLmUtil.fetchDefaultBridgeModule(
|
|
||||||
scalaVersion,
|
|
||||||
dependencyResolution.value,
|
|
||||||
updateConfiguration.value,
|
|
||||||
(update / unresolvedWarningConfiguration).value,
|
|
||||||
streams.value.log
|
|
||||||
)
|
|
||||||
Some(bridgeJar)
|
|
||||||
}
|
|
||||||
|
|
||||||
def compilersSetting = {
|
def compilersSetting = {
|
||||||
compilers := {
|
compilers := {
|
||||||
val st = state.value
|
val st = state.value
|
||||||
|
|
@ -1010,8 +1003,10 @@ object Defaults extends BuildCommon {
|
||||||
},
|
},
|
||||||
persistJarClasspath :== true,
|
persistJarClasspath :== true,
|
||||||
classpathEntryDefinesClassVF := {
|
classpathEntryDefinesClassVF := {
|
||||||
(if (persistJarClasspath.value) classpathDefinesClassCache.value
|
val cache =
|
||||||
else VirtualFileValueCache.definesClassCache(fileConverter.value)).get
|
if persistJarClasspath.value then classpathDefinesClassCache.value
|
||||||
|
else VirtualFileValueCache.definesClassCache(fileConverter.value)
|
||||||
|
cache.get
|
||||||
},
|
},
|
||||||
compileIncSetup := compileIncSetupTask.value,
|
compileIncSetup := compileIncSetupTask.value,
|
||||||
console := consoleTask.value,
|
console := consoleTask.value,
|
||||||
|
|
@ -1083,16 +1078,9 @@ object Defaults extends BuildCommon {
|
||||||
"1.3.0"
|
"1.3.0"
|
||||||
)
|
)
|
||||||
def watchTransitiveSourcesTask: Initialize[Task[Seq[Source]]] =
|
def watchTransitiveSourcesTask: Initialize[Task[Seq[Source]]] =
|
||||||
watchTransitiveSourcesTaskImpl(watchSources)
|
|
||||||
|
|
||||||
private def watchTransitiveSourcesTaskImpl(
|
|
||||||
key: TaskKey[Seq[Source]]
|
|
||||||
): Initialize[Task[Seq[Source]]] = {
|
|
||||||
import ScopeFilter.Make.*
|
import ScopeFilter.Make.*
|
||||||
val selectDeps = ScopeFilter(inAggregates(ThisProject) || inDependencies(ThisProject))
|
val selectDeps = ScopeFilter(inAggregates(ThisProject) || inDependencies(ThisProject))
|
||||||
val allWatched = (key ?? Nil).all(selectDeps)
|
watchSources.??(Nil).all(selectDeps).map(_.flatten)
|
||||||
Def.task { allWatched.value.flatten }
|
|
||||||
}
|
|
||||||
|
|
||||||
def transitiveUpdateTask: Initialize[Task[Seq[UpdateReport]]] = {
|
def transitiveUpdateTask: Initialize[Task[Seq[UpdateReport]]] = {
|
||||||
import ScopeFilter.Make.*
|
import ScopeFilter.Make.*
|
||||||
|
|
@ -1140,15 +1128,13 @@ object Defaults extends BuildCommon {
|
||||||
// use the same class loader as the Scala classes used by sbt
|
// use the same class loader as the Scala classes used by sbt
|
||||||
Def.task {
|
Def.task {
|
||||||
val allJars = scalaProvider.jars
|
val allJars = scalaProvider.jars
|
||||||
val libraryJars = allJars
|
val libraryJars = allJars.filter { jar =>
|
||||||
.filter { jar =>
|
jar.getName == "scala-library.jar" || jar.getName.startsWith("scala3-library_3")
|
||||||
(jar.getName == "scala-library.jar") || (jar.getName.startsWith(
|
}
|
||||||
"scala3-library_3"
|
val compilerJar = allJars.filter { jar =>
|
||||||
))
|
|
||||||
}
|
|
||||||
(allJars.filter { jar =>
|
|
||||||
jar.getName == "scala-compiler.jar" || jar.getName.startsWith("scala3-compiler_3")
|
jar.getName == "scala-compiler.jar" || jar.getName.startsWith("scala3-compiler_3")
|
||||||
}) match
|
}
|
||||||
|
compilerJar match
|
||||||
case Array(compilerJar) if libraryJars.nonEmpty =>
|
case Array(compilerJar) if libraryJars.nonEmpty =>
|
||||||
makeScalaInstance(
|
makeScalaInstance(
|
||||||
sv,
|
sv,
|
||||||
|
|
@ -1318,75 +1304,76 @@ object Defaults extends BuildCommon {
|
||||||
extraTestDigests :== Nil,
|
extraTestDigests :== Nil,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
lazy val testTasks: Seq[Setting[?]] =
|
lazy val testTasks: Seq[Setting[?]] = Def.settings(
|
||||||
testTaskOptions(test) ++ testTaskOptions(testOnly) ++ testTaskOptions(
|
testTaskOptions(test),
|
||||||
testQuick
|
testTaskOptions(testOnly),
|
||||||
) ++ testDefaults ++ Seq(
|
testTaskOptions(testQuick),
|
||||||
testLoader := ClassLoaders.testTask.value,
|
testDefaults,
|
||||||
loadedTestFrameworks := {
|
testLoader := ClassLoaders.testTask.value,
|
||||||
val loader = testLoader.value
|
loadedTestFrameworks := {
|
||||||
val log = streams.value.log
|
val loader = testLoader.value
|
||||||
testFrameworks.value.flatMap(f => f.create(loader, log).map(x => (f, x))).toMap
|
val log = streams.value.log
|
||||||
},
|
testFrameworks.value.flatMap(f => f.create(loader, log).map(x => (f, x))).toMap
|
||||||
definedTests := detectTests.value,
|
},
|
||||||
definedTestNames := definedTests
|
definedTests := detectTests.value,
|
||||||
.map(_.map(_.name).distinct)
|
definedTestNames := definedTests
|
||||||
.storeAs(definedTestNames)
|
.map(_.map(_.name).distinct)
|
||||||
.triggeredBy(compile)
|
.storeAs(definedTestNames)
|
||||||
.value,
|
.triggeredBy(compile)
|
||||||
definedTestDigests := IncrementalTest.definedTestDigestTask
|
.value,
|
||||||
.triggeredBy(compile)
|
definedTestDigests := IncrementalTest.definedTestDigestTask
|
||||||
.value,
|
.triggeredBy(compile)
|
||||||
testQuick / testFilter := IncrementalTest.filterTask.value,
|
.value,
|
||||||
extraTestDigests ++= IncrementalTest.extraTestDigestsTask.value,
|
testQuick / testFilter := IncrementalTest.filterTask.value,
|
||||||
executeTests := {
|
extraTestDigests ++= IncrementalTest.extraTestDigestsTask.value,
|
||||||
import sbt.TupleSyntax.*
|
executeTests := {
|
||||||
(
|
import sbt.TupleSyntax.*
|
||||||
test / streams,
|
(
|
||||||
loadedTestFrameworks,
|
test / streams,
|
||||||
testLoader,
|
loadedTestFrameworks,
|
||||||
(test / testGrouping),
|
testLoader,
|
||||||
(test / testExecution),
|
(test / testGrouping),
|
||||||
(test / fullClasspath),
|
(test / testExecution),
|
||||||
testForkedParallel,
|
(test / fullClasspath),
|
||||||
(test / javaOptions),
|
testForkedParallel,
|
||||||
(classLoaderLayeringStrategy),
|
(test / javaOptions),
|
||||||
thisProject,
|
(classLoaderLayeringStrategy),
|
||||||
fileConverter,
|
thisProject,
|
||||||
).flatMapN { case (s, lt, tl, gp, ex, cp, fp, jo, clls, thisProj, c) =>
|
fileConverter,
|
||||||
allTestGroupsTask(
|
).flatMapN { case (s, lt, tl, gp, ex, cp, fp, jo, clls, thisProj, c) =>
|
||||||
s,
|
allTestGroupsTask(
|
||||||
lt,
|
s,
|
||||||
tl,
|
lt,
|
||||||
gp,
|
tl,
|
||||||
ex,
|
gp,
|
||||||
cp,
|
ex,
|
||||||
fp,
|
cp,
|
||||||
jo,
|
fp,
|
||||||
clls,
|
jo,
|
||||||
projectId = s"${thisProj.id} / ",
|
clls,
|
||||||
c,
|
projectId = s"${thisProj.id} / ",
|
||||||
)
|
c,
|
||||||
}
|
)
|
||||||
}.value,
|
}
|
||||||
// ((streams in test, loadedTestFrameworks, testLoader, testGrouping in test, testExecution in test, fullClasspath in test, javaHome in test, testForkedParallel, javaOptions in test) flatMap allTestGroupsTask).value,
|
}.value,
|
||||||
Test / testFull / testResultLogger :== TestResultLogger.SilentWhenNoTests, // https://github.com/sbt/sbt/issues/1185
|
// ((streams in test, loadedTestFrameworks, testLoader, testGrouping in test, testExecution in test, fullClasspath in test, javaHome in test, testForkedParallel, javaOptions in test) flatMap allTestGroupsTask).value,
|
||||||
testFull := {
|
Test / testFull / testResultLogger :== TestResultLogger.SilentWhenNoTests, // https://github.com/sbt/sbt/issues/1185
|
||||||
val trl = (Test / testFull / testResultLogger).value
|
testFull := {
|
||||||
val taskName = Project.showContextKey(state.value).show(resolvedScoped.value)
|
val trl = (Test / testFull / testResultLogger).value
|
||||||
try trl.run(streams.value.log, executeTests.value, taskName)
|
val taskName = Project.showContextKey(state.value).show(resolvedScoped.value)
|
||||||
finally close(testLoader.value)
|
try trl.run(streams.value.log, executeTests.value, taskName)
|
||||||
},
|
finally close(testLoader.value)
|
||||||
testOnly := {
|
},
|
||||||
try inputTests(testOnly).evaluated
|
testOnly := {
|
||||||
finally close(testLoader.value)
|
try inputTests(testOnly).evaluated
|
||||||
},
|
finally close(testLoader.value)
|
||||||
testQuick := {
|
},
|
||||||
try inputTests(testQuick).evaluated
|
testQuick := {
|
||||||
finally close(testLoader.value)
|
try inputTests(testQuick).evaluated
|
||||||
},
|
finally close(testLoader.value)
|
||||||
test := testQuick.evaluated,
|
},
|
||||||
)
|
test := testQuick.evaluated,
|
||||||
|
)
|
||||||
|
|
||||||
private def close(sbtLoader: ClassLoader): Unit = sbtLoader match {
|
private def close(sbtLoader: ClassLoader): Unit = sbtLoader match {
|
||||||
case u: AutoCloseable => u.close()
|
case u: AutoCloseable => u.close()
|
||||||
|
|
@ -1398,13 +1385,11 @@ object Defaults extends BuildCommon {
|
||||||
* A scope whose task axis is set to Zero.
|
* A scope whose task axis is set to Zero.
|
||||||
*/
|
*/
|
||||||
lazy val TaskZero: Scope = ThisScope.copy(task = Zero)
|
lazy val TaskZero: Scope = ThisScope.copy(task = Zero)
|
||||||
lazy val TaskGlobal: Scope = TaskZero
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scope whose configuration axis is set to Zero.
|
* A scope whose configuration axis is set to Zero.
|
||||||
*/
|
*/
|
||||||
lazy val ConfigZero: Scope = ThisScope.copy(config = Zero)
|
lazy val ConfigZero: Scope = ThisScope.copy(config = Zero)
|
||||||
lazy val ConfigGlobal: Scope = ConfigZero
|
|
||||||
def testTaskOptions(key: Scoped): Seq[Setting[?]] =
|
def testTaskOptions(key: Scoped): Seq[Setting[?]] =
|
||||||
inTask(key)(
|
inTask(key)(
|
||||||
Seq(
|
Seq(
|
||||||
|
|
@ -1468,7 +1453,7 @@ object Defaults extends BuildCommon {
|
||||||
|
|
||||||
def singleTestGroup(key: Scoped): Initialize[Task[Seq[Tests.Group]]] =
|
def singleTestGroup(key: Scoped): Initialize[Task[Seq[Tests.Group]]] =
|
||||||
inTask(key, singleTestGroupDefault)
|
inTask(key, singleTestGroupDefault)
|
||||||
def singleTestGroupDefault: Initialize[Task[Seq[Tests.Group]]] = Def.task {
|
lazy val singleTestGroupDefault: Initialize[Task[Seq[Tests.Group]]] = Def.task {
|
||||||
val tests = definedTests.value
|
val tests = definedTests.value
|
||||||
val fk = fork.value
|
val fk = fork.value
|
||||||
val opts = forkOptions.value
|
val opts = forkOptions.value
|
||||||
|
|
@ -1940,7 +1925,7 @@ object Defaults extends BuildCommon {
|
||||||
converter.toVirtualFile(p.toPath())
|
converter.toVirtualFile(p.toPath())
|
||||||
}
|
}
|
||||||
|
|
||||||
def artifactSetting: Initialize[Artifact] =
|
lazy val artifactSetting: Initialize[Artifact] =
|
||||||
Def.setting {
|
Def.setting {
|
||||||
val a = artifact.value
|
val a = artifact.value
|
||||||
val classifier = artifactClassifier.value
|
val classifier = artifactClassifier.value
|
||||||
|
|
@ -1980,7 +1965,7 @@ object Defaults extends BuildCommon {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def packageTask: Initialize[Task[HashedVirtualFileRef]] =
|
lazy val packageTask: Initialize[Task[HashedVirtualFileRef]] =
|
||||||
Def.cachedTask {
|
Def.cachedTask {
|
||||||
val config = packageConfiguration.value
|
val config = packageConfiguration.value
|
||||||
val s = streams.value
|
val s = streams.value
|
||||||
|
|
@ -1996,7 +1981,7 @@ object Defaults extends BuildCommon {
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
def packageConfigurationTask: Initialize[Task[Pkg.Configuration]] =
|
lazy val packageConfigurationTask: Initialize[Task[Pkg.Configuration]] =
|
||||||
Def.task {
|
Def.task {
|
||||||
Pkg.Configuration(
|
Pkg.Configuration(
|
||||||
mappings.value,
|
mappings.value,
|
||||||
|
|
@ -2809,8 +2794,8 @@ object Defaults extends BuildCommon {
|
||||||
|
|
||||||
def noAggregation: Seq[Scoped] =
|
def noAggregation: Seq[Scoped] =
|
||||||
Seq(run, runMain, bgRun, bgRunMain, console, consoleQuick, consoleProject)
|
Seq(run, runMain, bgRun, bgRunMain, console, consoleQuick, consoleProject)
|
||||||
lazy val disableAggregation = Defaults.globalDefaults(noAggregation map disableAggregate)
|
lazy val disableAggregation =
|
||||||
def disableAggregate(k: Scoped) = (k / aggregate) :== false
|
Defaults.globalDefaults(noAggregation.map(k => (k / aggregate) :== false))
|
||||||
|
|
||||||
// 1. runnerSettings is added unscoped via JvmPlugin.
|
// 1. runnerSettings is added unscoped via JvmPlugin.
|
||||||
// 2. In addition it's added scoped to run task.
|
// 2. In addition it's added scoped to run task.
|
||||||
|
|
@ -2835,9 +2820,7 @@ object Defaults extends BuildCommon {
|
||||||
"Create a separate subproject instead of using IntegrationTest and in addition avoid using itSettings",
|
"Create a separate subproject instead of using IntegrationTest and in addition avoid using itSettings",
|
||||||
"1.9.0"
|
"1.9.0"
|
||||||
)
|
)
|
||||||
lazy val itSettings: Seq[Setting[?]] = inConfig(IntegrationTest) {
|
lazy val itSettings: Seq[Setting[?]] = inConfig(IntegrationTest)(testSettings)
|
||||||
testSettings
|
|
||||||
}
|
|
||||||
lazy val defaultConfigs: Seq[Setting[?]] = inConfig(Compile)(compileSettings) ++
|
lazy val defaultConfigs: Seq[Setting[?]] = inConfig(Compile)(compileSettings) ++
|
||||||
inConfig(Test)(testSettings) ++
|
inConfig(Test)(testSettings) ++
|
||||||
inConfig(Runtime)(Classpaths.configSettings)
|
inConfig(Runtime)(Classpaths.configSettings)
|
||||||
|
|
@ -2870,7 +2853,7 @@ object Defaults extends BuildCommon {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def dependencyResolutionTask: Def.Initialize[Task[DependencyResolution]] =
|
lazy val dependencyResolutionTask: Def.Initialize[Task[DependencyResolution]] =
|
||||||
Def.task {
|
Def.task {
|
||||||
CoursierDependencyResolution(csrConfiguration.value)
|
CoursierDependencyResolution(csrConfiguration.value)
|
||||||
}
|
}
|
||||||
|
|
@ -3133,16 +3116,14 @@ object Classpaths {
|
||||||
// Both POMs and JARs are Maven-compatible in sbt 2.x, so ignore the workarounds
|
// Both POMs and JARs are Maven-compatible in sbt 2.x, so ignore the workarounds
|
||||||
packagedDefaultArtifacts.value
|
packagedDefaultArtifacts.value
|
||||||
} else {
|
} else {
|
||||||
val crossVersion = sbtCrossVersion.value
|
val sbtV = (pluginCrossBuild / sbtBinaryVersion).value
|
||||||
|
val scalaV = scalaBinaryVersion.value
|
||||||
|
val crossVersion = (name: String) => name + s"_${scalaV}_$sbtV"
|
||||||
val legacyPomArtifact = (makePom / artifact).value
|
val legacyPomArtifact = (makePom / artifact).value
|
||||||
val converter = fileConverter.value
|
val converter = fileConverter.value
|
||||||
def addSuffix(a: Artifact): Artifact = a.withName(crossVersion(a.name))
|
def addSuffix(a: Artifact): Artifact = a.withName(crossVersion(a.name))
|
||||||
Map(
|
Map(addSuffix(legacyPomArtifact) -> makeMavenPomOfSbtPlugin(converter, crossVersion)) ++
|
||||||
addSuffix(legacyPomArtifact) -> converter.toVirtualFile(
|
pomConsistentArtifactsForLegacySbt(converter, crossVersion) ++
|
||||||
makeMavenPomOfSbtPlugin.value.toPath()
|
|
||||||
)
|
|
||||||
) ++
|
|
||||||
pomConsistentArtifactsForLegacySbt.value ++
|
|
||||||
legacyPackagedArtifacts.value
|
legacyPackagedArtifacts.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3154,52 +3135,46 @@ object Classpaths {
|
||||||
else Map.empty[Artifact, HashedVirtualFileRef]
|
else Map.empty[Artifact, HashedVirtualFileRef]
|
||||||
}
|
}
|
||||||
|
|
||||||
private def pomConsistentArtifactsForLegacySbt
|
private inline def pomConsistentArtifactsForLegacySbt(
|
||||||
: Def.Initialize[Task[Map[Artifact, HashedVirtualFileRef]]] =
|
converter: FileConverter,
|
||||||
Def.task {
|
crossVersion: String => String
|
||||||
val crossVersion = sbtCrossVersion.value
|
): Map[Artifact, HashedVirtualFileRef] =
|
||||||
val legacyPackages = packaged(defaultPackages).value
|
val legacyPackages = packaged(defaultPackages).value
|
||||||
val converter = fileConverter.value
|
def copyArtifact(
|
||||||
def copyArtifact(
|
artifact: Artifact,
|
||||||
artifact: Artifact,
|
fileRef: HashedVirtualFileRef
|
||||||
fileRef: HashedVirtualFileRef
|
): (Artifact, HashedVirtualFileRef) = {
|
||||||
): (Artifact, HashedVirtualFileRef) = {
|
val nameWithSuffix = crossVersion(artifact.name)
|
||||||
val nameWithSuffix = crossVersion(artifact.name)
|
val file = converter.toPath(fileRef).toFile
|
||||||
val file = converter.toPath(fileRef).toFile
|
val targetFile =
|
||||||
val targetFile =
|
new File(file.getParentFile, file.name.replace(artifact.name, nameWithSuffix))
|
||||||
new File(file.getParentFile, file.name.replace(artifact.name, nameWithSuffix))
|
IO.copyFile(file, targetFile)
|
||||||
IO.copyFile(file, targetFile)
|
artifact.withName(nameWithSuffix) -> converter.toVirtualFile(targetFile.toPath)
|
||||||
artifact.withName(nameWithSuffix) -> converter.toVirtualFile(targetFile.toPath)
|
}
|
||||||
}
|
legacyPackages.map { case (artifact, file) =>
|
||||||
legacyPackages.map { case (artifact, file) =>
|
copyArtifact(artifact, file);
|
||||||
copyArtifact(artifact, file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private def sbtCrossVersion: Def.Initialize[String => String] = Def.setting {
|
|
||||||
val sbtV = (pluginCrossBuild / sbtBinaryVersion).value
|
|
||||||
val scalaV = scalaBinaryVersion.value
|
|
||||||
name => name + s"_${scalaV}_$sbtV"
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a POM file that Maven can resolve.
|
* Generates a POM file that Maven can resolve.
|
||||||
* It appends the sbt cross version into all artifactIds of sbt plugins
|
* It appends the sbt cross version into all artifactIds of sbt plugins
|
||||||
* (the main one and the dependencies).
|
* (the main one and the dependencies).
|
||||||
*/
|
*/
|
||||||
private def makeMavenPomOfSbtPlugin: Def.Initialize[Task[File]] = Def.task {
|
private inline def makeMavenPomOfSbtPlugin(
|
||||||
|
converter: FileConverter,
|
||||||
|
crossVersion: String => String
|
||||||
|
): HashedVirtualFileRef =
|
||||||
val config = makePomConfiguration.value
|
val config = makePomConfiguration.value
|
||||||
val nameWithCross = sbtCrossVersion.value(artifact.value.name)
|
val nameWithCross = crossVersion(artifact.value.name)
|
||||||
val version = Keys.version.value
|
val version = Keys.version.value
|
||||||
val pomFile = config.file.get.getParentFile / s"$nameWithCross-$version.pom"
|
val pomFile = config.file.get.getParentFile / s"$nameWithCross-$version.pom"
|
||||||
val publisher = Keys.publisher.value
|
val publisher = Keys.publisher.value
|
||||||
val ivySbt = Keys.ivySbt.value
|
val ivySbt = Keys.ivySbt.value
|
||||||
val module = new ivySbt.Module(moduleSettings.value, appendSbtCrossVersion = true)
|
val module = new ivySbt.Module(moduleSettings.value, appendSbtCrossVersion = true)
|
||||||
publisher.makePomFile(module, config.withFile(pomFile), streams.value.log)
|
publisher.makePomFile(module, config.withFile(pomFile), streams.value.log)
|
||||||
pomFile
|
converter.toVirtualFile(pomFile.toPath)
|
||||||
}
|
|
||||||
|
|
||||||
val ivyPublishSettings: Seq[Setting[?]] = publishGlobalDefaults ++ Seq(
|
def ivyPublishSettings: Seq[Setting[?]] = publishGlobalDefaults ++ Seq(
|
||||||
artifacts :== Nil,
|
artifacts :== Nil,
|
||||||
packagedArtifacts :== Map.empty,
|
packagedArtifacts :== Map.empty,
|
||||||
makePom := {
|
makePom := {
|
||||||
|
|
@ -3218,7 +3193,7 @@ object Classpaths {
|
||||||
publishM2 := publishOrSkip(publishM2Configuration, publishM2 / skip).value
|
publishM2 := publishOrSkip(publishM2Configuration, publishM2 / skip).value
|
||||||
)
|
)
|
||||||
|
|
||||||
private def baseGlobalDefaults =
|
def baseGlobalDefaults =
|
||||||
Defaults.globalDefaults(
|
Defaults.globalDefaults(
|
||||||
Seq(
|
Seq(
|
||||||
conflictWarning :== ConflictWarning.default("global"),
|
conflictWarning :== ConflictWarning.default("global"),
|
||||||
|
|
@ -3290,7 +3265,7 @@ object Classpaths {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val ivyBaseSettings: Seq[Setting[?]] = baseGlobalDefaults ++ sbtClassifiersTasks ++ Seq(
|
def ivyBaseSettings: Seq[Setting[?]] = baseGlobalDefaults ++ sbtClassifiersTasks ++ Seq(
|
||||||
conflictWarning := conflictWarning.value.copy(label = Reference.display(thisProjectRef.value)),
|
conflictWarning := conflictWarning.value.copy(label = Reference.display(thisProjectRef.value)),
|
||||||
unmanagedBase := baseDirectory.value / "lib",
|
unmanagedBase := baseDirectory.value / "lib",
|
||||||
normalizedName := Project.normalizeModuleID(name.value),
|
normalizedName := Project.normalizeModuleID(name.value),
|
||||||
|
|
@ -3593,8 +3568,8 @@ object Classpaths {
|
||||||
update / unresolvedWarningConfiguration := UnresolvedWarningConfiguration(
|
update / unresolvedWarningConfiguration := UnresolvedWarningConfiguration(
|
||||||
dependencyPositions.value
|
dependencyPositions.value
|
||||||
),
|
),
|
||||||
updateFull := (updateTask.tag(Tags.Update, Tags.Network)).value,
|
updateFull := updateTask.value,
|
||||||
update := (updateWithoutDetails("update").tag(Tags.Update, Tags.Network)).value,
|
update := updateWithoutDetails("update").value,
|
||||||
update := {
|
update := {
|
||||||
val report = update.value
|
val report = update.value
|
||||||
val log = streams.value.log
|
val log = streams.value.log
|
||||||
|
|
@ -3605,7 +3580,7 @@ object Classpaths {
|
||||||
evicted / evictionWarningOptions := EvictionWarningOptions.full,
|
evicted / evictionWarningOptions := EvictionWarningOptions.full,
|
||||||
evicted := {
|
evicted := {
|
||||||
import ShowLines._
|
import ShowLines._
|
||||||
val report = (updateTask.tag(Tags.Update, Tags.Network)).value
|
val report = updateTask.value
|
||||||
val log = streams.value.log
|
val log = streams.value.log
|
||||||
val ew =
|
val ew =
|
||||||
EvictionWarning(ivyModule.value, (evicted / evictionWarningOptions).value, report)
|
EvictionWarning(ivyModule.value, (evicted / evictionWarningOptions).value, report)
|
||||||
|
|
@ -3630,7 +3605,7 @@ object Classpaths {
|
||||||
},
|
},
|
||||||
dependencyResolution := dependencyResolutionTask.value,
|
dependencyResolution := dependencyResolutionTask.value,
|
||||||
csrConfiguration := LMCoursier.updateClassifierConfigurationTask.value,
|
csrConfiguration := LMCoursier.updateClassifierConfigurationTask.value,
|
||||||
TaskGlobal / updateClassifiers := LibraryManagement.updateClassifiersTask.value,
|
TaskZero / updateClassifiers := LibraryManagement.updateClassifiersTask.value,
|
||||||
)
|
)
|
||||||
) ++ Seq(
|
) ++ Seq(
|
||||||
csrProject := CoursierInputsTasks.coursierProjectTask.value,
|
csrProject := CoursierInputsTasks.coursierProjectTask.value,
|
||||||
|
|
@ -3645,7 +3620,7 @@ object Classpaths {
|
||||||
IvyXml.generateIvyXmlSettings() ++
|
IvyXml.generateIvyXmlSettings() ++
|
||||||
LMCoursier.publicationsSetting(Seq(Compile, Test).map(c => c -> CConfiguration(c.name)))
|
LMCoursier.publicationsSetting(Seq(Compile, Test).map(c => c -> CConfiguration(c.name)))
|
||||||
|
|
||||||
val jvmBaseSettings: Seq[Setting[?]] = Seq(
|
def jvmBaseSettings: Seq[Setting[?]] = Seq(
|
||||||
libraryDependencies ++= autoLibraryDependency(
|
libraryDependencies ++= autoLibraryDependency(
|
||||||
autoScalaLibrary.value && scalaHome.value.isEmpty && managedScalaInstance.value,
|
autoScalaLibrary.value && scalaHome.value.isEmpty && managedScalaInstance.value,
|
||||||
sbtPlugin.value,
|
sbtPlugin.value,
|
||||||
|
|
@ -3761,7 +3736,7 @@ object Classpaths {
|
||||||
)
|
)
|
||||||
else projectID.value
|
else projectID.value
|
||||||
}
|
}
|
||||||
private[sbt] def ivySbt0: Initialize[Task[IvySbt]] =
|
private[sbt] lazy val ivySbt0: Initialize[Task[IvySbt]] =
|
||||||
Def.task {
|
Def.task {
|
||||||
Credentials.register(credentials.value, streams.value.log)
|
Credentials.register(credentials.value, streams.value.log)
|
||||||
new IvySbt(ivyConfiguration.value)
|
new IvySbt(ivyConfiguration.value)
|
||||||
|
|
@ -3834,7 +3809,7 @@ object Classpaths {
|
||||||
},
|
},
|
||||||
dependencyResolution := dependencyResolutionTask.value,
|
dependencyResolution := dependencyResolutionTask.value,
|
||||||
csrConfiguration := LMCoursier.updateSbtClassifierConfigurationTask.value,
|
csrConfiguration := LMCoursier.updateSbtClassifierConfigurationTask.value,
|
||||||
(TaskGlobal / updateSbtClassifiers) := (Def
|
(TaskZero / updateSbtClassifiers) := (Def
|
||||||
.task {
|
.task {
|
||||||
val lm = dependencyResolution.value
|
val lm = dependencyResolution.value
|
||||||
val s = streams.value
|
val s = streams.value
|
||||||
|
|
@ -4010,9 +3985,10 @@ object Classpaths {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def updateTask: Initialize[Task[UpdateReport]] = updateTask0("updateFull", true, true)
|
lazy val updateTask: Initialize[Task[UpdateReport]] =
|
||||||
|
updateTask0("updateFull", true, true).tag(Tags.Update, Tags.Network)
|
||||||
def updateWithoutDetails(label: String): Initialize[Task[UpdateReport]] =
|
def updateWithoutDetails(label: String): Initialize[Task[UpdateReport]] =
|
||||||
updateTask0(label, false, false)
|
updateTask0(label, false, false).tag(Tags.Update, Tags.Network)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cacheLabel - label to identify an update cache
|
* cacheLabel - label to identify an update cache
|
||||||
|
|
@ -4419,7 +4395,7 @@ object Classpaths {
|
||||||
|
|
||||||
def internalDependencyJarsTask: Initialize[Task[Classpath]] =
|
def internalDependencyJarsTask: Initialize[Task[Classpath]] =
|
||||||
ClasspathImpl.internalDependencyJarsTask
|
ClasspathImpl.internalDependencyJarsTask
|
||||||
def mkIvyConfiguration: Initialize[Task[InlineIvyConfiguration]] =
|
lazy val mkIvyConfiguration: Initialize[Task[InlineIvyConfiguration]] =
|
||||||
Def.task {
|
Def.task {
|
||||||
val (rs, other) = (fullResolvers.value.toVector, otherResolvers.value.toVector)
|
val (rs, other) = (fullResolvers.value.toVector, otherResolvers.value.toVector)
|
||||||
val s = streams.value
|
val s = streams.value
|
||||||
|
|
@ -4508,12 +4484,7 @@ object Classpaths {
|
||||||
ClasspathImpl.getClasspath(key, dep, conf, data)
|
ClasspathImpl.getClasspath(key, dep, conf, data)
|
||||||
|
|
||||||
def defaultConfigurationTask(p: ResolvedReference, data: Settings[Scope]): Configuration =
|
def defaultConfigurationTask(p: ResolvedReference, data: Settings[Scope]): Configuration =
|
||||||
flatten(
|
(p / defaultConfiguration).get(data).flatten.getOrElse(Configurations.Default)
|
||||||
(p / defaultConfiguration)
|
|
||||||
.get(data)
|
|
||||||
).getOrElse(Configurations.Default)
|
|
||||||
|
|
||||||
def flatten[T](o: Option[Option[T]]): Option[T] = o flatMap idFun
|
|
||||||
|
|
||||||
val sbtIvySnapshots: URLRepository = Resolver.sbtIvyRepo("snapshots")
|
val sbtIvySnapshots: URLRepository = Resolver.sbtIvyRepo("snapshots")
|
||||||
val typesafeReleases: URLRepository =
|
val typesafeReleases: URLRepository =
|
||||||
|
|
|
||||||
|
|
@ -274,22 +274,8 @@ object ProjectMatrix {
|
||||||
|
|
||||||
private def resolveMappings: ListMap[ProjectRow, Project] = {
|
private def resolveMappings: ListMap[ProjectRow, Project] = {
|
||||||
val projectIds = resolveProjectIds
|
val projectIds = resolveProjectIds
|
||||||
def dirSuffix(axes: Seq[VirtualAxis]): String =
|
|
||||||
axes.map(_.directorySuffix).filter(_.nonEmpty).mkString("-")
|
|
||||||
val projects =
|
val projects =
|
||||||
rows.map { r =>
|
rows.map { r =>
|
||||||
import VirtualAxis.*
|
|
||||||
val axes = r.axisValues.sortBy(_.suffixOrder)
|
|
||||||
val scalaDirSuffix = dirSuffix(axes)
|
|
||||||
val nonScalaDirSuffix = dirSuffix(axes.filterNot(_.isInstanceOf[ScalaVersionAxis]))
|
|
||||||
val nonScalaNorPlatformDirSuffix =
|
|
||||||
dirSuffix(axes.filterNot(_.isInstanceOf[ScalaVersionAxis | PlatformAxis]))
|
|
||||||
val platform = axes
|
|
||||||
.collect { case pa: VirtualAxis.PlatformAxis =>
|
|
||||||
pa
|
|
||||||
}
|
|
||||||
.headOption
|
|
||||||
.getOrElse(sys.error(s"platform axis is missing in $axes"))
|
|
||||||
val childId = projectIds(r)
|
val childId = projectIds(r)
|
||||||
val deps = dependencies.map { resolveMatrixDependency(_, r) } ++ nonMatrixDependencies
|
val deps = dependencies.map { resolveMatrixDependency(_, r) } ++ nonMatrixDependencies
|
||||||
val aggs = aggregate.map { case ref: LocalProjectMatrix =>
|
val aggs = aggregate.map { case ref: LocalProjectMatrix =>
|
||||||
|
|
@ -303,32 +289,7 @@ object ProjectMatrix {
|
||||||
.aggregate(aggs*)
|
.aggregate(aggs*)
|
||||||
.setPlugins(plugins)
|
.setPlugins(plugins)
|
||||||
.configs(configurations*)
|
.configs(configurations*)
|
||||||
.settings(
|
.settings(baseSettings ++ rowSettings(r) ++ self.settings)
|
||||||
name := self.id
|
|
||||||
)
|
|
||||||
.settings(
|
|
||||||
r.scalaVersionOpt match {
|
|
||||||
case Some(sv) =>
|
|
||||||
List(scalaVersion := sv)
|
|
||||||
case _ =>
|
|
||||||
List(autoScalaLibrary := false, crossPaths := false)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.settings(
|
|
||||||
outputPath := {
|
|
||||||
val o = outputPath.value
|
|
||||||
if nonScalaNorPlatformDirSuffix.nonEmpty then s"$o/$nonScalaNorPlatformDirSuffix"
|
|
||||||
else o
|
|
||||||
},
|
|
||||||
sourceDirectory := base.getAbsoluteFile / "src",
|
|
||||||
unmanagedBase := base.getAbsoluteFile / "lib",
|
|
||||||
ProjectExtra.inConfig(Compile)(makeSources(nonScalaDirSuffix, scalaDirSuffix)),
|
|
||||||
ProjectExtra.inConfig(Test)(makeSources(nonScalaDirSuffix, scalaDirSuffix)),
|
|
||||||
projectDependencies := projectDependenciesTask.value,
|
|
||||||
virtualAxes := axes,
|
|
||||||
projectMatrixBaseDirectory := base,
|
|
||||||
)
|
|
||||||
.settings(self.settings)
|
|
||||||
.configure(transforms*)
|
.configure(transforms*)
|
||||||
|
|
||||||
r -> r.process(p)
|
r -> r.process(p)
|
||||||
|
|
@ -336,8 +297,10 @@ object ProjectMatrix {
|
||||||
ListMap(projects*)
|
ListMap(projects*)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override lazy val componentProjects: Seq[Project] = resolvedMappings.values.toList
|
||||||
|
|
||||||
// backport of https://github.com/sbt/sbt/pull/5767
|
// backport of https://github.com/sbt/sbt/pull/5767
|
||||||
def projectDependenciesTask: Def.Initialize[Task[Seq[ModuleID]]] =
|
lazy val projectDependenciesTask: Def.Initialize[Task[Seq[ModuleID]]] =
|
||||||
Def.task {
|
Def.task {
|
||||||
val orig = projectDependencies.value
|
val orig = projectDependencies.value
|
||||||
val sbv = scalaBinaryVersion.value
|
val sbv = scalaBinaryVersion.value
|
||||||
|
|
@ -363,7 +326,39 @@ object ProjectMatrix {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override lazy val componentProjects: Seq[Project] = resolvedMappings.values.toList
|
private lazy val noScalaLibrary: Seq[Def.Setting[?]] =
|
||||||
|
Seq(autoScalaLibrary := false, crossPaths := false)
|
||||||
|
|
||||||
|
private lazy val baseSettings: Seq[Def.Setting[?]] = Def.settings(
|
||||||
|
name := self.id,
|
||||||
|
sourceDirectory := base.getAbsoluteFile / "src",
|
||||||
|
unmanagedBase := base.getAbsoluteFile / "lib",
|
||||||
|
projectDependencies := projectDependenciesTask.value,
|
||||||
|
projectMatrixBaseDirectory := base,
|
||||||
|
)
|
||||||
|
|
||||||
|
private def rowSettings(r: ProjectRow): Seq[Def.Setting[?]] =
|
||||||
|
import VirtualAxis.*
|
||||||
|
val axes = r.axisValues.sortBy(_.suffixOrder)
|
||||||
|
def dirSuffix(axes: Seq[VirtualAxis]): String =
|
||||||
|
axes.map(_.directorySuffix).filter(_.nonEmpty).mkString("-")
|
||||||
|
val scalaDirSuffix = dirSuffix(axes)
|
||||||
|
val nonScalaDirSuffix = dirSuffix(axes.filterNot(_.isInstanceOf[ScalaVersionAxis]))
|
||||||
|
val nonScalaNorPlatformDirSuffix = dirSuffix(
|
||||||
|
axes.filterNot(_.isInstanceOf[ScalaVersionAxis | PlatformAxis])
|
||||||
|
)
|
||||||
|
Def.settings(
|
||||||
|
r.scalaVersionOpt match {
|
||||||
|
case Some(sv) => Seq(scalaVersion := sv)
|
||||||
|
case _ => noScalaLibrary
|
||||||
|
},
|
||||||
|
if nonScalaNorPlatformDirSuffix.nonEmpty then
|
||||||
|
Seq(outputPath ~= (o => s"$o/$nonScalaNorPlatformDirSuffix"))
|
||||||
|
else Seq.empty,
|
||||||
|
ProjectExtra.inConfig(Compile)(makeSources(nonScalaDirSuffix, scalaDirSuffix)),
|
||||||
|
ProjectExtra.inConfig(Test)(makeSources(nonScalaDirSuffix, scalaDirSuffix)),
|
||||||
|
virtualAxes := axes,
|
||||||
|
)
|
||||||
|
|
||||||
private def resolveMatrixAggregate(
|
private def resolveMatrixAggregate(
|
||||||
other: ProjectMatrix,
|
other: ProjectMatrix,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ object MiniDependencyTreePlugin extends AutoPlugin {
|
||||||
override def globalSettings: Seq[Def.Setting[?]] = Seq(
|
override def globalSettings: Seq[Def.Setting[?]] = Seq(
|
||||||
dependencyTreeIncludeScalaLibrary := false
|
dependencyTreeIncludeScalaLibrary := false
|
||||||
)
|
)
|
||||||
override def projectSettings: Seq[Def.Setting[?]] =
|
override lazy val projectSettings: Seq[Def.Setting[?]] =
|
||||||
DependencyTreeSettings.coreSettings ++
|
DependencyTreeSettings.coreSettings ++
|
||||||
inConfig(Compile)(DependencyTreeSettings.baseBasicReportingSettings) ++
|
inConfig(Compile)(DependencyTreeSettings.baseBasicReportingSettings) ++
|
||||||
inConfig(Test)(DependencyTreeSettings.baseBasicReportingSettings)
|
inConfig(Test)(DependencyTreeSettings.baseBasicReportingSettings)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue