mirror of https://github.com/sbt/sbt.git
Trying to reproduce #641/#1676
This commit is contained in:
parent
01f1627702
commit
b1aa263b7f
|
|
@ -0,0 +1,44 @@
|
|||
def customIvyPaths: Seq[Def.Setting[_]] = Seq(
|
||||
ivyPaths := new IvyPaths((baseDirectory in ThisBuild).value, Some((baseDirectory in ThisBuild).value / "ivy-cache"))
|
||||
)
|
||||
|
||||
lazy val packageTests = taskKey[File]("package tests")
|
||||
|
||||
lazy val common = project.
|
||||
settings(customIvyPaths: _*).
|
||||
settings(
|
||||
organization := "com.badexample",
|
||||
name := "badexample",
|
||||
version := "1.0-SNAPSHOT",
|
||||
publishTo := {
|
||||
val p = ivyPaths.value.ivyHome.get
|
||||
Some(Resolver.file("maven-share-publish", p / "shared").mavenStyle())
|
||||
},
|
||||
crossVersion := CrossVersion.Disabled,
|
||||
publishMavenStyle := true,
|
||||
packageTests in Compile := (packageBin in Test).value,
|
||||
artifact in (Compile, packageTests) := Artifact(name.value, "tests"),
|
||||
addArtifact(artifact in (Compile, packageTests), packageTests in Compile)
|
||||
)
|
||||
|
||||
lazy val dependent = project.
|
||||
settings(customIvyPaths: _*).
|
||||
settings(
|
||||
// sharedResolver didn't work.
|
||||
resolvers += {
|
||||
val p = ivyPaths.value.ivyHome.get
|
||||
new MavenRepository("maven-share", p.toURL.toString + "/shared")
|
||||
},
|
||||
// Ignore the inter-project resolver, so we force to look remotely.
|
||||
fullResolvers := fullResolvers.value.filterNot(_==projectResolver.value),
|
||||
libraryDependencies += "com.badexample" % "badexample" % "1.0-SNAPSHOT" classifier("tests"),
|
||||
libraryDependencies += "com.badexample" % "badexample" % "1.0-SNAPSHOT"
|
||||
// updateOptions := updateOptions.value.withLatestSnapshots(true)
|
||||
)
|
||||
|
||||
TaskKey[Unit]("dumpResolvers") := {
|
||||
streams.value.log.info(s" -- dependent/fullResolvers -- ")
|
||||
(fullResolvers in dependent).value foreach { r =>
|
||||
streams.value.log.info(s" * ${r}")
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
object Common {
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
object Test {
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object Common {
|
||||
def name = "common"
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object Test {
|
||||
def name = "test"
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object Common {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
object Test {
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object User {
|
||||
println(Common.name)
|
||||
println(Test.name)
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# Validate that a bad dependency fails the compile
|
||||
$ copy-file changes/BadCommon.scala common/src/main/scala/Common.scala
|
||||
$ copy-file changes/BadTest.scala common/src/test/scala/Test.scala
|
||||
> common/publish
|
||||
|
||||
# Force dep resolution to be successful, then compilation to fail
|
||||
> dependent/update
|
||||
-> dependent/compile
|
||||
|
||||
# Push new good change.
|
||||
$ copy-file changes/GoodCommon.scala common/src/main/scala/Common.scala
|
||||
$ copy-file changes/GoodTest.scala common/src/test/scala/Test.scala
|
||||
# Sleep to ensure timestamp change
|
||||
$ sleep 1000
|
||||
> common/publish
|
||||
|
||||
# This should compile now.
|
||||
> dependent/update
|
||||
> dependent/compile
|
||||
Loading…
Reference in New Issue