Update Defaults and scripted to := style

This commit is contained in:
Eugene Yokota 2016-08-29 23:02:10 -04:00
parent 9335a03837
commit 829ec4dd3a
102 changed files with 421 additions and 380 deletions

View File

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

View File

@ -54,13 +54,14 @@ object DefaultOptions {
def resolvers(snapshot: Boolean): Seq[Resolver] = { def resolvers(snapshot: Boolean): Seq[Resolver] = {
if (snapshot) Seq(resolver.sonatypeSnapshots) else Nil 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") @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: Credentials = Credentials(userHome / ".ivy2" / ".credentials")
def credentials(state: State): Credentials = Credentials(getGlobalSettingsDirectory(state, getGlobalBase(state)) / ".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 shellPrompt(version: String): State => String =
def setupShellPrompt: Setting[_] = Keys.shellPrompt <<= Keys.version apply shellPrompt 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[_]]( Seq[Setting[_]](
projectDescriptors ~= { _ ++ gp.descriptors }, projectDescriptors ~= { _ ++ gp.descriptors },
projectDependencies ++= gp.projectID +: gp.dependencies, projectDependencies ++= gp.projectID +: gp.dependencies,
resolvers <<= resolvers { rs => (rs ++ gp.resolvers).distinct }, resolvers := {
val rs = resolvers.value
(rs ++ gp.resolvers).distinct
},
globalPluginUpdate := gp.updateReport, globalPluginUpdate := gp.updateReport,
// TODO: these shouldn't be required (but are): the project* settings above should take care of this // TODO: these shouldn't be required (but are): the project* settings above should take care of this
injectInternalClasspath(Runtime, gp.internalClasspath), injectInternalClasspath(Runtime, gp.internalClasspath),
@ -74,7 +77,7 @@ object GlobalPlugin {
} }
val globalPluginSettings = Project.inScope(Scope.GlobalScope in LocalRootProject)(Seq( val globalPluginSettings = Project.inScope(Scope.GlobalScope in LocalRootProject)(Seq(
organization := SbtArtifacts.Organization, organization := SbtArtifacts.Organization,
onLoadMessage <<= Keys.baseDirectory("Loading global plugins from " + _), onLoadMessage := Keys.baseDirectory("Loading global plugins from " + _).value,
name := "global-plugin", name := "global-plugin",
sbtPlugin := true, sbtPlugin := true,
version := "0.0" version := "0.0"

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
-> compile -> 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 > compile

View File

@ -2,17 +2,19 @@ scalaVersion in ThisBuild := "2.7.7"
scalaVersion := "2.9.1" scalaVersion := "2.9.1"
scalaVersion in update <<= scalaVersion { scalaVersion in update := {
case "2.9.1" => "2.9.0-1" scalaVersion.value match {
case "2.8.2" => "2.8.1" case "2.9.1" => "2.9.0-1"
case x => x 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) => (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 + "'") 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 in ThisBuild", 0, svTB)
check("scalaVersion", 1, svP) check("scalaVersion", 1, svP)
check("scalaVersion in update", 2, svU) check("scalaVersion in update", 2, svU)
} }
} }).evaluated

View File

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

View File

@ -4,7 +4,7 @@
-> doc -> 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 # hybrid project, only scaladoc run
> doc > doc
@ -12,7 +12,7 @@ $ exists "target/api/index.js"
$ absent "target/api/scala" $ absent "target/api/scala"
$ absent "target/api/java" $ 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 # 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. # 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/scala"
$ absent "target/api/java" $ 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 > ; 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(".")). lazy val root = (project in file(".")).
settings( settings(
updateDemo <<= updateDemoInit updateState demoState, updateDemo := (updateDemoInit updateState demoState).value,
check <<= checkInit, check := checkInit.evaluated,
inMemorySetting, inMemorySetting,
persistedSetting, persistedSetting,
inMemoryCheck, 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 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) 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 inMemoryCheck = checkKeep := (inputCheck( (ctx, s) => Space ~> str( getFromContext( keep, ctx, s)) )).evaluated
def persistedCheck = checkPersist <<= inputCheck( (ctx, s) => Space ~> str(loadFromContext(persist, ctx, s)) ) def persistedCheck = checkPersist := (inputCheck( (ctx, s) => Space ~> str(loadFromContext(persist, ctx, s)) )).evaluated
def inputCheck[T](f: (ScopedKey[_], State) => Parser[T]): Initialize[InputTask[Unit]] = def inputCheck[T](f: (ScopedKey[_], State) => Parser[T]): Initialize[InputTask[Unit]] =
InputTask( resolvedScoped(ctx => (s: State) => f(ctx, s)) )( dummyTask ) InputTask( resolvedScoped(ctx => (s: State) => f(ctx, s)) )( dummyTask )

View File

@ -15,7 +15,7 @@ lazy val a = project.
lazy val b = project. lazy val b = project.
settings( settings(
testTask <<= Def.task("").updateState(updater) testTask := Def.task("").updateState(updater).value
) )
def checkState(runs: Int, s: State): Unit = { 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") 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") 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") 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") testInputTask("testRunInputTaskSubCompile", "oo", myInputTask in (sub, Compile), "foo")

View File

@ -4,7 +4,10 @@ logLevel := Level.Debug
incOptions ~= { _.withApiDebug(true) } 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 aApi = a.apis.internalAPI("test.A").api.classApi
val jApi = a.apis.internalAPI("test.J").api.classApi val jApi = a.apis.internalAPI("test.J").api.classApi
import xsbt.api.DefaultShowAPI import xsbt.api.DefaultShowAPI

View File

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

View File

@ -1,8 +1,10 @@
import sbt.internal.inc.Analysis import sbt.internal.inc.Analysis
TaskKey[Unit]("verify-binary-deps") <<= (compile in Compile, classDirectory in Compile, baseDirectory) map { TaskKey[Unit]("verify-binary-deps") := {
case (a: Analysis, classDir: java.io.File, base: java.io.File) => val a = (compile in Compile).value match { case a: Analysis => a }
val nestedPkgClass = classDir / "test/nested.class" val classDir = (classDirectory in Compile).value
val fooSrc = base / "src/main/scala/test/nested/Foo.scala" val base = baseDirectory.value
assert(!a.relations.binaryDeps(fooSrc).contains(nestedPkgClass), a.relations.toString) 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 logLevel := Level.Debug
// dumps analysis into target/analysis-dump.txt file // 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) => (argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) =>
assert(args.size == 1) assert(args.size == 1)
val expectedIterationsNumber = args(0).toInt val expectedIterationsNumber = args(0).toInt
assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber)) 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 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) => (argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) =>
assert(args.size == 1) assert(args.size == 1)
val expectedIterationsNumber = args(0).toInt val expectedIterationsNumber = args(0).toInt
assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber)) 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) ivyConfigurations += config("macro").hide.extend(Compile)
// add the compiler as a dependency for src/macro/ // add the compiler as a dependency for src/macro/
libraryDependencies <+= libraryDependencies +=
scalaVersion("org.scala-lang" % "scala-compiler" % _ % "macro") scalaVersion("org.scala-lang" % "scala-compiler" % _ % "macro").value
// adds standard compile, console, package tasks for src/macro/ // adds standard compile, console, package tasks for src/macro/
inConfig(config("macro"))(Defaults.configSettings) inConfig(config("macro"))(Defaults.configSettings)
// puts the compiled macro on the classpath for the main sources // puts the compiled macro on the classpath for the main sources
unmanagedClasspath in Compile <++= unmanagedClasspath in Compile ++=
fullClasspath in config("macro") (fullClasspath in config("macro")).value
// includes sources in src/macro/ in the main source package // includes sources in src/macro/ in the main source package
mappings in (Compile, packageSrc) <++= mappings in (Compile, packageSrc) ++=
mappings in (config("macro"), packageSrc) (mappings in (config("macro"), packageSrc)).value
// Includes classes compiled from src/macro/ in the main binary // 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 // This can be omitted if the classes in src/macro/ aren't used at runtime
mappings in (Compile, packageBin) <++= mappings in (Compile, packageBin) ++=
mappings in (config("macro"), packageBin) (mappings in (config("macro"), packageBin)).value

View File

@ -3,4 +3,4 @@ libraryDependencies ++= Seq(
"junit" % "junit" % "4.8" % "test" "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(".")). lazy val root = (project in file(".")).
settings( 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"))), 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, 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, 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 // 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), classpathTypes := Set(tpe),
check <<= checkTask(dependencyClasspath), check := checkTask(dependencyClasspath).value,
checkFull <<= checkTask(fullClasspath) checkFull := checkTask(fullClasspath).value
) )
// define strings for defining the artifact // 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" libraryDependencies += "org.testng" % "testng" % "5.7" classifier "jdk15"

View File

@ -1,7 +1,7 @@
// the default, but make it explicit // the default, but make it explicit
publishMavenStyle := true 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" name := "test"

View File

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

View File

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

View File

@ -1,4 +1,5 @@
TaskKey[Unit]("check") <<= update map { report => TaskKey[Unit]("check") := {
val compatJetty = report.allModules.filter(mod => mod.name == "atmosphere-compat-jetty") val report = update.value
assert(compatJetty.isEmpty, "Expected dependencies to be excluded: " + compatJetty.mkString(", ")) 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(".")). lazy val root = (project in file(".")).
settings( settings(
libraryDependencies <++= baseDirectory(dependencies), libraryDependencies ++= baseDirectory(dependencies).value,
scalaVersion := "2.9.2", scalaVersion := "2.9.2",
ivyScala := { ivyScala.value map {_.copy(overrideScalaVersion = sbtPlugin.value)} }, ivyScala := { ivyScala.value map {_.copy(overrideScalaVersion = sbtPlugin.value)} },
autoScalaLibrary <<= baseDirectory(base => !(base / "noscala").exists ), autoScalaLibrary := baseDirectory(base => !(base / "noscala").exists ).value,
scalaOverride <<= check("scala.App") scalaOverride := check("scala.App").value
) )
def check(className: String): Def.Initialize[Task[Unit]] = fullClasspath in Compile map { cp => 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(".")). lazy val root = (project in file(".")).
settings( 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 <+= baseDirectory(transitive("javax.mail" % "mail" % "1.4.1")), libraryDependencies += baseDirectory(transitive("javax.mail" % "mail" % "1.4.1")).value,
TaskKey[Unit]("checkTransitive") <<= check(true), TaskKey[Unit]("checkTransitive") := check(true).value,
TaskKey[Unit]("checkIntransitive") <<= check(false) TaskKey[Unit]("checkIntransitive") := check(false).value
) )
def transitive(dep: ModuleID)(base: File) = 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 publishMavenStyle := false
publishTo <<= baseDirectory { base => publishTo := (baseDirectory { base =>
Some(Resolver.file("test-repo", base / "repo" / "test")(Resolver.defaultIvyPatterns)) 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" 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 publishMavenStyle := false
resolvers <<= baseDirectory( base => resolvers := baseDirectory( base =>
Resolver.file("test-repo", base / "repo" / "test")(Resolver.defaultIvyPatterns) :: Nil Resolver.file("test-repo", base / "repo" / "test")(Resolver.defaultIvyPatterns) :: Nil
) ).value
libraryDependencies <<= baseDirectory { base => libraryDependencies := (baseDirectory { base =>
val color = IO.read(base / "color") val color = IO.read(base / "color")
val dep = "org.scala-sbt" %% "define-color" % "1.0" extra("e:color" -> color) val dep = "org.scala-sbt" %% "define-color" % "1.0" extra("e:color" -> color)
dep :: Nil dep :: Nil
} }).value
organization := "org.example" organization := "org.example"

View File

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

View File

@ -1,9 +1,9 @@
lazy val root = (project in file(".")). lazy val root = (project in file(".")).
settings( 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 <++= baseDirectory (libraryDeps), libraryDependencies ++= baseDirectory (libraryDeps).value,
TaskKey[Unit]("checkForced") <<= check("1.2.14"), TaskKey[Unit]("checkForced") := check("1.2.14").value,
TaskKey[Unit]("checkDepend") <<= check("1.2.13") TaskKey[Unit]("checkDepend") := check("1.2.13").value
) )
def libraryDeps(base: File) = { def libraryDeps(base: File) = {

View File

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

View File

@ -2,9 +2,10 @@ import sbt.internal.librarymanagement.syntax._
libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5" 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") ) val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
assert(files.nonEmpty, "ScalaCheck module not found in update report") assert(files.nonEmpty, "ScalaCheck module not found in update report")
val missing = files.filter(! _.exists) val missing = files.filter(! _.exists)

View File

@ -4,7 +4,9 @@ externalIvySettings()
libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5" 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") ) val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
assert(files.nonEmpty, "ScalaCheck module not found in update report") assert(files.nonEmpty, "ScalaCheck module not found in update report")
} }

View File

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

View File

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

View File

@ -31,7 +31,8 @@ lazy val expectedInter =
<version>1.0</version> <version>1.0</version>
</dependency> </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 pom = xml.XML.loadFile(file)
val actual = pom \\ "dependencies" val actual = pom \\ "dependencies"
val expected = <d> val expected = <d>

View File

@ -2,10 +2,10 @@ import scala.xml._
lazy val root = (project in file(".")). lazy val root = (project in file(".")).
settings( settings(
readPom <<= makePom map XML.loadFile, readPom := (makePom map XML.loadFile).value,
TaskKey[Unit]("checkPom") <<= checkPom, TaskKey[Unit]("checkPom") := checkPom.value,
TaskKey[Unit]("checkExtra") <<= checkExtra, TaskKey[Unit]("checkExtra") := checkExtra.value,
TaskKey[Unit]("checkVersionPlusMapping") <<= checkVersionPlusMapping, TaskKey[Unit]("checkVersionPlusMapping") := checkVersionPlusMapping.value,
resolvers += Resolver.sonatypeRepo("snapshots"), resolvers += Resolver.sonatypeRepo("snapshots"),
makePomConfiguration ~= { _.copy(extra = <extra-tag/>) }, makePomConfiguration ~= { _.copy(extra = <extra-tag/>) },
libraryDependencies += "com.google.code.findbugs" % "jsr305" % "1.3.+" 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 // not in the default repositories
libraryDependencies += "com.sun.jmx" % "jmxri" % "1.2.1" 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)) } 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" libraryDependencies += "junit" % "junit" % "4.8"
autoScalaLibrary := false autoScalaLibrary := false
cleanFiles <+= baseDirectory(_ / "ivy-home") cleanFiles += baseDirectory(_ / "ivy-home").value

View File

@ -4,8 +4,8 @@ moduleName := "asdf"
crossPaths := false 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 val path = f.getAbsolutePath
assert(path contains module, "Path " + path + " did not contain module name " + module) assert(path contains module, "Path " + path + " did not contain module name " + module)
assert(!path.contains(n), "Path " + path + " contained " + n) 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 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("(", ", ", ")")) 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 pom = xml.XML.loadFile(file)
val actual = pom \\ "dependencies" val actual = pom \\ "dependencies"
def depSection(classifier: String) = def depSection(classifier: String) =

View File

@ -4,10 +4,11 @@ libraryDependencies ++= Seq(
autoScalaLibrary := false 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("(", ", ", ")")) 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. // 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. // 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("(", ", ", ")")) 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" organization := "org.example"

View File

@ -1,16 +1,16 @@
autoScalaLibrary := false 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)) 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 { (update, args) map {
case (report, Seq(expected, _*)) => case (report, Seq(expected, _*)) =>
report.allModules.forall(_.revision == expected) report.allModules.forall(_.revision == expected)
} }
} }).evaluated
scalaVersion := "2.9.1" scalaVersion := "2.9.1"

View File

@ -3,11 +3,11 @@ import complete.DefaultParsers._
lazy val root = (project in file(".")). lazy val root = (project in file(".")).
settings( settings(
resolvers ++= Seq(local, Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("snapshots")), resolvers ++= Seq(local, Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("snapshots")),
InputKey[Unit]("checkPom") <<= InputTask(_ => spaceDelimited("<args>")) { result => (makePom, result, streams) map checkPomRepositories }, InputKey[Unit]("checkPom") := (InputTask(_ => spaceDelimited("<args>")) { result => (makePom, result, streams) map checkPomRepositories }).evaluated,
makePomConfiguration <<= (makePomConfiguration, baseDirectory) { (conf, base) => makePomConfiguration := ((makePomConfiguration, baseDirectory) { (conf, base) =>
conf.copy(filterRepositories = pomIncludeRepository(base, conf.filterRepositories) ) conf.copy(filterRepositories = pomIncludeRepository(base, conf.filterRepositories) )
}, }).value,
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))) ivyPaths := baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))).value
) )
val local = "local-maven-repo" at "file://" + (Path.userHome / ".m2" /"repository").absolutePath 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( settings(
externalPom(), externalPom(),
scalaVersion := "2.9.0-1", scalaVersion := "2.9.0-1",
check <<= checkTask, check := checkTask.evaluated,
managedClasspath in Provided <<= (classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) } managedClasspath in Provided := ((classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) }).value
) )
def checkTask = InputTask(_ => parser ) { result => def checkTask = InputTask(_ => parser ) { result =>
@ -15,7 +15,7 @@ def checkTask = InputTask(_ => parser ) { result =>
checkClasspath(conf match { checkClasspath(conf match {
case Provided => p case Provided => p
case Compile => c case Compile => c
case Test => t case Test => t
case Runtime => r case Runtime => r
}, names.toSet) }, names.toSet)
} }

View File

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

View File

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

View File

@ -5,16 +5,16 @@ val check = InputKey[Unit]("check")
lazy val root = (project in file(".")). lazy val root = (project in file(".")).
settings( settings(
provided <<= baseDirectory(_ / "useProvided" exists), provided := baseDirectory(_ / "useProvided" exists).value,
configuration <<= provided(p => if(p) Provided else Compile), configuration := provided(p => if(p) Provided else Compile).value,
libraryDependencies <+= configuration(c => "javax.servlet" % "servlet-api" % "2.5" % c.name), 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) }, 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 => 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) => (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) 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) checkServletAPI(cp.files, expected, conf)
} }
} }).evaluated
) )
def checkServletAPI(paths: Seq[File], shouldBeIncluded: Boolean, label: String) = def checkServletAPI(paths: Seq[File], shouldBeIncluded: Boolean, label: String) =

View File

@ -4,8 +4,8 @@ lazy val root = (project in file(".")).
settings(inThisBuild(List( settings(inThisBuild(List(
organization := "A", organization := "A",
version := "1.0", version := "1.0",
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ), 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 } externalResolvers := (baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }).value
)), )),
mavenStyle, mavenStyle,
interProject, interProject,
@ -18,7 +18,7 @@ lazy val sub = project.
name := "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 = 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( settings(inThisBuild(List(
organization := "A", organization := "A",
version := "1.0", version := "1.0",
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ), 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 } externalResolvers := (baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }).value
)), )),
mavenStyle, mavenStyle,
name := "Retrieve Test", 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 ivyStyleDependencies = parentDep("A") :: subDep("A") :: subDep("B") ::parentDep("D") :: Nil
def mavenStyleDependencies = parentDep("B") :: parentDep("C") :: subDep("C") :: subDep("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, autoScalaLibrary := false,
managedScalaInstance := false, managedScalaInstance := false,
transitiveClassifiers := Seq("sources"), transitiveClassifiers := Seq("sources"),
TaskKey[Unit]("checkSources") <<= updateClassifiers map checkSources, TaskKey[Unit]("checkSources") := (updateClassifiers map checkSources).value,
TaskKey[Unit]("checkBinaries") <<= update map checkBinaries TaskKey[Unit]("checkBinaries") := (update map checkBinaries).value
) )
def getSources(report: UpdateReport) = report.matching(artifactFilter(`classifier` = "sources") ) def getSources(report: UpdateReport) = report.matching(artifactFilter(`classifier` = "sources") )

View File

@ -1,23 +1,24 @@
autoScalaLibrary := false 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( libraryDependencies ++= Seq(
"org.sat4j" % "org.sat4j.pb" % "2.3.1", "org.sat4j" % "org.sat4j.pb" % "2.3.1",
"org.sat4j" % "org.sat4j.core" % "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 mods = report.configuration(Compile.name).get.allModules.map(_.name).toSet
val expected = Set("org.sat4j.pb", "org.sat4j.core") val expected = Set("org.sat4j.pb", "org.sat4j.core")
if(mods != expected) if(mods != expected)
error("Expected modules " + expected + ", got: " + mods) 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 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. // 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") 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) if(jars != expected)
error("Expected jars " + expected + ", got: " + jars) 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(".")). lazy val root = (project in file(".")).
settings( 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", libraryDependencies += "org.jsoup" % "jsoup" % "1.9.1" % Test from "http://jsoup.org/packages/jsoup-1.9.1.jar",
ivyLoggingLevel := UpdateLogging.Full, ivyLoggingLevel := UpdateLogging.Full,
TaskKey[Unit]("checkInTest") <<= checkClasspath(Test), TaskKey[Unit]("checkInTest") := checkClasspath(Test).value,
TaskKey[Unit]("checkInCompile") <<= checkClasspath(Compile) TaskKey[Unit]("checkInCompile") := checkClasspath(Compile).value
) )
def checkClasspath(conf: Configuration) = 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._ import IO._
createDirectories(ss :: js :: Nil) createDirectories(ss :: js :: Nil)
copyFile(file("changes") / "Test.scala", ss / " Test s.scala") copyFile(file("changes") / "Test.scala", ss / " Test s.scala")
copyFile(file("changes") / "A.java", js / "a" / "A.java") copyFile(file("changes") / "A.java", js / "a" / "A.java")
delete(file("changes")) delete(file("changes"))
} }).value

View File

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

View File

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

View File

@ -22,8 +22,8 @@ package name.example {
import autoImport._ import autoImport._
override def projectSettings = Seq[Setting[_]]( override def projectSettings = Seq[Setting[_]](
checkMaxErrors <<= Keys.maxErrors map { me => assert(me == xyz, "Expected maxErrors to be " + xyz + ", but it was " + me ) }, 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 + "'" ) } 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( 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" streams.value.log info "resource generated in settings"
Nil Nil
} }).taskValue
) )
TaskKey[Unit]("check") := { TaskKey[Unit]("check") := {

View File

@ -2,9 +2,9 @@ import sbt._, syntax._, Keys._
object TestP extends AutoPlugin { object TestP extends AutoPlugin {
override def projectSettings: Seq[Setting[_]] = Seq( override def projectSettings: Seq[Setting[_]] = Seq(
resourceGenerators in Compile <+= Def.task { resourceGenerators in Compile += (Def.task {
streams.value.log info "resource generated in plugin" streams.value.log info "resource generated in plugin"
Nil 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)) deps.addClasspath(refA, ResolvedClasspathDependency(refB, None))
} }).value

View File

@ -4,7 +4,7 @@ lazy val proj = (project in file(".")).
settings( settings(
name := "my-test-proj", name := "my-test-proj",
organization := "com.example", organization := "com.example",
check <<= update map checkVersion, check := (update map checkVersion).value,
version := "0.1.0-SNAPSHOT" 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) => (argsTask, state) map { (args, s) =>
def get(label: String) = s get AttributeKey[Int](label) getOrElse 0 def get(label: String) = s get AttributeKey[Int](label) getOrElse 0
val loadCount = get("load-count") val loadCount = get("load-count")
@ -23,4 +23,4 @@ InputKey[Unit]("checkCount") <<= inputTask { argsTask =>
assert(expectedLoad == loadCount, "Expected load count: " + expectedLoad + ", got: " + loadCount) assert(expectedLoad == loadCount, "Expected load count: " + expectedLoad + ", got: " + loadCount)
assert(expectedUnload == unloadCount, "Expected unload count: " + expectedUnload + ", got: " + unloadCount) assert(expectedUnload == unloadCount, "Expected unload count: " + expectedUnload + ", got: " + unloadCount)
} }
} }).evaluated

View File

@ -13,7 +13,7 @@ lazy val sub = project
lazy val rootRef = LocalProject("root") 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) => 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(st, "sub test", true)
check0(pr, "superRoot main", false) 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(".")). lazy val root = (project in file(".")).
settings( settings(
checkLoaders <<= checkTask, checkLoaders := checkTask.value,
concurrentRestrictions := Nil concurrentRestrictions := Nil
) )

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,10 +6,10 @@ lazy val c = proj(project in file("c"))
def proj(p: Project): Project = def proj(p: Project): Project =
p.settings( p.settings(
ivyPaths <<= (baseDirectory in root, target in root)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), 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 resolvers += (appConfiguration { app => // need this to resolve sbt
val ivyHome = Classpaths.bootIvyHome(app) getOrElse sys.error("Launcher did not provide the Ivy home directory.") val ivyHome = Classpaths.bootIvyHome(app) getOrElse sys.error("Launcher did not provide the Ivy home directory.")
Resolver.file("real-local", ivyHome / "local")(Resolver.ivyStylePatterns) Resolver.file("real-local", ivyHome / "local")(Resolver.ivyStylePatterns)
}, }).value,
resolvers += Resolver.typesafeIvyRepo("releases") // not sure why this isn't included by default 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")) Some(Resolver.file("test-publish", x / "repo"))
) ).value
resolvers <+= (baseDirectory in ThisBuild)(x => resolvers += (baseDirectory in ThisBuild)(x =>
"test" at (x / "repo").asURL.toString "test" at (x / "repo").asURL.toString
) ).value
name := "demo3" 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" $ mkdir "forked"
> set fork := true > set fork := true
> 'set baseDirectory in run <<= baseDirectory(_ / "forked")' > 'set baseDirectory in run := baseDirectory(_ / "forked").value'
> run "forked" > run "forked"
$ exists forked/flag $ exists forked/flag

View File

@ -1,9 +1,9 @@
import sbt.internal.inc.Analysis 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) => (argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) =>
assert(args.size == 1) assert(args.size == 1)
val expectedIterationsNumber = args(0).toInt val expectedIterationsNumber = args(0).toInt
assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber)) 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. lazy val use = project.
settings( 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 def classes = (outputDirectory ** "*.class").get
if(!classes.isEmpty) sys.error("Classes existed:\n\t" + classes.mkString("\n\t")) else () if(!classes.isEmpty) sys.error("Classes existed:\n\t" + classes.mkString("\n\t")) else ()
} }).value
// apparently Travis CI stopped allowing long file names // apparently Travis CI stopped allowing long file names
// it fails with the default setting of 255 characters so // it fails with the default setting of 255 characters so

View File

@ -1,8 +1,8 @@
import sbt.internal.inc.Analysis import sbt.internal.inc.Analysis
name := "test" name := "test"
TaskKey[Unit]("checkSame") <<= compile in Configurations.Compile map { case analysis: Analysis => TaskKey[Unit]("checkSame") := (compile in Configurations.Compile map { case analysis: Analysis =>
analysis.apis.internal foreach { case (_, api) => analysis.apis.internal foreach { case (_, api) =>
assert( xsbt.api.SameAPI(api.api, api.api) ) assert( xsbt.api.SameAPI(api.api, api.api) )
} }
} }).value

View File

@ -13,13 +13,13 @@ lazy val root = (project in file(".")).
aggregate(macros, core). aggregate(macros, core).
settings( settings(
commonSettings, commonSettings,
run <<= run in Compile in core run := (run in Compile in core).evaluated
) )
lazy val macros = (project in file("macros")). lazy val macros = (project in file("macros")).
settings( settings(
commonSettings, commonSettings,
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-reflect" % _), libraryDependencies += (scalaVersion)("org.scala-lang" % "scala-reflect" % _).value,
libraryDependencies ++= ( libraryDependencies ++= (
if (scalaVersion.value.startsWith("2.10")) List("org.scalamacros" %% "quasiquotes" % paradiseVersion) if (scalaVersion.value.startsWith("2.10")) List("org.scalamacros" %% "quasiquotes" % paradiseVersion)
else Nil else Nil

View File

@ -1,6 +1,6 @@
val defaultSettings = Seq( val defaultSettings = Seq(
scalaVersion := "2.11.7", scalaVersion := "2.11.7",
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _ ) libraryDependencies += scalaVersion("org.scala-lang" % "scala-reflect" % _ ).value
) )
lazy val root = (project in file(".")). lazy val root = (project in file(".")).

View File

@ -1,6 +1,6 @@
val defaultSettings = Seq( val defaultSettings = Seq(
scalaVersion := "2.11.7", scalaVersion := "2.11.7",
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _ ) libraryDependencies += scalaVersion("org.scala-lang" % "scala-reflect" % _ ).value
) )
lazy val root = (project in file(".")). lazy val root = (project in file(".")).

View File

@ -1,6 +1,6 @@
val defaultSettings = Seq( val defaultSettings = Seq(
scalaVersion := "2.10.6", scalaVersion := "2.10.6",
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _ ) libraryDependencies += scalaVersion("org.scala-lang" % "scala-reflect" % _ ).value
) )
lazy val root = (project in file(".")). lazy val root = (project in file(".")).

View File

@ -1,5 +1,5 @@
val defaultSettings = Seq( val defaultSettings = Seq(
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _ ) libraryDependencies += scalaVersion("org.scala-lang" % "scala-reflect" % _ ).value
) )
lazy val root = (project in file(".")). lazy val root = (project in file(".")).

View File

@ -1,6 +1,6 @@
val defaultSettings = Seq( val defaultSettings = Seq(
scalaVersion := "2.10.6", scalaVersion := "2.10.6",
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _ ) libraryDependencies += scalaVersion("org.scala-lang" % "scala-reflect" % _ ).value
) )
lazy val root = (project in file(".")). lazy val root = (project in file(".")).

View File

@ -1,6 +1,6 @@
val defaultSettings = Seq( val defaultSettings = Seq(
scalaVersion := "2.10.6", scalaVersion := "2.10.6",
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _ )//, libraryDependencies += scalaVersion("org.scala-lang" % "scala-reflect" % _ ).value //,
//incOptions := incOptions.value.withNameHashing(true) //incOptions := incOptions.value.withNameHashing(true)
) )

View File

@ -2,8 +2,8 @@ import java.net.URLClassLoader
lazy val root = (project in file(".")). lazy val root = (project in file(".")).
settings( settings(
TaskKey[Unit]("checkFirst") <<= checkTask("First"), TaskKey[Unit]("checkFirst") := checkTask("First").value,
TaskKey[Unit]("checkSecond") <<= checkTask("Second") TaskKey[Unit]("checkSecond") := checkTask("Second").value
) )
def checkTask(className: String) = def checkTask(className: String) =

View File

@ -1,8 +1,9 @@
testGrouping <<= (definedTests in Test) map { tests => testGrouping := {
tests map { test => val tests = (definedTests in Test).value
new Tests.Group( tests map { test =>
name = test.name, new Tests.Group(
tests = Seq(test), name = test.name,
runPolicy = Tests.SubProcess(javaOptions = Seq.empty[String])) tests = Seq(test),
} runPolicy = Tests.SubProcess(javaOptions = Seq.empty[String]))
} }
}

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