Port dependency-management/cache-resolver

This commit is contained in:
Eugene Yokota 2016-03-28 12:50:37 -04:00
parent a1a1711106
commit 33c7db17c5
6 changed files with 57 additions and 33 deletions

View File

@ -2,9 +2,6 @@ ivyPaths in ThisBuild := {
val base = (baseDirectory in ThisBuild).value
new IvyPaths(base, Some(base / "ivy-cache"))
}
managedScalaInstance in ThisBuild := false
autoScalaLibrary in ThisBuild := false
crossPaths in ThisBuild := false
crossPaths in ThisBuild := false

View File

@ -0,0 +1,23 @@
lazy val root = (project in file(".")).
aggregate(a,b).
settings(
name := "use",
version := "1.0",
organization in ThisBuild := "org.example",
version in ThisBuild := "2.0-SNAPSHOT",
libraryDependencies += "org.example" % "b" % "2.0-SNAPSHOT",
ivyPaths := (ivyPaths in ThisBuild).value
)
lazy val a = project.
dependsOn(b).
settings(
name := "a",
ivyPaths := (ivyPaths in ThisBuild).value
)
lazy val b = project.
settings(
name := "b",
ivyPaths := (ivyPaths in ThisBuild).value
)

View File

@ -1,16 +0,0 @@
import sbt._
import Keys._
import Import._
object B extends Build {
override def settings = super.settings ++ Seq(
organization := "org.example",
version := "2.0-SNAPSHOT"
)
lazy val root = proj("root", ".") aggregate(a,b)
lazy val a = proj("a", "a") dependsOn(b)
lazy val b = proj("b", "b")
private[this] def proj(id: String, f: String): Project = Project(id, file(f)).settings( ivyPaths <<= ivyPaths in ThisBuild )
}

View File

@ -0,0 +1,20 @@
lazy val root = (project in file(".")).
aggregate(a,b).
settings(
organization in ThisBuild := "org.example",
version in ThisBuild := "2.0-SNAPSHOT",
ivyPaths := (ivyPaths in ThisBuild).value
)
lazy val a = project.
dependsOn(b).
settings(
name := "a",
ivyPaths := (ivyPaths in ThisBuild).value
)
lazy val b = project.
settings(
name := "b",
ivyPaths := (ivyPaths in ThisBuild).value
)

View File

@ -1,9 +1,8 @@
name := "use"
organization := "org.example"
version := "1.0"
libraryDependencies += "org.example" % "b" % "2.0-SNAPSHOT"
ivyPaths <<= ivyPaths in ThisBuild
lazy val root = (project in file(".")).
settings(
name := "use",
organization := "org.example",
version := "1.0",
libraryDependencies += "org.example" % "b" % "2.0-SNAPSHOT",
ivyPaths := (ivyPaths in ThisBuild).value
)

View File

@ -1,6 +1,6 @@
# Publish the def/{a,b} projects to the local repository
$ copy-file changes/def/Build.scala project/Build.scala
$ copy-file changes/def/build.sbt build.sbt
$ copy-file changes/def/Def.java b/Def.java
> reload
> publish-local
@ -11,7 +11,7 @@ $ copy-file changes/def/Def.java b/Def.java
# The resolver will be marked as local in the cache
# The dependency on def/b will be properly resolved
$ delete project/Build.scala
$ delete build.sbt
$ delete b/Def.java
$ copy-file changes/use/build.sbt build.sbt
$ copy-file changes/use/Use.java Use.java
@ -23,7 +23,8 @@ $ copy-file changes/use/Use.java Use.java
# Publish the def/{a,b} projects to the local repository again
# This will change the resolver in the cache to be inter-project
$ copy-file changes/def/Build.scala project/Build.scala
$ delete build.sbt
$ copy-file changes/both/build.sbt build.sbt
$ copy-file changes/def/Def.java b/Def.java
> reload
> publish-local
@ -33,7 +34,7 @@ $ copy-file changes/def/Def.java b/Def.java
# Resolve from local again. This will succeed, but the jars
# won't be on the classpath if the resolver isn't ignoredy.
$ delete project/Build.scala
$ delete build.sbt
$ delete b/Def.java
$ copy-file changes/use/build.sbt build.sbt
$ copy-file changes/use/Use.java Use.java