diff --git a/build.sbt b/build.sbt index cdb3e9736..0328e6eb6 100644 --- a/build.sbt +++ b/build.sbt @@ -2,6 +2,7 @@ import Util._ import Dependencies._ import Sxr.sxr import com.typesafe.tools.mima.core._, ProblemFilters._ +import local.Scripted // ThisBuild settings take lower precedence, // but can be shared across the multi projects. @@ -9,7 +10,7 @@ def buildLevelSettings: Seq[Setting[_]] = inThisBuild( Seq( organization := "org.scala-sbt", - version := "1.2.0-SNAPSHOT", + version := "1.2.1-SNAPSHOT", description := "sbt is an interactive build tool", bintrayOrganization := Some("sbt"), bintrayRepository := { @@ -80,7 +81,8 @@ val mimaSettings = Def settings ( mimaPreviousArtifacts := { Seq( "1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4", - "1.1.0", "1.1.1", "1.1.2", + "1.1.0", "1.1.1", "1.1.2", "1.1.3", "1.1.4", "1.1.5", "1.1.6", + "1.2.0" ).map { v => organization.value % moduleName.value % v cross (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled) }.toSet @@ -719,6 +721,10 @@ def allProjects = lazy val nonRoots = allProjects.map(p => LocalProject(p.id)) + +ThisBuild / scriptedBufferLog := true +ThisBuild / scriptedPrescripted := { _ => } + def otherRootSettings = Seq( scripted := scriptedTask.evaluated, diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index f74c579be..bc9b3a3f1 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -135,7 +135,9 @@ object Defaults extends BuildCommon { def buildCore: Seq[Setting[_]] = thisBuildCore ++ globalCore def thisBuildCore: Seq[Setting[_]] = inScope(GlobalScope.copy(project = Select(ThisBuild)))( - managedDirectory := baseDirectory.value / "lib_managed" + Seq( + managedDirectory := baseDirectory.value / "lib_managed" + ) ) private[sbt] lazy val globalCore: Seq[Setting[_]] = globalDefaults( defaultTestTasks(test) ++ defaultTestTasks(testOnly) ++ defaultTestTasks(testQuick) ++ Seq( @@ -303,8 +305,10 @@ object Defaults extends BuildCommon { def defaultTestTasks(key: Scoped): Seq[Setting[_]] = inTask(key)( - tags := Seq(Tags.Test -> 1), - logBuffered := true + Seq( + tags := Seq(Tags.Test -> 1), + logBuffered := true + ) ) // TODO: This should be on the new default settings for a project. @@ -761,22 +765,26 @@ object Defaults extends BuildCommon { lazy val ConfigGlobal: Scope = ConfigZero def testTaskOptions(key: Scoped): Seq[Setting[_]] = inTask(key)( - testListeners := { - TestLogger.make( - streams.value.log, - closeableTestLogger( - streamsManager.value, - test in resolvedScoped.value.scope, - logBuffered.value - ) - ) +: - new TestStatusReporter(succeededFile(streams.in(test).value.cacheDirectory)) +: - testListeners.in(TaskZero).value - }, - testOptions := Tests.Listeners(testListeners.value) +: (testOptions in TaskZero).value, - testExecution := testExecutionTask(key).value + Seq( + testListeners := { + TestLogger.make( + streams.value.log, + closeableTestLogger( + streamsManager.value, + test in resolvedScoped.value.scope, + logBuffered.value + ) + ) +: + new TestStatusReporter(succeededFile(streams.in(test).value.cacheDirectory)) +: + testListeners.in(TaskZero).value + }, + testOptions := Tests.Listeners(testListeners.value) +: (testOptions in TaskZero).value, + testExecution := testExecutionTask(key).value + ) ) ++ inScope(GlobalScope)( - derive(testGrouping := singleTestGroupDefault.value) + Seq( + derive(testGrouping := singleTestGroupDefault.value) + ) ) private[this] def closeableTestLogger(manager: Streams, baseKey: Scoped, buffered: Boolean)( @@ -1049,24 +1057,28 @@ object Defaults extends BuildCommon { lazy val packageConfig: Seq[Setting[_]] = inTask(packageBin)( - 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 - } + Seq( + 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)( - packageOptions := Package.addSpecManifestAttributes( - name.value, - version.value, - organizationName.value - ) +: packageOptions.value + Seq( + packageOptions := Package.addSpecManifestAttributes( + name.value, + version.value, + organizationName.value + ) +: packageOptions.value + ) ) ++ packageTaskSettings(packageBin, packageBinMappings) ++ packageTaskSettings(packageSrc, packageSrcMappings) ++ @@ -1154,12 +1166,14 @@ object Defaults extends BuildCommon { def packageTaskSettings(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) = inTask(key)( - key in TaskZero := packageTask.value, - packageConfiguration := packageConfigurationTask.value, - mappings := mappingsTask.value, - packagedArtifact := (artifact.value -> key.value), - artifact := artifactSetting.value, - artifactPath := artifactPathSetting(artifact).value + Seq( + key in TaskZero := packageTask.value, + packageConfiguration := packageConfigurationTask.value, + mappings := mappingsTask.value, + packagedArtifact := (artifact.value -> key.value), + artifact := artifactSetting.value, + artifactPath := artifactPathSetting(artifact).value + ) ) def packageTask: Initialize[Task[File]] = @@ -1367,49 +1381,51 @@ object Defaults extends BuildCommon { def docTaskSettings(key: TaskKey[File] = doc): Seq[Setting[_]] = inTask(key)( - apiMappings ++= { - val dependencyCp = dependencyClasspath.value - val log = streams.value.log - if (autoAPIMappings.value) APIMappings.extract(dependencyCp, log).toMap - else Map.empty[File, URL] - }, - fileInputOptions := Seq("-doc-root-content", "-diagrams-dot-path"), - key in TaskZero := { - val s = streams.value - val cs: Compilers = compilers.value - val srcs = sources.value - val out = target.value - val sOpts = scalacOptions.value - val xapis = apiMappings.value - val hasScala = srcs.exists(_.name.endsWith(".scala")) - val hasJava = srcs.exists(_.name.endsWith(".java")) - val cp = data(dependencyClasspath.value).toList - val label = nameForSrc(configuration.value.name) - val fiOpts = fileInputOptions.value - val reporter = (compilerReporter in compile).value - (hasScala, hasJava) match { - case (true, _) => - val options = sOpts ++ Opts.doc.externalAPI(xapis) - val runDoc = Doc.scaladoc(label, s.cacheStoreFactory sub "scala", cs.scalac match { - case ac: AnalyzingCompiler => ac.onArgs(exported(s, "scaladoc")) - }, fiOpts) - runDoc(srcs, cp, out, options, maxErrors.value, s.log) - case (_, true) => - val javadoc = - sbt.inc.Doc.cachedJavadoc(label, s.cacheStoreFactory sub "java", cs.javaTools) - javadoc.run( - srcs.toList, - cp, - out, - javacOptions.value.toList, - IncToolOptionsUtil.defaultIncToolOptions(), - s.log, - reporter - ) - case _ => () // do nothing + Seq( + apiMappings ++= { + val dependencyCp = dependencyClasspath.value + val log = streams.value.log + if (autoAPIMappings.value) APIMappings.extract(dependencyCp, log).toMap + else Map.empty[File, URL] + }, + fileInputOptions := Seq("-doc-root-content", "-diagrams-dot-path"), + key in TaskZero := { + val s = streams.value + val cs: Compilers = compilers.value + val srcs = sources.value + val out = target.value + val sOpts = scalacOptions.value + val xapis = apiMappings.value + val hasScala = srcs.exists(_.name.endsWith(".scala")) + val hasJava = srcs.exists(_.name.endsWith(".java")) + val cp = data(dependencyClasspath.value).toList + val label = nameForSrc(configuration.value.name) + val fiOpts = fileInputOptions.value + val reporter = (compilerReporter in compile).value + (hasScala, hasJava) match { + case (true, _) => + val options = sOpts ++ Opts.doc.externalAPI(xapis) + val runDoc = Doc.scaladoc(label, s.cacheStoreFactory sub "scala", cs.scalac match { + case ac: AnalyzingCompiler => ac.onArgs(exported(s, "scaladoc")) + }, fiOpts) + runDoc(srcs, cp, out, options, maxErrors.value, s.log) + case (_, true) => + val javadoc = + sbt.inc.Doc.cachedJavadoc(label, s.cacheStoreFactory sub "java", cs.javaTools) + javadoc.run( + srcs.toList, + cp, + out, + javacOptions.value.toList, + IncToolOptionsUtil.defaultIncToolOptions(), + s.log, + reporter + ) + case _ => () // do nothing + } + out } - out - } + ) ) def mainBgRunTask = mainBgRunTaskForConfig(Select(Runtime)) @@ -1710,13 +1726,15 @@ object Defaults extends BuildCommon { // build.sbt is treated a Scala source of metabuild, so to enable deprecation flag on build.sbt we set the option here. lazy val deprecationSettings: Seq[Setting[_]] = inConfig(Compile)( - scalacOptions := { - val old = scalacOptions.value - val existing = old.toSet - val d = "-deprecation" - if (sbtPlugin.value && !existing(d)) d :: old.toList - else old - } + Seq( + scalacOptions := { + val old = scalacOptions.value + val existing = old.toSet + val d = "-deprecation" + if (sbtPlugin.value && !existing(d)) d :: old.toList + else old + } + ) ) } object Classpaths { @@ -2259,82 +2277,84 @@ object Classpaths { def sbtClassifiersTasks = sbtClassifiersGlobalDefaults ++ inTask(updateSbtClassifiers)( - externalResolvers := { - val explicit = buildStructure.value - .units(thisProjectRef.value.build) - .unit - .plugins - .pluginData - .resolvers - explicit orElse bootRepositories(appConfiguration.value) getOrElse externalResolvers.value - }, - ivyConfiguration := InlineIvyConfiguration( - paths = ivyPaths.value, - resolvers = externalResolvers.value.toVector, - otherResolvers = Vector.empty, - moduleConfigurations = Vector.empty, - lock = Option(lock(appConfiguration.value)), - checksums = checksums.value.toVector, - managedChecksums = false, - resolutionCacheDir = Some(crossTarget.value / "resolution-cache"), - updateOptions = UpdateOptions(), - log = streams.value.log - ), - ivySbt := ivySbt0.value, - classifiersModule := classifiersModuleTask.value, - // Redefine scalaVersion and scalaBinaryVersion specifically for the dependency graph used for updateSbtClassifiers task. - // to fix https://github.com/sbt/sbt/issues/2686 - scalaVersion := appConfiguration.value.provider.scalaProvider.version, - scalaBinaryVersion := binaryScalaVersion(scalaVersion.value), - scalaModuleInfo := { - Some( - ScalaModuleInfo( - scalaVersion.value, - scalaBinaryVersion.value, - Vector(), - checkExplicit = false, - filterImplicit = false, - overrideScalaVersion = true - ).withScalaOrganization(scalaOrganization.value) - ) - }, - dependencyResolution := IvyDependencyResolution(ivyConfiguration.value), - updateSbtClassifiers in TaskGlobal := (Def.task { - val lm = dependencyResolution.value - val s = streams.value - val is = ivySbt.value - val mod = classifiersModule.value - val c = updateConfiguration.value - val app = appConfiguration.value - val srcTypes = sourceArtifactTypes.value - val docTypes = docArtifactTypes.value - val log = s.log - val out = is.withIvy(log)(_.getSettings.getDefaultIvyUserDir) - val uwConfig = (unresolvedWarningConfiguration in update).value - val depDir = dependencyCacheDirectory.value - val ivy = scalaModuleInfo.value - val st = state.value - withExcludes(out, mod.classifiers, lock(app)) { - excludes => - // val noExplicitCheck = ivy.map(_.withCheckExplicit(false)) - LibraryManagement.transitiveScratch( - lm, - "sbt", - GetClassifiersConfiguration( - mod, - excludes.toVector, - c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))), - srcTypes.toVector, - docTypes.toVector - ), - uwConfig, - log - ) match { - case Left(_) => ??? - case Right(ur) => ur - } - } - } tag (Tags.Update, Tags.Network)).value + Seq( + externalResolvers := { + val explicit = buildStructure.value + .units(thisProjectRef.value.build) + .unit + .plugins + .pluginData + .resolvers + explicit orElse bootRepositories(appConfiguration.value) getOrElse externalResolvers.value + }, + ivyConfiguration := InlineIvyConfiguration( + paths = ivyPaths.value, + resolvers = externalResolvers.value.toVector, + otherResolvers = Vector.empty, + moduleConfigurations = Vector.empty, + lock = Option(lock(appConfiguration.value)), + checksums = checksums.value.toVector, + managedChecksums = false, + resolutionCacheDir = Some(crossTarget.value / "resolution-cache"), + updateOptions = UpdateOptions(), + log = streams.value.log + ), + ivySbt := ivySbt0.value, + classifiersModule := classifiersModuleTask.value, + // Redefine scalaVersion and scalaBinaryVersion specifically for the dependency graph used for updateSbtClassifiers task. + // to fix https://github.com/sbt/sbt/issues/2686 + scalaVersion := appConfiguration.value.provider.scalaProvider.version, + scalaBinaryVersion := binaryScalaVersion(scalaVersion.value), + scalaModuleInfo := { + Some( + ScalaModuleInfo( + scalaVersion.value, + scalaBinaryVersion.value, + Vector(), + checkExplicit = false, + filterImplicit = false, + overrideScalaVersion = true + ).withScalaOrganization(scalaOrganization.value) + ) + }, + dependencyResolution := IvyDependencyResolution(ivyConfiguration.value), + updateSbtClassifiers in TaskGlobal := (Def.task { + val lm = dependencyResolution.value + val s = streams.value + val is = ivySbt.value + val mod = classifiersModule.value + val c = updateConfiguration.value + val app = appConfiguration.value + val srcTypes = sourceArtifactTypes.value + val docTypes = docArtifactTypes.value + val log = s.log + val out = is.withIvy(log)(_.getSettings.getDefaultIvyUserDir) + val uwConfig = (unresolvedWarningConfiguration in update).value + val depDir = dependencyCacheDirectory.value + val ivy = scalaModuleInfo.value + val st = state.value + withExcludes(out, mod.classifiers, lock(app)) { + excludes => + // val noExplicitCheck = ivy.map(_.withCheckExplicit(false)) + LibraryManagement.transitiveScratch( + lm, + "sbt", + GetClassifiersConfiguration( + mod, + excludes.toVector, + c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))), + srcTypes.toVector, + docTypes.toVector + ), + uwConfig, + log + ) match { + case Left(_) => ??? + case Right(ur) => ur + } + } + } tag (Tags.Update, Tags.Network)).value + ) ) ++ Seq(bootIvyConfiguration := (ivyConfiguration in updateSbtClassifiers).value) def classifiersModuleTask: Initialize[Task[GetClassifiersModule]] = @@ -3458,7 +3478,7 @@ trait BuildExtra extends BuildCommon with DefExtra { * This is useful for reducing test:compile time when not running test. */ def noTestCompletion(config: Configuration = Test): Setting[_] = - inConfig(config)(definedTests := detectTests.value).head + inConfig(config)(Seq(definedTests := detectTests.value)).head def filterKeys(ss: Seq[Setting[_]], transitive: Boolean = false)( f: ScopedKey[_] => Boolean diff --git a/main/src/main/scala/sbt/Extracted.scala b/main/src/main/scala/sbt/Extracted.scala index bc6decb10..20c2115a1 100644 --- a/main/src/main/scala/sbt/Extracted.scala +++ b/main/src/main/scala/sbt/Extracted.scala @@ -148,7 +148,7 @@ final case class Extracted( ): State = { val appendSettings = Load.transformSettings(Load.projectScope(currentRef), currentRef.build, rootProject, settings) - val newStructure = Load.reapply(sessionSettings ++ appendSettings, structure, state.log) + val newStructure = Load.reapply(sessionSettings ++ appendSettings, structure) Project.setProject(session, newStructure, state) } } diff --git a/main/src/main/scala/sbt/Main.scala b/main/src/main/scala/sbt/Main.scala index f6376ce82..c2c523475 100644 --- a/main/src/main/scala/sbt/Main.scala +++ b/main/src/main/scala/sbt/Main.scala @@ -472,7 +472,7 @@ object BuiltinCommands { val loggerInject = LogManager.settingsLogger(s) val withLogger = newSession.appendRaw(loggerInject :: Nil) val show = Project.showContextKey2(newSession) - val newStructure = Load.reapply(withLogger.mergeSettings, structure, s.log)(show) + val newStructure = Load.reapply(withLogger.mergeSettings, structure)(show) Project.setProject(newSession, newStructure, s) } diff --git a/main/src/main/scala/sbt/PluginCross.scala b/main/src/main/scala/sbt/PluginCross.scala index 634f3890e..fca253cc1 100644 --- a/main/src/main/scala/sbt/PluginCross.scala +++ b/main/src/main/scala/sbt/PluginCross.scala @@ -47,10 +47,10 @@ private[sbt] object PluginCross { val add = List(sbtVersion in GlobalScope in pluginCrossBuild :== version) ++ List(scalaVersion := scalaVersionSetting.value) ++ inScope(GlobalScope.copy(project = Select(currentRef)))( - scalaVersion := scalaVersionSetting.value + Seq(scalaVersion := scalaVersionSetting.value) ) val cleared = session.mergeSettings.filterNot(crossExclude) - val newStructure = Load.reapply(cleared ++ add, structure, state.log) + val newStructure = Load.reapply(cleared ++ add, structure) Project.setProject(session, newStructure, command :: state) } } diff --git a/main/src/main/scala/sbt/Project.scala b/main/src/main/scala/sbt/Project.scala index fcf5654dc..a6324868c 100755 --- a/main/src/main/scala/sbt/Project.scala +++ b/main/src/main/scala/sbt/Project.scala @@ -32,7 +32,7 @@ import Keys.{ watch } import Scope.{ Global, ThisScope } -import Def.{ Flattened, Initialize, ScopedKey, Setting, SettingsDefinition } +import Def.{ Flattened, Initialize, ScopedKey, Setting } import sbt.internal.{ Load, BuildStructure, @@ -892,19 +892,17 @@ trait ProjectExtra { implicit def richTaskSessionVar[T](init: Initialize[Task[T]]): Project.RichTaskSessionVar[T] = new Project.RichTaskSessionVar(init) - def inThisBuild(ss: SettingsDefinition*): Seq[Setting[_]] = - inScope(ThisScope.copy(project = Select(ThisBuild)))(ss flatMap (_.settings)) + def inThisBuild(ss: Seq[Setting[_]]): Seq[Setting[_]] = + inScope(ThisScope.copy(project = Select(ThisBuild)))(ss) - def inConfig(conf: Configuration)(ss: SettingsDefinition*): Seq[Setting[_]] = - inScope(ThisScope.copy(config = Select(conf)))( - (configuration :== conf) +: (ss flatMap (_.settings)) - ) + def inConfig(conf: Configuration)(ss: Seq[Setting[_]]): Seq[Setting[_]] = + inScope(ThisScope.copy(config = Select(conf)))((configuration :== conf) +: ss) - def inTask(t: Scoped)(ss: SettingsDefinition*): Seq[Setting[_]] = - inScope(ThisScope.copy(task = Select(t.key)))(ss flatMap (_.settings)) + def inTask(t: Scoped)(ss: Seq[Setting[_]]): Seq[Setting[_]] = + inScope(ThisScope.copy(task = Select(t.key)))(ss) - def inScope(scope: Scope)(ss: SettingsDefinition*): Seq[Setting[_]] = - Project.transform(Scope.replaceThis(scope), ss flatMap (_.settings)) + def inScope(scope: Scope)(ss: Seq[Setting[_]]): Seq[Setting[_]] = + Project.transform(Scope.replaceThis(scope), ss) private[sbt] def inThisBuild[T](i: Initialize[T]): Initialize[T] = inScope(ThisScope.copy(project = Select(ThisBuild)), i) diff --git a/main/src/main/scala/sbt/internal/GlobalPlugin.scala b/main/src/main/scala/sbt/internal/GlobalPlugin.scala index 92f237b7d..2582da002 100644 --- a/main/src/main/scala/sbt/internal/GlobalPlugin.scala +++ b/main/src/main/scala/sbt/internal/GlobalPlugin.scala @@ -106,11 +106,13 @@ object GlobalPlugin { } } val globalPluginSettings = Project.inScope(Scope.GlobalScope in LocalRootProject)( - organization := SbtArtifacts.Organization, - onLoadMessage := Keys.baseDirectory("Loading global plugins from " + _).value, - name := "global-plugin", - sbtPlugin := true, - version := "0.0" + Seq( + organization := SbtArtifacts.Organization, + onLoadMessage := Keys.baseDirectory("Loading global plugins from " + _).value, + name := "global-plugin", + sbtPlugin := true, + version := "0.0" + ) ) } final case class GlobalPluginData( diff --git a/main/src/main/scala/sbt/internal/Load.scala b/main/src/main/scala/sbt/internal/Load.scala index 0f1dc625d..975ae74d7 100755 --- a/main/src/main/scala/sbt/internal/Load.scala +++ b/main/src/main/scala/sbt/internal/Load.scala @@ -267,7 +267,7 @@ private[sbt] object Load { } Project.checkTargets(data) foreach sys.error val index = timed("Load.apply: structureIndex", log) { - structureIndex(data, settings, loaded.extra(data), projects, log) + structureIndex(data, settings, loaded.extra(data), projects) } val streams = timed("Load.apply: mkStreams", log) { mkStreams(projects, loaded.root, data) } val bs = new BuildStructure( @@ -321,8 +321,7 @@ private[sbt] object Load { data: Settings[Scope], settings: Seq[Setting[_]], extra: KeyIndex => BuildUtil[_], - projects: Map[URI, LoadedBuildUnit], - log: Logger + projects: Map[URI, LoadedBuildUnit] ): StructureIndex = { val keys = Index.allKeys(settings) val attributeKeys = Index.attributeKeys(data) ++ keys.map(_.key) @@ -331,7 +330,6 @@ private[sbt] object Load { val configsMap: Map[String, Seq[Configuration]] = projects.values.flatMap(bu => bu.defined map { case (k, v) => (k, v.configurations) }).toMap val keyIndex = KeyIndex(scopedKeys.toVector, projectsMap, configsMap) - checkConfigurations(keyIndex, log) val aggIndex = KeyIndex.aggregate(scopedKeys.toVector, extra(keyIndex), projectsMap, configsMap) new StructureIndex( Index.stringToKeyMap(attributeKeys), @@ -342,33 +340,14 @@ private[sbt] object Load { ) } - private def checkConfigurations(keyIndex: KeyIndex, log: Logger): Unit = { - keyIndex.guessedConfigIdents - .collect { - // Filter out any global configurations since we don't have a way of fixing them. - // Chances are this is only going to be the Test configuration which will have guessed correctly. - case (Some(projectRef), config, guess) => - (Reference.display(projectRef), config, guess) - } - .foreach { - case (project, config, guess) => - log.warn( - s"""The project $project references an unknown configuration "$config" and was guessed to be "$guess".""" - ) - log.warn("This configuration should be explicitly added to the project.") - } - } - // Reevaluates settings after modifying them. Does not recompile or reload any build components. - def reapply( - newSettings: Seq[Setting[_]], - structure: BuildStructure, - log: Logger - )(implicit display: Show[ScopedKey[_]]): BuildStructure = { + def reapply(newSettings: Seq[Setting[_]], structure: BuildStructure)( + implicit display: Show[ScopedKey[_]] + ): BuildStructure = { val transformed = finalTransforms(newSettings) val newData = Def.make(transformed)(structure.delegates, structure.scopeLocal, display) def extra(index: KeyIndex) = BuildUtil(structure.root, structure.units, index, newData) - val newIndex = structureIndex(newData, transformed, extra, structure.units, log) + val newIndex = structureIndex(newData, transformed, extra, structure.units) val newStreams = mkStreams(structure.units, structure.root, newData) new BuildStructure( units = structure.units, @@ -382,6 +361,15 @@ private[sbt] object Load { ) } + @deprecated("No longer used. For binary compatibility", "1.2.1") + def reapply( + newSettings: Seq[Setting[_]], + structure: BuildStructure, + log: Logger + )(implicit display: Show[ScopedKey[_]]): BuildStructure = { + reapply(newSettings, structure) + } + def buildConfigurations( loaded: LoadedBuild, rootProject: URI => String, @@ -1189,20 +1177,22 @@ private[sbt] object Load { /** These are the settings defined when loading a project "meta" build. */ val autoPluginSettings: Seq[Setting[_]] = inScope(GlobalScope in LocalRootProject)( - sbtPlugin :== true, - pluginData := { - val prod = (exportedProducts in Configurations.Runtime).value - val cp = (fullClasspath in Configurations.Runtime).value - val opts = (scalacOptions in Configurations.Compile).value - PluginData( - removeEntries(cp, prod), - prod, - Some(fullResolvers.value.toVector), - Some(update.value), - opts - ) - }, - onLoadMessage := ("Loading project definition from " + baseDirectory.value) + Seq( + sbtPlugin :== true, + pluginData := { + val prod = (exportedProducts in Configurations.Runtime).value + val cp = (fullClasspath in Configurations.Runtime).value + val opts = (scalacOptions in Configurations.Compile).value + PluginData( + removeEntries(cp, prod), + prod, + Some(fullResolvers.value.toVector), + Some(update.value), + opts + ) + }, + onLoadMessage := ("Loading project definition from " + baseDirectory.value) + ) ) private[this] def removeEntries( diff --git a/main/src/main/scala/sbt/internal/Script.scala b/main/src/main/scala/sbt/internal/Script.scala index f03dcacde..2192785a6 100644 --- a/main/src/main/scala/sbt/internal/Script.scala +++ b/main/src/main/scala/sbt/internal/Script.scala @@ -65,7 +65,7 @@ object Script { scriptSettings ++ embeddedSettings ) - val newStructure = Load.reapply(session.original ++ append, structure, state.log) + val newStructure = Load.reapply(session.original ++ append, structure) val arguments = state.remainingCommands.drop(1).map(e => s""""${e.commandLine}"""") val newState = arguments.mkString("run ", " ", "") :: state.copy(remainingCommands = Nil) Project.setProject(session, newStructure, newState) diff --git a/main/src/test/scala/PluginCommandTest.scala b/main/src/test/scala/PluginCommandTest.scala index 627c6b568..cc4443080 100644 --- a/main/src/test/scala/PluginCommandTest.scala +++ b/main/src/test/scala/PluginCommandTest.scala @@ -104,7 +104,7 @@ object FakeState { val extra: KeyIndex => BuildUtil[_] = (keyIndex) => BuildUtil(base.toURI, Map.empty, keyIndex, data) val structureIndex: StructureIndex = - Load.structureIndex(data, settings, extra, Map.empty, Logger.Null) + Load.structureIndex(data, settings, extra, Map.empty) val streams: (State) => BuildStreams.Streams = null val loadedDefinitions: LoadedDefinitions = new LoadedDefinitions( diff --git a/main/src/test/scala/sbt/internal/server/SettingQueryTest.scala b/main/src/test/scala/sbt/internal/server/SettingQueryTest.scala index 4342afeb2..995bb8a2c 100644 --- a/main/src/test/scala/sbt/internal/server/SettingQueryTest.scala +++ b/main/src/test/scala/sbt/internal/server/SettingQueryTest.scala @@ -174,7 +174,7 @@ object SettingQueryTest extends org.specs2.mutable.Specification { val data: Settings[Scope] = Def.make(settings)(delegates, scopeLocal, display) val extra: KeyIndex => BuildUtil[_] = index => BuildUtil(baseUri, units, index, data) - val index: StructureIndex = structureIndex(data, settings, extra, units, Logger.Null) + val index: StructureIndex = structureIndex(data, settings, extra, units) val streams: State => Streams = mkStreams(units, baseUri, data) val structure: BuildStructure = diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 3cac60fab..936f975c3 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -8,10 +8,10 @@ object Dependencies { val baseScalaVersion = scala212 // sbt modules - private val ioVersion = "1.2.0-M2" - private val utilVersion = "1.2.0-M2" - private val lmVersion = "1.2.0-M3" - private val zincVersion = "1.2.0-M2" + private val ioVersion = "1.2.1" + private val utilVersion = "1.2.0" + private val lmVersion = "1.2.0" + private val zincVersion = "1.2.1" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion diff --git a/project/Scripted.scala b/project/Scripted.scala index 2cd17db8b..e77749d63 100644 --- a/project/Scripted.scala +++ b/project/Scripted.scala @@ -1,32 +1,26 @@ +package local + import java.lang.reflect.InvocationTargetException import sbt._ import sbt.internal.inc.ScalaInstance import sbt.internal.inc.classpath.{ ClasspathUtilities, FilteredLoader } +import sbt.ScriptedPlugin.autoImport._ -object ScriptedPlugin extends AutoPlugin { +object LocalScriptedPlugin extends AutoPlugin { override def requires = plugins.JvmPlugin object autoImport extends ScriptedKeys - import autoImport._ - - override def globalSettings = super.globalSettings ++ Seq( - scriptedBufferLog := true, - scriptedPrescripted := { _ => }, - ) } trait ScriptedKeys { val publishAll = taskKey[Unit]("") val publishLocalBinAll = taskKey[Unit]("") - val scripted = inputKey[Unit]("") val scriptedUnpublished = inputKey[Unit]("Execute scripted without publishing sbt first. " + "Saves you some time when only your test has changed") val scriptedSource = settingKey[File]("") val scriptedPrescripted = taskKey[File => Unit]("") - val scriptedBufferLog = settingKey[Boolean]("") - val scriptedLaunchOpts = settingKey[Seq[String]]("options to pass to jvm launching scripted tasks") } object Scripted { diff --git a/project/build.properties b/project/build.properties index d6e35076c..f59579fd6 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.1.6 +sbt.version=1.2.0 diff --git a/sbt/src/sbt-test/actions/cross-multiproject/build.sbt b/sbt/src/sbt-test/actions/cross-multiproject/build.sbt index f7c0b12fc..d0eff709c 100644 --- a/sbt/src/sbt-test/actions/cross-multiproject/build.sbt +++ b/sbt/src/sbt-test/actions/cross-multiproject/build.sbt @@ -1,6 +1,6 @@ -inThisBuild( +inThisBuild(List( crossScalaVersions := Seq("2.12.1", "2.11.8") -) +)) lazy val rootProj = (project in file(".")) .aggregate(libProj, fooPlugin) diff --git a/sbt/src/sbt-test/actions/previous/scopes.sbt b/sbt/src/sbt-test/actions/previous/scopes.sbt index a6998efe0..8062b1df1 100644 --- a/sbt/src/sbt-test/actions/previous/scopes.sbt +++ b/sbt/src/sbt-test/actions/previous/scopes.sbt @@ -22,7 +22,7 @@ x in subA in Compile := { } -inConfig(Compile)( +inConfig(Compile)(Seq( y in subB := { // verify that the referenced key gets delegated val xty = (x in Test in y).previous getOrElse 0 // 13 @@ -31,7 +31,7 @@ inConfig(Compile)( println(s"xcy=$xcy, xty=$xty") xty * xcy } -) +)) def parser = { import complete.DefaultParsers._ diff --git a/sbt/src/sbt-test/dependency-management/cache-update/build.sbt b/sbt/src/sbt-test/dependency-management/cache-update/build.sbt index 146aca5b5..b0f3eec0b 100644 --- a/sbt/src/sbt-test/dependency-management/cache-update/build.sbt +++ b/sbt/src/sbt-test/dependency-management/cache-update/build.sbt @@ -4,7 +4,7 @@ dependencyOverrides in ThisBuild += "com.github.nscala-time" %% "nscala-time" % lazy val root = (project in file(".")) .dependsOn(p1 % Compile) .settings( - inThisBuild( + inThisBuild(List( organizationName := "eed3si9n", organizationHomepage := Some(url("http://example.com/")), homepage := Some(url("https://github.com/example/example")), @@ -20,7 +20,7 @@ lazy val root = (project in file(".")) version := "0.3.1-SNAPSHOT", description := "An HTTP client for Scala with Async Http Client underneath.", licenses := Seq("Apache 2" -> new URL("http://www.apache.org/licenses/LICENSE-2.0.txt")), - ), + )), ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache") diff --git a/sbt/src/sbt-test/dependency-management/cached-resolution-circular/multi.sbt b/sbt/src/sbt-test/dependency-management/cached-resolution-circular/multi.sbt index 05a8ffae7..b1180c1af 100644 --- a/sbt/src/sbt-test/dependency-management/cached-resolution-circular/multi.sbt +++ b/sbt/src/sbt-test/dependency-management/cached-resolution-circular/multi.sbt @@ -41,8 +41,8 @@ lazy val c = project. lazy val root = (project in file(".")). settings(commonSettings). - settings(inThisBuild( + settings(inThisBuild(Seq( organization := "org.example", version := "1.0-SNAPSHOT", updateOptions := updateOptions.value.withCachedResolution(true) - )) + ))) diff --git a/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/multi.sbt b/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/multi.sbt index aabebeae1..61a573e18 100644 --- a/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/multi.sbt +++ b/sbt/src/sbt-test/dependency-management/cached-resolution-conflicts/multi.sbt @@ -1,12 +1,12 @@ // https://github.com/sbt/sbt/issues/1710 // https://github.com/sbt/sbt/issues/1760 -inThisBuild( +inThisBuild(Seq( organization := "com.example", version := "0.1.0", scalaVersion := "2.10.4", updateOptions := updateOptions.value.withCachedResolution(true) -) +)) def commonSettings: Seq[Def.Setting[_]] = Seq( ivyPaths := IvyPaths((baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")), diff --git a/sbt/src/sbt-test/dependency-management/cached-resolution-exclude/multi.sbt b/sbt/src/sbt-test/dependency-management/cached-resolution-exclude/multi.sbt index 0a3327fa1..7bca9158b 100644 --- a/sbt/src/sbt-test/dependency-management/cached-resolution-exclude/multi.sbt +++ b/sbt/src/sbt-test/dependency-management/cached-resolution-exclude/multi.sbt @@ -27,7 +27,7 @@ lazy val b = project. lazy val root = (project in file(".")). aggregate(a, b). - settings(inThisBuild( + settings(inThisBuild(Seq( organization := "org.example", version := "1.0", updateOptions := updateOptions.value.withCachedResolution(true), @@ -45,4 +45,4 @@ lazy val root = (project in file(".")). sys.error("commons-io NOT found when it should NOT be excluded") } } - )) + ))) diff --git a/sbt/src/sbt-test/dependency-management/cached-resolution-interproj/multi.sbt b/sbt/src/sbt-test/dependency-management/cached-resolution-interproj/multi.sbt index c21995ecc..f359cfc76 100644 --- a/sbt/src/sbt-test/dependency-management/cached-resolution-interproj/multi.sbt +++ b/sbt/src/sbt-test/dependency-management/cached-resolution-interproj/multi.sbt @@ -27,7 +27,7 @@ lazy val a = project. lazy val root = (project in file(".")). aggregate(a). - settings(inThisBuild( + settings(inThisBuild(Seq( organization := "org.example", version := "1.0", updateOptions := updateOptions.value.withCachedResolution(true), @@ -49,4 +49,4 @@ lazy val root = (project in file(".")). sys.error("junit NOT found when it should be included: " + atestcp.toString) } } - )) + ))) 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 a7857d39d..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 @@ -2,12 +2,12 @@ lazy val p1 = (project in file("p1")). settings( checkTask(expectedMongo), libraryDependencies += "org.mongodb" %% "casbah" % "2.4.1" pomOnly(), - inThisBuild( + inThisBuild(List( organization := "org.example", version := "1.0", scalaVersion := "2.9.2", autoScalaLibrary := false - ) + )) ) lazy val p2 = (project in file("p2")). 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 b8ace934d..261aa6ac3 100644 --- a/sbt/src/sbt-test/dependency-management/publish-local/build.sbt +++ b/sbt/src/sbt-test/dependency-management/publish-local/build.sbt @@ -1,12 +1,12 @@ lazy val root = (project in file(".")). dependsOn(sub). aggregate(sub). - settings(inThisBuild( + settings(inThisBuild(List( organization := "A", version := "1.0", ivyPaths := baseDirectory( dir => IvyPaths(dir, Some(dir / "ivy" / "cache")) ).value, externalResolvers := (baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }).value - ), + )), mavenStyle, interProject, name := "Publish Test" 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 ca033e3b8..795608334 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 @@ -1,10 +1,10 @@ lazy val root = (project in file(".")). - settings(inThisBuild( + settings(inThisBuild(List( organization := "A", version := "1.0", ivyPaths := baseDirectory( dir => 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 }).value diff --git a/sbt/src/sbt-test/project/derived/build.sbt b/sbt/src/sbt-test/project/derived/build.sbt index 1d1a5fd5b..21cfc9207 100644 --- a/sbt/src/sbt-test/project/derived/build.sbt +++ b/sbt/src/sbt-test/project/derived/build.sbt @@ -23,7 +23,7 @@ globalDepE in Global := "globalE" // ---------------- Derived settings // verify that deriving is transitive -inScope(GlobalScope)( +inScope(GlobalScope)(Seq( Def.derive(customA := customB.value + "-a"), Def.derive(customB := thisProject.value.id + "-b"), // verify that a setting with multiple triggers still only gets added once @@ -36,7 +36,7 @@ inScope(GlobalScope)( // if customE were added in Global because of name, there would be an error // because description wouldn't be found Def.derive(customE := globalDepE.value + "-" + projectDepE.value) -) +)) // ---------------- Projects diff --git a/sbt/src/sbt-test/tests/fork-test-group-parallel/build.sbt b/sbt/src/sbt-test/tests/fork-test-group-parallel/build.sbt index 8f4ca2611..761d141ee 100644 --- a/sbt/src/sbt-test/tests/fork-test-group-parallel/build.sbt +++ b/sbt/src/sbt-test/tests/fork-test-group-parallel/build.sbt @@ -1,7 +1,7 @@ scalaVersion in ThisBuild := "2.11.8" concurrentRestrictions in Global := Seq(Tags.limitAll(4)) libraryDependencies += "org.specs2" %% "specs2-core" % "3.8.4" % Test -inConfig(Test)( +inConfig(Test)(Seq( testGrouping := { val home = javaHome.value val strategy = outputStrategy.value @@ -22,4 +22,4 @@ inConfig(Test)( ))} }, TaskKey[Unit]("test-failure") := test.failure.value -) +)) diff --git a/src/main/conscript/scalas/launchconfig b/src/main/conscript/scalas/launchconfig index 61b9b5108..ff9e8dae5 100644 --- a/src/main/conscript/scalas/launchconfig +++ b/src/main/conscript/scalas/launchconfig @@ -4,7 +4,7 @@ [app] org: ${sbt.organization-org.scala-sbt} name: sbt - version: ${sbt.version-read(sbt.version)[1.1.1]} + version: ${sbt.version-read(sbt.version)[1.2.0]} class: sbt.ScriptMain components: xsbti,extra cross-versioned: ${sbt.cross.versioned-false} @@ -22,6 +22,7 @@ [boot] directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/} + lock: ${sbt.boot.lock-true} [ivy] ivy-home: ${sbt.ivy.home-${user.home}/.ivy2/} diff --git a/src/main/conscript/screpl/launchconfig b/src/main/conscript/screpl/launchconfig index 23a9a6a39..ff6e22916 100644 --- a/src/main/conscript/screpl/launchconfig +++ b/src/main/conscript/screpl/launchconfig @@ -4,7 +4,7 @@ [app] org: ${sbt.organization-org.scala-sbt} name: sbt - version: ${sbt.version-read(sbt.version)[1.1.1]} + version: ${sbt.version-read(sbt.version)[1.2.0]} class: sbt.ConsoleMain components: xsbti,extra cross-versioned: ${sbt.cross.versioned-false} @@ -22,6 +22,7 @@ [boot] directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/} + lock: ${sbt.boot.lock-true} [ivy] ivy-home: ${sbt.ivy.home-${user.home}/.ivy2/} diff --git a/src/main/conscript/xsbt/launchconfig b/src/main/conscript/xsbt/launchconfig index ff2abceab..f65ff3ced 100644 --- a/src/main/conscript/xsbt/launchconfig +++ b/src/main/conscript/xsbt/launchconfig @@ -4,7 +4,7 @@ [app] org: ${sbt.organization-org.scala-sbt} name: sbt - version: ${sbt.version-read(sbt.version)[1.1.1]} + version: ${sbt.version-read(sbt.version)[1.2.0]} class: sbt.xMain components: xsbti,extra cross-versioned: ${sbt.cross.versioned-false} @@ -22,6 +22,7 @@ [boot] directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/} + lock: ${sbt.boot.lock-true} [ivy] ivy-home: ${sbt.ivy.home-${user.home}/.ivy2/}