Merge pull request #2163 from dwijnand/fix/1750

Fix SNAPSHOT srcs/docs with Ivy upgrade.
This commit is contained in:
Josh Suereth 2015-08-27 08:34:09 -04:00
commit f6895b6f00
6 changed files with 63 additions and 2 deletions

View File

@ -19,9 +19,10 @@ env:
- SCRIPTED_TEST="otherUnitTests"
- SCRIPTED_TEST="scripted actions/*"
- SCRIPTED_TEST="scripted api/*"
- SCRIPTED_TEST="scripted compiler-project/*""
- SCRIPTED_TEST="scripted compiler-project/*"
- SCRIPTED_TEST="scripted dependency-management/*1of2"
- SCRIPTED_TEST="scripted dependency-management/*2of2"
- SCRIPTED_TEST="scripted ivy-deps-management/*"
- SCRIPTED_TEST="scripted java/*"
- SCRIPTED_TEST="scripted package/*"
- SCRIPTED_TEST="scripted project/*1of2"

View File

@ -9,7 +9,7 @@ object Dependencies {
lazy val scala211 = "2.11.7"
lazy val jline = "jline" % "jline" % "2.11"
lazy val ivy = "org.scala-sbt.ivy" % "ivy" % "2.3.0-sbt-927bc9ded7f8fba63297cddd0d5a3d01d6ad5d8d"
lazy val ivy = "org.scala-sbt.ivy" % "ivy" % "2.3.0-sbt-d21bcdd997a724338fbb06ecb82453c1431ff6e6"
lazy val jsch = "com.jcraft" % "jsch" % "0.1.46" intransitive ()
lazy val sbinary = "org.scala-tools.sbinary" %% "sbinary" % "0.4.2"
lazy val sbtSerialization = "org.scala-sbt" %% "serialization" % "0.1.2"

View File

@ -0,0 +1,5 @@
package t
object Bippy {
def release = 1
}

View File

@ -0,0 +1,38 @@
def ivyHome = Def.setting((target in LocalRootProject).value / "ivy")
def localRepo = Def.setting((target in LocalRootProject).value / "local-repo")
val commonSettings = Seq[Def.Setting[_]](
organization := "org.example",
version := "1.0-SNAPSHOT",
scalaVersion := "2.11.7",
ivyPaths := new IvyPaths((baseDirectory in ThisBuild).value, Some(ivyHome.value)),
fullResolvers := fullResolvers.value.filterNot(_ == projectResolver.value)
)
lazy val bippy = project settings (
commonSettings,
resolvers += Resolver.file("ivy-local", file(sys.props("user.home")) / ".ivy2" / "local")(Resolver.ivyStylePatterns),
publishTo := Some(Resolver.file("local-repo", localRepo.value))
)
lazy val myapp = project settings (
commonSettings,
resolvers += new MavenRepository("local-repo", localRepo.value.toURL.toString) withLocalIfFile false,
libraryDependencies += "org.example" %% "bippy" % "1.0-SNAPSHOT"
)
InputKey[Unit]("check") := {
import sbt.complete.DefaultParsers._
val n = (token(Space) ~> token(Digit)).map(_.asDigit).parsed
val jarname = "bippy_2.11-1.0-SNAPSHOT-sources.jar"
val file1 = ivyHome.value / "cache" / "org.example" / "bippy_2.11" / "srcs" / jarname
val file2 = ivyHome.value / "maven-cache" / "org" / "example" / "bippy_2.11" / "1.0-SNAPSHOT" / jarname
val file = if (file1.exists()) file1 else if (file2.exists) file2 else sys error s"$jarname MIA"
val jar = new java.util.jar.JarFile(file)
val s = IO readStream jar.getInputStream(jar.getJarEntry("Bippy.scala"))
val expected = s"def release = $n"
assert(s contains expected, s"""Bippy should contain $expected, contents:\n$s""")
()
}

View File

@ -0,0 +1,5 @@
package t
object Bippy {
def release = 2
}

View File

@ -0,0 +1,12 @@
> bippy/publish
> myapp/updateClassifiers
# Sanity check before real test
> check 1
$ copy-file changes/Bippy2.scala bippy/Bippy.scala
> bippy/publish
> myapp/updateClassifiers
> check 2