From 829ec4dd3ac5f1a1e141e3be800db401a0620fd0 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Mon, 29 Aug 2016 23:02:10 -0400 Subject: [PATCH 1/2] Update Defaults and scripted to := style --- main/src/main/scala/sbt/Defaults.scala | 241 ++++++++++-------- main/src/main/scala/sbt/EvaluateTask.scala | 10 +- main/src/main/scala/sbt/Opts.scala | 9 +- .../scala/sbt/internal/GlobalPlugin.scala | 7 +- .../sbt/internal/SettingCompletions.scala | 2 +- .../test/resources/session-settings/4.sbt.txt | 2 - .../session-settings/4.sbt.txt_1/1.set.result | 3 - sbt/src/sbt-test/actions/aggregate/test | 12 +- sbt/src/sbt-test/actions/compile/test | 2 +- sbt/src/sbt-test/actions/cross/build.sbt | 14 +- sbt/src/sbt-test/actions/depends-on/build.sbt | 14 +- sbt/src/sbt-test/actions/doc/test | 6 +- sbt/src/sbt-test/actions/state/build.sbt | 12 +- .../actions/update-state-fail/build.sbt | 2 +- sbt/src/sbt-test/apiinfo/extracted/build.sbt | 8 +- .../apiinfo/show-circular-structure/build.sbt | 5 +- .../unstable-existential-names/build.sbt | 4 +- .../inc-package-class-dependency/build.sbt | 12 +- .../inc-pickled-existential/build.sbt | 4 +- .../inc-pickled-refinement/build.sbt | 4 +- .../compiler-project/macro-config/build.sbt | 16 +- .../compiler-project/run-test/build.sbt | 2 +- .../dependency-management/artifact/build.sbt | 15 +- .../cache-local/cache.sbt | 2 +- .../cache-local/changes/resolver.sbt | 4 +- .../classifier/build.sbt | 2 +- .../configurations/build.sbt | 2 +- .../changes/ivy/TestPublish.sbt | 4 +- .../configurations/changes/ivy/TestUse.sbt | 4 +- .../configurations/changes/maven/TestUse.sbt | 4 +- .../exclude-bundle/check.sbt | 7 +- .../exclude-scala/build.sbt | 6 +- .../exclude-transitive/build.sbt | 8 +- .../extra/DefineColor.sbt | 8 +- .../extra/changes/UseColor.sbt | 10 +- .../force-update-period/build.sbt | 4 +- .../dependency-management/force/build.sbt | 8 +- .../dependency-management/info/build.sbt | 12 +- .../inline-dependencies-a/build.sbt | 5 +- .../ivy-settings-b/build.sbt | 6 +- .../ivy-settings-c/build.sbt | 14 +- .../ivy-settings-multi-a/build.sbt | 2 +- .../make-pom-type/build.sbt | 3 +- .../dependency-management/make-pom/build.sbt | 8 +- .../metadata-only-resolver/build.sbt | 2 +- .../module-confs/common.sbt | 4 +- .../module-name/build.sbt | 4 +- .../multiple-classifiers/build.sbt | 7 +- .../changes/non-mergeable.sbt | 5 +- .../no-file-fails-publish/build.sbt | 2 +- .../dependency-management/override/build.sbt | 10 +- .../pom-advanced/build.sbt | 8 +- .../pom-classpaths/build.sbt | 6 +- .../dependency-management/pom-scope/build.sbt | 2 +- .../provided-multi/changes/p.sbt | 4 +- .../dependency-management/provided/build.sbt | 12 +- .../publish-local/build.sbt | 8 +- .../publish-local/changes/RetrieveTest.sbt | 8 +- .../dependency-management/sources/build.sbt | 4 +- .../dependency-management/t468/build.sbt | 9 +- .../dependency-management/url/build.sbt | 6 +- sbt/src/sbt-test/java/argfile/build.sbt | 9 +- sbt/src/sbt-test/package/manifest/build.sbt | 4 +- sbt/src/sbt-test/package/resources/build.sbt | 4 +- .../project/auto-import/project/P.scala | 4 +- .../build.sbt | 4 +- .../project/TestP.scala | 4 +- .../sbt-test/project/build-deps/changes/b.sbt | 4 +- .../project/global-plugin/changes/build.sbt | 2 +- sbt/src/sbt-test/project/load-hooks/build.sbt | 4 +- sbt/src/sbt-test/project/provided/build.sbt | 2 +- .../sbt-test/project/scala-loader/build.sbt | 2 +- .../scripted-plugin/project/plugins.sbt | 4 +- sbt/src/sbt-test/project/scripted13/build.sbt | 2 +- .../project/scripted13/project/plugins.sbt | 4 +- .../project/session-save/build.check.1 | 2 +- .../project/session-save/build.check.2 | 2 +- .../project/session-save/build.check.3 | 2 +- .../project/session-save/build.check.4 | 2 +- .../project/session-save/build.check.5 | 2 +- .../sbt-test/project/session-save/disabled | 4 +- .../project/transitive-plugins/a/build.sbt | 8 +- .../project/transitive-plugins/b/build.sbt | 8 +- .../project/transitive-plugins/build.sbt | 6 +- .../project/transitive-plugins/c/build.sbt | 8 +- sbt/src/sbt-test/reporter/nowarn/build.sbt | 4 +- sbt/src/sbt-test/run/fork/test | 2 +- .../abstract-type-override/build.sbt | 4 +- .../source-dependencies/binary/build.sbt | 2 +- .../source-dependencies/compactify/build.sbt | 4 +- .../inherited_type_params/build.sbt | 4 +- .../macro-annotation/build.sbt | 4 +- .../macro-arg-dep-2-11/build.sbt | 2 +- .../macro-arg-dep-nested-2-11/build.sbt | 2 +- .../macro-arg-dep-nested/build.sbt | 2 +- .../macro-arg-dep-stackoverflow/build.sbt | 2 +- .../macro-arg-dep/build.sbt | 2 +- .../source-dependencies/macro/build.sbt | 2 +- .../replace-test-a/build.sbt | 4 +- sbt/src/sbt-test/tests/empty/build.sbt | 17 +- sbt/src/sbt-test/tests/fork/build.sbt | 3 +- .../src/main/scala/sbt/ScriptedPlugin.scala | 14 +- 102 files changed, 421 insertions(+), 380 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 47cc86e04..b95012d18 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -150,7 +150,7 @@ object Defaults extends BuildCommon { scalaOrganization :== ScalaArtifacts.Organization, sbtResolver := { if (sbtVersion.value endsWith "-SNAPSHOT") Classpaths.sbtIvySnapshots else Classpaths.typesafeReleases }, crossVersion :== CrossVersion.Disabled, - buildDependencies <<= Classpaths.constructBuildDependencies, + buildDependencies := Classpaths.constructBuildDependencies.value, version :== "0.1-SNAPSHOT", classpathTypes :== Set("jar", "bundle") ++ CustomPomParser.JarPackagings, artifactClassifier :== None, @@ -189,9 +189,9 @@ object Defaults extends BuildCommon { skip :== false, taskTemporaryDirectory := { val dir = IO.createTemporaryDirectory; dir.deleteOnExit(); dir }, onComplete := { val dir = taskTemporaryDirectory.value; () => { IO.delete(dir); IO.createDirectory(dir) } }, - Previous.cache <<= Previous.cacheSetting, + Previous.cache := Previous.cacheSetting.value, Previous.references :== new Previous.References, - concurrentRestrictions <<= defaultRestrictions, + concurrentRestrictions := defaultRestrictions.value, parallelExecution :== true, pollInterval :== 500, logBuffered :== false, @@ -214,12 +214,12 @@ object Defaults extends BuildCommon { def projectCore: Seq[Setting[_]] = Seq( name := thisProject.value.id, logManager := LogManager.defaults(extraLoggers.value, StandardMain.console), - onLoadMessage <<= onLoadMessage or (name, thisProjectRef)("Set current project to " + _ + " (in build " + _.build + ")") + onLoadMessage := (onLoadMessage or (name, thisProjectRef)("Set current project to " + _ + " (in build " + _.build + ")")).value ) def paths = Seq( baseDirectory := thisProject.value.base, target := baseDirectory.value / "target", - historyPath <<= historyPath or target(t => Some(t / ".history")), + historyPath := (historyPath or target(t => Option(t / ".history"))).value, sourceDirectory := baseDirectory.value / "src", sourceManaged := crossTarget.value / "src_managed", resourceManaged := crossTarget.value / "resource_managed" @@ -227,31 +227,31 @@ object Defaults extends BuildCommon { lazy val configPaths = sourceConfigPaths ++ resourceConfigPaths ++ outputConfigPaths lazy val sourceConfigPaths = Seq( - sourceDirectory <<= configSrcSub(sourceDirectory), - sourceManaged <<= configSrcSub(sourceManaged), + sourceDirectory := configSrcSub(sourceDirectory).value, + sourceManaged := configSrcSub(sourceManaged).value, scalaSource := sourceDirectory.value / "scala", javaSource := sourceDirectory.value / "java", unmanagedSourceDirectories := makeCrossSources(scalaSource.value, javaSource.value, scalaBinaryVersion.value, crossPaths.value), - unmanagedSources <<= collectFiles(unmanagedSourceDirectories, includeFilter in unmanagedSources, excludeFilter in unmanagedSources), - watchSources in ConfigGlobal <++= unmanagedSources, + unmanagedSources := collectFiles(unmanagedSourceDirectories, includeFilter in unmanagedSources, excludeFilter in unmanagedSources).value, + watchSources in ConfigGlobal ++= unmanagedSources.value, managedSourceDirectories := Seq(sourceManaged.value), - managedSources <<= generate(sourceGenerators), + managedSources := generate(sourceGenerators).value, sourceGenerators :== Nil, - sourceDirectories <<= Classpaths.concatSettings(unmanagedSourceDirectories, managedSourceDirectories), - sources <<= Classpaths.concat(unmanagedSources, managedSources) + sourceDirectories := Classpaths.concatSettings(unmanagedSourceDirectories, managedSourceDirectories).value, + sources := Classpaths.concat(unmanagedSources, managedSources).value ) lazy val resourceConfigPaths = Seq( resourceDirectory := sourceDirectory.value / "resources", - resourceManaged <<= configSrcSub(resourceManaged), + resourceManaged := configSrcSub(resourceManaged).value, unmanagedResourceDirectories := Seq(resourceDirectory.value), managedResourceDirectories := Seq(resourceManaged.value), - resourceDirectories <<= Classpaths.concatSettings(unmanagedResourceDirectories, managedResourceDirectories), - unmanagedResources <<= collectFiles(unmanagedResourceDirectories, includeFilter in unmanagedResources, excludeFilter in unmanagedResources), + resourceDirectories := Classpaths.concatSettings(unmanagedResourceDirectories, managedResourceDirectories).value, + unmanagedResources := collectFiles(unmanagedResourceDirectories, includeFilter in unmanagedResources, excludeFilter in unmanagedResources).value, watchSources in ConfigGlobal ++= unmanagedResources.value, resourceGenerators :== Nil, - resourceGenerators <+= (discoveredSbtPlugins, resourceManaged) map PluginDiscovery.writeDescriptors, - managedResources <<= generate(resourceGenerators), - resources <<= Classpaths.concat(managedResources, unmanagedResources) + resourceGenerators += ((discoveredSbtPlugins, resourceManaged) map PluginDiscovery.writeDescriptors).taskValue, + managedResources := generate(resourceGenerators).value, + resources := Classpaths.concat(managedResources, unmanagedResources).value ) lazy val outputConfigPaths = Seq( classDirectory := crossTarget.value / (prefix(configuration.value.name) + "classes"), @@ -269,7 +269,7 @@ object Defaults extends BuildCommon { def compileBase = inTask(console)(compilersSetting :: Nil) ++ compileBaseGlobal ++ Seq( incOptions := incOptions.value.withClassfileManagerType( Maybe.just(new TransactionalManagerType(crossTarget.value / "classes.bak", sbt.util.Logger.Null))), - scalaInstance <<= scalaInstanceTask, + scalaInstance := scalaInstanceTask.value, crossVersion := (if (crossPaths.value) CrossVersion.binary else CrossVersion.Disabled), crossTarget := makeCrossTarget(target.value, scalaBinaryVersion.value, sbtBinaryVersion.value, sbtPlugin.value, crossPaths.value), clean := { @@ -309,10 +309,10 @@ object Defaults extends BuildCommon { bootIvyConfiguration.value, scalaCompilerBridgeSource.value)(appConfiguration.value, streams.value.log) lazy val configTasks = docTaskSettings(doc) ++ inTask(compile)(compileInputsSettings) ++ configGlobal ++ compileAnalysisSettings ++ Seq( - compile <<= compileTask, + compile := compileTask.value, manipulateBytecode := compileIncremental.value, - compileIncremental <<= compileIncrementalTask tag (Tags.Compile, Tags.CPU), - printWarnings <<= printWarningsTask, + compileIncremental := (compileIncrementalTask tag (Tags.Compile, Tags.CPU)).value, + printWarnings := printWarningsTask.value, compileAnalysisFilename := { // Here, if the user wants cross-scala-versioning, we also append it // to the analysis cache, so we keep the scala versions separated. @@ -321,19 +321,18 @@ object Defaults extends BuildCommon { else "" s"inc_compile${extra}" }, - compileIncSetup <<= compileIncSetupTask, - console <<= consoleTask, - consoleQuick <<= consoleQuickTask, - discoveredMainClasses <<= compile map discoverMainClasses storeAs discoveredMainClasses xtriggeredBy compile, - // definedSbtPlugins <<= discoverPlugins, - discoveredSbtPlugins <<= discoverSbtPluginNames, + compileIncSetup := compileIncSetupTask.value, + console := consoleTask.value, + consoleQuick := consoleQuickTask.value, + discoveredMainClasses := (compile map discoverMainClasses storeAs discoveredMainClasses xtriggeredBy compile).value, + discoveredSbtPlugins := discoverSbtPluginNames.value, inTask(run)(runnerTask :: Nil).head, selectMainClass := mainClass.value orElse askForMainClass(discoveredMainClasses.value), mainClass in run := (selectMainClass in run).value, mainClass := pickMainClassOrWarn(discoveredMainClasses.value, streams.value.log), - run <<= runTask(fullClasspath, mainClass in run, runner in run), - runMain <<= runMainTask(fullClasspath, runner in run), - copyResources <<= copyResourcesTask + run := runTask(fullClasspath, mainClass in run, runner in run).evaluated, + runMain := runMainTask(fullClasspath, runner in run).evaluated, + copyResources := copyResourcesTask.value ) private[this] lazy val configGlobal = globalDefaults(Seq( @@ -345,9 +344,9 @@ object Defaults extends BuildCommon { cleanFiles := Seq(managedDirectory.value, target.value), cleanKeepFiles := historyPath.value.toList, clean := doClean(cleanFiles.value, cleanKeepFiles.value), - consoleProject <<= consoleProjectTask, - watchTransitiveSources <<= watchTransitiveSourcesTask, - watch <<= watchSetting + consoleProject := consoleProjectTask.value, + watchTransitiveSources := watchTransitiveSourcesTask.value, + watch := watchSetting.value ) def generate(generators: SettingKey[Seq[Task[Seq[File]]]]): Initialize[Task[Seq[File]]] = generators { _.join.map(_.flatten) } @@ -460,18 +459,18 @@ object Defaults extends BuildCommon { lazy val testTasks: Seq[Setting[_]] = testTaskOptions(test) ++ testTaskOptions(testOnly) ++ testTaskOptions(testQuick) ++ testDefaults ++ Seq( testLoader := TestFramework.createTestLoader(data(fullClasspath.value), scalaInstance.value, IO.createUniqueDirectory(taskTemporaryDirectory.value)), loadedTestFrameworks := testFrameworks.value.flatMap(f => f.create(testLoader.value, streams.value.log).map(x => (f, x)).toIterable).toMap, - definedTests <<= detectTests, - definedTestNames <<= definedTests map (_.map(_.name).distinct) storeAs definedTestNames triggeredBy compile, - testFilter in testQuick <<= testQuickFilter, - executeTests <<= (streams in test, loadedTestFrameworks, testLoader, testGrouping in test, testExecution in test, fullClasspath in test, javaHome in test, testForkedParallel, javaOptions in test) flatMap allTestGroupsTask, + definedTests := detectTests.value, + definedTestNames := (definedTests map (_.map(_.name).distinct) storeAs definedTestNames triggeredBy compile).value, + testFilter in testQuick := testQuickFilter.value, + executeTests := ((streams in test, loadedTestFrameworks, testLoader, testGrouping in test, testExecution in test, fullClasspath in test, javaHome in test, testForkedParallel, javaOptions in test) flatMap allTestGroupsTask).value, testResultLogger in (Test, test) :== TestResultLogger.SilentWhenNoTests, // https://github.com/sbt/sbt/issues/1185 test := { val trl = (testResultLogger in (Test, test)).value val taskName = Project.showContextKey(state.value)(resolvedScoped.value) trl.run(streams.value.log, executeTests.value, taskName) }, - testOnly <<= inputTests(testOnly), - testQuick <<= inputTests(testQuick) + testOnly := inputTests(testOnly).evaluated, + testQuick := inputTests(testQuick).evaluated ) lazy val TaskGlobal: Scope = ThisScope.copy(task = Global) lazy val ConfigGlobal: Scope = ThisScope.copy(config = Global) @@ -482,9 +481,9 @@ object Defaults extends BuildCommon { testListeners.in(TaskGlobal).value }, testOptions := Tests.Listeners(testListeners.value) +: (testOptions in TaskGlobal).value, - testExecution <<= testExecutionTask(key) + testExecution := testExecutionTask(key).value )) ++ inScope(GlobalScope)(Seq( - derive(testGrouping <<= singleTestGroupDefault) + derive(testGrouping := singleTestGroupDefault.value) )) @deprecated("Doesn't provide for closing the underlying resources.", "0.13.1") def testLogger(manager: Streams, baseKey: Scoped)(tdef: TestDefinition): Logger = @@ -669,7 +668,18 @@ object Defaults extends BuildCommon { lazy val packageConfig: Seq[Setting[_]] = inTask(packageBin)(Seq( - packageOptions <<= (name, version, homepage, organization, organizationName, mainClass, packageOptions) map { (name, ver, h, org, orgName, main, p) => Package.addSpecManifestAttributes(name, ver, orgName) +: Package.addImplManifestAttributes(name, ver, h, org, orgName) +: main.map(Package.MainClass.apply) ++: p })) ++ + packageOptions := { + val n = name.value + val ver = version.value + val org = organization.value + val orgName = organizationName.value + val main = mainClass.value + val old = packageOptions.value + Package.addSpecManifestAttributes(n, ver, orgName) +: + Package.addImplManifestAttributes(n, ver, homepage.value, org, orgName) +: + main.map(Package.MainClass.apply) ++: old + } + )) ++ inTask(packageSrc)(Seq( packageOptions := Package.addSpecManifestAttributes(name.value, version.value, organizationName.value) +: packageOptions.value)) ++ packageTaskSettings(packageBin, packageBinMappings) ++ @@ -736,12 +746,12 @@ object Defaults extends BuildCommon { def packageTasks(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) = packageTaskSettings(key, mappingsTask) def packageTaskSettings(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) = inTask(key)(Seq( - key in TaskGlobal <<= packageTask, - packageConfiguration <<= packageConfigurationTask, - mappings <<= mappingsTask, + key in TaskGlobal := packageTask.value, + packageConfiguration := packageConfigurationTask.value, + mappings := mappingsTask.value, packagedArtifact := (artifact.value -> key.value), - artifact <<= artifactSetting, - artifactPath <<= artifactPathSetting(artifact) + artifact := artifactSetting.value, + artifactPath := artifactPathSetting(artifact).value )) def packageTask: Initialize[Task[File]] = (packageConfiguration, streams) map { (config, s) => @@ -797,7 +807,7 @@ object Defaults extends BuildCommon { } } - def runnerTask = runner <<= runnerInit + def runnerTask = runner := runnerInit.value def runnerInit: Initialize[Task[ScalaRun]] = Def.task { val tmp = taskTemporaryDirectory.value val resolvedScope = resolvedScoped.value.scope @@ -854,8 +864,8 @@ object Defaults extends BuildCommon { } )) - def mainRunTask = run <<= runTask(fullClasspath in Runtime, mainClass in run, runner in run) - def mainRunMainTask = runMain <<= runMainTask(fullClasspath in Runtime, runner in run) + def mainRunTask = run := runTask(fullClasspath in Runtime, mainClass in run, runner in run).evaluated + def mainRunMainTask = runMain := runMainTask(fullClasspath in Runtime, runner in run).evaluated def discoverMainClasses(analysis: CompileAnalysis): Seq[String] = Discovery.applications(Tests.allDefs(analysis)).collect({ case (definition, discovered) if discovered.hasMain => definition.name }).sorted @@ -1087,20 +1097,20 @@ object Classpaths { def concatSettings[T](a: SettingKey[Seq[T]], b: SettingKey[Seq[T]]): Initialize[Seq[T]] = (a, b)(_ ++ _) lazy val configSettings: Seq[Setting[_]] = classpaths ++ Seq( - products <<= makeProducts, + products := makeProducts.value, productDirectories := classDirectory.value :: Nil, classpathConfiguration := findClasspathConfig(internalConfigurationMap.value, configuration.value, classpathConfiguration.?.value, update.value) ) private[this] def classpaths: Seq[Setting[_]] = Seq( - externalDependencyClasspath <<= concat(unmanagedClasspath, managedClasspath), - dependencyClasspath <<= concat(internalDependencyClasspath, externalDependencyClasspath), - fullClasspath <<= concatDistinct(exportedProducts, dependencyClasspath), - internalDependencyClasspath <<= internalDependencies, - unmanagedClasspath <<= unmanagedDependencies, + externalDependencyClasspath := concat(unmanagedClasspath, managedClasspath).value, + dependencyClasspath := concat(internalDependencyClasspath, externalDependencyClasspath).value, + fullClasspath := concatDistinct(exportedProducts, dependencyClasspath).value, + internalDependencyClasspath := internalDependencies.value, + unmanagedClasspath := unmanagedDependencies.value, managedClasspath := managedJars(classpathConfiguration.value, classpathTypes.value, update.value), - exportedProducts <<= trackedExportedProducts(TrackLevel.TrackAlways), - exportedProductsIfMissing <<= trackedExportedProducts(TrackLevel.TrackIfMissing), - exportedProductsNoTracking <<= trackedExportedProducts(TrackLevel.NoTracking), + exportedProducts := trackedExportedProducts(TrackLevel.TrackAlways).value, + exportedProductsIfMissing := trackedExportedProducts(TrackLevel.TrackIfMissing).value, + exportedProductsNoTracking := trackedExportedProducts(TrackLevel.NoTracking).value, unmanagedJars := findUnmanagedJars(configuration.value, unmanagedBase.value, includeFilter in unmanagedJars value, excludeFilter in unmanagedJars value) ).map(exportClasspath) @@ -1144,8 +1154,8 @@ object Classpaths { )) val jvmPublishSettings: Seq[Setting[_]] = Seq( - artifacts <<= artifactDefs(defaultArtifactTasks), - packagedArtifacts <<= packaged(defaultArtifactTasks) + artifacts := artifactDefs(defaultArtifactTasks).value, + packagedArtifacts := packaged(defaultArtifactTasks).value ) val ivyPublishSettings: Seq[Setting[_]] = publishGlobalDefaults ++ Seq( @@ -1154,11 +1164,11 @@ object Classpaths { crossTarget := target.value, makePom := { val config = makePomConfiguration.value; IvyActions.makePom(ivyModule.value, config, streams.value.log); config.file }, packagedArtifact in makePom := ((artifact in makePom).value -> makePom.value), - deliver <<= deliverTask(deliverConfiguration), - deliverLocal <<= deliverTask(deliverLocalConfiguration), - publish <<= publishTask(publishConfiguration, deliver), - publishLocal <<= publishTask(publishLocalConfiguration, deliverLocal), - publishM2 <<= publishTask(publishM2Configuration, deliverLocal) + deliver := deliverTask(deliverConfiguration).value, + deliverLocal := deliverTask(deliverLocalConfiguration).value, + publish := publishTask(publishConfiguration, deliver).value, + publishLocal := publishTask(publishLocalConfiguration, deliverLocal).value, + publishM2 := publishTask(publishM2Configuration, deliverLocal).value ) private[this] def baseGlobalDefaults = Defaults.globalDefaults(Seq( @@ -1204,13 +1214,13 @@ object Classpaths { conflictWarning := conflictWarning.value.copy(label = Reference.display(thisProjectRef.value)), unmanagedBase := baseDirectory.value / "lib", normalizedName := Project.normalizeModuleID(name.value), - isSnapshot <<= isSnapshot or version(_ endsWith "-SNAPSHOT"), - description <<= description or name, - organization <<= organization or normalizedName, - organizationName <<= organizationName or organization, - organizationHomepage <<= organizationHomepage or homepage, - projectInfo <<= (name, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers) apply ModuleInfo, - overrideBuildResolvers <<= appConfiguration(isOverrideRepositories), + isSnapshot := (isSnapshot or version(_ endsWith "-SNAPSHOT")).value, + description := (description or name).value, + organization := (organization or normalizedName).value, + organizationName := (organizationName or organization).value, + organizationHomepage := (organizationHomepage or homepage).value, + projectInfo := ((name, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers) apply ModuleInfo).value, + overrideBuildResolvers := appConfiguration(isOverrideRepositories).value, externalResolvers := ((externalResolvers.?.value, resolvers.value, appResolvers.value, useJCenter.value) match { case (Some(delegated), Seq(), _, _) => delegated case (_, rs, Some(ars), uj) => ars ++ rs @@ -1224,39 +1234,40 @@ object Classpaths { Resolver.reorganizeAppResolvers(ars, uj, useMavenCentral) } }, - bootResolvers <<= appConfiguration map bootRepositories, - fullResolvers <<= (projectResolver, externalResolvers, sbtPlugin, sbtResolver, bootResolvers, overrideBuildResolvers) map { (proj, rs, isPlugin, sbtr, boot, overrideFlag) => + bootResolvers := (appConfiguration map bootRepositories).value, + fullResolvers := ((projectResolver, externalResolvers, sbtPlugin, sbtResolver, bootResolvers, overrideBuildResolvers) map { (proj, rs, isPlugin, sbtr, boot, overrideFlag) => boot match { case Some(repos) if overrideFlag => proj +: repos case _ => val base = if (isPlugin) sbtr +: sbtPluginReleases +: rs else rs proj +: base } - }, - moduleName <<= normalizedName, + }).value, + moduleName := normalizedName.value, ivyPaths := new IvyPaths(baseDirectory.value, bootIvyHome(appConfiguration.value)), dependencyCacheDirectory := { val st = state.value BuildPaths.getDependencyDirectory(st, BuildPaths.getGlobalBase(st)) }, otherResolvers := Resolver.publishMavenLocal :: publishTo.value.toList, - projectResolver <<= projectResolverTask, - projectDependencies <<= projectDependenciesTask, + projectResolver := projectResolverTask.value, + projectDependencies := projectDependenciesTask.value, // TODO - Is this the appropriate split? Ivy defines this simply as // just project + library, while the JVM plugin will define it as // having the additional sbtPlugin + autoScala magikz. allDependencies := { projectDependencies.value ++ libraryDependencies.value }, - ivyScala <<= ivyScala or (scalaHome, scalaVersion in update, scalaBinaryVersion in update, scalaOrganization, sbtPlugin) { (sh, fv, bv, so, plugin) => - Some(new IvyScala(fv, bv, Nil, filterImplicit = false, checkExplicit = true, overrideScalaVersion = true, scalaOrganization = so)) - }, - artifactPath in makePom <<= artifactPathSetting(artifact in makePom), + ivyScala := + (ivyScala or ((scalaHome, scalaVersion in update, scalaBinaryVersion in update, scalaOrganization, sbtPlugin) { (sh, fv, bv, so, plugin) => + Option(new IvyScala(fv, bv, Nil, filterImplicit = false, checkExplicit = true, overrideScalaVersion = true, scalaOrganization = so)) + })).value, + artifactPath in makePom := artifactPathSetting(artifact in makePom).value, publishArtifact in makePom := publishMavenStyle.value && publishArtifact.value, artifact in makePom := Artifact.pom(moduleName.value), - projectID <<= defaultProjectID, - projectID <<= pluginProjectID, - projectDescriptors <<= depMap, + projectID := defaultProjectID.value, + projectID := pluginProjectID.value, + projectDescriptors := depMap.value, updateConfiguration := { // Tell the UpdateConfiguration which artifact types are special (for sources and javadocs) val specialArtifactTypes = sourceArtifactTypes.value union docArtifactTypes.value @@ -1264,28 +1275,28 @@ object Classpaths { new UpdateConfiguration(retrieveConfiguration.value, false, ivyLoggingLevel.value, ArtifactTypeFilter.forbid(specialArtifactTypes)) }, retrieveConfiguration := { if (retrieveManaged.value) Some(new RetrieveConfiguration(managedDirectory.value, retrievePattern.value, retrieveManagedSync.value, configurationsToRetrieve.value)) else None }, - ivyConfiguration <<= mkIvyConfiguration, + ivyConfiguration := mkIvyConfiguration.value, ivyConfigurations := { val confs = thisProject.value.configurations (confs ++ confs.map(internalConfigurationMap.value) ++ (if (autoCompilerPlugins.value) CompilerPlugin :: Nil else Nil)).distinct }, ivyConfigurations ++= Configurations.auxiliary, ivyConfigurations ++= { if (managedScalaInstance.value && scalaHome.value.isEmpty) Configurations.ScalaTool :: Nil else Nil }, - moduleSettings <<= moduleSettings0, + moduleSettings := moduleSettings0.value, makePomConfiguration := new MakePomConfiguration(artifactPath in makePom value, projectInfo.value, None, pomExtra.value, pomPostProcess.value, pomIncludeRepository.value, pomAllRepositories.value), deliverLocalConfiguration := deliverConfig(crossTarget.value, status = if (isSnapshot.value) "integration" else "release", logging = ivyLoggingLevel.value), - deliverConfiguration <<= deliverLocalConfiguration, + deliverConfiguration := deliverLocalConfiguration.value, publishConfiguration := publishConfig(packagedArtifacts.in(publish).value, if (publishMavenStyle.value) None else Some(deliver.value), resolverName = getPublishTo(publishTo.value).name, checksums = checksums.in(publish).value, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value), publishLocalConfiguration := publishConfig(packagedArtifacts.in(publishLocal).value, Some(deliverLocal.value), checksums.in(publishLocal).value, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value), publishM2Configuration := publishConfig(packagedArtifacts.in(publishM2).value, None, resolverName = Resolver.publishMavenLocal.name, checksums = checksums.in(publishM2).value, logging = ivyLoggingLevel.value, overwrite = isSnapshot.value), - ivySbt <<= ivySbt0, + ivySbt := ivySbt0.value, ivyModule := { val is = ivySbt.value; new is.Module(moduleSettings.value) }, - transitiveUpdate <<= transitiveUpdateTask, + transitiveUpdate := transitiveUpdateTask.value, updateCacheName := "update_cache" + (if (crossPaths.value) s"_${scalaBinaryVersion.value}" else ""), evictionWarningOptions in update := EvictionWarningOptions.default, - dependencyPositions <<= dependencyPositionsTask, + dependencyPositions := dependencyPositionsTask.value, unresolvedWarningConfiguration in update := UnresolvedWarningConfiguration(dependencyPositions.value), - update <<= updateTask tag (Tags.Update, Tags.Network), + update := (updateTask tag (Tags.Update, Tags.Network)).value, update := { val report = update.value val log = streams.value.log @@ -1308,7 +1319,7 @@ object Classpaths { val externalModules = update.value.allModules.filterNot(m => projectDeps contains key(m)) GetClassifiersModule(projectID.value, externalModules, ivyConfigurations.in(updateClassifiers).value, transitiveClassifiers.in(updateClassifiers).value) }, - updateClassifiers <<= Def.task { + updateClassifiers := (Def.task { val s = streams.value val is = ivySbt.value val mod = (classifiersModule in updateClassifiers).value @@ -1322,7 +1333,7 @@ object Classpaths { withExcludes(out, mod.classifiers, lock(app)) { excludes => IvyActions.updateClassifiers(is, GetClassifiersConfiguration(mod, excludes, c.copy(artifactFilter = c.artifactFilter.invert), ivyScala.value, srcTypes, docTypes), uwConfig, LogicalClock(state.value.hashCode), Some(depDir), Vector.empty, s.log) } - } tag (Tags.Update, Tags.Network) + } tag (Tags.Update, Tags.Network)).value ) val jvmBaseSettings: Seq[Setting[_]] = Seq( @@ -1380,14 +1391,14 @@ object Classpaths { }, ivyConfiguration := new InlineIvyConfiguration(ivyPaths.value, externalResolvers.value, Nil, Nil, offline.value, Option(lock(appConfiguration.value)), checksums.value, Some(target.value / "resolution-cache"), UpdateOptions(), streams.value.log), - ivySbt <<= ivySbt0, - classifiersModule <<= (projectID, sbtDependency, transitiveClassifiers, loadedBuild, thisProjectRef) map { (pid, sbtDep, classifiers, lb, ref) => + ivySbt := ivySbt0.value, + classifiersModule := ((projectID, sbtDependency, transitiveClassifiers, loadedBuild, thisProjectRef) map { (pid, sbtDep, classifiers, lb, ref) => val pluginClasspath = lb.units(ref.build).unit.plugins.fullClasspath val pluginJars = pluginClasspath.filter(_.data.isFile) // exclude directories: an approximation to whether they've been published val pluginIDs: Seq[ModuleID] = pluginJars.flatMap(_ get moduleID.key) GetClassifiersModule(pid, sbtDep +: pluginIDs, Configurations.Default :: Nil, classifiers) - }, - updateSbtClassifiers in TaskGlobal <<= Def.task { + }).value, + updateSbtClassifiers in TaskGlobal := (Def.task { val s = streams.value val is = ivySbt.value val mod = classifiersModule.value @@ -1402,7 +1413,7 @@ object Classpaths { val noExplicitCheck = ivyScala.value.map(_.copy(checkExplicit = false)) IvyActions.transitiveScratch(is, "sbt", GetClassifiersConfiguration(mod, excludes, c.copy(artifactFilter = c.artifactFilter.invert), noExplicitCheck, srcTypes, docTypes), uwConfig, LogicalClock(state.value.hashCode), Some(depDir), s.log) } - } tag (Tags.Update, Tags.Network) + } tag (Tags.Update, Tags.Network)).value )) ++ Seq(bootIvyConfiguration := (ivyConfiguration in updateSbtClassifiers).value) def deliverTask(config: TaskKey[DeliverConfiguration]): Initialize[Task[File]] = @@ -1850,7 +1861,7 @@ object Classpaths { else Nil def addUnmanagedLibrary: Seq[Setting[_]] = Seq( - unmanagedJars in Compile <++= unmanagedScalaLibrary + unmanagedJars in Compile ++= unmanagedScalaLibrary.value ) def unmanagedScalaLibrary: Initialize[Task[Seq[File]]] = Def.taskDyn { @@ -2009,14 +2020,21 @@ trait BuildExtra extends BuildCommon with DefExtra { * Typically, use the default value for this version instead of specifying it explicitly. */ def addSbtPlugin(dependency: ModuleID, sbtVersion: String): Setting[Seq[ModuleID]] = - libraryDependencies <+= (scalaBinaryVersion in update) { scalaV => sbtPluginExtra(dependency, sbtVersion, scalaV) } + libraryDependencies += { + val scalaV = (scalaBinaryVersion in update).value + sbtPluginExtra(dependency, sbtVersion, scalaV) + } /** * Adds `dependency` as an sbt plugin for the sbt and Scala versions configured by * `sbtBinaryVersion` and `scalaBinaryVersion` scoped to `update`. */ def addSbtPlugin(dependency: ModuleID): Setting[Seq[ModuleID]] = - libraryDependencies <+= (sbtBinaryVersion in update, scalaBinaryVersion in update) { (sbtV, scalaV) => sbtPluginExtra(dependency, sbtV, scalaV) } + libraryDependencies += { + val sbtV = (sbtBinaryVersion in update).value + val scalaV = (scalaBinaryVersion in update).value + sbtPluginExtra(dependency, sbtV, scalaV) + } /** Transforms `dependency` to be in the auto-compiler plugin configuration. */ def compilerPlugin(dependency: ModuleID): ModuleID = @@ -2053,14 +2071,14 @@ trait BuildExtra extends BuildCommon with DefExtra { def externalIvySettingsURI(uri: Initialize[URI], addMultiResolver: Boolean = true): Setting[Task[IvyConfiguration]] = { val other = (baseDirectory, appConfiguration, projectResolver, updateOptions, streams).identityMap - ivyConfiguration <<= (uri zipWith other) { + ivyConfiguration := ((uri zipWith other) { case (u, otherTask) => otherTask map { case (base, app, pr, uo, s) => val extraResolvers = if (addMultiResolver) pr :: Nil else Nil new ExternalIvyConfiguration(base, u, Option(lock(app)), extraResolvers, uo, s.log) } - } + }).value } private[this] def inBase(name: String): Initialize[File] = Def.setting { baseDirectory.value / name } @@ -2083,22 +2101,22 @@ trait BuildExtra extends BuildCommon with DefExtra { } def fullRunInputTask(scoped: InputKey[Unit], config: Configuration, mainClass: String, baseArguments: String*): Setting[InputTask[Unit]] = - scoped <<= inputTask { result => + scoped := (inputTask { result => (initScoped(scoped.scopedKey, runnerInit) zipWith (fullClasspath in config, streams, result).identityMap) { (rTask, t) => (t, rTask) map { case ((cp, s, args), r) => toError(r.run(mainClass, data(cp), baseArguments ++ args, s.log)) } } - } + }).evaluated def fullRunTask(scoped: TaskKey[Unit], config: Configuration, mainClass: String, arguments: String*): Setting[Task[Unit]] = - scoped <<= (initScoped(scoped.scopedKey, runnerInit) zipWith (fullClasspath in config, streams).identityMap) { + scoped := ((initScoped(scoped.scopedKey, runnerInit) zipWith (fullClasspath in config, streams).identityMap) { case (rTask, t) => (t, rTask) map { case ((cp, s), r) => toError(r.run(mainClass, data(cp), arguments, s.log)) } - } + }).value def initScoped[T](sk: ScopedKey[_], i: Initialize[T]): Initialize[T] = initScope(fillTaskAxis(sk.scope, sk.key), i) def initScope[T](s: Scope, i: Initialize[T]): Initialize[T] = i mapReferenced Project.mapScope(Scope.replaceThis(s)) @@ -2106,7 +2124,8 @@ trait BuildExtra extends BuildCommon with DefExtra { * Disables post-compilation hook for determining tests for tab-completion (such as for 'test-only'). * This is useful for reducing test:compile time when not running test. */ - def noTestCompletion(config: Configuration = Test): Setting[_] = inConfig(config)(Seq(definedTests <<= detectTests)).head + def noTestCompletion(config: Configuration = Test): Setting[_] = + inConfig(config)(Seq(definedTests := detectTests.value)).head def filterKeys(ss: Seq[Setting[_]], transitive: Boolean = false)(f: ScopedKey[_] => Boolean): Seq[Setting[_]] = ss filter (s => f(s.key) && (!transitive || s.dependencies.forall(f))) diff --git a/main/src/main/scala/sbt/EvaluateTask.scala b/main/src/main/scala/sbt/EvaluateTask.scala index 9fff1cc84..c82df9e14 100644 --- a/main/src/main/scala/sbt/EvaluateTask.scala +++ b/main/src/main/scala/sbt/EvaluateTask.scala @@ -397,10 +397,12 @@ object EvaluateTask { // if the return type Seq[Setting[_]] is not explicitly given, scalac hangs val injectStreams: ScopedKey[_] => Seq[Setting[_]] = scoped => if (scoped.key == streams.key) - Seq(streams in scoped.scope <<= streamsManager map { mgr => - val stream = mgr(scoped) - stream.open() - stream + Seq(streams in scoped.scope := { + (streamsManager map { mgr => + val stream = mgr(scoped) + stream.open() + stream + }).value }) else Nil diff --git a/main/src/main/scala/sbt/Opts.scala b/main/src/main/scala/sbt/Opts.scala index 1adea2a5f..3c1e80361 100644 --- a/main/src/main/scala/sbt/Opts.scala +++ b/main/src/main/scala/sbt/Opts.scala @@ -54,13 +54,14 @@ object DefaultOptions { def resolvers(snapshot: Boolean): Seq[Resolver] = { if (snapshot) Seq(resolver.sonatypeSnapshots) else Nil } - def addResolvers: Setting[_] = Keys.resolvers <++= Keys.isSnapshot apply resolvers + def addResolvers: Setting[_] = Keys.resolvers ++= { resolvers(Keys.isSnapshot.value) } @deprecated("Use `credentials(State)` instead to make use of configuration path dynamically configured via `Keys.globalSettingsDirectory`; relying on ~/.ivy2 is not recommended anymore.", "0.12.0") def credentials: Credentials = Credentials(userHome / ".ivy2" / ".credentials") def credentials(state: State): Credentials = Credentials(getGlobalSettingsDirectory(state, getGlobalBase(state)) / ".credentials") - def addCredentials: Setting[_] = Keys.credentials <+= Keys.state map credentials + def addCredentials: Setting[_] = Keys.credentials += { credentials(Keys.state.value) } - def shellPrompt(version: String): State => String = s => "%s:%s:%s> ".format(s.configuration.provider.id.name, extract(s).currentProject.id, version) - def setupShellPrompt: Setting[_] = Keys.shellPrompt <<= Keys.version apply shellPrompt + def shellPrompt(version: String): State => String = + s => "%s:%s:%s> ".format(s.configuration.provider.id.name, extract(s).currentProject.id, version) + def setupShellPrompt: Setting[_] = Keys.shellPrompt := { shellPrompt(Keys.version.value) } } diff --git a/main/src/main/scala/sbt/internal/GlobalPlugin.scala b/main/src/main/scala/sbt/internal/GlobalPlugin.scala index f40364aee..56587a572 100644 --- a/main/src/main/scala/sbt/internal/GlobalPlugin.scala +++ b/main/src/main/scala/sbt/internal/GlobalPlugin.scala @@ -18,7 +18,10 @@ object GlobalPlugin { Seq[Setting[_]]( projectDescriptors ~= { _ ++ gp.descriptors }, projectDependencies ++= gp.projectID +: gp.dependencies, - resolvers <<= resolvers { rs => (rs ++ gp.resolvers).distinct }, + resolvers := { + val rs = resolvers.value + (rs ++ gp.resolvers).distinct + }, globalPluginUpdate := gp.updateReport, // TODO: these shouldn't be required (but are): the project* settings above should take care of this injectInternalClasspath(Runtime, gp.internalClasspath), @@ -74,7 +77,7 @@ object GlobalPlugin { } val globalPluginSettings = Project.inScope(Scope.GlobalScope in LocalRootProject)(Seq( organization := SbtArtifacts.Organization, - onLoadMessage <<= Keys.baseDirectory("Loading global plugins from " + _), + onLoadMessage := Keys.baseDirectory("Loading global plugins from " + _).value, name := "global-plugin", sbtPlugin := true, version := "0.0" diff --git a/main/src/main/scala/sbt/internal/SettingCompletions.scala b/main/src/main/scala/sbt/internal/SettingCompletions.scala index aa3ef0752..27fb58be1 100644 --- a/main/src/main/scala/sbt/internal/SettingCompletions.scala +++ b/main/src/main/scala/sbt/internal/SettingCompletions.scala @@ -40,7 +40,7 @@ private[sbt] object SettingCompletions { val globalSetting = resolve(Def.setting(global, setting.init, setting.pos)) globalSetting ++ allDefs.flatMap { d => if (d.key == akey) - Seq(SettingKey(akey) in d.scope <<= global) + Seq(SettingKey(akey) in d.scope := { global.value }) else Nil } diff --git a/main/src/test/resources/session-settings/4.sbt.txt b/main/src/test/resources/session-settings/4.sbt.txt index 5d1bcd5b2..39beb8d7d 100644 --- a/main/src/test/resources/session-settings/4.sbt.txt +++ b/main/src/test/resources/session-settings/4.sbt.txt @@ -11,7 +11,5 @@ k3 := { k4 := { }; k5 := () -k1 <<= k1 map {_ => sys.error("k1")} - k4 := { val x = k4.value; () } diff --git a/main/src/test/resources/session-settings/4.sbt.txt_1/1.set.result b/main/src/test/resources/session-settings/4.sbt.txt_1/1.set.result index 3f5ec19f4..01ae5270b 100644 --- a/main/src/test/resources/session-settings/4.sbt.txt_1/1.set.result +++ b/main/src/test/resources/session-settings/4.sbt.txt_1/1.set.result @@ -10,6 +10,3 @@ k3 := { } k4 := (); k5 := () - -k1 <<= k1 map {_ => sys.error("k1")} - diff --git a/sbt/src/sbt-test/actions/aggregate/test b/sbt/src/sbt-test/actions/aggregate/test index 223cc9476..d1088241a 100644 --- a/sbt/src/sbt-test/actions/aggregate/test +++ b/sbt/src/sbt-test/actions/aggregate/test @@ -5,7 +5,7 @@ $ absent ran # single project, 'mark' defined -> set Mark <<= mark +> set Mark := mark.value > mark $ exists ran $ delete ran @@ -29,14 +29,14 @@ $ mkdir sub sub/sub > reload # define in root project only -> set Mark <<= mark +> set Mark := mark.value > mark $ exists ran $ absent sub/ran $ delete ran # define in sub project, but shouldn't run without aggregation -> set Mark in sub <<= mark(sub) +> set Mark in sub := mark(sub).value > mark $ exists ran $ absent sub/ran @@ -58,8 +58,8 @@ $ touch aggregate > reload # add tasks to each subproject -> set Mark in sub <<= mark(sub) -> set Mark in sub2 <<= mark(sub2) +> set Mark in sub := mark(sub).value +> set Mark in sub2 := mark(sub2).value # check that aggregation works when root project has no task > mark @@ -74,7 +74,7 @@ $ absent ran $ delete sub/ran sub/sub/ran # add task to root project -> set Mark <<= mark +> set Mark := mark.value # disable aggregation for sub/mark so that sub2/mark doesn't run > set aggregate in (sub,Mark) := false diff --git a/sbt/src/sbt-test/actions/compile/test b/sbt/src/sbt-test/actions/compile/test index e7ac44939..0c25100b6 100644 --- a/sbt/src/sbt-test/actions/compile/test +++ b/sbt/src/sbt-test/actions/compile/test @@ -1,5 +1,5 @@ -> compile -> 'set sources in (Compile, compile) <<= sources in (Compile, compile) map { _.filterNot(_.getName contains "C") }' +> 'set sources in (Compile, compile) := { val src = (sources in (Compile, compile)).value; src.filterNot(_.getName contains "C") }' > compile diff --git a/sbt/src/sbt-test/actions/cross/build.sbt b/sbt/src/sbt-test/actions/cross/build.sbt index 1604f0fa2..f5c3dc75f 100644 --- a/sbt/src/sbt-test/actions/cross/build.sbt +++ b/sbt/src/sbt-test/actions/cross/build.sbt @@ -2,17 +2,19 @@ scalaVersion in ThisBuild := "2.7.7" scalaVersion := "2.9.1" -scalaVersion in update <<= scalaVersion { - case "2.9.1" => "2.9.0-1" - case "2.8.2" => "2.8.1" - case x => x +scalaVersion in update := { + scalaVersion.value match { + case "2.9.1" => "2.9.0-1" + case "2.8.2" => "2.8.1" + case x => x + } } -InputKey[Unit]("check") <<= inputTask { argsT => +InputKey[Unit]("check") := (inputTask { argsT => (argsT, scalaVersion in ThisBuild, scalaVersion, scalaVersion in update) map { (args, svTB, svP, svU) => def check(label: String, i: Int, actual: String) = assert(args(i) == actual, "Expected " + label + "='" + args(i) + "' got '" + actual + "'") check("scalaVersion in ThisBuild", 0, svTB) check("scalaVersion", 1, svP) check("scalaVersion in update", 2, svU) } -} +}).evaluated diff --git a/sbt/src/sbt-test/actions/depends-on/build.sbt b/sbt/src/sbt-test/actions/depends-on/build.sbt index ffcbfbc8a..c20f79671 100644 --- a/sbt/src/sbt-test/actions/depends-on/build.sbt +++ b/sbt/src/sbt-test/actions/depends-on/build.sbt @@ -2,10 +2,10 @@ lazy val root = (project in file(".")). settings( - a <<= baseDirectory map (b => if ((b / "succeed").exists) () else sys.error("fail")), - b <<= a.task(at => nop dependsOn(at)), - c <<= a map { _ => () }, - d <<= a flatMap { _ => task { () } } + a := (baseDirectory map (b => if ((b / "succeed").exists) () else sys.error("fail"))).value, + b := (a.task(at => nop dependsOn(at))).value, + c := (a map { _ => () }).value, + d := (a flatMap { _ => task { () } }).value ) lazy val a = taskKey[Unit]("") lazy val b = taskKey[Unit]("") @@ -14,10 +14,10 @@ lazy val d = taskKey[Unit]("") lazy val input = (project in file("input")). settings( - f <<= inputTask { _ map { args => if (args(0) == "succeed") () else sys.error("fail") } }, + f := (inputTask { _ map { args => if (args(0) == "succeed") () else sys.error("fail") } }).evaluated, j := sys.error("j"), - g <<= f dependsOn(j), - h <<= f map { _ => IO.touch(file("h")) } + g := (f dependsOn(j)).evaluated, + h := (f map { _ => IO.touch(file("h")) }).evaluated ) lazy val f = inputKey[Unit]("") lazy val g = inputKey[Unit]("") diff --git a/sbt/src/sbt-test/actions/doc/test b/sbt/src/sbt-test/actions/doc/test index 399766d0c..dd5ba0ed9 100644 --- a/sbt/src/sbt-test/actions/doc/test +++ b/sbt/src/sbt-test/actions/doc/test @@ -4,7 +4,7 @@ -> doc -> 'set sources in (Compile, doc) <<= sources in Compile map { _.filterNot(_.getName contains "B") }' +> 'set sources in (Compile, doc) := { val src = (sources in Compile).value; src.filterNot(_.getName contains "B") }' # hybrid project, only scaladoc run > doc @@ -12,7 +12,7 @@ $ exists "target/api/index.js" $ absent "target/api/scala" $ absent "target/api/java" -> 'set sources in (Compile, doc) <<= sources in (Compile, doc) map { _.filterNot(_.getName endsWith ".java") }' +> 'set sources in (Compile, doc) := { val src = (sources in (Compile, doc)).value; src.filterNot(_.getName endsWith ".java") }' # compile task is superfluous. Since doc task preceded by compile task has been problematic due to scala # compiler's way of handling empty classpath. We have it here to test that our workaround works. @@ -24,7 +24,7 @@ $ absent "target/api/package-list" $ absent "target/api/scala" $ absent "target/api/java" -> 'set sources in (Compile, doc) <<= sources in Compile map { _.filter(_.getName endsWith ".java") }' +> 'set sources in (Compile, doc) := { val src = (sources in Compile).value; src.filter(_.getName endsWith ".java") }' > ; clean ; doc diff --git a/sbt/src/sbt-test/actions/state/build.sbt b/sbt/src/sbt-test/actions/state/build.sbt index 8d315c7f8..c52644d14 100644 --- a/sbt/src/sbt-test/actions/state/build.sbt +++ b/sbt/src/sbt-test/actions/state/build.sbt @@ -16,8 +16,8 @@ def updateDemoInit = state map { s => (s get sample getOrElse 9) + 1 } lazy val root = (project in file(".")). settings( - updateDemo <<= updateDemoInit updateState demoState, - check <<= checkInit, + updateDemo := (updateDemoInit updateState demoState).value, + check := checkInit.evaluated, inMemorySetting, persistedSetting, inMemoryCheck, @@ -34,11 +34,11 @@ def checkInit: Initialize[InputTask[Unit]] = InputTask( (_: State) => token(Spac } } -def inMemorySetting = keep <<= getPrevious(keep) map { case None => 3; case Some(x) => x + 1} keepAs(keep) -def persistedSetting = persist <<= loadPrevious(persist) map { case None => 17; case Some(x) => x + 1} storeAs(persist) +def inMemorySetting = keep := (getPrevious(keep) map { case None => 3; case Some(x) => x + 1} keepAs(keep)).value +def persistedSetting = persist := (loadPrevious(persist) map { case None => 17; case Some(x) => x + 1} storeAs(persist)).value -def inMemoryCheck = checkKeep <<= inputCheck( (ctx, s) => Space ~> str( getFromContext( keep, ctx, s)) ) -def persistedCheck = checkPersist <<= inputCheck( (ctx, s) => Space ~> str(loadFromContext(persist, ctx, s)) ) +def inMemoryCheck = checkKeep := (inputCheck( (ctx, s) => Space ~> str( getFromContext( keep, ctx, s)) )).evaluated +def persistedCheck = checkPersist := (inputCheck( (ctx, s) => Space ~> str(loadFromContext(persist, ctx, s)) )).evaluated def inputCheck[T](f: (ScopedKey[_], State) => Parser[T]): Initialize[InputTask[Unit]] = InputTask( resolvedScoped(ctx => (s: State) => f(ctx, s)) )( dummyTask ) diff --git a/sbt/src/sbt-test/actions/update-state-fail/build.sbt b/sbt/src/sbt-test/actions/update-state-fail/build.sbt index 0b21b91e0..cb3695fd4 100644 --- a/sbt/src/sbt-test/actions/update-state-fail/build.sbt +++ b/sbt/src/sbt-test/actions/update-state-fail/build.sbt @@ -15,7 +15,7 @@ lazy val a = project. lazy val b = project. settings( - testTask <<= Def.task("").updateState(updater) + testTask := Def.task("").updateState(updater).value ) def checkState(runs: Int, s: State): Unit = { diff --git a/sbt/src/sbt-test/apiinfo/extracted/build.sbt b/sbt/src/sbt-test/apiinfo/extracted/build.sbt index 6d2b6432b..37533b32a 100644 --- a/sbt/src/sbt-test/apiinfo/extracted/build.sbt +++ b/sbt/src/sbt-test/apiinfo/extracted/build.sbt @@ -41,14 +41,14 @@ def testInputTask[T](name: String, expected: String, task: InputKey[T], arg: Str } } -myInputTask <<= argFunction(_.toUpperCase(Locale.ENGLISH)) +myInputTask := argFunction(_.toUpperCase(Locale.ENGLISH)).evaluated testInputTask("testRunInputTaskRoot", "FOO", myInputTask, "foo") -myInputTask in Compile <<= argFunction(_.toLowerCase(Locale.ENGLISH)) +myInputTask in Compile := argFunction(_.toLowerCase(Locale.ENGLISH)).evaluated testInputTask("testRunInputTaskRootCompile", "foo", myInputTask in Compile, "FOO") -myInputTask in sub <<= argFunction(_.head.toString) +myInputTask in sub := argFunction(_.head.toString).evaluated testInputTask("testRunInputTaskSub", "f", myInputTask in sub, "foo") -myInputTask in (sub, Compile) <<= argFunction(_.tail) +myInputTask in (sub, Compile) := argFunction(_.tail).evaluated testInputTask("testRunInputTaskSubCompile", "oo", myInputTask in (sub, Compile), "foo") diff --git a/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt b/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt index c0bd67e35..6d28ec8e9 100644 --- a/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt +++ b/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt @@ -4,7 +4,10 @@ logLevel := Level.Debug incOptions ~= { _.withApiDebug(true) } -TaskKey[Unit]("show-apis") <<= (compile in Compile, scalaSource in Compile, javaSource in Compile) map { case (a: Analysis, scalaSrc: java.io.File, javaSrc: java.io.File) => +TaskKey[Unit]("show-apis") := { + val a = (compile in Compile).value match { case a: Analysis => a } + val scalaSrc = (scalaSource in Compile).value + val javaSrc = (javaSource in Compile).value val aApi = a.apis.internalAPI("test.A").api.classApi val jApi = a.apis.internalAPI("test.J").api.classApi import xsbt.api.DefaultShowAPI diff --git a/sbt/src/sbt-test/apiinfo/unstable-existential-names/build.sbt b/sbt/src/sbt-test/apiinfo/unstable-existential-names/build.sbt index 071b3645f..ec0b0288c 100644 --- a/sbt/src/sbt-test/apiinfo/unstable-existential-names/build.sbt +++ b/sbt/src/sbt-test/apiinfo/unstable-existential-names/build.sbt @@ -1,7 +1,7 @@ import sbt.internal.inc.Analysis // checks number of compilation iterations performed since last `clean` run -InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) => +InputKey[Unit]("check-number-of-compiler-iterations") := (inputTask { (argTask: TaskKey[Seq[String]]) => (argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) => assert(args.size == 1) val expectedIterationsNumber = args(0).toInt @@ -9,4 +9,4 @@ InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: assert(allCompilationsSize == expectedIterationsNumber, "allCompilationsSize == %d (expected %d)".format(allCompilationsSize, expectedIterationsNumber)) } -} +}).evaluated diff --git a/sbt/src/sbt-test/compiler-project/inc-package-class-dependency/build.sbt b/sbt/src/sbt-test/compiler-project/inc-package-class-dependency/build.sbt index d2b41882c..2b4c53c7c 100644 --- a/sbt/src/sbt-test/compiler-project/inc-package-class-dependency/build.sbt +++ b/sbt/src/sbt-test/compiler-project/inc-package-class-dependency/build.sbt @@ -1,8 +1,10 @@ import sbt.internal.inc.Analysis -TaskKey[Unit]("verify-binary-deps") <<= (compile in Compile, classDirectory in Compile, baseDirectory) map { - case (a: Analysis, classDir: java.io.File, base: java.io.File) => - val nestedPkgClass = classDir / "test/nested.class" - val fooSrc = base / "src/main/scala/test/nested/Foo.scala" - assert(!a.relations.binaryDeps(fooSrc).contains(nestedPkgClass), a.relations.toString) +TaskKey[Unit]("verify-binary-deps") := { + val a = (compile in Compile).value match { case a: Analysis => a } + val classDir = (classDirectory in Compile).value + val base = baseDirectory.value + val nestedPkgClass = classDir / "test/nested.class" + val fooSrc = base / "src/main/scala/test/nested/Foo.scala" + assert(!a.relations.binaryDeps(fooSrc).contains(nestedPkgClass), a.relations.toString) } diff --git a/sbt/src/sbt-test/compiler-project/inc-pickled-existential/build.sbt b/sbt/src/sbt-test/compiler-project/inc-pickled-existential/build.sbt index df68db036..f671d44fc 100644 --- a/sbt/src/sbt-test/compiler-project/inc-pickled-existential/build.sbt +++ b/sbt/src/sbt-test/compiler-project/inc-pickled-existential/build.sbt @@ -3,10 +3,10 @@ import sbt.internal.inc.Analysis logLevel := Level.Debug // dumps analysis into target/analysis-dump.txt file -InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) => +InputKey[Unit]("check-number-of-compiler-iterations") := (inputTask { (argTask: TaskKey[Seq[String]]) => (argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) => assert(args.size == 1) val expectedIterationsNumber = args(0).toInt assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber)) } -} +}).evaluated diff --git a/sbt/src/sbt-test/compiler-project/inc-pickled-refinement/build.sbt b/sbt/src/sbt-test/compiler-project/inc-pickled-refinement/build.sbt index 09b2b0a29..66128f225 100644 --- a/sbt/src/sbt-test/compiler-project/inc-pickled-refinement/build.sbt +++ b/sbt/src/sbt-test/compiler-project/inc-pickled-refinement/build.sbt @@ -1,9 +1,9 @@ import sbt.internal.inc.Analysis -InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) => +InputKey[Unit]("check-number-of-compiler-iterations") := (inputTask { (argTask: TaskKey[Seq[String]]) => (argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) => assert(args.size == 1) val expectedIterationsNumber = args(0).toInt assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber)) } -} +}).evaluated diff --git a/sbt/src/sbt-test/compiler-project/macro-config/build.sbt b/sbt/src/sbt-test/compiler-project/macro-config/build.sbt index c35214c69..12abb53bd 100644 --- a/sbt/src/sbt-test/compiler-project/macro-config/build.sbt +++ b/sbt/src/sbt-test/compiler-project/macro-config/build.sbt @@ -4,21 +4,21 @@ ivyConfigurations += config("macro").hide.extend(Compile) // add the compiler as a dependency for src/macro/ -libraryDependencies <+= - scalaVersion("org.scala-lang" % "scala-compiler" % _ % "macro") +libraryDependencies += + scalaVersion("org.scala-lang" % "scala-compiler" % _ % "macro").value // adds standard compile, console, package tasks for src/macro/ inConfig(config("macro"))(Defaults.configSettings) // puts the compiled macro on the classpath for the main sources -unmanagedClasspath in Compile <++= - fullClasspath in config("macro") +unmanagedClasspath in Compile ++= + (fullClasspath in config("macro")).value // includes sources in src/macro/ in the main source package -mappings in (Compile, packageSrc) <++= - mappings in (config("macro"), packageSrc) +mappings in (Compile, packageSrc) ++= + (mappings in (config("macro"), packageSrc)).value // Includes classes compiled from src/macro/ in the main binary // This can be omitted if the classes in src/macro/ aren't used at runtime -mappings in (Compile, packageBin) <++= - mappings in (config("macro"), packageBin) +mappings in (Compile, packageBin) ++= + (mappings in (config("macro"), packageBin)).value diff --git a/sbt/src/sbt-test/compiler-project/run-test/build.sbt b/sbt/src/sbt-test/compiler-project/run-test/build.sbt index 0b2253a59..52cd6d1f6 100644 --- a/sbt/src/sbt-test/compiler-project/run-test/build.sbt +++ b/sbt/src/sbt-test/compiler-project/run-test/build.sbt @@ -3,4 +3,4 @@ libraryDependencies ++= Seq( "junit" % "junit" % "4.8" % "test" ) -libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _ ) +libraryDependencies += scalaVersion("org.scala-lang" % "scala-compiler" % _ ).value diff --git a/sbt/src/sbt-test/dependency-management/artifact/build.sbt b/sbt/src/sbt-test/dependency-management/artifact/build.sbt index 5ee15ab8a..9307e2f78 100644 --- a/sbt/src/sbt-test/dependency-management/artifact/build.sbt +++ b/sbt/src/sbt-test/dependency-management/artifact/build.sbt @@ -5,18 +5,19 @@ lazy val check = taskKey[Unit]("") lazy val root = (project in file(".")). settings( - ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), + ivyPaths := ((baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache")))).value, publishTo := Some(Resolver.file("Test Publish Repo", file("test-repo"))), - resolvers <+= baseDirectory { base => "Test Repo" at (base / "test-repo").toURI.toString }, + resolvers += (baseDirectory { base => "Test Repo" at (base / "test-repo").toURI.toString }).value, moduleName := artifactID, - projectID <<= baseDirectory { base => (if(base / "retrieve" exists) retrieveID else publishedID) }, + projectID := (baseDirectory { base => (if(base / "retrieve" exists) retrieveID else publishedID) }).value, artifact in (Compile, packageBin) := mainArtifact, - libraryDependencies <<= (libraryDependencies, baseDirectory) { (deps, base) => deps ++ (if(base / "retrieve" exists) publishedID :: Nil else Nil) }, + libraryDependencies := ((libraryDependencies, baseDirectory) { (deps, base) => + deps ++ (if(base / "retrieve" exists) publishedID :: Nil else Nil) }).value, // needed to add a jar with a different type to the managed classpath - unmanagedClasspath in Compile <+= scalaInstance.map(_.libraryJar), + unmanagedClasspath in Compile += scalaInstance.map(_.libraryJar).value, classpathTypes := Set(tpe), - check <<= checkTask(dependencyClasspath), - checkFull <<= checkTask(fullClasspath) + check := checkTask(dependencyClasspath).value, + checkFull := checkTask(fullClasspath).value ) // define strings for defining the artifact diff --git a/sbt/src/sbt-test/dependency-management/cache-local/cache.sbt b/sbt/src/sbt-test/dependency-management/cache-local/cache.sbt index adedcc1c7..70b089e70 100644 --- a/sbt/src/sbt-test/dependency-management/cache-local/cache.sbt +++ b/sbt/src/sbt-test/dependency-management/cache-local/cache.sbt @@ -1 +1 @@ - ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / ".ivy2"))) +ivyPaths := { new IvyPaths(baseDirectory.value, Some(target.value / ".ivy2")) } diff --git a/sbt/src/sbt-test/dependency-management/cache-local/changes/resolver.sbt b/sbt/src/sbt-test/dependency-management/cache-local/changes/resolver.sbt index eb623beca..642794849 100644 --- a/sbt/src/sbt-test/dependency-management/cache-local/changes/resolver.sbt +++ b/sbt/src/sbt-test/dependency-management/cache-local/changes/resolver.sbt @@ -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 diff --git a/sbt/src/sbt-test/dependency-management/classifier/build.sbt b/sbt/src/sbt-test/dependency-management/classifier/build.sbt index ab96c9fb0..72a1c94d1 100644 --- a/sbt/src/sbt-test/dependency-management/classifier/build.sbt +++ b/sbt/src/sbt-test/dependency-management/classifier/build.sbt @@ -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" diff --git a/sbt/src/sbt-test/dependency-management/configurations/build.sbt b/sbt/src/sbt-test/dependency-management/configurations/build.sbt index 0bd0da113..47f63cd0a 100644 --- a/sbt/src/sbt-test/dependency-management/configurations/build.sbt +++ b/sbt/src/sbt-test/dependency-management/configurations/build.sbt @@ -1,7 +1,7 @@ // the default, but make it explicit publishMavenStyle := true -publishTo <<= baseDirectory(bd => Some( MavenRepository("test-repo", (bd / "repo").toURI.toASCIIString )) ) +publishTo := baseDirectory(bd => Some( MavenRepository("test-repo", (bd / "repo").toURI.toASCIIString )) ).value name := "test" diff --git a/sbt/src/sbt-test/dependency-management/configurations/changes/ivy/TestPublish.sbt b/sbt/src/sbt-test/dependency-management/configurations/changes/ivy/TestPublish.sbt index 9f1fc169b..37becf51a 100644 --- a/sbt/src/sbt-test/dependency-management/configurations/changes/ivy/TestPublish.sbt +++ b/sbt/src/sbt-test/dependency-management/configurations/changes/ivy/TestPublish.sbt @@ -1,8 +1,8 @@ publishMavenStyle := false -publishTo <<= baseDirectory { base => +publishTo := (baseDirectory { base => Some( Resolver.file("test-repo", base / "repo")(Patterns(false, Resolver.mavenStyleBasePattern)) ) -} +}).value name := "test-ivy" diff --git a/sbt/src/sbt-test/dependency-management/configurations/changes/ivy/TestUse.sbt b/sbt/src/sbt-test/dependency-management/configurations/changes/ivy/TestUse.sbt index a29853df8..7e7889c80 100644 --- a/sbt/src/sbt-test/dependency-management/configurations/changes/ivy/TestUse.sbt +++ b/sbt/src/sbt-test/dependency-management/configurations/changes/ivy/TestUse.sbt @@ -1,8 +1,8 @@ publishMavenStyle := false -resolvers <<= baseDirectory { base => +resolvers := (baseDirectory { base => Resolver.file("test-repo", base / "repo")(Patterns(false, Resolver.mavenStyleBasePattern)) :: Nil -} +}).value libraryDependencies ++= Seq( "org.example" %% "test-ivy" % "1.0", diff --git a/sbt/src/sbt-test/dependency-management/configurations/changes/maven/TestUse.sbt b/sbt/src/sbt-test/dependency-management/configurations/changes/maven/TestUse.sbt index 5acddca8b..e9af517ec 100644 --- a/sbt/src/sbt-test/dependency-management/configurations/changes/maven/TestUse.sbt +++ b/sbt/src/sbt-test/dependency-management/configurations/changes/maven/TestUse.sbt @@ -1,6 +1,6 @@ -resolvers <<= baseDirectory { base => +resolvers := (baseDirectory { base => Resolver.file("test-repo", base / "repo") :: Nil -} +}).value libraryDependencies ++= Seq( "org.example" %% "test" % "1.0", diff --git a/sbt/src/sbt-test/dependency-management/exclude-bundle/check.sbt b/sbt/src/sbt-test/dependency-management/exclude-bundle/check.sbt index a2f89121e..2433695ab 100644 --- a/sbt/src/sbt-test/dependency-management/exclude-bundle/check.sbt +++ b/sbt/src/sbt-test/dependency-management/exclude-bundle/check.sbt @@ -1,4 +1,5 @@ -TaskKey[Unit]("check") <<= update map { report => - val compatJetty = report.allModules.filter(mod => mod.name == "atmosphere-compat-jetty") - assert(compatJetty.isEmpty, "Expected dependencies to be excluded: " + compatJetty.mkString(", ")) +TaskKey[Unit]("check") := { + val report = update.value + val compatJetty = report.allModules.filter(mod => mod.name == "atmosphere-compat-jetty") + assert(compatJetty.isEmpty, "Expected dependencies to be excluded: " + compatJetty.mkString(", ")) } diff --git a/sbt/src/sbt-test/dependency-management/exclude-scala/build.sbt b/sbt/src/sbt-test/dependency-management/exclude-scala/build.sbt index d5ffa1bec..7697c37e6 100644 --- a/sbt/src/sbt-test/dependency-management/exclude-scala/build.sbt +++ b/sbt/src/sbt-test/dependency-management/exclude-scala/build.sbt @@ -4,11 +4,11 @@ lazy val scalaOverride = taskKey[Unit]("Check that the proper version of Scala i lazy val root = (project in file(".")). settings( - libraryDependencies <++= baseDirectory(dependencies), + libraryDependencies ++= baseDirectory(dependencies).value, scalaVersion := "2.9.2", ivyScala := { ivyScala.value map {_.copy(overrideScalaVersion = sbtPlugin.value)} }, - autoScalaLibrary <<= baseDirectory(base => !(base / "noscala").exists ), - scalaOverride <<= check("scala.App") + autoScalaLibrary := baseDirectory(base => !(base / "noscala").exists ).value, + scalaOverride := check("scala.App").value ) def check(className: String): Def.Initialize[Task[Unit]] = fullClasspath in Compile map { cp => diff --git a/sbt/src/sbt-test/dependency-management/exclude-transitive/build.sbt b/sbt/src/sbt-test/dependency-management/exclude-transitive/build.sbt index 5e7f0cda8..820eaecc9 100644 --- a/sbt/src/sbt-test/dependency-management/exclude-transitive/build.sbt +++ b/sbt/src/sbt-test/dependency-management/exclude-transitive/build.sbt @@ -1,9 +1,9 @@ lazy val root = (project in file(".")). settings( - ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), - libraryDependencies <+= baseDirectory(transitive("javax.mail" % "mail" % "1.4.1")), - TaskKey[Unit]("checkTransitive") <<= check(true), - TaskKey[Unit]("checkIntransitive") <<= check(false) + ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value, + libraryDependencies += baseDirectory(transitive("javax.mail" % "mail" % "1.4.1")).value, + TaskKey[Unit]("checkTransitive") := check(true).value, + TaskKey[Unit]("checkIntransitive") := check(false).value ) def transitive(dep: ModuleID)(base: File) = diff --git a/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt b/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt index 1c02cbcf5..be9c65205 100644 --- a/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt +++ b/sbt/src/sbt-test/dependency-management/extra/DefineColor.sbt @@ -1,12 +1,12 @@ -ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))) +ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value publishMavenStyle := false -publishTo <<= baseDirectory { base => +publishTo := (baseDirectory { base => Some(Resolver.file("test-repo", base / "repo" / "test")(Resolver.defaultIvyPatterns)) -} +}).value -projectID <<= projectID { _.extra("e:color" -> "red") } +projectID := (projectID { _.extra("e:color" -> "red") }).value organization := "org.scala-sbt" diff --git a/sbt/src/sbt-test/dependency-management/extra/changes/UseColor.sbt b/sbt/src/sbt-test/dependency-management/extra/changes/UseColor.sbt index 3f87d7383..59e2cabac 100644 --- a/sbt/src/sbt-test/dependency-management/extra/changes/UseColor.sbt +++ b/sbt/src/sbt-test/dependency-management/extra/changes/UseColor.sbt @@ -1,16 +1,16 @@ -ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache")) ) +ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache")) ).value publishMavenStyle := false -resolvers <<= baseDirectory( base => +resolvers := baseDirectory( base => Resolver.file("test-repo", base / "repo" / "test")(Resolver.defaultIvyPatterns) :: Nil -) +).value -libraryDependencies <<= baseDirectory { base => +libraryDependencies := (baseDirectory { base => val color = IO.read(base / "color") val dep = "org.scala-sbt" %% "define-color" % "1.0" extra("e:color" -> color) dep :: Nil -} +}).value organization := "org.example" diff --git a/sbt/src/sbt-test/dependency-management/force-update-period/build.sbt b/sbt/src/sbt-test/dependency-management/force-update-period/build.sbt index ca910bdd9..b7505be1d 100644 --- a/sbt/src/sbt-test/dependency-management/force-update-period/build.sbt +++ b/sbt/src/sbt-test/dependency-management/force-update-period/build.sbt @@ -2,7 +2,7 @@ libraryDependencies += "log4j" % "log4j" % "1.2.16" % "compile" autoScalaLibrary := false -TaskKey[Unit]("check-last-update-time") <<= streams map { (s) => +TaskKey[Unit]("check-last-update-time") := (streams map { (s) => val fullUpdateOutput = s.cacheDirectory / "out" val timeDiff = System.currentTimeMillis()-fullUpdateOutput.lastModified() val exists = fullUpdateOutput.exists() @@ -10,4 +10,4 @@ TaskKey[Unit]("check-last-update-time") <<= streams map { (s) => if (exists && timeDiff > 5000) { sys.error("Full update not perfomed") } -} \ No newline at end of file +}).value diff --git a/sbt/src/sbt-test/dependency-management/force/build.sbt b/sbt/src/sbt-test/dependency-management/force/build.sbt index d3cf67d04..819a04d06 100644 --- a/sbt/src/sbt-test/dependency-management/force/build.sbt +++ b/sbt/src/sbt-test/dependency-management/force/build.sbt @@ -1,9 +1,9 @@ lazy val root = (project in file(".")). settings( - ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), - libraryDependencies <++= baseDirectory (libraryDeps), - TaskKey[Unit]("checkForced") <<= check("1.2.14"), - TaskKey[Unit]("checkDepend") <<= check("1.2.13") + ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value, + libraryDependencies ++= baseDirectory (libraryDeps).value, + TaskKey[Unit]("checkForced") := check("1.2.14").value, + TaskKey[Unit]("checkDepend") := check("1.2.13").value ) def libraryDeps(base: File) = { diff --git a/sbt/src/sbt-test/dependency-management/info/build.sbt b/sbt/src/sbt-test/dependency-management/info/build.sbt index bf0e7f1b6..6644b2c30 100644 --- a/sbt/src/sbt-test/dependency-management/info/build.sbt +++ b/sbt/src/sbt-test/dependency-management/info/build.sbt @@ -2,14 +2,14 @@ import scala.xml._ lazy val root = (project in file(".")). settings( - ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), - ivyXML <<= (customInfo, organization, moduleName, version) apply inlineXML, + ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value, + ivyXML := ((customInfo, organization, moduleName, version) apply inlineXML).value, scalaVersion := "2.9.1", projectID ~= (_ cross false), - customInfo <<= baseDirectory{_ / "info" exists }, - TaskKey[Unit]("check-download") <<= checkDownload, - delivered <<= deliverLocal map XML.loadFile, - TaskKey[Unit]("check-info") <<= checkInfo + customInfo := (baseDirectory{_ / "info" exists }).value, + TaskKey[Unit]("check-download") := checkDownload.value, + delivered := (deliverLocal map XML.loadFile).value, + TaskKey[Unit]("check-info") := checkInfo.value ) lazy val delivered = taskKey[NodeSeq]("") diff --git a/sbt/src/sbt-test/dependency-management/inline-dependencies-a/build.sbt b/sbt/src/sbt-test/dependency-management/inline-dependencies-a/build.sbt index a0b74a7b7..9f7a50a6a 100644 --- a/sbt/src/sbt-test/dependency-management/inline-dependencies-a/build.sbt +++ b/sbt/src/sbt-test/dependency-management/inline-dependencies-a/build.sbt @@ -2,9 +2,10 @@ import sbt.internal.librarymanagement.syntax._ libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5" -ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))) +ivyPaths := baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))).value -TaskKey[Unit]("check") <<= update map { report => +TaskKey[Unit]("check") := { + val report = update.value val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") ) assert(files.nonEmpty, "ScalaCheck module not found in update report") val missing = files.filter(! _.exists) diff --git a/sbt/src/sbt-test/dependency-management/ivy-settings-b/build.sbt b/sbt/src/sbt-test/dependency-management/ivy-settings-b/build.sbt index ff8f57015..17de0f07f 100644 --- a/sbt/src/sbt-test/dependency-management/ivy-settings-b/build.sbt +++ b/sbt/src/sbt-test/dependency-management/ivy-settings-b/build.sbt @@ -4,7 +4,9 @@ externalIvySettings() libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5" -TaskKey[Unit]("check") <<= (baseDirectory, update) map { (base, report) => +TaskKey[Unit]("check") := { + val base = baseDirectory.value + val report = update.value val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") ) assert(files.nonEmpty, "ScalaCheck module not found in update report") -} \ No newline at end of file +} diff --git a/sbt/src/sbt-test/dependency-management/ivy-settings-c/build.sbt b/sbt/src/sbt-test/dependency-management/ivy-settings-c/build.sbt index 074279b36..a8425099e 100644 --- a/sbt/src/sbt-test/dependency-management/ivy-settings-c/build.sbt +++ b/sbt/src/sbt-test/dependency-management/ivy-settings-c/build.sbt @@ -1,7 +1,7 @@ lazy val commonSettings = Seq( autoScalaLibrary := false, ivyScala := None, - unmanagedJars in Compile <++= scalaInstance map (_.allJars.toSeq), + unmanagedJars in Compile ++= (scalaInstance map (_.allJars.toSeq)).value, publishArtifact in packageSrc := false, publishArtifact in packageDoc := false, publishMavenStyle := false @@ -12,9 +12,9 @@ lazy val dep = project. commonSettings, organization := "org.example", version := "1.0", - publishTo <<= baseDirectory in ThisBuild apply { base => + publishTo := (baseDirectory in ThisBuild apply { base => Some(Resolver.file("file", base / "repo")(Resolver.ivyStylePatterns)) - } + }).value ) lazy val use = project. @@ -22,11 +22,11 @@ lazy val use = project. commonSettings, libraryDependencies += "org.example" %% "dep" % "1.0", externalIvySettings(), - publishTo <<= baseDirectory { base => + publishTo := (baseDirectory { base => Some(Resolver.file("file", base / "repo")(Resolver.ivyStylePatterns)) - }, - TaskKey[Unit]("check") <<= baseDirectory map {base => + }).value, + TaskKey[Unit]("check") := (baseDirectory map {base => val inCache = ( (base / "target" / "use-cache") ** "*.jar").get assert(inCache.isEmpty, "Cache contained jars: " + inCache) - } + }).value ) diff --git a/sbt/src/sbt-test/dependency-management/ivy-settings-multi-a/build.sbt b/sbt/src/sbt-test/dependency-management/ivy-settings-multi-a/build.sbt index 28330f49c..d218debd4 100644 --- a/sbt/src/sbt-test/dependency-management/ivy-settings-multi-a/build.sbt +++ b/sbt/src/sbt-test/dependency-management/ivy-settings-multi-a/build.sbt @@ -1,6 +1,6 @@ lazy val commonSettings = Seq( autoScalaLibrary := false, - unmanagedJars in Compile <++= scalaInstance map (_.allJars.toSeq) + unmanagedJars in Compile ++= (scalaInstance map (_.allJars.toSeq)).value ) lazy val dep = project. diff --git a/sbt/src/sbt-test/dependency-management/make-pom-type/build.sbt b/sbt/src/sbt-test/dependency-management/make-pom-type/build.sbt index 524b569d3..6d9005519 100644 --- a/sbt/src/sbt-test/dependency-management/make-pom-type/build.sbt +++ b/sbt/src/sbt-test/dependency-management/make-pom-type/build.sbt @@ -31,7 +31,8 @@ lazy val expectedInter = 1.0 -def checkTask(expectedDep: xml.Elem) = TaskKey[Unit]("checkPom") <<= makePom map { file => +def checkTask(expectedDep: xml.Elem) = TaskKey[Unit]("checkPom") := { + val file = makePom.value val pom = xml.XML.loadFile(file) val actual = pom \\ "dependencies" val expected = diff --git a/sbt/src/sbt-test/dependency-management/make-pom/build.sbt b/sbt/src/sbt-test/dependency-management/make-pom/build.sbt index 07e508a41..adc041a9c 100644 --- a/sbt/src/sbt-test/dependency-management/make-pom/build.sbt +++ b/sbt/src/sbt-test/dependency-management/make-pom/build.sbt @@ -2,10 +2,10 @@ import scala.xml._ lazy val root = (project in file(".")). settings( - readPom <<= makePom map XML.loadFile, - TaskKey[Unit]("checkPom") <<= checkPom, - TaskKey[Unit]("checkExtra") <<= checkExtra, - TaskKey[Unit]("checkVersionPlusMapping") <<= checkVersionPlusMapping, + readPom := (makePom map XML.loadFile).value, + TaskKey[Unit]("checkPom") := checkPom.value, + TaskKey[Unit]("checkExtra") := checkExtra.value, + TaskKey[Unit]("checkVersionPlusMapping") := checkVersionPlusMapping.value, resolvers += Resolver.sonatypeRepo("snapshots"), makePomConfiguration ~= { _.copy(extra = ) }, libraryDependencies += "com.google.code.findbugs" % "jsr305" % "1.3.+" diff --git a/sbt/src/sbt-test/dependency-management/metadata-only-resolver/build.sbt b/sbt/src/sbt-test/dependency-management/metadata-only-resolver/build.sbt index 98e8b7518..05b5fd161 100644 --- a/sbt/src/sbt-test/dependency-management/metadata-only-resolver/build.sbt +++ b/sbt/src/sbt-test/dependency-management/metadata-only-resolver/build.sbt @@ -1,4 +1,4 @@ -ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / ".ivy2"))) +ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / ".ivy2"))).value // not in the default repositories libraryDependencies += "com.sun.jmx" % "jmxri" % "1.2.1" diff --git a/sbt/src/sbt-test/dependency-management/module-confs/common.sbt b/sbt/src/sbt-test/dependency-management/module-confs/common.sbt index a22544b6e..c24da6b6e 100644 --- a/sbt/src/sbt-test/dependency-management/module-confs/common.sbt +++ b/sbt/src/sbt-test/dependency-management/module-confs/common.sbt @@ -1,9 +1,9 @@ ivyScala ~= { (is: Option[IvyScala]) => is.map(_.copy(checkExplicit = false, overrideScalaVersion = false, filterImplicit = false)) } -ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))) +ivyPaths := baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))).value libraryDependencies += "junit" % "junit" % "4.8" autoScalaLibrary := false -cleanFiles <+= baseDirectory(_ / "ivy-home") \ No newline at end of file +cleanFiles += baseDirectory(_ / "ivy-home").value diff --git a/sbt/src/sbt-test/dependency-management/module-name/build.sbt b/sbt/src/sbt-test/dependency-management/module-name/build.sbt index a850df961..95bc29025 100644 --- a/sbt/src/sbt-test/dependency-management/module-name/build.sbt +++ b/sbt/src/sbt-test/dependency-management/module-name/build.sbt @@ -4,8 +4,8 @@ moduleName := "asdf" crossPaths := false -TaskKey[Unit]("checkName") <<= (moduleName, name, packageBin in Compile) map { (module, n, f) => +TaskKey[Unit]("checkName") := ((moduleName, name, packageBin in Compile) map { (module, n, f) => val path = f.getAbsolutePath assert(path contains module, "Path " + path + " did not contain module name " + module) assert(!path.contains(n), "Path " + path + " contained " + n) -} +}).value diff --git a/sbt/src/sbt-test/dependency-management/multiple-classifiers/build.sbt b/sbt/src/sbt-test/dependency-management/multiple-classifiers/build.sbt index d3fbdcf1e..d18d8e278 100644 --- a/sbt/src/sbt-test/dependency-management/multiple-classifiers/build.sbt +++ b/sbt/src/sbt-test/dependency-management/multiple-classifiers/build.sbt @@ -4,11 +4,12 @@ libraryDependencies ++= Seq("natives-windows", "natives-linux", "natives-osx") m autoScalaLibrary := false -TaskKey[Unit]("check") <<= dependencyClasspath in Compile map { cp => +TaskKey[Unit]("check") := (dependencyClasspath in Compile map { cp => assert(cp.size == 3, "Expected 3 jars, got: " + cp.files.mkString("(", ", ", ")")) -} +}).value -TaskKey[Unit]("checkPom") <<= makePom map { file => +TaskKey[Unit]("checkPom") := { + val file = makePom.value val pom = xml.XML.loadFile(file) val actual = pom \\ "dependencies" def depSection(classifier: String) = diff --git a/sbt/src/sbt-test/dependency-management/multiple-classifiers/changes/non-mergeable.sbt b/sbt/src/sbt-test/dependency-management/multiple-classifiers/changes/non-mergeable.sbt index caac80653..e41cc71f6 100644 --- a/sbt/src/sbt-test/dependency-management/multiple-classifiers/changes/non-mergeable.sbt +++ b/sbt/src/sbt-test/dependency-management/multiple-classifiers/changes/non-mergeable.sbt @@ -4,10 +4,11 @@ libraryDependencies ++= Seq( autoScalaLibrary := false -TaskKey[Unit]("check") <<= (externalDependencyClasspath in Compile, externalDependencyClasspath in Test) map { (cp, tcp) => +TaskKey[Unit]("check") := { + val cp = (externalDependencyClasspath in Compile).value + val tcp = (externalDependencyClasspath in Test).value assert(cp.size == 2, "Expected 2 jars on compile classpath, got: " + cp.files.mkString("(", ", ", ")")) // this should really be 1 because of intransitive(), but Ivy doesn't handle this. // So, this test can only check that the assertion reported in #582 isn't triggered. assert(tcp.size == 2, "Expected 2 jar on test classpath, got: " + tcp.files.mkString("(", ", ", ")")) } - diff --git a/sbt/src/sbt-test/dependency-management/no-file-fails-publish/build.sbt b/sbt/src/sbt-test/dependency-management/no-file-fails-publish/build.sbt index 829a4b18f..15c50d013 100644 --- a/sbt/src/sbt-test/dependency-management/no-file-fails-publish/build.sbt +++ b/sbt/src/sbt-test/dependency-management/no-file-fails-publish/build.sbt @@ -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" diff --git a/sbt/src/sbt-test/dependency-management/override/build.sbt b/sbt/src/sbt-test/dependency-management/override/build.sbt index 299af2d5b..ba454e7d3 100644 --- a/sbt/src/sbt-test/dependency-management/override/build.sbt +++ b/sbt/src/sbt-test/dependency-management/override/build.sbt @@ -1,16 +1,16 @@ autoScalaLibrary := false -ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))) +ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value -ivyScala <<= (scalaVersion in update, scalaBinaryVersion in update) { (fv, bv) => +ivyScala := ((scalaVersion in update, scalaBinaryVersion in update) { (fv, bv) => Some(new IvyScala(fv, bv, Nil, filterImplicit = false, checkExplicit = false, overrideScalaVersion = false)) -} +}).value -InputKey[Unit]("check") <<= inputTask { args => +InputKey[Unit]("check") := (inputTask { args => (update, args) map { case (report, Seq(expected, _*)) => report.allModules.forall(_.revision == expected) } -} +}).evaluated scalaVersion := "2.9.1" \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/pom-advanced/build.sbt b/sbt/src/sbt-test/dependency-management/pom-advanced/build.sbt index dd14d2862..8db20a07c 100644 --- a/sbt/src/sbt-test/dependency-management/pom-advanced/build.sbt +++ b/sbt/src/sbt-test/dependency-management/pom-advanced/build.sbt @@ -3,11 +3,11 @@ import complete.DefaultParsers._ lazy val root = (project in file(".")). settings( resolvers ++= Seq(local, Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("snapshots")), - InputKey[Unit]("checkPom") <<= InputTask(_ => spaceDelimited("")) { result => (makePom, result, streams) map checkPomRepositories }, - makePomConfiguration <<= (makePomConfiguration, baseDirectory) { (conf, base) => + InputKey[Unit]("checkPom") := (InputTask(_ => spaceDelimited("")) { result => (makePom, result, streams) map checkPomRepositories }).evaluated, + makePomConfiguration := ((makePomConfiguration, baseDirectory) { (conf, base) => conf.copy(filterRepositories = pomIncludeRepository(base, conf.filterRepositories) ) - }, - ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))) + }).value, + ivyPaths := baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))).value ) val local = "local-maven-repo" at "file://" + (Path.userHome / ".m2" /"repository").absolutePath diff --git a/sbt/src/sbt-test/dependency-management/pom-classpaths/build.sbt b/sbt/src/sbt-test/dependency-management/pom-classpaths/build.sbt index cd5d8fb2b..ea5889151 100644 --- a/sbt/src/sbt-test/dependency-management/pom-classpaths/build.sbt +++ b/sbt/src/sbt-test/dependency-management/pom-classpaths/build.sbt @@ -5,8 +5,8 @@ lazy val root = (project in file(".")). settings( externalPom(), scalaVersion := "2.9.0-1", - check <<= checkTask, - managedClasspath in Provided <<= (classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) } + check := checkTask.evaluated, + managedClasspath in Provided := ((classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) }).value ) def checkTask = InputTask(_ => parser ) { result => @@ -15,7 +15,7 @@ def checkTask = InputTask(_ => parser ) { result => checkClasspath(conf match { case Provided => p case Compile => c - case Test => t + case Test => t case Runtime => r }, names.toSet) } diff --git a/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt b/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt index d9c036978..6977b4fea 100644 --- a/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt +++ b/sbt/src/sbt-test/dependency-management/pom-scope/build.sbt @@ -3,7 +3,7 @@ lazy val custom = config("custom") lazy val root = (project in file(".")). configs(custom). settings( - TaskKey[Unit]("checkPom") <<= checkPom, + TaskKey[Unit]("checkPom") := checkPom.value, libraryDependencies ++= Seq( "a" % "a" % "1.0", "b" % "b" % "1.0" % "runtime,optional", diff --git a/sbt/src/sbt-test/dependency-management/provided-multi/changes/p.sbt b/sbt/src/sbt-test/dependency-management/provided-multi/changes/p.sbt index 3dc6dc210..33584366f 100644 --- a/sbt/src/sbt-test/dependency-management/provided-multi/changes/p.sbt +++ b/sbt/src/sbt-test/dependency-management/provided-multi/changes/p.sbt @@ -12,8 +12,8 @@ lazy val a = project. lazy val b = project. dependsOn(a). settings( - libraryDependencies <<= declared(d => if(d) Seq("org.scala-tools.sbinary" %% "sbinary" % "0.4.0" % "provided") else Nil), - declared <<= baseDirectory(_ / "declare.lib" exists), + libraryDependencies := declared(d => if(d) Seq("org.scala-tools.sbinary" %% "sbinary" % "0.4.0" % "provided") else Nil).value, + declared := baseDirectory(_ / "declare.lib" exists).value, configIvyScala, scalaBinaryVersion in update := "2.9.0" ) diff --git a/sbt/src/sbt-test/dependency-management/provided/build.sbt b/sbt/src/sbt-test/dependency-management/provided/build.sbt index c5d4a8def..fd7634e61 100644 --- a/sbt/src/sbt-test/dependency-management/provided/build.sbt +++ b/sbt/src/sbt-test/dependency-management/provided/build.sbt @@ -5,16 +5,16 @@ val check = InputKey[Unit]("check") lazy val root = (project in file(".")). settings( - provided <<= baseDirectory(_ / "useProvided" exists), - configuration <<= provided(p => if(p) Provided else Compile), - libraryDependencies <+= configuration(c => "javax.servlet" % "servlet-api" % "2.5" % c.name), - managedClasspath in Provided <<= (classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) }, - check <<= InputTask(_ => Space ~> token(Compile.name.id | Runtime.name | Provided.name | Test.name) ~ token(Space ~> Bool)) { result => + provided := baseDirectory(_ / "useProvided" exists).value, + configuration := provided(p => if(p) Provided else Compile).value, + libraryDependencies += configuration(c => "javax.servlet" % "servlet-api" % "2.5" % c.name).value, + managedClasspath in Provided := ((classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) }).value, + check := (InputTask(_ => Space ~> token(Compile.name.id | Runtime.name | Provided.name | Test.name) ~ token(Space ~> Bool)) { result => (result, managedClasspath in Provided, fullClasspath in Runtime, fullClasspath in Compile, fullClasspath in Test) map { case ((conf, expected), p, r, c, t) => val cp = if(conf == Compile.name) c else if(conf == Runtime.name) r else if(conf == Provided.name) p else if(conf == Test.name) t else sys.error("Invalid config: " + conf) checkServletAPI(cp.files, expected, conf) } - } + }).evaluated ) def checkServletAPI(paths: Seq[File], shouldBeIncluded: Boolean, label: String) = diff --git a/sbt/src/sbt-test/dependency-management/publish-local/build.sbt b/sbt/src/sbt-test/dependency-management/publish-local/build.sbt index 4e5fa7e4c..d7aaf442c 100644 --- a/sbt/src/sbt-test/dependency-management/publish-local/build.sbt +++ b/sbt/src/sbt-test/dependency-management/publish-local/build.sbt @@ -4,8 +4,8 @@ lazy val root = (project in file(".")). settings(inThisBuild(List( organization := "A", version := "1.0", - ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ), - externalResolvers <<= baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil } + ivyPaths := baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ).value, + externalResolvers := (baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }).value )), mavenStyle, interProject, @@ -18,7 +18,7 @@ lazy val sub = project. name := "Sub Project" ) -lazy val mavenStyle = publishMavenStyle <<= baseDirectory { base => (base / "mavenStyle") exists } +lazy val mavenStyle = publishMavenStyle := (baseDirectory { base => (base / "mavenStyle") exists }).value def interProject = - projectDependencies <<= (publishMavenStyle, publishMavenStyle in sub, projectDependencies) map { (style, subStyle, pd) => if(style == subStyle) pd else Nil } + projectDependencies := ((publishMavenStyle, publishMavenStyle in sub, projectDependencies) map { (style, subStyle, pd) => if(style == subStyle) pd else Nil }).value diff --git a/sbt/src/sbt-test/dependency-management/publish-local/changes/RetrieveTest.sbt b/sbt/src/sbt-test/dependency-management/publish-local/changes/RetrieveTest.sbt index 6ff7b2501..9f1617128 100644 --- a/sbt/src/sbt-test/dependency-management/publish-local/changes/RetrieveTest.sbt +++ b/sbt/src/sbt-test/dependency-management/publish-local/changes/RetrieveTest.sbt @@ -2,16 +2,16 @@ lazy val root = (project in file(".")). settings(inThisBuild(List( organization := "A", version := "1.0", - ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ), - externalResolvers <<= baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil } + ivyPaths := baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy" / "cache")) ).value, + externalResolvers := (baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }).value )), mavenStyle, name := "Retrieve Test", - libraryDependencies <<= publishMavenStyle { style => if(style) mavenStyleDependencies else ivyStyleDependencies } + libraryDependencies := (publishMavenStyle { style => if(style) mavenStyleDependencies else ivyStyleDependencies }).value ) -lazy val mavenStyle = publishMavenStyle <<= baseDirectory { base => (base / "mavenStyle") exists } +lazy val mavenStyle = publishMavenStyle := (baseDirectory { base => (base / "mavenStyle") exists }).value def ivyStyleDependencies = parentDep("A") :: subDep("A") :: subDep("B") ::parentDep("D") :: Nil def mavenStyleDependencies = parentDep("B") :: parentDep("C") :: subDep("C") :: subDep("D") :: Nil diff --git a/sbt/src/sbt-test/dependency-management/sources/build.sbt b/sbt/src/sbt-test/dependency-management/sources/build.sbt index 08d617ea8..5fa6d7405 100644 --- a/sbt/src/sbt-test/dependency-management/sources/build.sbt +++ b/sbt/src/sbt-test/dependency-management/sources/build.sbt @@ -7,8 +7,8 @@ lazy val root = (project in file(".")). autoScalaLibrary := false, managedScalaInstance := false, transitiveClassifiers := Seq("sources"), - TaskKey[Unit]("checkSources") <<= updateClassifiers map checkSources, - TaskKey[Unit]("checkBinaries") <<= update map checkBinaries + TaskKey[Unit]("checkSources") := (updateClassifiers map checkSources).value, + TaskKey[Unit]("checkBinaries") := (update map checkBinaries).value ) def getSources(report: UpdateReport) = report.matching(artifactFilter(`classifier` = "sources") ) diff --git a/sbt/src/sbt-test/dependency-management/t468/build.sbt b/sbt/src/sbt-test/dependency-management/t468/build.sbt index a2a7fce0e..ab4051a0c 100644 --- a/sbt/src/sbt-test/dependency-management/t468/build.sbt +++ b/sbt/src/sbt-test/dependency-management/t468/build.sbt @@ -1,23 +1,24 @@ autoScalaLibrary := false -ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))) +ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value libraryDependencies ++= Seq( "org.sat4j" % "org.sat4j.pb" % "2.3.1", "org.sat4j" % "org.sat4j.core" % "2.3.1" ) -TaskKey[Unit]("checkUpdate") <<= update map { report => +TaskKey[Unit]("checkUpdate") := { + val report = update.value val mods = report.configuration(Compile.name).get.allModules.map(_.name).toSet val expected = Set("org.sat4j.pb", "org.sat4j.core") if(mods != expected) error("Expected modules " + expected + ", got: " + mods) } -TaskKey[Unit]("checkClasspath") <<= dependencyClasspath in Compile map { cp => +TaskKey[Unit]("checkClasspath") := (dependencyClasspath in Compile map { cp => val jars = cp.files.map(_.getName).toSet // Note: pb depends on tests artifact in core for no good reason. Previously this was not correctly added to the classpath. val expected = Set("org.sat4j.pb-2.3.1.jar", "org.sat4j.core-2.3.1.jar", "org.sat4j.core-2.3.1-tests.jar") if(jars != expected) error("Expected jars " + expected + ", got: " + jars) -} +}).value diff --git a/sbt/src/sbt-test/dependency-management/url/build.sbt b/sbt/src/sbt-test/dependency-management/url/build.sbt index d1d0d0e98..14273cc1b 100644 --- a/sbt/src/sbt-test/dependency-management/url/build.sbt +++ b/sbt/src/sbt-test/dependency-management/url/build.sbt @@ -2,11 +2,11 @@ import sbt.internal.inc.classpath.ClasspathUtilities lazy val root = (project in file(".")). settings( - ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), + ivyPaths := (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value, libraryDependencies += "org.jsoup" % "jsoup" % "1.9.1" % Test from "http://jsoup.org/packages/jsoup-1.9.1.jar", ivyLoggingLevel := UpdateLogging.Full, - TaskKey[Unit]("checkInTest") <<= checkClasspath(Test), - TaskKey[Unit]("checkInCompile") <<= checkClasspath(Compile) + TaskKey[Unit]("checkInTest") := checkClasspath(Test).value, + TaskKey[Unit]("checkInCompile") := checkClasspath(Compile).value ) def checkClasspath(conf: Configuration) = diff --git a/sbt/src/sbt-test/java/argfile/build.sbt b/sbt/src/sbt-test/java/argfile/build.sbt index 70bf4e0b6..5ce2c66e1 100644 --- a/sbt/src/sbt-test/java/argfile/build.sbt +++ b/sbt/src/sbt-test/java/argfile/build.sbt @@ -1,12 +1,11 @@ -scalaSource in Configurations.Compile <<= sourceDirectory( _ / " scala test " ) +scalaSource in Configurations.Compile := sourceDirectory( _ / " scala test " ).value -javaSource in Configurations.Compile <<= sourceDirectory( _ / " java test " ) +javaSource in Configurations.Compile := sourceDirectory( _ / " java test " ).value -TaskKey[Unit]("init") <<= (scalaSource in Configurations.Compile, javaSource in Configurations.Compile) map { (ss, js) => +TaskKey[Unit]("init") := ((scalaSource in Configurations.Compile, javaSource in Configurations.Compile) map { (ss, js) => import IO._ createDirectories(ss :: js :: Nil) copyFile(file("changes") / "Test.scala", ss / " Test s.scala") copyFile(file("changes") / "A.java", js / "a" / "A.java") delete(file("changes")) -} - \ No newline at end of file +}).value diff --git a/sbt/src/sbt-test/package/manifest/build.sbt b/sbt/src/sbt-test/package/manifest/build.sbt index 6f00588e5..e12b8db8d 100644 --- a/sbt/src/sbt-test/package/manifest/build.sbt +++ b/sbt/src/sbt-test/package/manifest/build.sbt @@ -9,7 +9,7 @@ crossPaths := false mainClass := Some("jartest.Main") -packageOptions in (Compile, packageBin) <<= (packageOptions in (Compile, packageBin), scalaInstance) map { (opts, si) => +packageOptions in (Compile, packageBin) := ((packageOptions in (Compile, packageBin), scalaInstance) map { (opts, si) => def manifestExtra = { val mf = new Manifest @@ -17,4 +17,4 @@ packageOptions in (Compile, packageBin) <<= (packageOptions in (Compile, package mf } opts :+ Package.JarManifest(manifestExtra) -} +}).value diff --git a/sbt/src/sbt-test/package/resources/build.sbt b/sbt/src/sbt-test/package/resources/build.sbt index 7fe8d5b24..a1942fed7 100644 --- a/sbt/src/sbt-test/package/resources/build.sbt +++ b/sbt/src/sbt-test/package/resources/build.sbt @@ -4,7 +4,7 @@ version := "0.1" crossPaths := false -packageOptions <<= (packageOptions, scalaInstance) map { (opts, si) => +packageOptions := ((packageOptions, scalaInstance) map { (opts, si) => def manifestExtra = { import java.util.jar._ @@ -13,4 +13,4 @@ packageOptions <<= (packageOptions, scalaInstance) map { (opts, si) => mf } Package.JarManifest(manifestExtra) +: opts -} \ No newline at end of file +}).value diff --git a/sbt/src/sbt-test/project/auto-import/project/P.scala b/sbt/src/sbt-test/project/auto-import/project/P.scala index cc5720ba2..0ff8fbd51 100644 --- a/sbt/src/sbt-test/project/auto-import/project/P.scala +++ b/sbt/src/sbt-test/project/auto-import/project/P.scala @@ -22,8 +22,8 @@ package name.example { import autoImport._ override def projectSettings = Seq[Setting[_]]( - checkMaxErrors <<= Keys.maxErrors map { me => assert(me == xyz, "Expected maxErrors to be " + xyz + ", but it was " + me ) }, - checkName <<= Keys.name map { n => assert(n == "Demo", "Expected name to be 'Demo', but it was '" + n + "'" ) } + checkMaxErrors := (Keys.maxErrors map { me => assert(me == xyz, "Expected maxErrors to be " + xyz + ", but it was " + me ) }).value, + checkName := (Keys.name map { n => assert(n == "Demo", "Expected name to be 'Demo', but it was '" + n + "'" ) }).value ) } } diff --git a/sbt/src/sbt-test/project/auto-plugins-default-requires-jvmplugin/build.sbt b/sbt/src/sbt-test/project/auto-plugins-default-requires-jvmplugin/build.sbt index d23089916..601ed7611 100644 --- a/sbt/src/sbt-test/project/auto-plugins-default-requires-jvmplugin/build.sbt +++ b/sbt/src/sbt-test/project/auto-plugins-default-requires-jvmplugin/build.sbt @@ -1,8 +1,8 @@ val test123 = project in file(".") enablePlugins TestP settings( - resourceGenerators in Compile <+= Def.task { + resourceGenerators in Compile += (Def.task { streams.value.log info "resource generated in settings" Nil - } + }).taskValue ) TaskKey[Unit]("check") := { diff --git a/sbt/src/sbt-test/project/auto-plugins-default-requires-jvmplugin/project/TestP.scala b/sbt/src/sbt-test/project/auto-plugins-default-requires-jvmplugin/project/TestP.scala index 6efbbeaa2..ce7b6f707 100644 --- a/sbt/src/sbt-test/project/auto-plugins-default-requires-jvmplugin/project/TestP.scala +++ b/sbt/src/sbt-test/project/auto-plugins-default-requires-jvmplugin/project/TestP.scala @@ -2,9 +2,9 @@ import sbt._, syntax._, Keys._ object TestP extends AutoPlugin { override def projectSettings: Seq[Setting[_]] = Seq( - resourceGenerators in Compile <+= Def.task { + resourceGenerators in Compile += (Def.task { streams.value.log info "resource generated in plugin" Nil - } + }).taskValue ) } diff --git a/sbt/src/sbt-test/project/build-deps/changes/b.sbt b/sbt/src/sbt-test/project/build-deps/changes/b.sbt index a316d19df..4de1f967f 100644 --- a/sbt/src/sbt-test/project/build-deps/changes/b.sbt +++ b/sbt/src/sbt-test/project/build-deps/changes/b.sbt @@ -1,3 +1,3 @@ -buildDependencies in Global <<= (buildDependencies in Global, thisProjectRef, thisProjectRef in LocalProject("a")) { (deps, refB, refA) => +buildDependencies in Global := ((buildDependencies in Global, thisProjectRef, thisProjectRef in LocalProject("a")) { (deps, refB, refA) => deps.addClasspath(refA, ResolvedClasspathDependency(refB, None)) -} +}).value diff --git a/sbt/src/sbt-test/project/global-plugin/changes/build.sbt b/sbt/src/sbt-test/project/global-plugin/changes/build.sbt index 0ed1660fb..26bad9260 100644 --- a/sbt/src/sbt-test/project/global-plugin/changes/build.sbt +++ b/sbt/src/sbt-test/project/global-plugin/changes/build.sbt @@ -4,7 +4,7 @@ lazy val proj = (project in file(".")). settings( name := "my-test-proj", organization := "com.example", - check <<= update map checkVersion, + check := (update map checkVersion).value, version := "0.1.0-SNAPSHOT" ) diff --git a/sbt/src/sbt-test/project/load-hooks/build.sbt b/sbt/src/sbt-test/project/load-hooks/build.sbt index 00e68d9b6..60d7a7a36 100644 --- a/sbt/src/sbt-test/project/load-hooks/build.sbt +++ b/sbt/src/sbt-test/project/load-hooks/build.sbt @@ -13,7 +13,7 @@ ) } -InputKey[Unit]("checkCount") <<= inputTask { argsTask => +InputKey[Unit]("checkCount") := (inputTask { argsTask => (argsTask, state) map { (args, s) => def get(label: String) = s get AttributeKey[Int](label) getOrElse 0 val loadCount = get("load-count") @@ -23,4 +23,4 @@ InputKey[Unit]("checkCount") <<= inputTask { argsTask => assert(expectedLoad == loadCount, "Expected load count: " + expectedLoad + ", got: " + loadCount) assert(expectedUnload == unloadCount, "Expected unload count: " + expectedUnload + ", got: " + unloadCount) } -} +}).evaluated diff --git a/sbt/src/sbt-test/project/provided/build.sbt b/sbt/src/sbt-test/project/provided/build.sbt index 04db88aea..ae80958f7 100644 --- a/sbt/src/sbt-test/project/provided/build.sbt +++ b/sbt/src/sbt-test/project/provided/build.sbt @@ -13,7 +13,7 @@ lazy val sub = project lazy val rootRef = LocalProject("root") -def rootSettings = (TaskKey[Unit]("check") <<= checkTask) +def rootSettings = (TaskKey[Unit]("check") := checkTask.value) def checkTask = (fullClasspath in (rootRef, Compile), fullClasspath in (rootRef, Runtime), fullClasspath in (rootRef, Test), fullClasspath in (sub, Test), fullClasspath in (superRoot, Compile)) map { (rc, rr, rt, st, pr) => check0(st, "sub test", true) check0(pr, "superRoot main", false) diff --git a/sbt/src/sbt-test/project/scala-loader/build.sbt b/sbt/src/sbt-test/project/scala-loader/build.sbt index 5104db211..4f5209d51 100644 --- a/sbt/src/sbt-test/project/scala-loader/build.sbt +++ b/sbt/src/sbt-test/project/scala-loader/build.sbt @@ -6,7 +6,7 @@ def checkTask = subs.map(sub => scalaInstance in LocalProject(sub.id)).join.map lazy val root = (project in file(".")). settings( - checkLoaders <<= checkTask, + checkLoaders := checkTask.value, concurrentRestrictions := Nil ) diff --git a/sbt/src/sbt-test/project/scripted-plugin/project/plugins.sbt b/sbt/src/sbt-test/project/scripted-plugin/project/plugins.sbt index db3e94022..529e7d656 100644 --- a/sbt/src/sbt-test/project/scripted-plugin/project/plugins.sbt +++ b/sbt/src/sbt-test/project/scripted-plugin/project/plugins.sbt @@ -1,3 +1,3 @@ -libraryDependencies <+= sbtVersion { sv => - "org.scala-sbt" %% "scripted-plugin" % sv +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value } diff --git a/sbt/src/sbt-test/project/scripted13/build.sbt b/sbt/src/sbt-test/project/scripted13/build.sbt index c7203498b..45efde4f0 100644 --- a/sbt/src/sbt-test/project/scripted13/build.sbt +++ b/sbt/src/sbt-test/project/scripted13/build.sbt @@ -1,6 +1,6 @@ scriptedSettings -scriptedSbt <<= sbtVersion +scriptedSbt := sbtVersion.value sbtPlugin := true diff --git a/sbt/src/sbt-test/project/scripted13/project/plugins.sbt b/sbt/src/sbt-test/project/scripted13/project/plugins.sbt index 56c9892bd..a2a45d929 100644 --- a/sbt/src/sbt-test/project/scripted13/project/plugins.sbt +++ b/sbt/src/sbt-test/project/scripted13/project/plugins.sbt @@ -1,5 +1,5 @@ -libraryDependencies <+= sbtVersion { sbtv => - "org.scala-sbt" %% "scripted-plugin" % sbtv +libraryDependencies += { + "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value } offline := true diff --git a/sbt/src/sbt-test/project/session-save/build.check.1 b/sbt/src/sbt-test/project/session-save/build.check.1 index 6a74daa67..c21f29a34 100644 --- a/sbt/src/sbt-test/project/session-save/build.check.1 +++ b/sbt/src/sbt-test/project/session-save/build.check.1 @@ -1,6 +1,6 @@ k1 := {error("k1")} -k2 <<= k1 map identity +k2 := (k1 map identity).value k3 := { diff --git a/sbt/src/sbt-test/project/session-save/build.check.2 b/sbt/src/sbt-test/project/session-save/build.check.2 index 99b769797..b74d26e1a 100644 --- a/sbt/src/sbt-test/project/session-save/build.check.2 +++ b/sbt/src/sbt-test/project/session-save/build.check.2 @@ -1,6 +1,6 @@ k1 := {} -k2 <<= k1 map identity +k2 := (k1 map identity).value k3 := { diff --git a/sbt/src/sbt-test/project/session-save/build.check.3 b/sbt/src/sbt-test/project/session-save/build.check.3 index 9a964b29a..32ebb5323 100644 --- a/sbt/src/sbt-test/project/session-save/build.check.3 +++ b/sbt/src/sbt-test/project/session-save/build.check.3 @@ -11,5 +11,5 @@ k3 := { k4 := { }; k5 := () -k1 <<= k1 map {_ => sys.error("k1")} +k1 := (k1 map {_ => sys.error("k1")}).value diff --git a/sbt/src/sbt-test/project/session-save/build.check.4 b/sbt/src/sbt-test/project/session-save/build.check.4 index 5d1bcd5b2..f8931ecf3 100644 --- a/sbt/src/sbt-test/project/session-save/build.check.4 +++ b/sbt/src/sbt-test/project/session-save/build.check.4 @@ -11,7 +11,7 @@ k3 := { k4 := { }; k5 := () -k1 <<= k1 map {_ => sys.error("k1")} +k1 := (k1 map {_ => sys.error("k1")}).value k4 := { val x = k4.value; () } diff --git a/sbt/src/sbt-test/project/session-save/build.check.5 b/sbt/src/sbt-test/project/session-save/build.check.5 index 3f5ec19f4..fa7e2b007 100644 --- a/sbt/src/sbt-test/project/session-save/build.check.5 +++ b/sbt/src/sbt-test/project/session-save/build.check.5 @@ -11,5 +11,5 @@ k3 := { k4 := (); k5 := () -k1 <<= k1 map {_ => sys.error("k1")} +k1 := (k1 map {_ => sys.error("k1")}).value diff --git a/sbt/src/sbt-test/project/session-save/disabled b/sbt/src/sbt-test/project/session-save/disabled index 00d54c883..3c164fb74 100644 --- a/sbt/src/sbt-test/project/session-save/disabled +++ b/sbt/src/sbt-test/project/session-save/disabled @@ -3,7 +3,7 @@ > reload -> k1 -> set k2 <<= k1 map identity +> set k2 := (k1 map identity).value > session save > reload -> k2 @@ -16,7 +16,7 @@ $ must-mirror build.sbt build.check.1 > k2 $ must-mirror build.sbt build.check.2 -> set k1 <<= k1 map {_ => sys.error("k1")} +> set k1 := (k1 map {_ => sys.error("k1")}).value > set k2 := {} > session save > reload diff --git a/sbt/src/sbt-test/project/transitive-plugins/a/build.sbt b/sbt/src/sbt-test/project/transitive-plugins/a/build.sbt index 8d7cbb57b..9ee2cb6a7 100644 --- a/sbt/src/sbt-test/project/transitive-plugins/a/build.sbt +++ b/sbt/src/sbt-test/project/transitive-plugins/a/build.sbt @@ -1,10 +1,10 @@ -publishTo <<= (baseDirectory in ThisBuild)(x => +publishTo := (baseDirectory in ThisBuild)(x => Some(Resolver.file("test-publish", x / "repo/")) -) +).value -resolvers <+= (baseDirectory in ThisBuild)(x => +resolvers += (baseDirectory in ThisBuild)(x => "test" at (x / "repo/").asURL.toString -) +).value name := "demo1" diff --git a/sbt/src/sbt-test/project/transitive-plugins/b/build.sbt b/sbt/src/sbt-test/project/transitive-plugins/b/build.sbt index 916ad0935..57803aeb4 100644 --- a/sbt/src/sbt-test/project/transitive-plugins/b/build.sbt +++ b/sbt/src/sbt-test/project/transitive-plugins/b/build.sbt @@ -1,10 +1,10 @@ -publishTo <<= (baseDirectory in ThisBuild)(x => +publishTo := (baseDirectory in ThisBuild)(x => Some(Resolver.file("test-publish", x / "repo")) -) +).value -resolvers <+= (baseDirectory in ThisBuild)(x => +resolvers += (baseDirectory in ThisBuild)(x => "test" at (x / "repo").asURL.toString -) +).value name := "demo2" diff --git a/sbt/src/sbt-test/project/transitive-plugins/build.sbt b/sbt/src/sbt-test/project/transitive-plugins/build.sbt index 9a6a8b382..5865cfb1a 100644 --- a/sbt/src/sbt-test/project/transitive-plugins/build.sbt +++ b/sbt/src/sbt-test/project/transitive-plugins/build.sbt @@ -6,10 +6,10 @@ lazy val c = proj(project in file("c")) def proj(p: Project): Project = p.settings( - ivyPaths <<= (baseDirectory in root, target in root)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), - resolvers <+= appConfiguration { app => // need this to resolve sbt + ivyPaths := (baseDirectory in root, target in root)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))).value, + resolvers += (appConfiguration { app => // need this to resolve sbt val ivyHome = Classpaths.bootIvyHome(app) getOrElse sys.error("Launcher did not provide the Ivy home directory.") Resolver.file("real-local", ivyHome / "local")(Resolver.ivyStylePatterns) - }, + }).value, resolvers += Resolver.typesafeIvyRepo("releases") // not sure why this isn't included by default ) diff --git a/sbt/src/sbt-test/project/transitive-plugins/c/build.sbt b/sbt/src/sbt-test/project/transitive-plugins/c/build.sbt index 3672a1c05..53fca2b24 100644 --- a/sbt/src/sbt-test/project/transitive-plugins/c/build.sbt +++ b/sbt/src/sbt-test/project/transitive-plugins/c/build.sbt @@ -1,10 +1,10 @@ -publishTo <<= (baseDirectory in ThisBuild)(x => +publishTo := (baseDirectory in ThisBuild)(x => Some(Resolver.file("test-publish", x / "repo")) -) +).value -resolvers <+= (baseDirectory in ThisBuild)(x => +resolvers += (baseDirectory in ThisBuild)(x => "test" at (x / "repo").asURL.toString -) +).value name := "demo3" diff --git a/sbt/src/sbt-test/reporter/nowarn/build.sbt b/sbt/src/sbt-test/reporter/nowarn/build.sbt index 8381d9489..f60d75926 100644 --- a/sbt/src/sbt-test/reporter/nowarn/build.sbt +++ b/sbt/src/sbt-test/reporter/nowarn/build.sbt @@ -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 diff --git a/sbt/src/sbt-test/run/fork/test b/sbt/src/sbt-test/run/fork/test index c0fae0eb0..1c5cbb769 100644 --- a/sbt/src/sbt-test/run/fork/test +++ b/sbt/src/sbt-test/run/fork/test @@ -4,7 +4,7 @@ $ delete flag $ mkdir "forked" > set fork := true -> 'set baseDirectory in run <<= baseDirectory(_ / "forked")' +> 'set baseDirectory in run := baseDirectory(_ / "forked").value' > run "forked" $ exists forked/flag diff --git a/sbt/src/sbt-test/source-dependencies/abstract-type-override/build.sbt b/sbt/src/sbt-test/source-dependencies/abstract-type-override/build.sbt index 305240720..fbdcd84fe 100644 --- a/sbt/src/sbt-test/source-dependencies/abstract-type-override/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/abstract-type-override/build.sbt @@ -1,9 +1,9 @@ import sbt.internal.inc.Analysis -InputKey[Unit]("checkNumberOfCompilerIterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) => +InputKey[Unit]("checkNumberOfCompilerIterations") := (inputTask { (argTask: TaskKey[Seq[String]]) => (argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) => assert(args.size == 1) val expectedIterationsNumber = args(0).toInt assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber)) } -} +}).evaluated diff --git a/sbt/src/sbt-test/source-dependencies/binary/build.sbt b/sbt/src/sbt-test/source-dependencies/binary/build.sbt index 00acecef9..27d7016cc 100644 --- a/sbt/src/sbt-test/source-dependencies/binary/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/binary/build.sbt @@ -2,5 +2,5 @@ lazy val dep = project lazy val use = project. settings( - unmanagedJars in Compile <+= packageBin in (dep, Compile) map Attributed.blank + unmanagedJars in Compile += (packageBin in (dep, Compile) map Attributed.blank).value ) diff --git a/sbt/src/sbt-test/source-dependencies/compactify/build.sbt b/sbt/src/sbt-test/source-dependencies/compactify/build.sbt index 37f0c4462..8ab6d08a2 100644 --- a/sbt/src/sbt-test/source-dependencies/compactify/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/compactify/build.sbt @@ -1,7 +1,7 @@ -TaskKey[Unit]("outputEmpty") <<= classDirectory in Configurations.Compile map { outputDirectory => +TaskKey[Unit]("outputEmpty") := (classDirectory in Configurations.Compile map { outputDirectory => def classes = (outputDirectory ** "*.class").get if(!classes.isEmpty) sys.error("Classes existed:\n\t" + classes.mkString("\n\t")) else () -} +}).value // apparently Travis CI stopped allowing long file names // it fails with the default setting of 255 characters so diff --git a/sbt/src/sbt-test/source-dependencies/inherited_type_params/build.sbt b/sbt/src/sbt-test/source-dependencies/inherited_type_params/build.sbt index e622db1ed..3f976bc4f 100644 --- a/sbt/src/sbt-test/source-dependencies/inherited_type_params/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/inherited_type_params/build.sbt @@ -1,8 +1,8 @@ import sbt.internal.inc.Analysis 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) => assert( xsbt.api.SameAPI(api.api, api.api) ) } -} +}).value diff --git a/sbt/src/sbt-test/source-dependencies/macro-annotation/build.sbt b/sbt/src/sbt-test/source-dependencies/macro-annotation/build.sbt index 08839d26b..4243856d5 100644 --- a/sbt/src/sbt-test/source-dependencies/macro-annotation/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/macro-annotation/build.sbt @@ -13,13 +13,13 @@ lazy val root = (project in file(".")). aggregate(macros, core). settings( commonSettings, - run <<= run in Compile in core + run := (run in Compile in core).evaluated ) lazy val macros = (project in file("macros")). settings( commonSettings, - libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-reflect" % _), + libraryDependencies += (scalaVersion)("org.scala-lang" % "scala-reflect" % _).value, libraryDependencies ++= ( if (scalaVersion.value.startsWith("2.10")) List("org.scalamacros" %% "quasiquotes" % paradiseVersion) else Nil diff --git a/sbt/src/sbt-test/source-dependencies/macro-arg-dep-2-11/build.sbt b/sbt/src/sbt-test/source-dependencies/macro-arg-dep-2-11/build.sbt index ced00eb8d..4d503314a 100644 --- a/sbt/src/sbt-test/source-dependencies/macro-arg-dep-2-11/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/macro-arg-dep-2-11/build.sbt @@ -1,6 +1,6 @@ val defaultSettings = Seq( 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(".")). diff --git a/sbt/src/sbt-test/source-dependencies/macro-arg-dep-nested-2-11/build.sbt b/sbt/src/sbt-test/source-dependencies/macro-arg-dep-nested-2-11/build.sbt index 1a2374c55..8912a3a20 100644 --- a/sbt/src/sbt-test/source-dependencies/macro-arg-dep-nested-2-11/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/macro-arg-dep-nested-2-11/build.sbt @@ -1,6 +1,6 @@ val defaultSettings = Seq( 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(".")). diff --git a/sbt/src/sbt-test/source-dependencies/macro-arg-dep-nested/build.sbt b/sbt/src/sbt-test/source-dependencies/macro-arg-dep-nested/build.sbt index f569c7377..264dd3d57 100644 --- a/sbt/src/sbt-test/source-dependencies/macro-arg-dep-nested/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/macro-arg-dep-nested/build.sbt @@ -1,6 +1,6 @@ val defaultSettings = Seq( 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(".")). diff --git a/sbt/src/sbt-test/source-dependencies/macro-arg-dep-stackoverflow/build.sbt b/sbt/src/sbt-test/source-dependencies/macro-arg-dep-stackoverflow/build.sbt index 17be9b032..218d378cb 100644 --- a/sbt/src/sbt-test/source-dependencies/macro-arg-dep-stackoverflow/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/macro-arg-dep-stackoverflow/build.sbt @@ -1,5 +1,5 @@ val defaultSettings = Seq( - libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _ ) + libraryDependencies += scalaVersion("org.scala-lang" % "scala-reflect" % _ ).value ) lazy val root = (project in file(".")). diff --git a/sbt/src/sbt-test/source-dependencies/macro-arg-dep/build.sbt b/sbt/src/sbt-test/source-dependencies/macro-arg-dep/build.sbt index f569c7377..264dd3d57 100644 --- a/sbt/src/sbt-test/source-dependencies/macro-arg-dep/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/macro-arg-dep/build.sbt @@ -1,6 +1,6 @@ val defaultSettings = Seq( 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(".")). diff --git a/sbt/src/sbt-test/source-dependencies/macro/build.sbt b/sbt/src/sbt-test/source-dependencies/macro/build.sbt index 85676b5fa..1e81806a5 100644 --- a/sbt/src/sbt-test/source-dependencies/macro/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/macro/build.sbt @@ -1,6 +1,6 @@ val defaultSettings = Seq( scalaVersion := "2.10.6", - libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _ )//, + libraryDependencies += scalaVersion("org.scala-lang" % "scala-reflect" % _ ).value //, //incOptions := incOptions.value.withNameHashing(true) ) diff --git a/sbt/src/sbt-test/source-dependencies/replace-test-a/build.sbt b/sbt/src/sbt-test/source-dependencies/replace-test-a/build.sbt index bb5bef7ce..26e149cbe 100644 --- a/sbt/src/sbt-test/source-dependencies/replace-test-a/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/replace-test-a/build.sbt @@ -2,8 +2,8 @@ import java.net.URLClassLoader lazy val root = (project in file(".")). settings( - TaskKey[Unit]("checkFirst") <<= checkTask("First"), - TaskKey[Unit]("checkSecond") <<= checkTask("Second") + TaskKey[Unit]("checkFirst") := checkTask("First").value, + TaskKey[Unit]("checkSecond") := checkTask("Second").value ) def checkTask(className: String) = diff --git a/sbt/src/sbt-test/tests/empty/build.sbt b/sbt/src/sbt-test/tests/empty/build.sbt index 9d367c12a..6c6170abf 100644 --- a/sbt/src/sbt-test/tests/empty/build.sbt +++ b/sbt/src/sbt-test/tests/empty/build.sbt @@ -1,8 +1,9 @@ -testGrouping <<= (definedTests in Test) map { tests => - tests map { test => - new Tests.Group( - name = test.name, - tests = Seq(test), - runPolicy = Tests.SubProcess(javaOptions = Seq.empty[String])) - } - } +testGrouping := { + val tests = (definedTests in Test).value + tests map { test => + new Tests.Group( + name = test.name, + tests = Seq(test), + runPolicy = Tests.SubProcess(javaOptions = Seq.empty[String])) + } +} diff --git a/sbt/src/sbt-test/tests/fork/build.sbt b/sbt/src/sbt-test/tests/fork/build.sbt index 575b2b261..88832f844 100644 --- a/sbt/src/sbt-test/tests/fork/build.sbt +++ b/sbt/src/sbt-test/tests/fork/build.sbt @@ -12,7 +12,8 @@ def groupPrefix(idx: Int) = groupId(idx) + "_file_" lazy val root = (project in file(".")). settings( scalaVersion := "2.11.8", - testGrouping in Test <<= definedTests in Test map { tests => + testGrouping in Test := { + val tests = (definedTests in Test).value assert(tests.size == 3) for (idx <- 0 until groups) yield new Group(groupId(idx), tests, SubProcess(Seq("-Dgroup.prefix=" + groupPrefix(idx)))) diff --git a/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala b/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala index 860e0a09f..5ccd43830 100644 --- a/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala +++ b/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala @@ -33,7 +33,7 @@ object ScriptedPlugin extends AutoPlugin { override lazy val projectSettings = Seq( ivyConfigurations ++= Seq(scriptedConf, scriptedLaunchConf), scriptedSbt := sbtVersion.value, - sbtLauncher <<= getJars(scriptedLaunchConf).map(_.get.head), + sbtLauncher := getJars(scriptedLaunchConf).map(_.get.head).value, sbtTestDirectory := sourceDirectory.value / "sbt-test", libraryDependencies ++= Seq( "org.scala-sbt" %% "scripted-sbt" % scriptedSbt.value % scriptedConf.toString, @@ -41,11 +41,15 @@ object ScriptedPlugin extends AutoPlugin { ), scriptedBufferLog := true, scriptedClasspath := getJars(scriptedConf).value, - scriptedTests <<= scriptedTestsTask, - scriptedRun <<= scriptedRunTask, - scriptedDependencies <<= (compile in Test, publishLocal) map { (analysis, pub) => Unit }, + scriptedTests := scriptedTestsTask.value, + scriptedRun := scriptedRunTask.value, + scriptedDependencies := { + val analysis = (compile in Test).value + val pub = (publishLocal).value + Unit + }, scriptedLaunchOpts := Seq(), - scripted <<= scriptedTask + scripted := scriptedTask.evaluated ) def scriptedTestsTask: Initialize[Task[AnyRef]] = (scriptedClasspath, scalaInstance) map { From 01bd4add3cdd96af5e7443dfbe021704ed815f69 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Mon, 29 Aug 2016 23:08:27 -0400 Subject: [PATCH 2/2] Replace the old operators with Restligeist macros The old operators `<<=`, `<+=`, and `<++=` are now replaced with Restligeist macros that will always fail during compile-time but can display migration guide as the error message. This would provide better upgrade experience than simply removing the methods and displaying `<<= is not a member of sbt.TaskKey`. --- MIGRATION.md | 3 +- .../src/main/scala/sbt/Structure.scala | 17 +++---- .../src/main/scala/sbt/std/TaskMacro.scala | 49 +++++++++++++------ .../old-ops/changes/settingAppend1/build.sbt | 4 ++ .../old-ops/changes/settingAppendN/build.sbt | 4 ++ .../old-ops/changes/settingAssign/build.sbt | 4 ++ .../old-ops/changes/taskAppend1/build.sbt | 6 +++ .../old-ops/changes/taskAppendN/build.sbt | 6 +++ .../old-ops/changes/taskAssign/build.sbt | 4 ++ sbt/src/sbt-test/project/old-ops/test | 17 +++++++ 10 files changed, 88 insertions(+), 26 deletions(-) create mode 100644 sbt/src/sbt-test/project/old-ops/changes/settingAppend1/build.sbt create mode 100644 sbt/src/sbt-test/project/old-ops/changes/settingAppendN/build.sbt create mode 100644 sbt/src/sbt-test/project/old-ops/changes/settingAssign/build.sbt create mode 100644 sbt/src/sbt-test/project/old-ops/changes/taskAppend1/build.sbt create mode 100644 sbt/src/sbt-test/project/old-ops/changes/taskAppendN/build.sbt create mode 100644 sbt/src/sbt-test/project/old-ops/changes/taskAssign/build.sbt create mode 100644 sbt/src/sbt-test/project/old-ops/test diff --git a/MIGRATION.md b/MIGRATION.md index f5753e214..0278371cf 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -8,7 +8,8 @@ Migration notes - The incremental compiler, called Zinc, uses class-based name hashing. - Zinc drops support for Scala 2.8.x and 2.9.x. - Removed the pre-0.13.7 *.sbt file parser (previously available under `-Dsbt.parser.simple=true`) -- Removed old, hypher-separated key names (use `publishLocal` instead of `publish-local`) +- Removed old, hyphen-separated key names (use `publishLocal` instead of `publish-local`) +- Removes no-longer-documented old operators `<<=`, `<+=`, and `<++=`. #### Additional import required diff --git a/main-settings/src/main/scala/sbt/Structure.scala b/main-settings/src/main/scala/sbt/Structure.scala index 93c18452d..9f74e983b 100644 --- a/main-settings/src/main/scala/sbt/Structure.scala +++ b/main-settings/src/main/scala/sbt/Structure.scala @@ -39,8 +39,8 @@ sealed abstract class SettingKey[T] extends ScopedTaskable[T] with KeyedInitiali final def :=(v: T): Setting[T] = macro std.TaskMacro.settingAssignMacroImpl[T] final def +=[U](v: U)(implicit a: Append.Value[T, U]): Setting[T] = macro std.TaskMacro.settingAppend1Impl[T, U] final def ++=[U](vs: U)(implicit a: Append.Values[T, U]): Setting[T] = macro std.TaskMacro.settingAppendNImpl[T, U] - final def <+=[V](v: Initialize[V])(implicit a: Append.Value[T, V]): Setting[T] = macro std.TaskMacro.settingAppend1Position[T, V] - final def <++=[V](vs: Initialize[V])(implicit a: Append.Values[T, V]): Setting[T] = macro std.TaskMacro.settingAppendNPosition[T, V] + final def <+=[V](v: Initialize[V])(implicit a: Append.Value[T, V]): Setting[T] = macro std.TaskMacro.fakeSettingAppend1Position[T, V] + final def <++=[V](vs: Initialize[V])(implicit a: Append.Values[T, V]): Setting[T] = macro std.TaskMacro.fakeSettingAppendNPosition[T, V] final def -=[U](v: U)(implicit r: Remove.Value[T, U]): Setting[T] = macro std.TaskMacro.settingRemove1Impl[T, U] final def --=[U](vs: U)(implicit r: Remove.Values[T, U]): Setting[T] = macro std.TaskMacro.settingRemoveNImpl[T, U] final def ~=(f: T => T): Setting[T] = macro std.TaskMacro.settingTransformPosition[T] @@ -70,8 +70,8 @@ sealed abstract class TaskKey[T] extends ScopedTaskable[T] with KeyedInitialize[ def +=[U](v: U)(implicit a: Append.Value[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskAppend1Impl[T, U] def ++=[U](vs: U)(implicit a: Append.Values[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskAppendNImpl[T, U] - def <+=[V](v: Initialize[Task[V]])(implicit a: Append.Value[T, V]): Setting[Task[T]] = macro std.TaskMacro.taskAppend1Position[T, V] - def <++=[V](vs: Initialize[Task[V]])(implicit a: Append.Values[T, V]): Setting[Task[T]] = macro std.TaskMacro.taskAppendNPosition[T, V] + def <+=[V](v: Initialize[Task[V]])(implicit a: Append.Value[T, V]): Setting[Task[T]] = macro std.TaskMacro.fakeTaskAppend1Position[T, V] + def <++=[V](vs: Initialize[Task[V]])(implicit a: Append.Values[T, V]): Setting[Task[T]] = macro std.TaskMacro.fakeTaskAppendNPosition[T, V] final def -=[U](v: U)(implicit r: Remove.Value[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskRemove1Impl[T, U] final def --=[U](vs: U)(implicit r: Remove.Values[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskRemoveNImpl[T, U] @@ -147,12 +147,7 @@ object Scoped { private[sbt] final def :==(app: S): Setting[S] = macro std.TaskMacro.settingAssignPure[S] - /** - * Binds a single value to this. A new [Def.Setting] is defined using the value(s) of `app`. - * @param app value to bind to this key - * @return setting binding this key to the given value. - */ - final def <<=(app: Initialize[S]): Setting[S] = macro std.TaskMacro.settingAssignPosition[S] + final def <<=(app: Initialize[S]): Setting[S] = macro std.TaskMacro.fakeSettingAssignPosition[S] /** Internally used function for setting a value along with the `.sbt` file location where it is defined. */ final def set(app: Initialize[S], source: SourcePosition): Setting[S] = setting(scopedKey, app, source) @@ -198,7 +193,7 @@ object Scoped { def :=(v: S): Setting[Task[S]] = macro std.TaskMacro.taskAssignMacroImpl[S] def ~=(f: S => S): Setting[Task[S]] = macro std.TaskMacro.taskTransformPosition[S] - def <<=(app: Initialize[Task[S]]): Setting[Task[S]] = macro std.TaskMacro.itaskAssignPosition[S] + def <<=(app: Initialize[Task[S]]): Setting[Task[S]] = macro std.TaskMacro.fakeItaskAssignPosition[S] def set(app: Initialize[Task[S]], source: SourcePosition): Setting[Task[S]] = Def.setting(scopedKey, app, source) def transform(f: S => S, source: SourcePosition): Setting[Task[S]] = set(scopedKey(_ map f), source) diff --git a/main-settings/src/main/scala/sbt/std/TaskMacro.scala b/main-settings/src/main/scala/sbt/std/TaskMacro.scala index c98bbf704..0841a8601 100644 --- a/main-settings/src/main/scala/sbt/std/TaskMacro.scala +++ b/main-settings/src/main/scala/sbt/std/TaskMacro.scala @@ -72,6 +72,13 @@ object TaskMacro { final val TransformInitName = "transform" final val InputTaskCreateDynName = "createDyn" final val InputTaskCreateFreeName = "createFree" + final val append1Migration = "Use `lhs += { x.value }`." + final val appendNMigration = "Use `lhs ++= { x.value }`." + final val assignMigration = + """Use `key := { x.value }` or `key ~= (old => { newValue })`. + |The RHS of `<<=` takes an `Initialize[_]` expression, which can be converted to `:=` style + |by wrapping the expression in parenthesis, and calling `.value` at the end. + |For example, `key := (key.dependsOn(compile in Test)).value`.""".stripMargin def taskMacroImpl[T: c.WeakTypeTag](c: Context)(t: c.Expr[T]): c.Expr[Initialize[Task[T]]] = Instance.contImpl[T, Id](c, FullInstance, FullConvert, MixedBuilder)(Left(t), Instance.idTransform[c.type]) @@ -94,6 +101,34 @@ object TaskMacro { c.Expr[Setting[Task[T]]](assign) } + // Error macros (Restligeist) + // These macros are there just so we can fail old operators like `<<=` and provide useful migration information. + + def fakeSettingAssignPosition[T: c.WeakTypeTag](c: Context)(app: c.Expr[Initialize[T]]): c.Expr[Setting[T]] = + ContextUtil.selectMacroImpl[Setting[T]](c) { (ts, pos) => + c.abort(pos, assignMigration) + } + def fakeSettingAppend1Position[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(v: c.Expr[Initialize[V]])(a: c.Expr[Append.Value[S, V]]): c.Expr[Setting[S]] = + ContextUtil.selectMacroImpl[Setting[S]](c) { (ts, pos) => + c.abort(pos, append1Migration) + } + def fakeSettingAppendNPosition[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(vs: c.Expr[Initialize[V]])(a: c.Expr[Append.Values[S, V]]): c.Expr[Setting[S]] = + ContextUtil.selectMacroImpl[Setting[S]](c) { (ts, pos) => + c.abort(pos, appendNMigration) + } + def fakeItaskAssignPosition[T: c.WeakTypeTag](c: Context)(app: c.Expr[Initialize[Task[T]]]): c.Expr[Setting[Task[T]]] = + ContextUtil.selectMacroImpl[Setting[Task[T]]](c) { (ts, pos) => + c.abort(pos, assignMigration) + } + def fakeTaskAppend1Position[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(v: c.Expr[Initialize[Task[V]]])(a: c.Expr[Append.Value[S, V]]): c.Expr[Setting[Task[S]]] = + ContextUtil.selectMacroImpl[Setting[Task[S]]](c) { (ts, pos) => + c.abort(pos, append1Migration) + } + def fakeTaskAppendNPosition[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(vs: c.Expr[Initialize[Task[V]]])(a: c.Expr[Append.Values[S, V]]): c.Expr[Setting[Task[S]]] = + ContextUtil.selectMacroImpl[Setting[Task[S]]](c) { (ts, pos) => + c.abort(pos, appendNMigration) + } + /* Implementations of <<= macro variations for tasks and settings. These just get the source position of the call site.*/ def itaskAssignPosition[T: c.WeakTypeTag](c: Context)(app: c.Expr[Initialize[Task[T]]]): c.Expr[Setting[Task[T]]] = @@ -102,26 +137,12 @@ object TaskMacro { itaskAssignPosition(c)(c.universe.reify { Def.valueStrict(app.splice) }) def taskAssignPositionPure[T: c.WeakTypeTag](c: Context)(app: c.Expr[T]): c.Expr[Setting[Task[T]]] = taskAssignPositionT(c)(c.universe.reify { TaskExtra.constant(app.splice) }) - def taskTransformPosition[S: c.WeakTypeTag](c: Context)(f: c.Expr[S => S]): c.Expr[Setting[Task[S]]] = c.Expr[Setting[Task[S]]](transformMacroImpl(c)(f.tree)(TransformInitName)) def settingTransformPosition[S: c.WeakTypeTag](c: Context)(f: c.Expr[S => S]): c.Expr[Setting[S]] = c.Expr[Setting[S]](transformMacroImpl(c)(f.tree)(TransformInitName)) def itaskTransformPosition[S: c.WeakTypeTag](c: Context)(f: c.Expr[S => S]): c.Expr[Setting[S]] = c.Expr[Setting[S]](transformMacroImpl(c)(f.tree)(TransformInitName)) - - def taskAppendNPosition[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(vs: c.Expr[Initialize[Task[V]]])(a: c.Expr[Append.Values[S, V]]): c.Expr[Setting[Task[S]]] = - c.Expr[Setting[Task[S]]](appendMacroImpl(c)(vs.tree, a.tree)(AppendNInitName)) - - def settingAppendNPosition[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(vs: c.Expr[Initialize[V]])(a: c.Expr[Append.Values[S, V]]): c.Expr[Setting[S]] = - c.Expr[Setting[S]](appendMacroImpl(c)(vs.tree, a.tree)(AppendNInitName)) - - def taskAppend1Position[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(v: c.Expr[Initialize[Task[V]]])(a: c.Expr[Append.Value[S, V]]): c.Expr[Setting[Task[S]]] = - c.Expr[Setting[Task[S]]](appendMacroImpl(c)(v.tree, a.tree)(Append1InitName)) - - def settingAppend1Position[S: c.WeakTypeTag, V: c.WeakTypeTag](c: Context)(v: c.Expr[Initialize[V]])(a: c.Expr[Append.Value[S, V]]): c.Expr[Setting[S]] = - c.Expr[Setting[S]](appendMacroImpl(c)(v.tree, a.tree)(Append1InitName)) - def settingAssignPure[T: c.WeakTypeTag](c: Context)(app: c.Expr[T]): c.Expr[Setting[T]] = settingAssignPosition(c)(c.universe.reify { Def.valueStrict(app.splice) }) def settingAssignPosition[T: c.WeakTypeTag](c: Context)(app: c.Expr[Initialize[T]]): c.Expr[Setting[T]] = diff --git a/sbt/src/sbt-test/project/old-ops/changes/settingAppend1/build.sbt b/sbt/src/sbt-test/project/old-ops/changes/settingAppend1/build.sbt new file mode 100644 index 000000000..902c68c45 --- /dev/null +++ b/sbt/src/sbt-test/project/old-ops/changes/settingAppend1/build.sbt @@ -0,0 +1,4 @@ +lazy val root = (project in file(".")). + settings( + crossScalaVersions <+= scalaVersion + ) diff --git a/sbt/src/sbt-test/project/old-ops/changes/settingAppendN/build.sbt b/sbt/src/sbt-test/project/old-ops/changes/settingAppendN/build.sbt new file mode 100644 index 000000000..7f36df425 --- /dev/null +++ b/sbt/src/sbt-test/project/old-ops/changes/settingAppendN/build.sbt @@ -0,0 +1,4 @@ +lazy val root = (project in file(".")). + settings( + crossScalaVersions <++= (scalaVersion) { Seq(_) } + ) diff --git a/sbt/src/sbt-test/project/old-ops/changes/settingAssign/build.sbt b/sbt/src/sbt-test/project/old-ops/changes/settingAssign/build.sbt new file mode 100644 index 000000000..fff07a0e5 --- /dev/null +++ b/sbt/src/sbt-test/project/old-ops/changes/settingAssign/build.sbt @@ -0,0 +1,4 @@ +lazy val root = (project in file(".")). + settings( + crossScalaVersions <<= crossScalaVersions + ) diff --git a/sbt/src/sbt-test/project/old-ops/changes/taskAppend1/build.sbt b/sbt/src/sbt-test/project/old-ops/changes/taskAppend1/build.sbt new file mode 100644 index 000000000..8ab652466 --- /dev/null +++ b/sbt/src/sbt-test/project/old-ops/changes/taskAppend1/build.sbt @@ -0,0 +1,6 @@ +lazy val foo = taskKey[String]("") +lazy val root = (project in file(".")). + settings( + scalacOptions <+= foo, + foo := "-unchecked" + ) diff --git a/sbt/src/sbt-test/project/old-ops/changes/taskAppendN/build.sbt b/sbt/src/sbt-test/project/old-ops/changes/taskAppendN/build.sbt new file mode 100644 index 000000000..d7d9c0629 --- /dev/null +++ b/sbt/src/sbt-test/project/old-ops/changes/taskAppendN/build.sbt @@ -0,0 +1,6 @@ +lazy val foo = taskKey[Seq[String]]("") +lazy val root = (project in file(".")). + settings( + scalacOptions <++= foo, + foo := Seq("-unchecked") + ) diff --git a/sbt/src/sbt-test/project/old-ops/changes/taskAssign/build.sbt b/sbt/src/sbt-test/project/old-ops/changes/taskAssign/build.sbt new file mode 100644 index 000000000..3bbe0922e --- /dev/null +++ b/sbt/src/sbt-test/project/old-ops/changes/taskAssign/build.sbt @@ -0,0 +1,4 @@ +lazy val root = (project in file(".")). + settings( + scalacOptions <<= scalacOptions + ) diff --git a/sbt/src/sbt-test/project/old-ops/test b/sbt/src/sbt-test/project/old-ops/test new file mode 100644 index 000000000..2eae3cfe4 --- /dev/null +++ b/sbt/src/sbt-test/project/old-ops/test @@ -0,0 +1,17 @@ +$ copy-file changes/settingAssign/build.sbt build.sbt +-> compile + +$ copy-file changes/settingAppend1/build.sbt build.sbt +-> compile + +$ copy-file changes/settingAppendN/build.sbt build.sbt +-> compile + +$ copy-file changes/taskAssign/build.sbt build.sbt +-> compile + +$ copy-file changes/taskAppend1/build.sbt build.sbt +-> compile + +$ copy-file changes/taskAppendN/build.sbt build.sbt +-> compile