mirror of https://github.com/sbt/sbt.git
test to verify source dependency overrides binary dependency
This commit is contained in:
parent
54b6d5db30
commit
bf4d2a7a65
|
|
@ -0,0 +1,3 @@
|
|||
object A {
|
||||
val x = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
organization := "org.example"
|
||||
|
||||
name := "app"
|
||||
|
||||
version := "0.1.17"
|
||||
|
||||
publishTo <<= baseDirectory(base => Some(Resolver.file("sample", base / "repo")))
|
||||
|
||||
resolvers <++= publishTo(_.toList)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object A {
|
||||
val x = 5
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
object B
|
||||
{
|
||||
def main(args: Array[String])
|
||||
{
|
||||
val expected = args(0).toInt
|
||||
val actual = A.x
|
||||
println("Expected: " + expected)
|
||||
println("Actual: " + actual)
|
||||
assert(expected == actual, "Expected " + expected + ", got: " + actual)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
|
||||
object B extends Build
|
||||
{
|
||||
override def projectDefinitions(f: File) = Seq( makeProject(f) )
|
||||
|
||||
def makeProject(f: File) =
|
||||
{
|
||||
val addBin = if(isBinary(f)) binaryDep(baseProject) else baseProject
|
||||
if(isSource(f)) sourceDep(addBin) else addBin
|
||||
}
|
||||
|
||||
def isBinary(f: File) = f / "binary" exists;
|
||||
def isSource(f: File) = f / "source" exists;
|
||||
|
||||
def baseProject = Project("root", file("."))
|
||||
def sourceDep(p: Project) = p dependsOn( file("ext") )
|
||||
def binaryDep(p: Project) = p settings(
|
||||
libraryDependencies += "org.example" %% "app" % "0.1.17",
|
||||
resolvers <+= baseDirectory(base => Resolver.file("sample", base / "repo"))
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
organization := "org.example"
|
||||
|
||||
name := "app"
|
||||
|
||||
version <<= baseDirectory { base =>
|
||||
if(base / "older" exists) "0.1.16" else "0.1.18"
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
> publish
|
||||
$ delete A.scala build.sbt
|
||||
|
||||
$ mkdir ext
|
||||
$ copy-file changes/A.scala ext/A.scala
|
||||
$ copy-file changes/B.scala B.scala
|
||||
$ copy-file changes/Build.scala project/Build.scala
|
||||
$ copy-file changes/ext.sbt ext/build.sbt
|
||||
|
||||
-> compile
|
||||
|
||||
$ touch binary
|
||||
> reload
|
||||
> run 3
|
||||
|
||||
$ delete binary
|
||||
$ touch source
|
||||
> reload
|
||||
> run 5
|
||||
|
||||
$ touch binary source
|
||||
> reload
|
||||
> run 5
|
||||
|
||||
$ touch ext/older
|
||||
> reload
|
||||
> run 5
|
||||
Loading…
Reference in New Issue