Merge pull request #2711 from eed3si9n/wip/value_and_op

[sbt 1.0] Remove old operators `<<=`, `<+=`, and `<++=`
This commit is contained in:
Dale Wijnand 2016-08-30 07:17:52 +01:00 committed by GitHub
commit 2df9f9492d
112 changed files with 509 additions and 406 deletions

View File

@ -8,7 +8,8 @@ Migration notes
- The incremental compiler, called Zinc, uses class-based name hashing.
- Zinc drops support for Scala 2.8.x and 2.9.x.
- Removed the pre-0.13.7 *.sbt file parser (previously available under `-Dsbt.parser.simple=true`)
- Removed old, hypher-separated key names (use `publishLocal` instead of `publish-local`)
- Removed old, hyphen-separated key names (use `publishLocal` instead of `publish-local`)
- Removes no-longer-documented old operators `<<=`, `<+=`, and `<++=`.
#### Additional import required

View File

@ -39,8 +39,8 @@ sealed abstract class SettingKey[T] extends ScopedTaskable[T] with KeyedInitiali
final def :=(v: T): Setting[T] = macro std.TaskMacro.settingAssignMacroImpl[T]
final def +=[U](v: U)(implicit a: Append.Value[T, U]): Setting[T] = macro std.TaskMacro.settingAppend1Impl[T, U]
final def ++=[U](vs: U)(implicit a: Append.Values[T, U]): Setting[T] = macro std.TaskMacro.settingAppendNImpl[T, U]
final def <+=[V](v: Initialize[V])(implicit a: Append.Value[T, V]): Setting[T] = macro std.TaskMacro.settingAppend1Position[T, V]
final def <++=[V](vs: Initialize[V])(implicit a: Append.Values[T, V]): Setting[T] = macro std.TaskMacro.settingAppendNPosition[T, V]
final def <+=[V](v: Initialize[V])(implicit a: Append.Value[T, V]): Setting[T] = macro std.TaskMacro.fakeSettingAppend1Position[T, V]
final def <++=[V](vs: Initialize[V])(implicit a: Append.Values[T, V]): Setting[T] = macro std.TaskMacro.fakeSettingAppendNPosition[T, V]
final def -=[U](v: U)(implicit r: Remove.Value[T, U]): Setting[T] = macro std.TaskMacro.settingRemove1Impl[T, U]
final def --=[U](vs: U)(implicit r: Remove.Values[T, U]): Setting[T] = macro std.TaskMacro.settingRemoveNImpl[T, U]
final def ~=(f: T => T): Setting[T] = macro std.TaskMacro.settingTransformPosition[T]
@ -70,8 +70,8 @@ sealed abstract class TaskKey[T] extends ScopedTaskable[T] with KeyedInitialize[
def +=[U](v: U)(implicit a: Append.Value[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskAppend1Impl[T, U]
def ++=[U](vs: U)(implicit a: Append.Values[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskAppendNImpl[T, U]
def <+=[V](v: Initialize[Task[V]])(implicit a: Append.Value[T, V]): Setting[Task[T]] = macro std.TaskMacro.taskAppend1Position[T, V]
def <++=[V](vs: Initialize[Task[V]])(implicit a: Append.Values[T, V]): Setting[Task[T]] = macro std.TaskMacro.taskAppendNPosition[T, V]
def <+=[V](v: Initialize[Task[V]])(implicit a: Append.Value[T, V]): Setting[Task[T]] = macro std.TaskMacro.fakeTaskAppend1Position[T, V]
def <++=[V](vs: Initialize[Task[V]])(implicit a: Append.Values[T, V]): Setting[Task[T]] = macro std.TaskMacro.fakeTaskAppendNPosition[T, V]
final def -=[U](v: U)(implicit r: Remove.Value[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskRemove1Impl[T, U]
final def --=[U](vs: U)(implicit r: Remove.Values[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskRemoveNImpl[T, U]
@ -147,12 +147,7 @@ object Scoped {
private[sbt] final def :==(app: S): Setting[S] = macro std.TaskMacro.settingAssignPure[S]
/**
* Binds a single value to this. A new [Def.Setting] is defined using the value(s) of `app`.
* @param app value to bind to this key
* @return setting binding this key to the given value.
*/
final def <<=(app: Initialize[S]): Setting[S] = macro std.TaskMacro.settingAssignPosition[S]
final def <<=(app: Initialize[S]): Setting[S] = macro std.TaskMacro.fakeSettingAssignPosition[S]
/** Internally used function for setting a value along with the `.sbt` file location where it is defined. */
final def set(app: Initialize[S], source: SourcePosition): Setting[S] = setting(scopedKey, app, source)
@ -198,7 +193,7 @@ object Scoped {
def :=(v: S): Setting[Task[S]] = macro std.TaskMacro.taskAssignMacroImpl[S]
def ~=(f: S => S): Setting[Task[S]] = macro std.TaskMacro.taskTransformPosition[S]
def <<=(app: Initialize[Task[S]]): Setting[Task[S]] = macro std.TaskMacro.itaskAssignPosition[S]
def <<=(app: Initialize[Task[S]]): Setting[Task[S]] = macro std.TaskMacro.fakeItaskAssignPosition[S]
def set(app: Initialize[Task[S]], source: SourcePosition): Setting[Task[S]] = Def.setting(scopedKey, app, source)
def transform(f: S => S, source: SourcePosition): Setting[Task[S]] = set(scopedKey(_ map f), source)

View File

@ -72,6 +72,13 @@ object TaskMacro {
final val TransformInitName = "transform"
final val InputTaskCreateDynName = "createDyn"
final val InputTaskCreateFreeName = "createFree"
final val append1Migration = "Use `lhs += { x.value }`."
final val appendNMigration = "Use `lhs ++= { x.value }`."
final val assignMigration =
"""Use `key := { x.value }` or `key ~= (old => { newValue })`.
|The RHS of `<<=` takes an `Initialize[_]` expression, which can be converted to `:=` style
|by wrapping the expression in parenthesis, and calling `.value` at the end.
|For example, `key := (key.dependsOn(compile in Test)).value`.""".stripMargin
def taskMacroImpl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[Initialize[Task[T]]] =
Instance.contImpl[T, Id](c, FullInstance, FullConvert, MixedBuilder)(Left(t), Instance.idTransform[c.type])
@ -94,6 +101,34 @@ object TaskMacro {
c.Expr[Setting[Task[T]]](assign)
}
// Error macros (Restligeist)
// These macros are there just so we can fail old operators like `<<=` and provide useful migration information.
def fakeSettingAssignPosition[T: c.WeakTypeTag](c: Context)(app: c.Expr[Initialize[T]]): c.Expr[Setting[T]] =
ContextUtil.selectMacroImpl[Setting[T]](c) { (ts, pos) =>
c.abort(pos, assignMigration)
}
def fakeSettingAppend1Position[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(v: c.Expr[Initialize[V]])(a: c.Expr[Append.Value[S, V]]): c.Expr[Setting[S]] =
ContextUtil.selectMacroImpl[Setting[S]](c) { (ts, pos) =>
c.abort(pos, append1Migration)
}
def fakeSettingAppendNPosition[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(vs: c.Expr[Initialize[V]])(a: c.Expr[Append.Values[S, V]]): c.Expr[Setting[S]] =
ContextUtil.selectMacroImpl[Setting[S]](c) { (ts, pos) =>
c.abort(pos, appendNMigration)
}
def fakeItaskAssignPosition[T: c.WeakTypeTag](c: Context)(app: c.Expr[Initialize[Task[T]]]): c.Expr[Setting[Task[T]]] =
ContextUtil.selectMacroImpl[Setting[Task[T]]](c) { (ts, pos) =>
c.abort(pos, assignMigration)
}
def fakeTaskAppend1Position[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(v: c.Expr[Initialize[Task[V]]])(a: c.Expr[Append.Value[S, V]]): c.Expr[Setting[Task[S]]] =
ContextUtil.selectMacroImpl[Setting[Task[S]]](c) { (ts, pos) =>
c.abort(pos, append1Migration)
}
def fakeTaskAppendNPosition[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(vs: c.Expr[Initialize[Task[V]]])(a: c.Expr[Append.Values[S, V]]): c.Expr[Setting[Task[S]]] =
ContextUtil.selectMacroImpl[Setting[Task[S]]](c) { (ts, pos) =>
c.abort(pos, appendNMigration)
}
/* Implementations of <<= macro variations for tasks and settings. These just get the source position of the call site.*/
def itaskAssignPosition[T: c.WeakTypeTag](c: Context)(app: c.Expr[Initialize[Task[T]]]): c.Expr[Setting[Task[T]]] =
@ -102,26 +137,12 @@ object TaskMacro {
itaskAssignPosition(c)(c.universe.reify { Def.valueStrict(app.splice) })
def taskAssignPositionPure[T: c.WeakTypeTag](c: Context)(app: c.Expr[T]): c.Expr[Setting[Task[T]]] =
taskAssignPositionT(c)(c.universe.reify { TaskExtra.constant(app.splice) })
def taskTransformPosition[S: c.WeakTypeTag](c: Context)(f: c.Expr[S => S]): c.Expr[Setting[Task[S]]] =
c.Expr[Setting[Task[S]]](transformMacroImpl(c)(f.tree)(TransformInitName))
def settingTransformPosition[S: c.WeakTypeTag](c: Context)(f: c.Expr[S => S]): c.Expr[Setting[S]] =
c.Expr[Setting[S]](transformMacroImpl(c)(f.tree)(TransformInitName))
def itaskTransformPosition[S: c.WeakTypeTag](c: Context)(f: c.Expr[S => S]): c.Expr[Setting[S]] =
c.Expr[Setting[S]](transformMacroImpl(c)(f.tree)(TransformInitName))
def taskAppendNPosition[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(vs: c.Expr[Initialize[Task[V]]])(a: c.Expr[Append.Values[S, V]]): c.Expr[Setting[Task[S]]] =
c.Expr[Setting[Task[S]]](appendMacroImpl(c)(vs.tree, a.tree)(AppendNInitName))
def settingAppendNPosition[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(vs: c.Expr[Initialize[V]])(a: c.Expr[Append.Values[S, V]]): c.Expr[Setting[S]] =
c.Expr[Setting[S]](appendMacroImpl(c)(vs.tree, a.tree)(AppendNInitName))
def taskAppend1Position[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(v: c.Expr[Initialize[Task[V]]])(a: c.Expr[Append.Value[S, V]]): c.Expr[Setting[Task[S]]] =
c.Expr[Setting[Task[S]]](appendMacroImpl(c)(v.tree, a.tree)(Append1InitName))
def settingAppend1Position[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(v: c.Expr[Initialize[V]])(a: c.Expr[Append.Value[S, V]]): c.Expr[Setting[S]] =
c.Expr[Setting[S]](appendMacroImpl(c)(v.tree, a.tree)(Append1InitName))
def settingAssignPure[T: c.WeakTypeTag](c: Context)(app: c.Expr[T]): c.Expr[Setting[T]] =
settingAssignPosition(c)(c.universe.reify { Def.valueStrict(app.splice) })
def settingAssignPosition[T: c.WeakTypeTag](c: Context)(app: c.Expr[Initialize[T]]): c.Expr[Setting[T]] =

View File

@ -150,7 +150,7 @@ object Defaults extends BuildCommon {
scalaOrganization :== ScalaArtifacts.Organization,
sbtResolver := { if (sbtVersion.value endsWith "-SNAPSHOT") Classpaths.sbtIvySnapshots else Classpaths.typesafeReleases },
crossVersion :== CrossVersion.Disabled,
buildDependencies <<= Classpaths.constructBuildDependencies,
buildDependencies := Classpaths.constructBuildDependencies.value,
version :== "0.1-SNAPSHOT",
classpathTypes :== Set("jar", "bundle") ++ CustomPomParser.JarPackagings,
artifactClassifier :== None,
@ -189,9 +189,9 @@ object Defaults extends BuildCommon {
skip :== false,
taskTemporaryDirectory := { val dir = IO.createTemporaryDirectory; dir.deleteOnExit(); dir },
onComplete := { val dir = taskTemporaryDirectory.value; () => { IO.delete(dir); IO.createDirectory(dir) } },
Previous.cache <<= Previous.cacheSetting,
Previous.cache := Previous.cacheSetting.value,
Previous.references :== new Previous.References,
concurrentRestrictions <<= defaultRestrictions,
concurrentRestrictions := defaultRestrictions.value,
parallelExecution :== true,
pollInterval :== 500,
logBuffered :== false,
@ -214,12 +214,12 @@ object Defaults extends BuildCommon {
def projectCore: Seq[Setting[_]] = Seq(
name := thisProject.value.id,
logManager := LogManager.defaults(extraLoggers.value, StandardMain.console),
onLoadMessage <<= onLoadMessage or (name, thisProjectRef)("Set current project to " + _ + " (in build " + _.build + ")")
onLoadMessage := (onLoadMessage or (name, thisProjectRef)("Set current project to " + _ + " (in build " + _.build + ")")).value
)
def paths = Seq(
baseDirectory := thisProject.value.base,
target := baseDirectory.value / "target",
historyPath <<= historyPath or target(t => Some(t / ".history")),
historyPath := (historyPath or target(t => Option(t / ".history"))).value,
sourceDirectory := baseDirectory.value / "src",
sourceManaged := crossTarget.value / "src_managed",
resourceManaged := crossTarget.value / "resource_managed"
@ -227,31 +227,31 @@ object Defaults extends BuildCommon {
lazy val configPaths = sourceConfigPaths ++ resourceConfigPaths ++ outputConfigPaths
lazy val sourceConfigPaths = Seq(
sourceDirectory <<= configSrcSub(sourceDirectory),
sourceManaged <<= configSrcSub(sourceManaged),
sourceDirectory := configSrcSub(sourceDirectory).value,
sourceManaged := configSrcSub(sourceManaged).value,
scalaSource := sourceDirectory.value / "scala",
javaSource := sourceDirectory.value / "java",
unmanagedSourceDirectories := makeCrossSources(scalaSource.value, javaSource.value, scalaBinaryVersion.value, crossPaths.value),
unmanagedSources <<= collectFiles(unmanagedSourceDirectories, includeFilter in unmanagedSources, excludeFilter in unmanagedSources),
watchSources in ConfigGlobal <++= unmanagedSources,
unmanagedSources := collectFiles(unmanagedSourceDirectories, includeFilter in unmanagedSources, excludeFilter in unmanagedSources).value,
watchSources in ConfigGlobal ++= unmanagedSources.value,
managedSourceDirectories := Seq(sourceManaged.value),
managedSources <<= generate(sourceGenerators),
managedSources := generate(sourceGenerators).value,
sourceGenerators :== Nil,
sourceDirectories <<= Classpaths.concatSettings(unmanagedSourceDirectories, managedSourceDirectories),
sources <<= Classpaths.concat(unmanagedSources, managedSources)
sourceDirectories := Classpaths.concatSettings(unmanagedSourceDirectories, managedSourceDirectories).value,
sources := Classpaths.concat(unmanagedSources, managedSources).value
)
lazy val resourceConfigPaths = Seq(
resourceDirectory := sourceDirectory.value / "resources",
resourceManaged <<= configSrcSub(resourceManaged),
resourceManaged := configSrcSub(resourceManaged).value,
unmanagedResourceDirectories := Seq(resourceDirectory.value),
managedResourceDirectories := Seq(resourceManaged.value),
resourceDirectories <<= Classpaths.concatSettings(unmanagedResourceDirectories, managedResourceDirectories),
unmanagedResources <<= collectFiles(unmanagedResourceDirectories, includeFilter in unmanagedResources, excludeFilter in unmanagedResources),
resourceDirectories := Classpaths.concatSettings(unmanagedResourceDirectories, managedResourceDirectories).value,
unmanagedResources := collectFiles(unmanagedResourceDirectories, includeFilter in unmanagedResources, excludeFilter in unmanagedResources).value,
watchSources in ConfigGlobal ++= unmanagedResources.value,
resourceGenerators :== Nil,
resourceGenerators <+= (discoveredSbtPlugins, resourceManaged) map PluginDiscovery.writeDescriptors,
managedResources <<= generate(resourceGenerators),
resources <<= Classpaths.concat(managedResources, unmanagedResources)
resourceGenerators += ((discoveredSbtPlugins, resourceManaged) map PluginDiscovery.writeDescriptors).taskValue,
managedResources := generate(resourceGenerators).value,
resources := Classpaths.concat(managedResources, unmanagedResources).value
)
lazy val outputConfigPaths = Seq(
classDirectory := crossTarget.value / (prefix(configuration.value.name) + "classes"),
@ -269,7 +269,7 @@ object Defaults extends BuildCommon {
def compileBase = inTask(console)(compilersSetting :: Nil) ++ compileBaseGlobal ++ Seq(
incOptions := incOptions.value.withClassfileManagerType(
Maybe.just(new TransactionalManagerType(crossTarget.value / "classes.bak", sbt.util.Logger.Null))),
scalaInstance <<= scalaInstanceTask,
scalaInstance := scalaInstanceTask.value,
crossVersion := (if (crossPaths.value) CrossVersion.binary else CrossVersion.Disabled),
crossTarget := makeCrossTarget(target.value, scalaBinaryVersion.value, sbtBinaryVersion.value, sbtPlugin.value, crossPaths.value),
clean := {
@ -309,10 +309,10 @@ object Defaults extends BuildCommon {
bootIvyConfiguration.value, scalaCompilerBridgeSource.value)(appConfiguration.value, streams.value.log)
lazy val configTasks = docTaskSettings(doc) ++ inTask(compile)(compileInputsSettings) ++ configGlobal ++ compileAnalysisSettings ++ Seq(
compile <<= compileTask,
compile := compileTask.value,
manipulateBytecode := compileIncremental.value,
compileIncremental <<= compileIncrementalTask tag (Tags.Compile, Tags.CPU),
printWarnings <<= printWarningsTask,
compileIncremental := (compileIncrementalTask tag (Tags.Compile, Tags.CPU)).value,
printWarnings := printWarningsTask.value,
compileAnalysisFilename := {
// Here, if the user wants cross-scala-versioning, we also append it
// to the analysis cache, so we keep the scala versions separated.
@ -321,19 +321,18 @@ object Defaults extends BuildCommon {
else ""
s"inc_compile${extra}"
},
compileIncSetup <<= compileIncSetupTask,
console <<= consoleTask,
consoleQuick <<= consoleQuickTask,
discoveredMainClasses <<= compile map discoverMainClasses storeAs discoveredMainClasses xtriggeredBy compile,
// definedSbtPlugins <<= discoverPlugins,
discoveredSbtPlugins <<= discoverSbtPluginNames,
compileIncSetup := compileIncSetupTask.value,
console := consoleTask.value,
consoleQuick := consoleQuickTask.value,
discoveredMainClasses := (compile map discoverMainClasses storeAs discoveredMainClasses xtriggeredBy compile).value,
discoveredSbtPlugins := discoverSbtPluginNames.value,
inTask(run)(runnerTask :: Nil).head,
selectMainClass := mainClass.value orElse askForMainClass(discoveredMainClasses.value),
mainClass in run := (selectMainClass in run).value,
mainClass := pickMainClassOrWarn(discoveredMainClasses.value, streams.value.log),
run <<= runTask(fullClasspath, mainClass in run, runner in run),
runMain <<= runMainTask(fullClasspath, runner in run),
copyResources <<= copyResourcesTask
run := runTask(fullClasspath, mainClass in run, runner in run).evaluated,
runMain := runMainTask(fullClasspath, runner in run).evaluated,
copyResources := copyResourcesTask.value
)
private[this] lazy val configGlobal = globalDefaults(Seq(
@ -345,9 +344,9 @@ object Defaults extends BuildCommon {
cleanFiles := Seq(managedDirectory.value, target.value),
cleanKeepFiles := historyPath.value.toList,
clean := doClean(cleanFiles.value, cleanKeepFiles.value),
consoleProject <<= consoleProjectTask,
watchTransitiveSources <<= watchTransitiveSourcesTask,
watch <<= watchSetting
consoleProject := consoleProjectTask.value,
watchTransitiveSources := watchTransitiveSourcesTask.value,
watch := watchSetting.value
)
def generate(generators: SettingKey[Seq[Task[Seq[File]]]]): Initialize[Task[Seq[File]]] = generators { _.join.map(_.flatten) }
@ -460,18 +459,18 @@ object Defaults extends BuildCommon {
lazy val testTasks: Seq[Setting[_]] = testTaskOptions(test) ++ testTaskOptions(testOnly) ++ testTaskOptions(testQuick) ++ testDefaults ++ Seq(
testLoader := TestFramework.createTestLoader(data(fullClasspath.value), scalaInstance.value, IO.createUniqueDirectory(taskTemporaryDirectory.value)),
loadedTestFrameworks := testFrameworks.value.flatMap(f => f.create(testLoader.value, streams.value.log).map(x => (f, x)).toIterable).toMap,
definedTests <<= detectTests,
definedTestNames <<= definedTests map (_.map(_.name).distinct) storeAs definedTestNames triggeredBy compile,
testFilter in testQuick <<= testQuickFilter,
executeTests <<= (streams in test, loadedTestFrameworks, testLoader, testGrouping in test, testExecution in test, fullClasspath in test, javaHome in test, testForkedParallel, javaOptions in test) flatMap allTestGroupsTask,
definedTests := detectTests.value,
definedTestNames := (definedTests map (_.map(_.name).distinct) storeAs definedTestNames triggeredBy compile).value,
testFilter in testQuick := testQuickFilter.value,
executeTests := ((streams in test, loadedTestFrameworks, testLoader, testGrouping in test, testExecution in test, fullClasspath in test, javaHome in test, testForkedParallel, javaOptions in test) flatMap allTestGroupsTask).value,
testResultLogger in (Test, test) :== TestResultLogger.SilentWhenNoTests, // https://github.com/sbt/sbt/issues/1185
test := {
val trl = (testResultLogger in (Test, test)).value
val taskName = Project.showContextKey(state.value)(resolvedScoped.value)
trl.run(streams.value.log, executeTests.value, taskName)
},
testOnly <<= inputTests(testOnly),
testQuick <<= inputTests(testQuick)
testOnly := inputTests(testOnly).evaluated,
testQuick := inputTests(testQuick).evaluated
)
lazy val TaskGlobal: Scope = ThisScope.copy(task = Global)
lazy val ConfigGlobal: Scope = ThisScope.copy(config = Global)
@ -482,9 +481,9 @@ object Defaults extends BuildCommon {
testListeners.in(TaskGlobal).value
},
testOptions := Tests.Listeners(testListeners.value) +: (testOptions in TaskGlobal).value,
testExecution <<= testExecutionTask(key)
testExecution := testExecutionTask(key).value
)) ++ inScope(GlobalScope)(Seq(
derive(testGrouping <<= singleTestGroupDefault)
derive(testGrouping := singleTestGroupDefault.value)
))
@deprecated("Doesn't provide for closing the underlying resources.", "0.13.1")
def testLogger(manager: Streams, baseKey: Scoped)(tdef: TestDefinition): Logger =
@ -669,7 +668,18 @@ object Defaults extends BuildCommon {
lazy val packageConfig: Seq[Setting[_]] =
inTask(packageBin)(Seq(
packageOptions <<= (name, version, homepage, organization, organizationName, mainClass, packageOptions) map { (name, ver, h, org, orgName, main, p) => Package.addSpecManifestAttributes(name, ver, orgName) +: Package.addImplManifestAttributes(name, ver, h, org, orgName) +: main.map(Package.MainClass.apply) ++: p })) ++
packageOptions := {
val n = name.value
val ver = version.value
val org = organization.value
val orgName = organizationName.value
val main = mainClass.value
val old = packageOptions.value
Package.addSpecManifestAttributes(n, ver, orgName) +:
Package.addImplManifestAttributes(n, ver, homepage.value, org, orgName) +:
main.map(Package.MainClass.apply) ++: old
}
)) ++
inTask(packageSrc)(Seq(
packageOptions := Package.addSpecManifestAttributes(name.value, version.value, organizationName.value) +: packageOptions.value)) ++
packageTaskSettings(packageBin, packageBinMappings) ++
@ -736,12 +746,12 @@ object Defaults extends BuildCommon {
def packageTasks(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) = packageTaskSettings(key, mappingsTask)
def packageTaskSettings(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) =
inTask(key)(Seq(
key in TaskGlobal <<= packageTask,
packageConfiguration <<= packageConfigurationTask,
mappings <<= mappingsTask,
key in TaskGlobal := packageTask.value,
packageConfiguration := packageConfigurationTask.value,
mappings := mappingsTask.value,
packagedArtifact := (artifact.value -> key.value),
artifact <<= artifactSetting,
artifactPath <<= artifactPathSetting(artifact)
artifact := artifactSetting.value,
artifactPath := artifactPathSetting(artifact).value
))
def packageTask: Initialize[Task[File]] =
(packageConfiguration, streams) map { (config, s) =>
@ -797,7 +807,7 @@ object Defaults extends BuildCommon {
}
}
def runnerTask = runner <<= runnerInit
def runnerTask = runner := runnerInit.value
def runnerInit: Initialize[Task[ScalaRun]] = Def.task {
val tmp = taskTemporaryDirectory.value
val resolvedScope = resolvedScoped.value.scope
@ -854,8 +864,8 @@ object Defaults extends BuildCommon {
}
))
def mainRunTask = run <<= runTask(fullClasspath in Runtime, mainClass in run, runner in run)
def mainRunMainTask = runMain <<= runMainTask(fullClasspath in Runtime, runner in run)
def mainRunTask = run := runTask(fullClasspath in Runtime, mainClass in run, runner in run).evaluated
def mainRunMainTask = runMain := runMainTask(fullClasspath in Runtime, runner in run).evaluated
def discoverMainClasses(analysis: CompileAnalysis): Seq[String] =
Discovery.applications(Tests.allDefs(analysis)).collect({ case (definition, discovered) if discovered.hasMain => definition.name }).sorted
@ -1087,20 +1097,20 @@ object Classpaths {
def concatSettings[T](a: SettingKey[Seq[T]], b: SettingKey[Seq[T]]): Initialize[Seq[T]] = (a, b)(_ ++ _)
lazy val configSettings: Seq[Setting[_]] = classpaths ++ Seq(
products <<= makeProducts,
products := makeProducts.value,
productDirectories := classDirectory.value :: Nil,
classpathConfiguration := findClasspathConfig(internalConfigurationMap.value, configuration.value, classpathConfiguration.?.value, update.value)
)
private[this] def classpaths: Seq[Setting[_]] = Seq(
externalDependencyClasspath <<= concat(unmanagedClasspath, managedClasspath),
dependencyClasspath <<= concat(internalDependencyClasspath, externalDependencyClasspath),
fullClasspath <<= concatDistinct(exportedProducts, dependencyClasspath),
internalDependencyClasspath <<= internalDependencies,
unmanagedClasspath <<= unmanagedDependencies,
externalDependencyClasspath := concat(unmanagedClasspath, managedClasspath).value,
dependencyClasspath := concat(internalDependencyClasspath, externalDependencyClasspath).value,
fullClasspath := concatDistinct(exportedProducts, dependencyClasspath).value,
internalDependencyClasspath := internalDependencies.value,
unmanagedClasspath := unmanagedDependencies.value,
managedClasspath := managedJars(classpathConfiguration.value, classpathTypes.value, update.value),
exportedProducts <<= trackedExportedProducts(TrackLevel.TrackAlways),
exportedProductsIfMissing <<= trackedExportedProducts(TrackLevel.TrackIfMissing),
exportedProductsNoTracking <<= trackedExportedProducts(TrackLevel.NoTracking),
exportedProducts := trackedExportedProducts(TrackLevel.TrackAlways).value,
exportedProductsIfMissing := trackedExportedProducts(TrackLevel.TrackIfMissing).value,
exportedProductsNoTracking := trackedExportedProducts(TrackLevel.NoTracking).value,
unmanagedJars := findUnmanagedJars(configuration.value, unmanagedBase.value, includeFilter in unmanagedJars value, excludeFilter in unmanagedJars value)
).map(exportClasspath)
@ -1144,8 +1154,8 @@ object Classpaths {
))
val jvmPublishSettings: Seq[Setting[_]] = Seq(
artifacts <<= artifactDefs(defaultArtifactTasks),
packagedArtifacts <<= packaged(defaultArtifactTasks)
artifacts := artifactDefs(defaultArtifactTasks).value,
packagedArtifacts := packaged(defaultArtifactTasks).value
)
val ivyPublishSettings: Seq[Setting[_]] = publishGlobalDefaults ++ Seq(
@ -1154,11 +1164,11 @@ object Classpaths {
crossTarget := target.value,
makePom := { val config = makePomConfiguration.value; IvyActions.makePom(ivyModule.value, config, streams.value.log); config.file },
packagedArtifact in makePom := ((artifact in makePom).value -> makePom.value),
deliver <<= deliverTask(deliverConfiguration),
deliverLocal <<= deliverTask(deliverLocalConfiguration),
publish <<= publishTask(publishConfiguration, deliver),
publishLocal <<= publishTask(publishLocalConfiguration, deliverLocal),
publishM2 <<= publishTask(publishM2Configuration, deliverLocal)
deliver := deliverTask(deliverConfiguration).value,
deliverLocal := deliverTask(deliverLocalConfiguration).value,
publish := publishTask(publishConfiguration, deliver).value,
publishLocal := publishTask(publishLocalConfiguration, deliverLocal).value,
publishM2 := publishTask(publishM2Configuration, deliverLocal).value
)
private[this] def baseGlobalDefaults = Defaults.globalDefaults(Seq(
@ -1204,13 +1214,13 @@ object Classpaths {
conflictWarning := conflictWarning.value.copy(label = Reference.display(thisProjectRef.value)),
unmanagedBase := baseDirectory.value / "lib",
normalizedName := Project.normalizeModuleID(name.value),
isSnapshot <<= isSnapshot or version(_ endsWith "-SNAPSHOT"),
description <<= description or name,
organization <<= organization or normalizedName,
organizationName <<= organizationName or organization,
organizationHomepage <<= organizationHomepage or homepage,
projectInfo <<= (name, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers) apply ModuleInfo,
overrideBuildResolvers <<= appConfiguration(isOverrideRepositories),
isSnapshot := (isSnapshot or version(_ endsWith "-SNAPSHOT")).value,
description := (description or name).value,
organization := (organization or normalizedName).value,
organizationName := (organizationName or organization).value,
organizationHomepage := (organizationHomepage or homepage).value,
projectInfo := ((name, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers) apply ModuleInfo).value,
overrideBuildResolvers := appConfiguration(isOverrideRepositories).value,
externalResolvers := ((externalResolvers.?.value, resolvers.value, appResolvers.value, useJCenter.value) match {
case (Some(delegated), Seq(), _, _) => delegated
case (_, rs, Some(ars), uj) => ars ++ rs
@ -1224,39 +1234,40 @@ object Classpaths {
Resolver.reorganizeAppResolvers(ars, uj, useMavenCentral)
}
},
bootResolvers <<= appConfiguration map bootRepositories,
fullResolvers <<= (projectResolver, externalResolvers, sbtPlugin, sbtResolver, bootResolvers, overrideBuildResolvers) map { (proj, rs, isPlugin, sbtr, boot, overrideFlag) =>
bootResolvers := (appConfiguration map bootRepositories).value,
fullResolvers := ((projectResolver, externalResolvers, sbtPlugin, sbtResolver, bootResolvers, overrideBuildResolvers) map { (proj, rs, isPlugin, sbtr, boot, overrideFlag) =>
boot match {
case Some(repos) if overrideFlag => proj +: repos
case _ =>
val base = if (isPlugin) sbtr +: sbtPluginReleases +: rs else rs
proj +: base
}
},
moduleName <<= normalizedName,
}).value,
moduleName := normalizedName.value,
ivyPaths := new IvyPaths(baseDirectory.value, bootIvyHome(appConfiguration.value)),
dependencyCacheDirectory := {
val st = state.value
BuildPaths.getDependencyDirectory(st, BuildPaths.getGlobalBase(st))
},
otherResolvers := Resolver.publishMavenLocal :: publishTo.value.toList,
projectResolver <<= projectResolverTask,
projectDependencies <<= projectDependenciesTask,
projectResolver := projectResolverTask.value,
projectDependencies := projectDependenciesTask.value,
// TODO - Is this the appropriate split? Ivy defines this simply as
// just project + library, while the JVM plugin will define it as
// having the additional sbtPlugin + autoScala magikz.
allDependencies := {
projectDependencies.value ++ libraryDependencies.value
},
ivyScala <<= ivyScala or (scalaHome, scalaVersion in update, scalaBinaryVersion in update, scalaOrganization, sbtPlugin) { (sh, fv, bv, so, plugin) =>
Some(new IvyScala(fv, bv, Nil, filterImplicit = false, checkExplicit = true, overrideScalaVersion = true, scalaOrganization = so))
},
artifactPath in makePom <<= artifactPathSetting(artifact in makePom),
ivyScala :=
(ivyScala or ((scalaHome, scalaVersion in update, scalaBinaryVersion in update, scalaOrganization, sbtPlugin) { (sh, fv, bv, so, plugin) =>
Option(new IvyScala(fv, bv, Nil, filterImplicit = false, checkExplicit = true, overrideScalaVersion = true, scalaOrganization = so))
})).value,
artifactPath in makePom := artifactPathSetting(artifact in makePom).value,
publishArtifact in makePom := publishMavenStyle.value && publishArtifact.value,
artifact in makePom := Artifact.pom(moduleName.value),
projectID <<= defaultProjectID,
projectID <<= pluginProjectID,
projectDescriptors <<= depMap,
projectID := defaultProjectID.value,
projectID := pluginProjectID.value,
projectDescriptors := depMap.value,
updateConfiguration := {
// Tell the UpdateConfiguration which artifact types are special (for sources and javadocs)
val specialArtifactTypes = sourceArtifactTypes.value union docArtifactTypes.value
@ -1264,28 +1275,28 @@ object Classpaths {
new UpdateConfiguration(retrieveConfiguration.value, false, ivyLoggingLevel.value, ArtifactTypeFilter.forbid(specialArtifactTypes))
},
retrieveConfiguration := { if (retrieveManaged.value) Some(new RetrieveConfiguration(managedDirectory.value, retrievePattern.value, retrieveManagedSync.value, configurationsToRetrieve.value)) else None },
ivyConfiguration <<= mkIvyConfiguration,
ivyConfiguration := mkIvyConfiguration.value,
ivyConfigurations := {
val confs = thisProject.value.configurations
(confs ++ confs.map(internalConfigurationMap.value) ++ (if (autoCompilerPlugins.value) CompilerPlugin :: Nil else Nil)).distinct
},
ivyConfigurations ++= Configurations.auxiliary,
ivyConfigurations ++= { if (managedScalaInstance.value && scalaHome.value.isEmpty) Configurations.ScalaTool :: Nil else Nil },
moduleSettings <<= moduleSettings0,
moduleSettings := moduleSettings0.value,
makePomConfiguration := new MakePomConfiguration(artifactPath in makePom value, projectInfo.value, None, pomExtra.value, pomPostProcess.value, pomIncludeRepository.value, pomAllRepositories.value),
deliverLocalConfiguration := deliverConfig(crossTarget.value, status = if (isSnapshot.value) "integration" else "release", logging = ivyLoggingLevel.value),
deliverConfiguration <<= deliverLocalConfiguration,
deliverConfiguration := deliverLocalConfiguration.value,
publishConfiguration := publishConfig(packagedArtifacts.in(publish).value, if (publishMavenStyle.value) None else Some(deliver.value), resolverName = getPublishTo(publishTo.value).name, checksums = checksums.in(publish).value, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value),
publishLocalConfiguration := publishConfig(packagedArtifacts.in(publishLocal).value, Some(deliverLocal.value), checksums.in(publishLocal).value, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value),
publishM2Configuration := publishConfig(packagedArtifacts.in(publishM2).value, None, resolverName = Resolver.publishMavenLocal.name, checksums = checksums.in(publishM2).value, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value),
ivySbt <<= ivySbt0,
ivySbt := ivySbt0.value,
ivyModule := { val is = ivySbt.value; new is.Module(moduleSettings.value) },
transitiveUpdate <<= transitiveUpdateTask,
transitiveUpdate := transitiveUpdateTask.value,
updateCacheName := "update_cache" + (if (crossPaths.value) s"_${scalaBinaryVersion.value}" else ""),
evictionWarningOptions in update := EvictionWarningOptions.default,
dependencyPositions <<= dependencyPositionsTask,
dependencyPositions := dependencyPositionsTask.value,
unresolvedWarningConfiguration in update := UnresolvedWarningConfiguration(dependencyPositions.value),
update <<= updateTask tag (Tags.Update, Tags.Network),
update := (updateTask tag (Tags.Update, Tags.Network)).value,
update := {
val report = update.value
val log = streams.value.log
@ -1308,7 +1319,7 @@ object Classpaths {
val externalModules = update.value.allModules.filterNot(m => projectDeps contains key(m))
GetClassifiersModule(projectID.value, externalModules, ivyConfigurations.in(updateClassifiers).value, transitiveClassifiers.in(updateClassifiers).value)
},
updateClassifiers <<= Def.task {
updateClassifiers := (Def.task {
val s = streams.value
val is = ivySbt.value
val mod = (classifiersModule in updateClassifiers).value
@ -1322,7 +1333,7 @@ object Classpaths {
withExcludes(out, mod.classifiers, lock(app)) { excludes =>
IvyActions.updateClassifiers(is, GetClassifiersConfiguration(mod, excludes, c.copy(artifactFilter = c.artifactFilter.invert), ivyScala.value, srcTypes, docTypes), uwConfig, LogicalClock(state.value.hashCode), Some(depDir), Vector.empty, s.log)
}
} tag (Tags.Update, Tags.Network)
} tag (Tags.Update, Tags.Network)).value
)
val jvmBaseSettings: Seq[Setting[_]] = Seq(
@ -1380,14 +1391,14 @@ object Classpaths {
},
ivyConfiguration := new InlineIvyConfiguration(ivyPaths.value, externalResolvers.value, Nil, Nil, offline.value, Option(lock(appConfiguration.value)),
checksums.value, Some(target.value / "resolution-cache"), UpdateOptions(), streams.value.log),
ivySbt <<= ivySbt0,
classifiersModule <<= (projectID, sbtDependency, transitiveClassifiers, loadedBuild, thisProjectRef) map { (pid, sbtDep, classifiers, lb, ref) =>
ivySbt := ivySbt0.value,
classifiersModule := ((projectID, sbtDependency, transitiveClassifiers, loadedBuild, thisProjectRef) map { (pid, sbtDep, classifiers, lb, ref) =>
val pluginClasspath = lb.units(ref.build).unit.plugins.fullClasspath
val pluginJars = pluginClasspath.filter(_.data.isFile) // exclude directories: an approximation to whether they've been published
val pluginIDs: Seq[ModuleID] = pluginJars.flatMap(_ get moduleID.key)
GetClassifiersModule(pid, sbtDep +: pluginIDs, Configurations.Default :: Nil, classifiers)
},
updateSbtClassifiers in TaskGlobal <<= Def.task {
}).value,
updateSbtClassifiers in TaskGlobal := (Def.task {
val s = streams.value
val is = ivySbt.value
val mod = classifiersModule.value
@ -1402,7 +1413,7 @@ object Classpaths {
val noExplicitCheck = ivyScala.value.map(_.copy(checkExplicit = false))
IvyActions.transitiveScratch(is, "sbt", GetClassifiersConfiguration(mod, excludes, c.copy(artifactFilter = c.artifactFilter.invert), noExplicitCheck, srcTypes, docTypes), uwConfig, LogicalClock(state.value.hashCode), Some(depDir), s.log)
}
} tag (Tags.Update, Tags.Network)
} tag (Tags.Update, Tags.Network)).value
)) ++ Seq(bootIvyConfiguration := (ivyConfiguration in updateSbtClassifiers).value)
def deliverTask(config: TaskKey[DeliverConfiguration]): Initialize[Task[File]] =
@ -1850,7 +1861,7 @@ object Classpaths {
else
Nil
def addUnmanagedLibrary: Seq[Setting[_]] = Seq(
unmanagedJars in Compile <++= unmanagedScalaLibrary
unmanagedJars in Compile ++= unmanagedScalaLibrary.value
)
def unmanagedScalaLibrary: Initialize[Task[Seq[File]]] =
Def.taskDyn {
@ -2009,14 +2020,21 @@ trait BuildExtra extends BuildCommon with DefExtra {
* Typically, use the default value for this version instead of specifying it explicitly.
*/
def addSbtPlugin(dependency: ModuleID, sbtVersion: String): Setting[Seq[ModuleID]] =
libraryDependencies <+= (scalaBinaryVersion in update) { scalaV => sbtPluginExtra(dependency, sbtVersion, scalaV) }
libraryDependencies += {
val scalaV = (scalaBinaryVersion in update).value
sbtPluginExtra(dependency, sbtVersion, scalaV)
}
/**
* Adds `dependency` as an sbt plugin for the sbt and Scala versions configured by
* `sbtBinaryVersion` and `scalaBinaryVersion` scoped to `update`.
*/
def addSbtPlugin(dependency: ModuleID): Setting[Seq[ModuleID]] =
libraryDependencies <+= (sbtBinaryVersion in update, scalaBinaryVersion in update) { (sbtV, scalaV) => sbtPluginExtra(dependency, sbtV, scalaV) }
libraryDependencies += {
val sbtV = (sbtBinaryVersion in update).value
val scalaV = (scalaBinaryVersion in update).value
sbtPluginExtra(dependency, sbtV, scalaV)
}
/** Transforms `dependency` to be in the auto-compiler plugin configuration. */
def compilerPlugin(dependency: ModuleID): ModuleID =
@ -2053,14 +2071,14 @@ trait BuildExtra extends BuildCommon with DefExtra {
def externalIvySettingsURI(uri: Initialize[URI], addMultiResolver: Boolean = true): Setting[Task[IvyConfiguration]] =
{
val other = (baseDirectory, appConfiguration, projectResolver, updateOptions, streams).identityMap
ivyConfiguration <<= (uri zipWith other) {
ivyConfiguration := ((uri zipWith other) {
case (u, otherTask) =>
otherTask map {
case (base, app, pr, uo, s) =>
val extraResolvers = if (addMultiResolver) pr :: Nil else Nil
new ExternalIvyConfiguration(base, u, Option(lock(app)), extraResolvers, uo, s.log)
}
}
}).value
}
private[this] def inBase(name: String): Initialize[File] = Def.setting { baseDirectory.value / name }
@ -2083,22 +2101,22 @@ trait BuildExtra extends BuildCommon with DefExtra {
}
def fullRunInputTask(scoped: InputKey[Unit], config: Configuration, mainClass: String, baseArguments: String*): Setting[InputTask[Unit]] =
scoped <<= inputTask { result =>
scoped := (inputTask { result =>
(initScoped(scoped.scopedKey, runnerInit) zipWith (fullClasspath in config, streams, result).identityMap) { (rTask, t) =>
(t, rTask) map {
case ((cp, s, args), r) =>
toError(r.run(mainClass, data(cp), baseArguments ++ args, s.log))
}
}
}
}).evaluated
def fullRunTask(scoped: TaskKey[Unit], config: Configuration, mainClass: String, arguments: String*): Setting[Task[Unit]] =
scoped <<= (initScoped(scoped.scopedKey, runnerInit) zipWith (fullClasspath in config, streams).identityMap) {
scoped := ((initScoped(scoped.scopedKey, runnerInit) zipWith (fullClasspath in config, streams).identityMap) {
case (rTask, t) =>
(t, rTask) map {
case ((cp, s), r) =>
toError(r.run(mainClass, data(cp), arguments, s.log))
}
}
}).value
def initScoped[T](sk: ScopedKey[_], i: Initialize[T]): Initialize[T] = initScope(fillTaskAxis(sk.scope, sk.key), i)
def initScope[T](s: Scope, i: Initialize[T]): Initialize[T] = i mapReferenced Project.mapScope(Scope.replaceThis(s))
@ -2106,7 +2124,8 @@ trait BuildExtra extends BuildCommon with DefExtra {
* Disables post-compilation hook for determining tests for tab-completion (such as for 'test-only').
* This is useful for reducing test:compile time when not running test.
*/
def noTestCompletion(config: Configuration = Test): Setting[_] = inConfig(config)(Seq(definedTests <<= detectTests)).head
def noTestCompletion(config: Configuration = Test): Setting[_] =
inConfig(config)(Seq(definedTests := detectTests.value)).head
def filterKeys(ss: Seq[Setting[_]], transitive: Boolean = false)(f: ScopedKey[_] => Boolean): Seq[Setting[_]] =
ss filter (s => f(s.key) && (!transitive || s.dependencies.forall(f)))

View File

@ -397,10 +397,12 @@ object EvaluateTask {
// if the return type Seq[Setting[_]] is not explicitly given, scalac hangs
val injectStreams: ScopedKey[_] => Seq[Setting[_]] = scoped =>
if (scoped.key == streams.key)
Seq(streams in scoped.scope <<= streamsManager map { mgr =>
val stream = mgr(scoped)
stream.open()
stream
Seq(streams in scoped.scope := {
(streamsManager map { mgr =>
val stream = mgr(scoped)
stream.open()
stream
}).value
})
else
Nil

View File

@ -54,13 +54,14 @@ object DefaultOptions {
def resolvers(snapshot: Boolean): Seq[Resolver] = {
if (snapshot) Seq(resolver.sonatypeSnapshots) else Nil
}
def addResolvers: Setting[_] = Keys.resolvers <++= Keys.isSnapshot apply resolvers
def addResolvers: Setting[_] = Keys.resolvers ++= { resolvers(Keys.isSnapshot.value) }
@deprecated("Use `credentials(State)` instead to make use of configuration path dynamically configured via `Keys.globalSettingsDirectory`; relying on ~/.ivy2 is not recommended anymore.", "0.12.0")
def credentials: Credentials = Credentials(userHome / ".ivy2" / ".credentials")
def credentials(state: State): Credentials = Credentials(getGlobalSettingsDirectory(state, getGlobalBase(state)) / ".credentials")
def addCredentials: Setting[_] = Keys.credentials <+= Keys.state map credentials
def addCredentials: Setting[_] = Keys.credentials += { credentials(Keys.state.value) }
def shellPrompt(version: String): State => String = s => "%s:%s:%s> ".format(s.configuration.provider.id.name, extract(s).currentProject.id, version)
def setupShellPrompt: Setting[_] = Keys.shellPrompt <<= Keys.version apply shellPrompt
def shellPrompt(version: String): State => String =
s => "%s:%s:%s> ".format(s.configuration.provider.id.name, extract(s).currentProject.id, version)
def setupShellPrompt: Setting[_] = Keys.shellPrompt := { shellPrompt(Keys.version.value) }
}

View File

@ -18,7 +18,10 @@ object GlobalPlugin {
Seq[Setting[_]](
projectDescriptors ~= { _ ++ gp.descriptors },
projectDependencies ++= gp.projectID +: gp.dependencies,
resolvers <<= resolvers { rs => (rs ++ gp.resolvers).distinct },
resolvers := {
val rs = resolvers.value
(rs ++ gp.resolvers).distinct
},
globalPluginUpdate := gp.updateReport,
// TODO: these shouldn't be required (but are): the project* settings above should take care of this
injectInternalClasspath(Runtime, gp.internalClasspath),
@ -74,7 +77,7 @@ object GlobalPlugin {
}
val globalPluginSettings = Project.inScope(Scope.GlobalScope in LocalRootProject)(Seq(
organization := SbtArtifacts.Organization,
onLoadMessage <<= Keys.baseDirectory("Loading global plugins from " + _),
onLoadMessage := Keys.baseDirectory("Loading global plugins from " + _).value,
name := "global-plugin",
sbtPlugin := true,
version := "0.0"

View File

@ -40,7 +40,7 @@ private[sbt] object SettingCompletions {
val globalSetting = resolve(Def.setting(global, setting.init, setting.pos))
globalSetting ++ allDefs.flatMap { d =>
if (d.key == akey)
Seq(SettingKey(akey) in d.scope <<= global)
Seq(SettingKey(akey) in d.scope := { global.value })
else
Nil
}

View File

@ -11,7 +11,5 @@ k3 := {
k4 := { }; k5 := ()
k1 <<= k1 map {_ => sys.error("k1")}
k4 := { val x = k4.value; () }

View File

@ -10,6 +10,3 @@ k3 := {
}
k4 := (); k5 := ()
k1 <<= k1 map {_ => sys.error("k1")}

View File

@ -5,7 +5,7 @@
$ absent ran
# single project, 'mark' defined
> set Mark <<= mark
> set Mark := mark.value
> mark
$ exists ran
$ delete ran
@ -29,14 +29,14 @@ $ mkdir sub sub/sub
> reload
# define in root project only
> set Mark <<= mark
> set Mark := mark.value
> mark
$ exists ran
$ absent sub/ran
$ delete ran
# define in sub project, but shouldn't run without aggregation
> set Mark in sub <<= mark(sub)
> set Mark in sub := mark(sub).value
> mark
$ exists ran
$ absent sub/ran
@ -58,8 +58,8 @@ $ touch aggregate
> reload
# add tasks to each subproject
> set Mark in sub <<= mark(sub)
> set Mark in sub2 <<= mark(sub2)
> set Mark in sub := mark(sub).value
> set Mark in sub2 := mark(sub2).value
# check that aggregation works when root project has no task
> mark
@ -74,7 +74,7 @@ $ absent ran
$ delete sub/ran sub/sub/ran
# add task to root project
> set Mark <<= mark
> set Mark := mark.value
# disable aggregation for sub/mark so that sub2/mark doesn't run
> set aggregate in (sub,Mark) := false

View File

@ -1,5 +1,5 @@
-> compile
> 'set sources in (Compile, compile) <<= sources in (Compile, compile) map { _.filterNot(_.getName contains "C") }'
> 'set sources in (Compile, compile) := { val src = (sources in (Compile, compile)).value; src.filterNot(_.getName contains "C") }'
> compile

View File

@ -2,17 +2,19 @@ scalaVersion in ThisBuild := "2.7.7"
scalaVersion := "2.9.1"
scalaVersion in update <<= scalaVersion {
case "2.9.1" => "2.9.0-1"
case "2.8.2" => "2.8.1"
case x => x
scalaVersion in update := {
scalaVersion.value match {
case "2.9.1" => "2.9.0-1"
case "2.8.2" => "2.8.1"
case x => x
}
}
InputKey[Unit]("check") <<= inputTask { argsT =>
InputKey[Unit]("check") := (inputTask { argsT =>
(argsT, scalaVersion in ThisBuild, scalaVersion, scalaVersion in update) map { (args, svTB, svP, svU) =>
def check(label: String, i: Int, actual: String) = assert(args(i) == actual, "Expected " + label + "='" + args(i) + "' got '" + actual + "'")
check("scalaVersion in ThisBuild", 0, svTB)
check("scalaVersion", 1, svP)
check("scalaVersion in update", 2, svU)
}
}
}).evaluated

View File

@ -2,10 +2,10 @@
lazy val root = (project in file(".")).
settings(
a <<= baseDirectory map (b => if ((b / "succeed").exists) () else sys.error("fail")),
b <<= a.task(at => nop dependsOn(at)),
c <<= a map { _ => () },
d <<= a flatMap { _ => task { () } }
a := (baseDirectory map (b => if ((b / "succeed").exists) () else sys.error("fail"))).value,
b := (a.task(at => nop dependsOn(at))).value,
c := (a map { _ => () }).value,
d := (a flatMap { _ => task { () } }).value
)
lazy val a = taskKey[Unit]("")
lazy val b = taskKey[Unit]("")
@ -14,10 +14,10 @@ lazy val d = taskKey[Unit]("")
lazy val input = (project in file("input")).
settings(
f <<= inputTask { _ map { args => if (args(0) == "succeed") () else sys.error("fail") } },
f := (inputTask { _ map { args => if (args(0) == "succeed") () else sys.error("fail") } }).evaluated,
j := sys.error("j"),
g <<= f dependsOn(j),
h <<= f map { _ => IO.touch(file("h")) }
g := (f dependsOn(j)).evaluated,
h := (f map { _ => IO.touch(file("h")) }).evaluated
)
lazy val f = inputKey[Unit]("")
lazy val g = inputKey[Unit]("")

View File

@ -4,7 +4,7 @@
-> doc
> 'set sources in (Compile, doc) <<= sources in Compile map { _.filterNot(_.getName contains "B") }'
> 'set sources in (Compile, doc) := { val src = (sources in Compile).value; src.filterNot(_.getName contains "B") }'
# hybrid project, only scaladoc run
> doc
@ -12,7 +12,7 @@ $ exists "target/api/index.js"
$ absent "target/api/scala"
$ absent "target/api/java"
> 'set sources in (Compile, doc) <<= sources in (Compile, doc) map { _.filterNot(_.getName endsWith ".java") }'
> 'set sources in (Compile, doc) := { val src = (sources in (Compile, doc)).value; src.filterNot(_.getName endsWith ".java") }'
# compile task is superfluous. Since doc task preceded by compile task has been problematic due to scala
# compiler's way of handling empty classpath. We have it here to test that our workaround works.
@ -24,7 +24,7 @@ $ absent "target/api/package-list"
$ absent "target/api/scala"
$ absent "target/api/java"
> 'set sources in (Compile, doc) <<= sources in Compile map { _.filter(_.getName endsWith ".java") }'
> 'set sources in (Compile, doc) := { val src = (sources in Compile).value; src.filter(_.getName endsWith ".java") }'
> ; clean ; doc

View File

@ -16,8 +16,8 @@ def updateDemoInit = state map { s => (s get sample getOrElse 9) + 1 }
lazy val root = (project in file(".")).
settings(
updateDemo <<= updateDemoInit updateState demoState,
check <<= checkInit,
updateDemo := (updateDemoInit updateState demoState).value,
check := checkInit.evaluated,
inMemorySetting,
persistedSetting,
inMemoryCheck,
@ -34,11 +34,11 @@ def checkInit: Initialize[InputTask[Unit]] = InputTask( (_: State) => token(Spac
}
}
def inMemorySetting = keep <<= getPrevious(keep) map { case None => 3; case Some(x) => x + 1} keepAs(keep)
def persistedSetting = persist <<= loadPrevious(persist) map { case None => 17; case Some(x) => x + 1} storeAs(persist)
def inMemorySetting = keep := (getPrevious(keep) map { case None => 3; case Some(x) => x + 1} keepAs(keep)).value
def persistedSetting = persist := (loadPrevious(persist) map { case None => 17; case Some(x) => x + 1} storeAs(persist)).value
def inMemoryCheck = checkKeep <<= inputCheck( (ctx, s) => Space ~> str( getFromContext( keep, ctx, s)) )
def persistedCheck = checkPersist <<= inputCheck( (ctx, s) => Space ~> str(loadFromContext(persist, ctx, s)) )
def inMemoryCheck = checkKeep := (inputCheck( (ctx, s) => Space ~> str( getFromContext( keep, ctx, s)) )).evaluated
def persistedCheck = checkPersist := (inputCheck( (ctx, s) => Space ~> str(loadFromContext(persist, ctx, s)) )).evaluated
def inputCheck[T](f: (ScopedKey[_], State) => Parser[T]): Initialize[InputTask[Unit]] =
InputTask( resolvedScoped(ctx => (s: State) => f(ctx, s)) )( dummyTask )

View File

@ -15,7 +15,7 @@ lazy val a = project.
lazy val b = project.
settings(
testTask <<= Def.task("").updateState(updater)
testTask := Def.task("").updateState(updater).value
)
def checkState(runs: Int, s: State): Unit = {

View File

@ -41,14 +41,14 @@ def testInputTask[T](name: String, expected: String, task: InputKey[T], arg: Str
}
}
myInputTask <<= argFunction(_.toUpperCase(Locale.ENGLISH))
myInputTask := argFunction(_.toUpperCase(Locale.ENGLISH)).evaluated
testInputTask("testRunInputTaskRoot", "FOO", myInputTask, "foo")
myInputTask in Compile <<= argFunction(_.toLowerCase(Locale.ENGLISH))
myInputTask in Compile := argFunction(_.toLowerCase(Locale.ENGLISH)).evaluated
testInputTask("testRunInputTaskRootCompile", "foo", myInputTask in Compile, "FOO")
myInputTask in sub <<= argFunction(_.head.toString)
myInputTask in sub := argFunction(_.head.toString).evaluated
testInputTask("testRunInputTaskSub", "f", myInputTask in sub, "foo")
myInputTask in (sub, Compile) <<= argFunction(_.tail)
myInputTask in (sub, Compile) := argFunction(_.tail).evaluated
testInputTask("testRunInputTaskSubCompile", "oo", myInputTask in (sub, Compile), "foo")

View File

@ -4,7 +4,10 @@ logLevel := Level.Debug
incOptions ~= { _.withApiDebug(true) }
TaskKey[Unit]("show-apis") <<= (compile in Compile, scalaSource in Compile, javaSource in Compile) map { case (a: Analysis, scalaSrc: java.io.File, javaSrc: java.io.File) =>
TaskKey[Unit]("show-apis") := {
val a = (compile in Compile).value match { case a: Analysis => a }
val scalaSrc = (scalaSource in Compile).value
val javaSrc = (javaSource in Compile).value
val aApi = a.apis.internalAPI("test.A").api.classApi
val jApi = a.apis.internalAPI("test.J").api.classApi
import xsbt.api.DefaultShowAPI

View File

@ -1,7 +1,7 @@
import sbt.internal.inc.Analysis
// checks number of compilation iterations performed since last `clean` run
InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) =>
InputKey[Unit]("check-number-of-compiler-iterations") := (inputTask { (argTask: TaskKey[Seq[String]]) =>
(argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) =>
assert(args.size == 1)
val expectedIterationsNumber = args(0).toInt
@ -9,4 +9,4 @@ InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask:
assert(allCompilationsSize == expectedIterationsNumber,
"allCompilationsSize == %d (expected %d)".format(allCompilationsSize, expectedIterationsNumber))
}
}
}).evaluated

View File

@ -1,8 +1,10 @@
import sbt.internal.inc.Analysis
TaskKey[Unit]("verify-binary-deps") <<= (compile in Compile, classDirectory in Compile, baseDirectory) map {
case (a: Analysis, classDir: java.io.File, base: java.io.File) =>
val nestedPkgClass = classDir / "test/nested.class"
val fooSrc = base / "src/main/scala/test/nested/Foo.scala"
assert(!a.relations.binaryDeps(fooSrc).contains(nestedPkgClass), a.relations.toString)
TaskKey[Unit]("verify-binary-deps") := {
val a = (compile in Compile).value match { case a: Analysis => a }
val classDir = (classDirectory in Compile).value
val base = baseDirectory.value
val nestedPkgClass = classDir / "test/nested.class"
val fooSrc = base / "src/main/scala/test/nested/Foo.scala"
assert(!a.relations.binaryDeps(fooSrc).contains(nestedPkgClass), a.relations.toString)
}

View File

@ -3,10 +3,10 @@ import sbt.internal.inc.Analysis
logLevel := Level.Debug
// dumps analysis into target/analysis-dump.txt file
InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) =>
InputKey[Unit]("check-number-of-compiler-iterations") := (inputTask { (argTask: TaskKey[Seq[String]]) =>
(argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) =>
assert(args.size == 1)
val expectedIterationsNumber = args(0).toInt
assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber))
}
}
}).evaluated

View File

@ -1,9 +1,9 @@
import sbt.internal.inc.Analysis
InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) =>
InputKey[Unit]("check-number-of-compiler-iterations") := (inputTask { (argTask: TaskKey[Seq[String]]) =>
(argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) =>
assert(args.size == 1)
val expectedIterationsNumber = args(0).toInt
assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber))
}
}
}).evaluated

View File

@ -4,21 +4,21 @@
ivyConfigurations += config("macro").hide.extend(Compile)
// add the compiler as a dependency for src/macro/
libraryDependencies <+=
scalaVersion("org.scala-lang" % "scala-compiler" % _ % "macro")
libraryDependencies +=
scalaVersion("org.scala-lang" % "scala-compiler" % _ % "macro").value
// adds standard compile, console, package tasks for src/macro/
inConfig(config("macro"))(Defaults.configSettings)
// puts the compiled macro on the classpath for the main sources
unmanagedClasspath in Compile <++=
fullClasspath in config("macro")
unmanagedClasspath in Compile ++=
(fullClasspath in config("macro")).value
// includes sources in src/macro/ in the main source package
mappings in (Compile, packageSrc) <++=
mappings in (config("macro"), packageSrc)
mappings in (Compile, packageSrc) ++=
(mappings in (config("macro"), packageSrc)).value
// Includes classes compiled from src/macro/ in the main binary
// This can be omitted if the classes in src/macro/ aren't used at runtime
mappings in (Compile, packageBin) <++=
mappings in (config("macro"), packageBin)
mappings in (Compile, packageBin) ++=
(mappings in (config("macro"), packageBin)).value

View File

@ -3,4 +3,4 @@ libraryDependencies ++= Seq(
"junit" % "junit" % "4.8" % "test"
)
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _ )
libraryDependencies += scalaVersion("org.scala-lang" % "scala-compiler" % _ ).value

View File

@ -5,18 +5,19 @@ lazy val check = taskKey[Unit]("")
lazy val root = (project in file(".")).
settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
ivyPaths := ((baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache")))).value,
publishTo := Some(Resolver.file("Test Publish Repo", file("test-repo"))),
resolvers <+= baseDirectory { base => "Test Repo" at (base / "test-repo").toURI.toString },
resolvers += (baseDirectory { base => "Test Repo" at (base / "test-repo").toURI.toString }).value,
moduleName := artifactID,
projectID <<= baseDirectory { base => (if(base / "retrieve" exists) retrieveID else publishedID) },
projectID := (baseDirectory { base => (if(base / "retrieve" exists) retrieveID else publishedID) }).value,
artifact in (Compile, packageBin) := mainArtifact,
libraryDependencies <<= (libraryDependencies, baseDirectory) { (deps, base) => deps ++ (if(base / "retrieve" exists) publishedID :: Nil else Nil) },
libraryDependencies := ((libraryDependencies, baseDirectory) { (deps, base) =>
deps ++ (if(base / "retrieve" exists) publishedID :: Nil else Nil) }).value,
// needed to add a jar with a different type to the managed classpath
unmanagedClasspath in Compile <+= scalaInstance.map(_.libraryJar),
unmanagedClasspath in Compile += scalaInstance.map(_.libraryJar).value,
classpathTypes := Set(tpe),
check <<= checkTask(dependencyClasspath),
checkFull <<= checkTask(fullClasspath)
check := checkTask(dependencyClasspath).value,
checkFull := checkTask(fullClasspath).value
)
// define strings for defining the artifact

View File

@ -1 +1 @@
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / ".ivy2")))
ivyPaths := { new IvyPaths(baseDirectory.value, Some(target.value / ".ivy2")) }

View File

@ -1,5 +1,5 @@
publishTo <<= baseDirectory(base => Some(Resolver.file("filesys-publish", base / "repo")) )
publishTo := baseDirectory(base => Some(Resolver.file("filesys-publish", base / "repo")) ).value
resolvers <+= baseDirectory(base => "filesys" at (base / "repo").toURI.toString)
resolvers += baseDirectory(base => "filesys" at (base / "repo").toURI.toString).value

View File

@ -1,3 +1,3 @@
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache")))
ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value
libraryDependencies += "org.testng" % "testng" % "5.7" classifier "jdk15"

View File

@ -1,7 +1,7 @@
// the default, but make it explicit
publishMavenStyle := true
publishTo <<= baseDirectory(bd => Some( MavenRepository("test-repo", (bd / "repo").toURI.toASCIIString )) )
publishTo := baseDirectory(bd => Some( MavenRepository("test-repo", (bd / "repo").toURI.toASCIIString )) ).value
name := "test"

View File

@ -1,8 +1,8 @@
publishMavenStyle := false
publishTo <<= baseDirectory { base =>
publishTo := (baseDirectory { base =>
Some( Resolver.file("test-repo", base / "repo")(Patterns(false, Resolver.mavenStyleBasePattern)) )
}
}).value
name := "test-ivy"

View File

@ -1,8 +1,8 @@
publishMavenStyle := false
resolvers <<= baseDirectory { base =>
resolvers := (baseDirectory { base =>
Resolver.file("test-repo", base / "repo")(Patterns(false, Resolver.mavenStyleBasePattern)) :: Nil
}
}).value
libraryDependencies ++= Seq(
"org.example" %% "test-ivy" % "1.0",

View File

@ -1,6 +1,6 @@
resolvers <<= baseDirectory { base =>
resolvers := (baseDirectory { base =>
Resolver.file("test-repo", base / "repo") :: Nil
}
}).value
libraryDependencies ++= Seq(
"org.example" %% "test" % "1.0",

View File

@ -1,4 +1,5 @@
TaskKey[Unit]("check") <<= update map { report =>
val compatJetty = report.allModules.filter(mod => mod.name == "atmosphere-compat-jetty")
assert(compatJetty.isEmpty, "Expected dependencies to be excluded: " + compatJetty.mkString(", "))
TaskKey[Unit]("check") := {
val report = update.value
val compatJetty = report.allModules.filter(mod => mod.name == "atmosphere-compat-jetty")
assert(compatJetty.isEmpty, "Expected dependencies to be excluded: " + compatJetty.mkString(", "))
}

View File

@ -4,11 +4,11 @@ lazy val scalaOverride = taskKey[Unit]("Check that the proper version of Scala i
lazy val root = (project in file(".")).
settings(
libraryDependencies <++= baseDirectory(dependencies),
libraryDependencies ++= baseDirectory(dependencies).value,
scalaVersion := "2.9.2",
ivyScala := { ivyScala.value map {_.copy(overrideScalaVersion = sbtPlugin.value)} },
autoScalaLibrary <<= baseDirectory(base => !(base / "noscala").exists ),
scalaOverride <<= check("scala.App")
autoScalaLibrary := baseDirectory(base => !(base / "noscala").exists ).value,
scalaOverride := check("scala.App").value
)
def check(className: String): Def.Initialize[Task[Unit]] = fullClasspath in Compile map { cp =>

View File

@ -1,9 +1,9 @@
lazy val root = (project in file(".")).
settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
libraryDependencies <+= baseDirectory(transitive("javax.mail" % "mail" % "1.4.1")),
TaskKey[Unit]("checkTransitive") <<= check(true),
TaskKey[Unit]("checkIntransitive") <<= check(false)
ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value,
libraryDependencies += baseDirectory(transitive("javax.mail" % "mail" % "1.4.1")).value,
TaskKey[Unit]("checkTransitive") := check(true).value,
TaskKey[Unit]("checkIntransitive") := check(false).value
)
def transitive(dep: ModuleID)(base: File) =

View File

@ -1,12 +1,12 @@
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache")))
ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value
publishMavenStyle := false
publishTo <<= baseDirectory { base =>
publishTo := (baseDirectory { base =>
Some(Resolver.file("test-repo", base / "repo" / "test")(Resolver.defaultIvyPatterns))
}
}).value
projectID <<= projectID { _.extra("e:color" -> "red") }
projectID := (projectID { _.extra("e:color" -> "red") }).value
organization := "org.scala-sbt"

View File

@ -1,16 +1,16 @@
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache")) )
ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache")) ).value
publishMavenStyle := false
resolvers <<= baseDirectory( base =>
resolvers := baseDirectory( base =>
Resolver.file("test-repo", base / "repo" / "test")(Resolver.defaultIvyPatterns) :: Nil
)
).value
libraryDependencies <<= baseDirectory { base =>
libraryDependencies := (baseDirectory { base =>
val color = IO.read(base / "color")
val dep = "org.scala-sbt" %% "define-color" % "1.0" extra("e:color" -> color)
dep :: Nil
}
}).value
organization := "org.example"

View File

@ -2,7 +2,7 @@ libraryDependencies += "log4j" % "log4j" % "1.2.16" % "compile"
autoScalaLibrary := false
TaskKey[Unit]("check-last-update-time") <<= streams map { (s) =>
TaskKey[Unit]("check-last-update-time") := (streams map { (s) =>
val fullUpdateOutput = s.cacheDirectory / "out"
val timeDiff = System.currentTimeMillis()-fullUpdateOutput.lastModified()
val exists = fullUpdateOutput.exists()
@ -10,4 +10,4 @@ TaskKey[Unit]("check-last-update-time") <<= streams map { (s) =>
if (exists && timeDiff > 5000) {
sys.error("Full update not perfomed")
}
}
}).value

View File

@ -1,9 +1,9 @@
lazy val root = (project in file(".")).
settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
libraryDependencies <++= baseDirectory (libraryDeps),
TaskKey[Unit]("checkForced") <<= check("1.2.14"),
TaskKey[Unit]("checkDepend") <<= check("1.2.13")
ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value,
libraryDependencies ++= baseDirectory (libraryDeps).value,
TaskKey[Unit]("checkForced") := check("1.2.14").value,
TaskKey[Unit]("checkDepend") := check("1.2.13").value
)
def libraryDeps(base: File) = {

View File

@ -2,14 +2,14 @@ import scala.xml._
lazy val root = (project in file(".")).
settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
ivyXML <<= (customInfo, organization, moduleName, version) apply inlineXML,
ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value,
ivyXML := ((customInfo, organization, moduleName, version) apply inlineXML).value,
scalaVersion := "2.9.1",
projectID ~= (_ cross false),
customInfo <<= baseDirectory{_ / "info" exists },
TaskKey[Unit]("check-download") <<= checkDownload,
delivered <<= deliverLocal map XML.loadFile,
TaskKey[Unit]("check-info") <<= checkInfo
customInfo := (baseDirectory{_ / "info" exists }).value,
TaskKey[Unit]("check-download") := checkDownload.value,
delivered := (deliverLocal map XML.loadFile).value,
TaskKey[Unit]("check-info") := checkInfo.value
)
lazy val delivered = taskKey[NodeSeq]("")

View File

@ -2,9 +2,10 @@ import sbt.internal.librarymanagement.syntax._
libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5"
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home")))
ivyPaths := baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))).value
TaskKey[Unit]("check") <<= update map { report =>
TaskKey[Unit]("check") := {
val report = update.value
val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
assert(files.nonEmpty, "ScalaCheck module not found in update report")
val missing = files.filter(! _.exists)

View File

@ -4,7 +4,9 @@ externalIvySettings()
libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5"
TaskKey[Unit]("check") <<= (baseDirectory, update) map { (base, report) =>
TaskKey[Unit]("check") := {
val base = baseDirectory.value
val report = update.value
val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
assert(files.nonEmpty, "ScalaCheck module not found in update report")
}
}

View File

@ -1,7 +1,7 @@
lazy val commonSettings = Seq(
autoScalaLibrary := false,
ivyScala := None,
unmanagedJars in Compile <++= scalaInstance map (_.allJars.toSeq),
unmanagedJars in Compile ++= (scalaInstance map (_.allJars.toSeq)).value,
publishArtifact in packageSrc := false,
publishArtifact in packageDoc := false,
publishMavenStyle := false
@ -12,9 +12,9 @@ lazy val dep = project.
commonSettings,
organization := "org.example",
version := "1.0",
publishTo <<= baseDirectory in ThisBuild apply { base =>
publishTo := (baseDirectory in ThisBuild apply { base =>
Some(Resolver.file("file", base / "repo")(Resolver.ivyStylePatterns))
}
}).value
)
lazy val use = project.
@ -22,11 +22,11 @@ lazy val use = project.
commonSettings,
libraryDependencies += "org.example" %% "dep" % "1.0",
externalIvySettings(),
publishTo <<= baseDirectory { base =>
publishTo := (baseDirectory { base =>
Some(Resolver.file("file", base / "repo")(Resolver.ivyStylePatterns))
},
TaskKey[Unit]("check") <<= baseDirectory map {base =>
}).value,
TaskKey[Unit]("check") := (baseDirectory map {base =>
val inCache = ( (base / "target" / "use-cache") ** "*.jar").get
assert(inCache.isEmpty, "Cache contained jars: " + inCache)
}
}).value
)

View File

@ -1,6 +1,6 @@
lazy val commonSettings = Seq(
autoScalaLibrary := false,
unmanagedJars in Compile <++= scalaInstance map (_.allJars.toSeq)
unmanagedJars in Compile ++= (scalaInstance map (_.allJars.toSeq)).value
)
lazy val dep = project.

View File

@ -31,7 +31,8 @@ lazy val expectedInter =
<version>1.0</version>
</dependency>
def checkTask(expectedDep: xml.Elem) = TaskKey[Unit]("checkPom") <<= makePom map { file =>
def checkTask(expectedDep: xml.Elem) = TaskKey[Unit]("checkPom") := {
val file = makePom.value
val pom = xml.XML.loadFile(file)
val actual = pom \\ "dependencies"
val expected = <d>

View File

@ -2,10 +2,10 @@ import scala.xml._
lazy val root = (project in file(".")).
settings(
readPom <<= makePom map XML.loadFile,
TaskKey[Unit]("checkPom") <<= checkPom,
TaskKey[Unit]("checkExtra") <<= checkExtra,
TaskKey[Unit]("checkVersionPlusMapping") <<= checkVersionPlusMapping,
readPom := (makePom map XML.loadFile).value,
TaskKey[Unit]("checkPom") := checkPom.value,
TaskKey[Unit]("checkExtra") := checkExtra.value,
TaskKey[Unit]("checkVersionPlusMapping") := checkVersionPlusMapping.value,
resolvers += Resolver.sonatypeRepo("snapshots"),
makePomConfiguration ~= { _.copy(extra = <extra-tag/>) },
libraryDependencies += "com.google.code.findbugs" % "jsr305" % "1.3.+"

View File

@ -1,4 +1,4 @@
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / ".ivy2")))
ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / ".ivy2"))).value
// not in the default repositories
libraryDependencies += "com.sun.jmx" % "jmxri" % "1.2.1"

View File

@ -1,9 +1,9 @@
ivyScala ~= { (is: Option[IvyScala]) => is.map(_.copy(checkExplicit = false, overrideScalaVersion = false, filterImplicit = false)) }
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home")))
ivyPaths := baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))).value
libraryDependencies += "junit" % "junit" % "4.8"
autoScalaLibrary := false
cleanFiles <+= baseDirectory(_ / "ivy-home")
cleanFiles += baseDirectory(_ / "ivy-home").value

View File

@ -4,8 +4,8 @@ moduleName := "asdf"
crossPaths := false
TaskKey[Unit]("checkName") <<= (moduleName, name, packageBin in Compile) map { (module, n, f) =>
TaskKey[Unit]("checkName") := ((moduleName, name, packageBin in Compile) map { (module, n, f) =>
val path = f.getAbsolutePath
assert(path contains module, "Path " + path + " did not contain module name " + module)
assert(!path.contains(n), "Path " + path + " contained " + n)
}
}).value

View File

@ -4,11 +4,12 @@ libraryDependencies ++= Seq("natives-windows", "natives-linux", "natives-osx") m
autoScalaLibrary := false
TaskKey[Unit]("check") <<= dependencyClasspath in Compile map { cp =>
TaskKey[Unit]("check") := (dependencyClasspath in Compile map { cp =>
assert(cp.size == 3, "Expected 3 jars, got: " + cp.files.mkString("(", ", ", ")"))
}
}).value
TaskKey[Unit]("checkPom") <<= makePom map { file =>
TaskKey[Unit]("checkPom") := {
val file = makePom.value
val pom = xml.XML.loadFile(file)
val actual = pom \\ "dependencies"
def depSection(classifier: String) =

View File

@ -4,10 +4,11 @@ libraryDependencies ++= Seq(
autoScalaLibrary := false
TaskKey[Unit]("check") <<= (externalDependencyClasspath in Compile, externalDependencyClasspath in Test) map { (cp, tcp) =>
TaskKey[Unit]("check") := {
val cp = (externalDependencyClasspath in Compile).value
val tcp = (externalDependencyClasspath in Test).value
assert(cp.size == 2, "Expected 2 jars on compile classpath, got: " + cp.files.mkString("(", ", ", ")"))
// this should really be 1 because of intransitive(), but Ivy doesn't handle this.
// So, this test can only check that the assertion reported in #582 isn't triggered.
assert(tcp.size == 2, "Expected 2 jar on test classpath, got: " + tcp.files.mkString("(", ", ", ")"))
}

View File

@ -1,4 +1,4 @@
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache")))
ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value
organization := "org.example"

View File

@ -1,16 +1,16 @@
autoScalaLibrary := false
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache")))
ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value
ivyScala <<= (scalaVersion in update, scalaBinaryVersion in update) { (fv, bv) =>
ivyScala := ((scalaVersion in update, scalaBinaryVersion in update) { (fv, bv) =>
Some(new IvyScala(fv, bv, Nil, filterImplicit = false, checkExplicit = false, overrideScalaVersion = false))
}
}).value
InputKey[Unit]("check") <<= inputTask { args =>
InputKey[Unit]("check") := (inputTask { args =>
(update, args) map {
case (report, Seq(expected, _*)) =>
report.allModules.forall(_.revision == expected)
}
}
}).evaluated
scalaVersion := "2.9.1"

View File

@ -3,11 +3,11 @@ import complete.DefaultParsers._
lazy val root = (project in file(".")).
settings(
resolvers ++= Seq(local, Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("snapshots")),
InputKey[Unit]("checkPom") <<= InputTask(_ => spaceDelimited("<args>")) { result => (makePom, result, streams) map checkPomRepositories },
makePomConfiguration <<= (makePomConfiguration, baseDirectory) { (conf, base) =>
InputKey[Unit]("checkPom") := (InputTask(_ => spaceDelimited("<args>")) { result => (makePom, result, streams) map checkPomRepositories }).evaluated,
makePomConfiguration := ((makePomConfiguration, baseDirectory) { (conf, base) =>
conf.copy(filterRepositories = pomIncludeRepository(base, conf.filterRepositories) )
},
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home")))
}).value,
ivyPaths := baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))).value
)
val local = "local-maven-repo" at "file://" + (Path.userHome / ".m2" /"repository").absolutePath

View File

@ -5,8 +5,8 @@ lazy val root = (project in file(".")).
settings(
externalPom(),
scalaVersion := "2.9.0-1",
check <<= checkTask,
managedClasspath in Provided <<= (classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) }
check := checkTask.evaluated,
managedClasspath in Provided := ((classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) }).value
)
def checkTask = InputTask(_ => parser ) { result =>
@ -15,7 +15,7 @@ def checkTask = InputTask(_ => parser ) { result =>
checkClasspath(conf match {
case Provided => p
case Compile => c
case Test => t
case Test => t
case Runtime => r
}, names.toSet)
}

View File

@ -3,7 +3,7 @@ lazy val custom = config("custom")
lazy val root = (project in file(".")).
configs(custom).
settings(
TaskKey[Unit]("checkPom") <<= checkPom,
TaskKey[Unit]("checkPom") := checkPom.value,
libraryDependencies ++= Seq(
"a" % "a" % "1.0",
"b" % "b" % "1.0" % "runtime,optional",

View File

@ -12,8 +12,8 @@ lazy val a = project.
lazy val b = project.
dependsOn(a).
settings(
libraryDependencies <<= declared(d => if(d) Seq("org.scala-tools.sbinary" %% "sbinary" % "0.4.0" % "provided") else Nil),
declared <<= baseDirectory(_ / "declare.lib" exists),
libraryDependencies := declared(d => if(d) Seq("org.scala-tools.sbinary" %% "sbinary" % "0.4.0" % "provided") else Nil).value,
declared := baseDirectory(_ / "declare.lib" exists).value,
configIvyScala,
scalaBinaryVersion in update := "2.9.0"
)

View File

@ -5,16 +5,16 @@ val check = InputKey[Unit]("check")
lazy val root = (project in file(".")).
settings(
provided <<= baseDirectory(_ / "useProvided" exists),
configuration <<= provided(p => if(p) Provided else Compile),
libraryDependencies <+= configuration(c => "javax.servlet" % "servlet-api" % "2.5" % c.name),
managedClasspath in Provided <<= (classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) },
check <<= InputTask(_ => Space ~> token(Compile.name.id | Runtime.name | Provided.name | Test.name) ~ token(Space ~> Bool)) { result =>
provided := baseDirectory(_ / "useProvided" exists).value,
configuration := provided(p => if(p) Provided else Compile).value,
libraryDependencies += configuration(c => "javax.servlet" % "servlet-api" % "2.5" % c.name).value,
managedClasspath in Provided := ((classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) }).value,
check := (InputTask(_ => Space ~> token(Compile.name.id | Runtime.name | Provided.name | Test.name) ~ token(Space ~> Bool)) { result =>
(result, managedClasspath in Provided, fullClasspath in Runtime, fullClasspath in Compile, fullClasspath in Test) map { case ((conf, expected), p, r, c, t) =>
val cp = if(conf == Compile.name) c else if(conf == Runtime.name) r else if(conf == Provided.name) p else if(conf == Test.name) t else sys.error("Invalid config: " + conf)
checkServletAPI(cp.files, expected, conf)
}
}
}).evaluated
)
def checkServletAPI(paths: Seq[File], shouldBeIncluded: Boolean, label: String) =

View File

@ -4,8 +4,8 @@ lazy val root = (project in file(".")).
settings(inThisBuild(List(
organization := "A",
version := "1.0",
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ),
externalResolvers <<= baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }
ivyPaths := baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ).value,
externalResolvers := (baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }).value
)),
mavenStyle,
interProject,
@ -18,7 +18,7 @@ lazy val sub = project.
name := "Sub Project"
)
lazy val mavenStyle = publishMavenStyle <<= baseDirectory { base => (base / "mavenStyle") exists }
lazy val mavenStyle = publishMavenStyle := (baseDirectory { base => (base / "mavenStyle") exists }).value
def interProject =
projectDependencies <<= (publishMavenStyle, publishMavenStyle in sub, projectDependencies) map { (style, subStyle, pd) => if(style == subStyle) pd else Nil }
projectDependencies := ((publishMavenStyle, publishMavenStyle in sub, projectDependencies) map { (style, subStyle, pd) => if(style == subStyle) pd else Nil }).value

View File

@ -2,16 +2,16 @@ lazy val root = (project in file(".")).
settings(inThisBuild(List(
organization := "A",
version := "1.0",
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ),
externalResolvers <<= baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }
ivyPaths := baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ).value,
externalResolvers := (baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }).value
)),
mavenStyle,
name := "Retrieve Test",
libraryDependencies <<= publishMavenStyle { style => if(style) mavenStyleDependencies else ivyStyleDependencies }
libraryDependencies := (publishMavenStyle { style => if(style) mavenStyleDependencies else ivyStyleDependencies }).value
)
lazy val mavenStyle = publishMavenStyle <<= baseDirectory { base => (base / "mavenStyle") exists }
lazy val mavenStyle = publishMavenStyle := (baseDirectory { base => (base / "mavenStyle") exists }).value
def ivyStyleDependencies = parentDep("A") :: subDep("A") :: subDep("B") ::parentDep("D") :: Nil
def mavenStyleDependencies = parentDep("B") :: parentDep("C") :: subDep("C") :: subDep("D") :: Nil

View File

@ -7,8 +7,8 @@ lazy val root = (project in file(".")).
autoScalaLibrary := false,
managedScalaInstance := false,
transitiveClassifiers := Seq("sources"),
TaskKey[Unit]("checkSources") <<= updateClassifiers map checkSources,
TaskKey[Unit]("checkBinaries") <<= update map checkBinaries
TaskKey[Unit]("checkSources") := (updateClassifiers map checkSources).value,
TaskKey[Unit]("checkBinaries") := (update map checkBinaries).value
)
def getSources(report: UpdateReport) = report.matching(artifactFilter(`classifier` = "sources") )

View File

@ -1,23 +1,24 @@
autoScalaLibrary := false
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache")))
ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value
libraryDependencies ++= Seq(
"org.sat4j" % "org.sat4j.pb" % "2.3.1",
"org.sat4j" % "org.sat4j.core" % "2.3.1"
)
TaskKey[Unit]("checkUpdate") <<= update map { report =>
TaskKey[Unit]("checkUpdate") := {
val report = update.value
val mods = report.configuration(Compile.name).get.allModules.map(_.name).toSet
val expected = Set("org.sat4j.pb", "org.sat4j.core")
if(mods != expected)
error("Expected modules " + expected + ", got: " + mods)
}
TaskKey[Unit]("checkClasspath") <<= dependencyClasspath in Compile map { cp =>
TaskKey[Unit]("checkClasspath") := (dependencyClasspath in Compile map { cp =>
val jars = cp.files.map(_.getName).toSet
// Note: pb depends on tests artifact in core for no good reason. Previously this was not correctly added to the classpath.
val expected = Set("org.sat4j.pb-2.3.1.jar", "org.sat4j.core-2.3.1.jar", "org.sat4j.core-2.3.1-tests.jar")
if(jars != expected)
error("Expected jars " + expected + ", got: " + jars)
}
}).value

View File

@ -2,11 +2,11 @@ import sbt.internal.inc.classpath.ClasspathUtilities
lazy val root = (project in file(".")).
settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value,
libraryDependencies += "org.jsoup" % "jsoup" % "1.9.1" % Test from "http://jsoup.org/packages/jsoup-1.9.1.jar",
ivyLoggingLevel := UpdateLogging.Full,
TaskKey[Unit]("checkInTest") <<= checkClasspath(Test),
TaskKey[Unit]("checkInCompile") <<= checkClasspath(Compile)
TaskKey[Unit]("checkInTest") := checkClasspath(Test).value,
TaskKey[Unit]("checkInCompile") := checkClasspath(Compile).value
)
def checkClasspath(conf: Configuration) =

View File

@ -1,12 +1,11 @@
scalaSource in Configurations.Compile <<= sourceDirectory( _ / " scala test " )
scalaSource in Configurations.Compile := sourceDirectory( _ / " scala test " ).value
javaSource in Configurations.Compile <<= sourceDirectory( _ / " java test " )
javaSource in Configurations.Compile := sourceDirectory( _ / " java test " ).value
TaskKey[Unit]("init") <<= (scalaSource in Configurations.Compile, javaSource in Configurations.Compile) map { (ss, js) =>
TaskKey[Unit]("init") := ((scalaSource in Configurations.Compile, javaSource in Configurations.Compile) map { (ss, js) =>
import IO._
createDirectories(ss :: js :: Nil)
copyFile(file("changes") / "Test.scala", ss / " Test s.scala")
copyFile(file("changes") / "A.java", js / "a" / "A.java")
delete(file("changes"))
}
}).value

View File

@ -9,7 +9,7 @@ crossPaths := false
mainClass := Some("jartest.Main")
packageOptions in (Compile, packageBin) <<= (packageOptions in (Compile, packageBin), scalaInstance) map { (opts, si) =>
packageOptions in (Compile, packageBin) := ((packageOptions in (Compile, packageBin), scalaInstance) map { (opts, si) =>
def manifestExtra =
{
val mf = new Manifest
@ -17,4 +17,4 @@ packageOptions in (Compile, packageBin) <<= (packageOptions in (Compile, package
mf
}
opts :+ Package.JarManifest(manifestExtra)
}
}).value

View File

@ -4,7 +4,7 @@ version := "0.1"
crossPaths := false
packageOptions <<= (packageOptions, scalaInstance) map { (opts, si) =>
packageOptions := ((packageOptions, scalaInstance) map { (opts, si) =>
def manifestExtra =
{
import java.util.jar._
@ -13,4 +13,4 @@ packageOptions <<= (packageOptions, scalaInstance) map { (opts, si) =>
mf
}
Package.JarManifest(manifestExtra) +: opts
}
}).value

View File

@ -22,8 +22,8 @@ package name.example {
import autoImport._
override def projectSettings = Seq[Setting[_]](
checkMaxErrors <<= Keys.maxErrors map { me => assert(me == xyz, "Expected maxErrors to be " + xyz + ", but it was " + me ) },
checkName <<= Keys.name map { n => assert(n == "Demo", "Expected name to be 'Demo', but it was '" + n + "'" ) }
checkMaxErrors := (Keys.maxErrors map { me => assert(me == xyz, "Expected maxErrors to be " + xyz + ", but it was " + me ) }).value,
checkName := (Keys.name map { n => assert(n == "Demo", "Expected name to be 'Demo', but it was '" + n + "'" ) }).value
)
}
}

View File

@ -1,8 +1,8 @@
val test123 = project in file(".") enablePlugins TestP settings(
resourceGenerators in Compile <+= Def.task {
resourceGenerators in Compile += (Def.task {
streams.value.log info "resource generated in settings"
Nil
}
}).taskValue
)
TaskKey[Unit]("check") := {

View File

@ -2,9 +2,9 @@ import sbt._, syntax._, Keys._
object TestP extends AutoPlugin {
override def projectSettings: Seq[Setting[_]] = Seq(
resourceGenerators in Compile <+= Def.task {
resourceGenerators in Compile += (Def.task {
streams.value.log info "resource generated in plugin"
Nil
}
}).taskValue
)
}

View File

@ -1,3 +1,3 @@
buildDependencies in Global <<= (buildDependencies in Global, thisProjectRef, thisProjectRef in LocalProject("a")) { (deps, refB, refA) =>
buildDependencies in Global := ((buildDependencies in Global, thisProjectRef, thisProjectRef in LocalProject("a")) { (deps, refB, refA) =>
deps.addClasspath(refA, ResolvedClasspathDependency(refB, None))
}
}).value

View File

@ -4,7 +4,7 @@ lazy val proj = (project in file(".")).
settings(
name := "my-test-proj",
organization := "com.example",
check <<= update map checkVersion,
check := (update map checkVersion).value,
version := "0.1.0-SNAPSHOT"
)

View File

@ -13,7 +13,7 @@
)
}
InputKey[Unit]("checkCount") <<= inputTask { argsTask =>
InputKey[Unit]("checkCount") := (inputTask { argsTask =>
(argsTask, state) map { (args, s) =>
def get(label: String) = s get AttributeKey[Int](label) getOrElse 0
val loadCount = get("load-count")
@ -23,4 +23,4 @@ InputKey[Unit]("checkCount") <<= inputTask { argsTask =>
assert(expectedLoad == loadCount, "Expected load count: " + expectedLoad + ", got: " + loadCount)
assert(expectedUnload == unloadCount, "Expected unload count: " + expectedUnload + ", got: " + unloadCount)
}
}
}).evaluated

View File

@ -0,0 +1,4 @@
lazy val root = (project in file(".")).
settings(
crossScalaVersions <+= scalaVersion
)

View File

@ -0,0 +1,4 @@
lazy val root = (project in file(".")).
settings(
crossScalaVersions <++= (scalaVersion) { Seq(_) }
)

View File

@ -0,0 +1,4 @@
lazy val root = (project in file(".")).
settings(
crossScalaVersions <<= crossScalaVersions
)

View File

@ -0,0 +1,6 @@
lazy val foo = taskKey[String]("")
lazy val root = (project in file(".")).
settings(
scalacOptions <+= foo,
foo := "-unchecked"
)

View File

@ -0,0 +1,6 @@
lazy val foo = taskKey[Seq[String]]("")
lazy val root = (project in file(".")).
settings(
scalacOptions <++= foo,
foo := Seq("-unchecked")
)

View File

@ -0,0 +1,4 @@
lazy val root = (project in file(".")).
settings(
scalacOptions <<= scalacOptions
)

View File

@ -0,0 +1,17 @@
$ copy-file changes/settingAssign/build.sbt build.sbt
-> compile
$ copy-file changes/settingAppend1/build.sbt build.sbt
-> compile
$ copy-file changes/settingAppendN/build.sbt build.sbt
-> compile
$ copy-file changes/taskAssign/build.sbt build.sbt
-> compile
$ copy-file changes/taskAppend1/build.sbt build.sbt
-> compile
$ copy-file changes/taskAppendN/build.sbt build.sbt
-> compile

View File

@ -13,7 +13,7 @@ lazy val sub = project
lazy val rootRef = LocalProject("root")
def rootSettings = (TaskKey[Unit]("check") <<= checkTask)
def rootSettings = (TaskKey[Unit]("check") := checkTask.value)
def checkTask = (fullClasspath in (rootRef, Compile), fullClasspath in (rootRef, Runtime), fullClasspath in (rootRef, Test), fullClasspath in (sub, Test), fullClasspath in (superRoot, Compile)) map { (rc, rr, rt, st, pr) =>
check0(st, "sub test", true)
check0(pr, "superRoot main", false)

View File

@ -6,7 +6,7 @@ def checkTask = subs.map(sub => scalaInstance in LocalProject(sub.id)).join.map
lazy val root = (project in file(".")).
settings(
checkLoaders <<= checkTask,
checkLoaders := checkTask.value,
concurrentRestrictions := Nil
)

View File

@ -1,3 +1,3 @@
libraryDependencies <+= sbtVersion { sv =>
"org.scala-sbt" %% "scripted-plugin" % sv
libraryDependencies += {
"org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
}

View File

@ -1,6 +1,6 @@
scriptedSettings
scriptedSbt <<= sbtVersion
scriptedSbt := sbtVersion.value
sbtPlugin := true

View File

@ -1,5 +1,5 @@
libraryDependencies <+= sbtVersion { sbtv =>
"org.scala-sbt" %% "scripted-plugin" % sbtv
libraryDependencies += {
"org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
}
offline := true

View File

@ -1,6 +1,6 @@
k1 := {error("k1")}
k2 <<= k1 map identity
k2 := (k1 map identity).value
k3 := {

View File

@ -1,6 +1,6 @@
k1 := {}
k2 <<= k1 map identity
k2 := (k1 map identity).value
k3 := {

View File

@ -11,5 +11,5 @@ k3 := {
k4 := { }; k5 := ()
k1 <<= k1 map {_ => sys.error("k1")}
k1 := (k1 map {_ => sys.error("k1")}).value

View File

@ -11,7 +11,7 @@ k3 := {
k4 := { }; k5 := ()
k1 <<= k1 map {_ => sys.error("k1")}
k1 := (k1 map {_ => sys.error("k1")}).value
k4 := { val x = k4.value; () }

View File

@ -11,5 +11,5 @@ k3 := {
k4 := (); k5 := ()
k1 <<= k1 map {_ => sys.error("k1")}
k1 := (k1 map {_ => sys.error("k1")}).value

View File

@ -3,7 +3,7 @@
> reload
-> k1
> set k2 <<= k1 map identity
> set k2 := (k1 map identity).value
> session save
> reload
-> k2
@ -16,7 +16,7 @@ $ must-mirror build.sbt build.check.1
> k2
$ must-mirror build.sbt build.check.2
> set k1 <<= k1 map {_ => sys.error("k1")}
> set k1 := (k1 map {_ => sys.error("k1")}).value
> set k2 := {}
> session save
> reload

View File

@ -1,10 +1,10 @@
publishTo <<= (baseDirectory in ThisBuild)(x =>
publishTo := (baseDirectory in ThisBuild)(x =>
Some(Resolver.file("test-publish", x / "repo/"))
)
).value
resolvers <+= (baseDirectory in ThisBuild)(x =>
resolvers += (baseDirectory in ThisBuild)(x =>
"test" at (x / "repo/").asURL.toString
)
).value
name := "demo1"

View File

@ -1,10 +1,10 @@
publishTo <<= (baseDirectory in ThisBuild)(x =>
publishTo := (baseDirectory in ThisBuild)(x =>
Some(Resolver.file("test-publish", x / "repo"))
)
).value
resolvers <+= (baseDirectory in ThisBuild)(x =>
resolvers += (baseDirectory in ThisBuild)(x =>
"test" at (x / "repo").asURL.toString
)
).value
name := "demo2"

View File

@ -6,10 +6,10 @@ lazy val c = proj(project in file("c"))
def proj(p: Project): Project =
p.settings(
ivyPaths <<= (baseDirectory in root, target in root)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
resolvers <+= appConfiguration { app => // need this to resolve sbt
ivyPaths := (baseDirectory in root, target in root)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value,
resolvers += (appConfiguration { app => // need this to resolve sbt
val ivyHome = Classpaths.bootIvyHome(app) getOrElse sys.error("Launcher did not provide the Ivy home directory.")
Resolver.file("real-local", ivyHome / "local")(Resolver.ivyStylePatterns)
},
}).value,
resolvers += Resolver.typesafeIvyRepo("releases") // not sure why this isn't included by default
)

View File

@ -1,10 +1,10 @@
publishTo <<= (baseDirectory in ThisBuild)(x =>
publishTo := (baseDirectory in ThisBuild)(x =>
Some(Resolver.file("test-publish", x / "repo"))
)
).value
resolvers <+= (baseDirectory in ThisBuild)(x =>
resolvers += (baseDirectory in ThisBuild)(x =>
"test" at (x / "repo").asURL.toString
)
).value
name := "demo3"

View File

@ -19,6 +19,6 @@ def check(expectation: Boolean) = Def.task[Unit] {
}
}
assertWarning <<= check(true)
assertWarning := check(true).value
assertNoWarning <<= check(false)
assertNoWarning := check(false).value

View File

@ -4,7 +4,7 @@ $ delete flag
$ mkdir "forked"
> set fork := true
> 'set baseDirectory in run <<= baseDirectory(_ / "forked")'
> 'set baseDirectory in run := baseDirectory(_ / "forked").value'
> run "forked"
$ exists forked/flag

View File

@ -1,9 +1,9 @@
import sbt.internal.inc.Analysis
InputKey[Unit]("checkNumberOfCompilerIterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) =>
InputKey[Unit]("checkNumberOfCompilerIterations") := (inputTask { (argTask: TaskKey[Seq[String]]) =>
(argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) =>
assert(args.size == 1)
val expectedIterationsNumber = args(0).toInt
assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber))
}
}
}).evaluated

View File

@ -2,5 +2,5 @@ lazy val dep = project
lazy val use = project.
settings(
unmanagedJars in Compile <+= packageBin in (dep, Compile) map Attributed.blank
unmanagedJars in Compile += (packageBin in (dep, Compile) map Attributed.blank).value
)

View File

@ -1,7 +1,7 @@
TaskKey[Unit]("outputEmpty") <<= classDirectory in Configurations.Compile map { outputDirectory =>
TaskKey[Unit]("outputEmpty") := (classDirectory in Configurations.Compile map { outputDirectory =>
def classes = (outputDirectory ** "*.class").get
if(!classes.isEmpty) sys.error("Classes existed:\n\t" + classes.mkString("\n\t")) else ()
}
}).value
// apparently Travis CI stopped allowing long file names
// it fails with the default setting of 255 characters so

Some files were not shown because too many files have changed in this diff Show More