From 7abe7a95a42cccc9567eb68d4e43589db4f5c546 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Thu, 20 Aug 2015 23:11:15 +0100 Subject: [PATCH 1/3] Add updateClassifiers SNAPSHOT srcs test. Currently fails with: [info] java.lang.AssertionError: assertion failed: Bippy should contain def release = 2, contents: [info] package t [info] [info] object Bippy { [info] def release = 1 [info] } Also fails with MavenResolverPlugin.. :( --- .../bippy/Bippy.scala | 5 +++ .../build.sbt | 38 +++++++++++++++++++ .../changes/Bippy2.scala | 5 +++ .../update-classifiers-snapshot-srcs/test | 12 ++++++ 4 files changed, 60 insertions(+) create mode 100644 sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/bippy/Bippy.scala create mode 100644 sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/build.sbt create mode 100644 sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/changes/Bippy2.scala create mode 100644 sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/test diff --git a/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/bippy/Bippy.scala b/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/bippy/Bippy.scala new file mode 100644 index 000000000..4551f8de6 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/bippy/Bippy.scala @@ -0,0 +1,5 @@ +package t + +object Bippy { + def release = 1 +} diff --git a/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/build.sbt b/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/build.sbt new file mode 100644 index 000000000..06932eb7e --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/build.sbt @@ -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""") + () +} diff --git a/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/changes/Bippy2.scala b/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/changes/Bippy2.scala new file mode 100644 index 000000000..61b347466 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/changes/Bippy2.scala @@ -0,0 +1,5 @@ +package t + +object Bippy { + def release = 2 +} diff --git a/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/test b/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/test new file mode 100644 index 000000000..a4142446b --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/test @@ -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 From 09ae28803cb49d813cda88ab1375eda3011be8ae Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 17 Aug 2015 16:17:24 +0100 Subject: [PATCH 2/3] Fix SNAPSHOT srcs/docs with Ivy upgrade. --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index d676af4bc..b67813b55 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -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" From caa0f9c010ba657c16de2eebf9b7ce929e6cdca9 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Tue, 25 Aug 2015 22:03:12 +0100 Subject: [PATCH 3/3] Move update-classifiers-snapshot-srcs as it fails with MavenResolverPlugin. --- .travis.yml | 3 ++- .../update-classifiers-snapshot-srcs/bippy/Bippy.scala | 0 .../update-classifiers-snapshot-srcs/build.sbt | 0 .../update-classifiers-snapshot-srcs/changes/Bippy2.scala | 0 .../update-classifiers-snapshot-srcs/test | 0 5 files changed, 2 insertions(+), 1 deletion(-) rename sbt/src/sbt-test/{dependency-management => ivy-deps-management}/update-classifiers-snapshot-srcs/bippy/Bippy.scala (100%) rename sbt/src/sbt-test/{dependency-management => ivy-deps-management}/update-classifiers-snapshot-srcs/build.sbt (100%) rename sbt/src/sbt-test/{dependency-management => ivy-deps-management}/update-classifiers-snapshot-srcs/changes/Bippy2.scala (100%) rename sbt/src/sbt-test/{dependency-management => ivy-deps-management}/update-classifiers-snapshot-srcs/test (100%) diff --git a/.travis.yml b/.travis.yml index 45cd0c5e9..ff140215d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/bippy/Bippy.scala b/sbt/src/sbt-test/ivy-deps-management/update-classifiers-snapshot-srcs/bippy/Bippy.scala similarity index 100% rename from sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/bippy/Bippy.scala rename to sbt/src/sbt-test/ivy-deps-management/update-classifiers-snapshot-srcs/bippy/Bippy.scala diff --git a/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/build.sbt b/sbt/src/sbt-test/ivy-deps-management/update-classifiers-snapshot-srcs/build.sbt similarity index 100% rename from sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/build.sbt rename to sbt/src/sbt-test/ivy-deps-management/update-classifiers-snapshot-srcs/build.sbt diff --git a/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/changes/Bippy2.scala b/sbt/src/sbt-test/ivy-deps-management/update-classifiers-snapshot-srcs/changes/Bippy2.scala similarity index 100% rename from sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/changes/Bippy2.scala rename to sbt/src/sbt-test/ivy-deps-management/update-classifiers-snapshot-srcs/changes/Bippy2.scala diff --git a/sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/test b/sbt/src/sbt-test/ivy-deps-management/update-classifiers-snapshot-srcs/test similarity index 100% rename from sbt/src/sbt-test/dependency-management/update-classifiers-snapshot-srcs/test rename to sbt/src/sbt-test/ivy-deps-management/update-classifiers-snapshot-srcs/test