From 886d95c0e5c71a588f40c010be2f11d69e9ea01e Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Tue, 12 Jul 2016 13:24:01 +0100 Subject: [PATCH] Don't redefine updateOptions to ignore ThisBuild Fixes #2671 --- main/src/main/scala/sbt/Defaults.scala | 1 - .../cached-resolution-circular/multi.sbt | 20 ++++++++--------- .../cached-resolution-conflicts/multi.sbt | 20 +++++++---------- .../cached-resolution-exclude/multi.sbt | 18 ++++++--------- .../cached-resolution-interproj/multi.sbt | 22 ++++++++----------- 5 files changed, 34 insertions(+), 47 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 4025238a9..39e977aba 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -1245,7 +1245,6 @@ object Classpaths { // By default, to retrieve all types *but* these (it's assumed that everything else is binary/resource) new UpdateConfiguration(retrieveConfiguration.value, false, ivyLoggingLevel.value, ArtifactTypeFilter.forbid(specialArtifactTypes)) }, - updateOptions := (updateOptions in Global).value, retrieveConfiguration := { if (retrieveManaged.value) Some(new RetrieveConfiguration(managedDirectory.value, retrievePattern.value, retrieveManagedSync.value, configurationsToRetrieve.value)) else None }, ivyConfiguration <<= mkIvyConfiguration, ivyConfigurations := { 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 8ba4c7f15..a17acd76d 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 @@ -10,13 +10,12 @@ def commonSettings: Seq[Def.Setting[_]] = Seq( ivyPaths := new IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache")), scalaVersion := "2.10.4", - fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project"), - updateOptions := updateOptions.value.withCachedResolution(true) + fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project") ) lazy val a = project. - settings(commonSettings: _*). settings( + commonSettings, name := "a", libraryDependencies := Seq( "commons-io" % "commons-io" % "1.3", @@ -28,21 +27,22 @@ lazy val a = project. ) lazy val b = project. - settings(commonSettings: _*). settings( + commonSettings, name := "b" ) lazy val c = project. - settings(commonSettings: _*). settings( + commonSettings, name := "c", libraryDependencies := Seq(organization.value %% "b" % version.value) ) lazy val root = (project in file(".")). - settings(commonSettings: _*). - settings( - organization in ThisBuild := "org.example", - version in ThisBuild := "1.0-SNAPSHOT" - ) + settings(commonSettings). + 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 abdb4dc68..d1b098cf3 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 @@ -12,22 +12,17 @@ def commonSettings: Seq[Def.Setting[_]] = fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project") ) -def cachedResolutionSettings: Seq[Def.Setting[_]] = - commonSettings ++ Seq( - updateOptions := updateOptions.value.withCachedResolution(true) - ) - lazy val X1 = project. - settings(cachedResolutionSettings: _*). settings( + commonSettings, libraryDependencies ++= Seq( "com.example" %% "y1" % "0.1.0" % "compile->compile;runtime->runtime", "com.example" %% "y2" % "0.1.0" % "compile->compile;runtime->runtime") ) lazy val Y1 = project. - settings(cachedResolutionSettings: _*). settings( + commonSettings, name := "y1", libraryDependencies ++= Seq( // this includes slf4j 1.7.5 @@ -41,8 +36,8 @@ lazy val Y1 = project. ) lazy val Y2 = project. - settings(cachedResolutionSettings: _*). settings( + commonSettings, name := "y2", libraryDependencies ++= Seq( // this includes slf4j 1.6.6 @@ -54,9 +49,10 @@ lazy val Y2 = project. ) lazy val root = (project in file(".")). - settings( - organization in ThisBuild := "org.example", - version in ThisBuild := "1.0", + settings(inThisBuild(Seq( + organization := "org.example", + version := "1.0", + updateOptions := updateOptions.value.withCachedResolution(true), check := { val x1cp = (externalDependencyClasspath in Compile in X1).value.map {_.data.getName}.sorted // sys.error("slf4j-api is not found on X1" + x1cp) @@ -69,4 +65,4 @@ lazy val root = (project in file(".")). sys.error("servlet-api-2.3.jar is found when it should be evicted:" + x1cp) } } - ) + ))) 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 c9233cc5a..d8e6f261d 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 @@ -9,14 +9,9 @@ def commonSettings: Seq[Def.Setting[_]] = resolvers += Resolver.sonatypeRepo("snapshots") ) -def cachedResolutionSettings: Seq[Def.Setting[_]] = - commonSettings ++ Seq( - updateOptions := updateOptions.value.withCachedResolution(true) - ) - lazy val a = project. - settings(cachedResolutionSettings: _*). settings( + commonSettings, libraryDependencies += "net.databinder" %% "unfiltered-uploads" % "0.8.0" exclude("commons-io", "commons-io"), ivyXML := @@ -25,16 +20,17 @@ lazy val a = project. ) lazy val b = project. - settings(cachedResolutionSettings: _*). settings( + commonSettings, libraryDependencies += "net.databinder" %% "unfiltered-uploads" % "0.8.0" ) lazy val root = (project in file(".")). aggregate(a, b). - settings( - organization in ThisBuild := "org.example", - version in ThisBuild := "1.0", + settings(inThisBuild(Seq( + organization := "org.example", + version := "1.0", + updateOptions := updateOptions.value.withCachedResolution(true), check := { val acp = (externalDependencyClasspath in Compile in a).value.sortBy {_.data.getName} val bcp = (externalDependencyClasspath in Compile in b).value.sortBy {_.data.getName} @@ -49,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 064c28ada..50b154fbb 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 @@ -9,32 +9,28 @@ def commonSettings: Seq[Def.Setting[_]] = resolvers += Resolver.sonatypeRepo("snapshots") ) -def cachedResolutionSettings: Seq[Def.Setting[_]] = - commonSettings ++ Seq( - updateOptions := updateOptions.value.withCachedResolution(true) - ) - lazy val transitiveTest = project. - settings(cachedResolutionSettings: _*). settings( + commonSettings, libraryDependencies += "junit" % "junit" % "4.11" % Test ) lazy val transitiveTestDefault = project. - settings(cachedResolutionSettings: _*). settings( + commonSettings, libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.1" ) lazy val a = project. -dependsOn(transitiveTestDefault % Test, transitiveTest % "test->test"). - settings(cachedResolutionSettings: _*) + dependsOn(transitiveTestDefault % Test, transitiveTest % "test->test"). + settings(commonSettings) lazy val root = (project in file(".")). aggregate(a). - settings( - organization in ThisBuild := "org.example", - version in ThisBuild := "1.0", + settings(inThisBuild(Seq( + organization := "org.example", + version := "1.0", + updateOptions := updateOptions.value.withCachedResolution(true), check := { val ur = (update in a).value val acp = (externalDependencyClasspath in Compile in a).value.map {_.data.getName} @@ -53,4 +49,4 @@ lazy val root = (project in file(".")). sys.error("junit NOT found when it should be included: " + atestcp.toString) } } - ) + )))