Don't redefine updateOptions to ignore ThisBuild

Fixes #2671
This commit is contained in:
Dale Wijnand 2016-07-12 13:24:01 +01:00
parent 798683b552
commit 886d95c0e5
5 changed files with 34 additions and 47 deletions

View File

@ -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 := {

View File

@ -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)
)))

View File

@ -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)
}
}
)
)))

View File

@ -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 :=
<dependencies>
@ -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")
}
}
)
)))

View File

@ -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)
}
}
)
)))