use Ivy for some tests

This commit is contained in:
Eugene Yokota 2019-04-19 01:07:27 -04:00
parent b47ed4e62a
commit 9a666b5418
29 changed files with 82 additions and 32 deletions

View File

@ -1,3 +1,6 @@
// https://github.com/coursier/coursier/issues/1123
ThisBuild / useCoursier := false
Seq(
autoAPIMappings in ThisBuild := true,
publishArtifact in (ThisBuild, packageDoc) := false,

View File

@ -1,9 +1,10 @@
import java.nio.file.Files
import java.nio.file.attribute.FileTime
import scala.collection.JavaConverters._
val rewriteIvy = inputKey[Unit]("Rewrite ivy directory")
ThisBuild / useCoursier := false
val snapshot = (project in file(".")).settings(
name := "akka-test",
scalaVersion := "2.12.8",

View File

@ -3,8 +3,10 @@ import sbt.internal.inc.classpath.ClasspathUtilities
lazy val checkFull = taskKey[Unit]("")
lazy val check = taskKey[Unit]("")
lazy val root = (project in file(".")).
settings(
ThisBuild / useCoursier := false
lazy val root = (project in file("."))
.settings(
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")),
publishTo := Some(Resolver.file("Test Publish Repo", file("test-repo"))),
resolvers += (baseDirectory { base => "Test Repo" at (base / "test-repo").toURI.toString }).value,
@ -34,7 +36,7 @@ def publishedID = org % artifactID % vers artifacts(mainArtifact)
def retrieveID = org % "test-retrieve" % "2.0"
// check that the test class is on the compile classpath, either because it was compiled or because it was properly retrieved
def checkTask(classpath: TaskKey[Classpath]) = Def task {
def checkTask(classpath: TaskKey[Classpath]) = Def.task {
val deps = libraryDependencies.value
val cp = (classpath in Compile).value.files
val loader = ClasspathUtilities.toLoader(cp, scalaInstance.value.loader)

View File

@ -1,5 +1,8 @@
ThisBuild / scalaVersion := "2.12.8"
// TTL of Coursier is 24h
ThisBuild / useCoursier := false
def localCache =
ivyPaths := IvyPaths(baseDirectory.value, Some((baseDirectory in ThisBuild).value / "ivy" / "cache"))

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
lazy val check = taskKey[Unit]("Runs the check")
def commonSettings: Seq[Def.Setting[_]] =

View File

@ -1,6 +1,8 @@
// https://github.com/sbt/sbt/issues/1649
lazy val check = taskKey[Unit]("Runs the check")
ThisBuild / useCoursier := false
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")),

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
lazy val check = taskKey[Unit]("Runs the check")
def commonSettings: Seq[Def.Setting[_]] =

View File

@ -1,11 +1,11 @@
configurationsToRetrieve := Some(Vector(Compile))
ThisBuild / useCoursier := false
retrieveManaged := true
libraryDependencies += "log4j" % "log4j" % "1.2.16" % "compile"
autoScalaLibrary := false
managedDirectory := file("dependencies")
retrievePattern := "[conf]/[artifact]-[revision](-[classifier]).[ext]"
lazy val root = (project in file("."))
.settings(
configurationsToRetrieve := Some(Vector(Compile)),
retrieveManaged := true,
libraryDependencies += "log4j" % "log4j" % "1.2.16" % "compile",
autoScalaLibrary := false,
managedDirectory := file("dependencies"),
retrievePattern := "[conf]/[artifact]-[revision](-[classifier]).[ext]",
)

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
libraryDependencies ++= Seq(
"org.spark-project" %% "spark-core" % "0.5.1",
"log4j" % "log4j" % "1.2.17"

View File

@ -1,11 +1,13 @@
ThisBuild / useCoursier := false
resolvers += Resolver.file("buggy", file("repo"))(
Patterns(
ivyPatterns = Vector("[organization]/[module]/[revision]/ivy.xml"),
artifactPatterns = Vector("[organization]/[module]/[revision]/[artifact].[ext]"),
isMavenCompatible = false,
descriptorOptional = true,
skipConsistencyCheck = true
)
Patterns(
ivyPatterns = Vector("[organization]/[module]/[revision]/ivy.xml"),
artifactPatterns = Vector("[organization]/[module]/[revision]/[artifact].[ext]"),
isMavenCompatible = false,
descriptorOptional = true,
skipConsistencyCheck = true
)
)
libraryDependencies += "a" % "b" % "1.0.0" % "compile->runtime" artifacts(Artifact("b1", "jar", "jar"))

View File

@ -1,13 +1,13 @@
<ivy-module xmlns:e="http://ant.apache.org/ivy/extra" version="2.0">
<info organisation="a" module="b" revision="1.0.0" status="release" publication="20160201120702">
<description>a</description>
<description>a</description>
</info>
<configurations>
<conf name="runtime" description="..."/>
<conf name="runtime" description="..."/>
</configurations>
<publications>
<artifact name="b1.jar" type="jar" ext="jar" conf="runtime"/>
<artifact name="b2.jar" type="jar" ext="jar" conf="runtime"/>
<artifact name="b1" type="jar" ext="jar" conf="runtime"/>
<artifact name="fake" type="jar" ext="jar" conf="runtime"/>
</publications>
<dependencies>
</dependencies>

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
lazy val root = (project in file("."))
.settings(
scalaVersion := "2.12.6",

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
lazy val root = (project in file("."))
.settings(
organization := "org.example",

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
libraryDependencies += "log4j" % "log4j" % "1.2.16" % "compile"
autoScalaLibrary := false

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
import scala.xml._
lazy val root = (project in file(".")).

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
externalIvySettings()
externalIvyFile()

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
externalIvySettings()
libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5"

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
lazy val commonSettings = Seq(
autoScalaLibrary := false,
scalaModuleInfo := None,

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
lazy val commonSettings = Seq(
autoScalaLibrary := false,
unmanagedJars in Compile ++= (scalaInstance map (_.allJars.toSeq)).value

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
lazy val a = (project in file(".")).
settings(externalIvySettings()) dependsOn(b)

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
addSbtPlugin("org.example" % "def" % "latest.integration")
resolvers ++= {

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
import complete._
import complete.DefaultParsers._

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
val checkIvyXml = taskKey[Unit]("Checks the ivy.xml transform was correct")
lazy val root = (project in file(".")).

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
retrieveManaged := true
libraryDependencies += "log4j" % "log4j" % "1.2.16"

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
organization := "org.dummy"
scalaOrganization := "org.other"

View File

@ -1,6 +1,9 @@
ThisBuild / organization := "com.example"
ThisBuild / scalaVersion := "2.12.8"
// TTL is 24h so we can't detect the change
ThisBuild / useCoursier := false
def customIvyPaths: Seq[Def.Setting[_]] = Seq(
ivyPaths := IvyPaths((baseDirectory in ThisBuild).value, Some((baseDirectory in ThisBuild).value / "ivy-cache"))
)

View File

@ -1,10 +1,10 @@
ThisBuild / useCoursier := false
ivyPaths := {
val base = baseDirectory.value
IvyPaths(base, Some(base / "ivy-cache"))
}
managedScalaInstance := false
autoScalaLibrary := false
crossPaths := false

View File

@ -11,14 +11,12 @@ lazy val root = (project in file(".")).
def checkClasspath(conf: Configuration) =
fullClasspath in conf map { cp =>
try
{
try {
val loader = ClasspathUtilities.toLoader(cp.files)
Class.forName("org.jsoup.Jsoup", false, loader)
()
}
catch
{
case _: ClassNotFoundException => sys.error("Dependency not downloaded.")
catch {
case _: ClassNotFoundException => sys.error(s"could not instantiate org.jsoup.Jsoup: ${cp.files}")
}
}

View File

@ -1,3 +1,5 @@
ThisBuild / useCoursier := false
lazy val root = (project in file(".")).
settings(
autoScalaLibrary := false,