mirror of https://github.com/sbt/sbt.git
Merge pull request #1644 from sbt/wip/cached-resolution-bug
[0.13.7] Fixes json serialization turning license into {}.
This commit is contained in:
commit
3478973935
|
|
@ -128,7 +128,8 @@ object IvyRetrieve {
|
|||
val licenses: Seq[(String, Option[String])] = mdOpt match {
|
||||
case Some(md) => md.getLicenses.toArray.toVector collect {
|
||||
case lic: IvyLicense if Option(lic.getName).isDefined =>
|
||||
(lic.getName, nonEmptyString(lic.getUrl))
|
||||
val temporaryURL = "http://localhost"
|
||||
(lic.getName, nonEmptyString(lic.getUrl) orElse { Some(temporaryURL) })
|
||||
}
|
||||
case _ => Nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ object Resolver {
|
|||
def loadHomeFromSettings(f: () => File): Option[File] =
|
||||
try {
|
||||
val file = f()
|
||||
if(!file.exists) None
|
||||
if (!file.exists) None
|
||||
else ((XML.loadFile(file) \ "localRepository").text match {
|
||||
case "" => None
|
||||
case e @ _ => Some(new File(e))
|
||||
|
|
|
|||
|
|
@ -1062,6 +1062,10 @@ object Classpaths {
|
|||
},
|
||||
moduleName <<= normalizedName,
|
||||
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,
|
||||
|
|
@ -1266,7 +1270,7 @@ object Classpaths {
|
|||
val show = Reference.display(thisProjectRef.value)
|
||||
val st = state.value
|
||||
val logicalClock = LogicalClock(Hash.toHex(intToByteArray(st.hashCode)))
|
||||
val depDir = BuildPaths.getDependencyDirectory(st, BuildPaths.getGlobalBase(st))
|
||||
val depDir = dependencyCacheDirectory.value
|
||||
cachedUpdate(s.cacheDirectory / updateCacheName.value, show, ivyModule.value, updateConfiguration.value, transform,
|
||||
skip = (skip in update).value, force = isRoot, depsUpdated = depsUpdated,
|
||||
uwConfig = uwConfig, logicalClock = logicalClock, depDir = Some(depDir), log = s.log)
|
||||
|
|
|
|||
|
|
@ -297,6 +297,7 @@ object Keys {
|
|||
val retrieveConfiguration = SettingKey[Option[RetrieveConfiguration]]("retrieve-configuration", "Configures retrieving dependencies to the current build.", DSetting)
|
||||
val offline = SettingKey[Boolean]("offline", "Configures sbt to work without a network connection where possible.", ASetting)
|
||||
val ivyPaths = SettingKey[IvyPaths]("ivy-paths", "Configures paths used by Ivy for dependency management.", DSetting)
|
||||
val dependencyCacheDirectory = TaskKey[File]("dependency-cache-directory", "The base directory for cached dependencies.", DTask)
|
||||
val libraryDependencies = SettingKey[Seq[ModuleID]]("library-dependencies", "Declares managed dependencies.", APlusSetting)
|
||||
val dependencyOverrides = SettingKey[Set[ModuleID]]("dependency-overrides", "Declares managed dependency overrides.", BSetting)
|
||||
val allDependencies = TaskKey[Seq[ModuleID]]("all-dependencies", "Inter-project and library dependencies.", CTask)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ lazy val check = taskKey[Unit]("Runs the check")
|
|||
|
||||
def commonSettings: Seq[Def.Setting[_]] =
|
||||
Seq(
|
||||
ivyPaths := new IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache")),
|
||||
ivyPaths := new IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")),
|
||||
dependencyCacheDirectory := (baseDirectory in LocalRootProject).value / "dependency",
|
||||
libraryDependencies := Seq(
|
||||
"net.sf.json-lib" % "json-lib" % "2.4" classifier "jdk15" intransitive(),
|
||||
"com.typesafe.akka" %% "akka-remote" % "2.3.4" exclude("com.typesafe.akka", "akka-actor_2.10"),
|
||||
|
|
@ -2,4 +2,6 @@
|
|||
|
||||
> check
|
||||
|
||||
# > c/run
|
||||
> clean
|
||||
|
||||
> check
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
lazy val check = taskKey[Unit]("Runs the check")
|
||||
|
||||
def commonSettings: Seq[Def.Setting[_]] =
|
||||
Seq(
|
||||
ivyPaths := new IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")),
|
||||
dependencyCacheDirectory := (baseDirectory in LocalRootProject).value / "dependency",
|
||||
libraryDependencies := Seq(
|
||||
"org.springframework" % "spring-core" % "3.2.2.RELEASE" force() exclude("org.springframework", "spring-asm"),
|
||||
"org.springframework" % "spring-context" % "4.0.3.RELEASE" exclude("org.springframework", "spring-asm")
|
||||
),
|
||||
scalaVersion := "2.10.4",
|
||||
resolvers += Resolver.sonatypeRepo("snapshots")
|
||||
)
|
||||
|
||||
def cachedResolutionSettings: Seq[Def.Setting[_]] =
|
||||
commonSettings ++ Seq(
|
||||
updateOptions := updateOptions.value.withCachedResolution(true)
|
||||
)
|
||||
|
||||
lazy val a = project.
|
||||
settings(cachedResolutionSettings: _*)
|
||||
|
||||
lazy val b = project.
|
||||
settings(commonSettings: _*)
|
||||
|
||||
lazy val c = project.
|
||||
dependsOn(a).
|
||||
settings(cachedResolutionSettings: _*)
|
||||
|
||||
lazy val root = (project in file(".")).
|
||||
aggregate(a, b, c).
|
||||
settings(
|
||||
organization in ThisBuild := "org.example",
|
||||
version in ThisBuild := "1.0",
|
||||
check := {
|
||||
// sys.error(dependencyCacheDirectory.value.toString)
|
||||
val acp = (externalDependencyClasspath in Compile in a).value.sortBy {_.data.getName}
|
||||
val bcp = (externalDependencyClasspath in Compile in b).value.sortBy {_.data.getName}
|
||||
val ccp = (externalDependencyClasspath in Compile in c).value.sortBy {_.data.getName}
|
||||
if (acp == bcp && acp == ccp) ()
|
||||
else sys.error("Different classpaths are found:" +
|
||||
"\n - a (consolidated) " + acp.toString +
|
||||
"\n - b (plain) " + bcp.toString +
|
||||
"\n - c (inter-project) " + ccp.toString)
|
||||
}
|
||||
)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
> check
|
||||
|
||||
> clean
|
||||
|
||||
> check
|
||||
Loading…
Reference in New Issue