mirror of https://github.com/sbt/sbt.git
Fix lm-coursier scripted
This commit is contained in:
parent
6d3fcb495d
commit
149aa09315
|
|
@ -221,13 +221,12 @@ jobs:
|
|||
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
|
||||
find $HOME/.sbt -name "*.lock" -delete || true
|
||||
coursier-test:
|
||||
name: test lm-coursier (${{ matrix.os }}, ${{ matrix.TEST_GROUP }})
|
||||
name: test lm-coursier (${{ matrix.os }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
TEST_GROUP: [1, 2]
|
||||
steps:
|
||||
- name: Don't convert LF to CRLF during checkout
|
||||
if: runner.os == 'Windows'
|
||||
|
|
@ -245,5 +244,3 @@ jobs:
|
|||
apps: sbt
|
||||
- run: scripts/lm-coursier-ci.sh
|
||||
shell: bash
|
||||
env:
|
||||
TEST_GROUP: ${{ matrix.TEST_GROUP }}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-c
|
|||
|
||||
def commonSettings: Seq[Def.Setting[_]] =
|
||||
Seq(
|
||||
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")),
|
||||
ivyPaths := IvyPaths( (ThisBuild / baseDirectory).value, Some((baseDirectory in LocalRootProject).value / "ivy-cache")),
|
||||
dependencyCacheDirectory := (baseDirectory in LocalRootProject).value / "dependency",
|
||||
scalaVersion := "2.10.4",
|
||||
organization in ThisBuild := "org.example",
|
||||
version in ThisBuild := "1.0-SNAPSHOT",
|
||||
ThisBuild / organization := "org.example",
|
||||
ThisBuild / version := "1.0-SNAPSHOT",
|
||||
resolvers += Resolver.file("old-local", file(sys.props("user.home") + "/.ivy2/local"))(Resolver.ivyStylePatterns)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ lazy val b = project
|
|||
)
|
||||
|
||||
lazy val bResolver = Def.setting {
|
||||
val dir = baseDirectory.in(ThisBuild).value / "b-repo"
|
||||
val dir = (ThisBuild / baseDirectory).value / "b-repo"
|
||||
Resolver.file("b-resolver", dir)(Resolver.defaultIvyPatterns)
|
||||
}
|
||||
|
||||
|
|
@ -17,8 +17,8 @@ lazy val check = taskKey[Unit]("")
|
|||
|
||||
check := {
|
||||
import java.nio.file._
|
||||
val f = baseDirectory.in(ThisBuild).value / "b-repo/b/b_2.12/0.1.0-SNAPSHOT/ivys/ivy.xml"
|
||||
assert(f.exists())
|
||||
val f = (ThisBuild / baseDirectory).value / "b-repo/b/b_3/0.1.0-SNAPSHOT/ivys/ivy.xml"
|
||||
assert(f.exists(), s"missing $f")
|
||||
val content = new String(Files.readAllBytes(f.toPath), "UTF-8")
|
||||
assert(content.contains("""e:info.apiURL="http://example.org/b""""))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
lazy val check = taskKey[Unit]("")
|
||||
|
||||
scalaVersion in ThisBuild := "2.12.8"
|
||||
organization in ThisBuild := "com.example"
|
||||
ThisBuild / scalaVersion := "2.12.8"
|
||||
ThisBuild / organization := "com.example"
|
||||
|
||||
lazy val app = (project in file("app"))
|
||||
.dependsOn(util)
|
||||
|
|
@ -9,7 +9,7 @@ lazy val app = (project in file("app"))
|
|||
name := "app",
|
||||
libraryDependencies += "com.chuusai" %% "shapeless" % "2.3.3",
|
||||
check := {
|
||||
val ur = update.value
|
||||
val ur = updateFull.value
|
||||
val cr = ur.configuration(Compile).get
|
||||
// configuration report must include a module report for subproject dependency
|
||||
val coreReport = cr.modules.find(m =>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
> run
|
||||
> runBlock
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ scalaVersion := "2.12.8"
|
|||
val checkEmpty = TaskKey[Unit]("checkEmpty")
|
||||
|
||||
checkEmpty := {
|
||||
assert(coursier.Helper.checkEmpty)
|
||||
assert(coursier.Helper.checkEmpty())
|
||||
}
|
||||
|
||||
val checkNotEmpty = TaskKey[Unit]("checkNotEmpty")
|
||||
|
||||
checkNotEmpty := {
|
||||
assert(!coursier.Helper.checkEmpty)
|
||||
assert(!coursier.Helper.checkEmpty())
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
## TODO fix
|
||||
> clean
|
||||
> checkEmpty
|
||||
> update
|
||||
|
|
@ -4,7 +4,7 @@ scalaVersion := "2.12.8"
|
|||
|
||||
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
|
||||
|
||||
coursierExtraCredentials += {
|
||||
csrExtraCredentials += {
|
||||
val content =
|
||||
s"""foo.host=${uri(sys.env("TEST_REPOSITORY")).getHost}
|
||||
|foo.username=user
|
||||
|
|
@ -12,9 +12,9 @@ coursierExtraCredentials += {
|
|||
|foo.auto=true
|
||||
|foo.https-only=false
|
||||
""".stripMargin
|
||||
val dest = baseDirectory.in(ThisBuild).value / "project" / "target" / "cred"
|
||||
val dest = (ThisBuild / baseDirectory).value / "project" / "target" / "cred"
|
||||
Files.write(dest.toPath, content.getBytes("UTF-8"))
|
||||
lmcoursier.credentials.Credentials(dest)
|
||||
lmcoursier.credentials.FileCredentials(dest.toString)
|
||||
}
|
||||
|
||||
libraryDependencies += "com.abc" % "test" % "0.1"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
coursierExtraCredentials += lmcoursier.credentials.Credentials(
|
||||
csrExtraCredentials += lmcoursier.credentials.DirectCredentials(
|
||||
uri(sys.env("TEST_REPOSITORY")).getHost,
|
||||
sys.env("TEST_REPOSITORY_USER"),
|
||||
sys.env("TEST_REPOSITORY_PASSWORD")
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
scalaVersion := "2.12.8"
|
||||
|
||||
organization := "io.get-coursier.test"
|
||||
name := "dependency-overrides"
|
||||
version := "0.1.0-SNAPSHOT"
|
||||
|
||||
libraryDependencies += "io.get-coursier" %% "coursier" % "2.0.0-RC2-6"
|
||||
dependencyOverrides += "io.get-coursier" %% "coursier-core" % "1.1.0-M14-7"
|
||||
|
||||
lazy val check = taskKey[Unit]("")
|
||||
|
||||
check := {
|
||||
val f = coursierWriteIvyXml.value
|
||||
val content = new String(java.nio.file.Files.readAllBytes(f.toPath), "UTF-8")
|
||||
System.err.println(s"ivy.xml:\n'$content'")
|
||||
assert(content.contains("<override "), s"No override found in '$content'")
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import coursier.util.Properties
|
||||
|
||||
object Main extends App {
|
||||
val expected = "1.1.0-M14-7"
|
||||
assert(
|
||||
Properties.version == expected,
|
||||
s"Expected coursier-core $expected, got ${Properties.version}"
|
||||
)
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
> run
|
||||
> check
|
||||
|
|
@ -31,14 +31,9 @@ lazy val c = project
|
|||
|
||||
lazy val check = taskKey[Unit]("")
|
||||
|
||||
check := {
|
||||
|
||||
val aReport = update.in(a).value
|
||||
val bReport = update.in(b).value
|
||||
val cReport = update.in(c).value
|
||||
|
||||
def doCheck(report: UpdateReport, evictionsExpected: Boolean = true): Unit = {
|
||||
|
||||
Global / check := {
|
||||
inline def doCheck(project: Project, evictionsExpected: Boolean = true): Unit = {
|
||||
val report = (project / updateFull).value
|
||||
val compileReport = report
|
||||
.configurations
|
||||
.find(_.configuration.name == "compile")
|
||||
|
|
@ -49,10 +44,13 @@ check := {
|
|||
val foundEvictions = compileReport.details.exists(_.modules.exists(_.evicted))
|
||||
if (foundEvictions != evictionsExpected)
|
||||
compileReport.details.foreach(println)
|
||||
assert(foundEvictions == evictionsExpected)
|
||||
assert(
|
||||
foundEvictions == evictionsExpected,
|
||||
if evictionsExpected then s"no evictions in ${project.id}" else s"evictions in ${project.id}"
|
||||
)
|
||||
}
|
||||
|
||||
doCheck(aReport)
|
||||
doCheck(bReport)
|
||||
doCheck(cReport, evictionsExpected = false)
|
||||
doCheck(a)
|
||||
doCheck(b)
|
||||
doCheck(c, evictionsExpected = false)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
scalaVersion := "2.12.8"
|
||||
scalaVersion := "2.12.20"
|
||||
|
||||
libraryDependencies += "ccl.northwestern.edu" % "netlogo" % "5.3.1" % "provided" from s"https://github.com/NetLogo/NetLogo/releases/download/5.3.1/NetLogo.jar"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
$ delete output
|
||||
> run
|
||||
> runBlock
|
||||
$ exists output
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
scalaVersion := "2.12.8"
|
||||
scalaVersion := "2.12.20"
|
||||
|
||||
// keeping the default cache policies here
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
$ delete output
|
||||
> run
|
||||
> runBlock
|
||||
$ exists output
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
scalaVersion := "2.12.8"
|
||||
scalaVersion := "2.12.20"
|
||||
|
||||
libraryDependencies += "com.chuusai" %% "shapeless" % "2.3.41" from {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
$ delete output
|
||||
> run
|
||||
> runBlock
|
||||
$ exists output
|
||||
$ delete shapeless_2.11-2.3.0.jar
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@ val logFile = settingKey[File]("")
|
|||
// Arbitrary dependency with no transitive dependencies
|
||||
libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.25"
|
||||
// We want to control when the cache gets a hit
|
||||
coursierCache := baseDirectory.value / "cache"
|
||||
csrCacheDirectory := baseDirectory.value / "cache"
|
||||
logFile := baseDirectory.value / "log"
|
||||
|
||||
coursierLogger := {
|
||||
csrLogger := {
|
||||
var logStream: java.io.PrintStream = null
|
||||
def log(msg: String): Unit = {
|
||||
println(msg)
|
||||
logStream.println(msg)
|
||||
}
|
||||
val cacheFile = coursierCache.value
|
||||
val cacheFile = csrCacheDirectory.value
|
||||
|
||||
val logger = new lmcoursier.definitions.CacheLogger {
|
||||
override def init(sizeHint: Option[Int]): Unit = {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
$ delete output
|
||||
> run
|
||||
> runBlock
|
||||
$ exists output
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ libraryDependencies ++= Seq(
|
|||
// depends on coursier-core 2.0.0-RC6-16
|
||||
"io.get-coursier" %% "coursier" % "2.0.0-RC6-16" % Test
|
||||
)
|
||||
mainClass.in(Compile) := Some("Main")
|
||||
mainClass.in(Test) := Some("Test")
|
||||
Compile / mainClass := Some("Main")
|
||||
Test / mainClass := Some("Test")
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
> run
|
||||
> test:run
|
||||
> runBlock
|
||||
> Test/run
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ object Main extends App {
|
|||
.toVector
|
||||
.map(_.toString)
|
||||
.sorted
|
||||
.distinct // TODO should not need distinct
|
||||
|
||||
notFromCoursierCache("scala-library")
|
||||
assert(props.lengthCompare(1) == 0, s"Found several library.properties files in classpath: $props")
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
$ delete output
|
||||
> run
|
||||
> runBlock
|
||||
$ exists output
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
$ delete output
|
||||
> run
|
||||
> runBlock
|
||||
$ exists output
|
||||
> updateClassifiersCheck
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
import lmcoursier.definitions.*
|
||||
import lmcoursier.syntax.*
|
||||
|
||||
lazy val semver61 = project
|
||||
.settings(
|
||||
|
|
@ -6,7 +8,7 @@ lazy val semver61 = project
|
|||
"com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M11",
|
||||
"io.argonaut" %% "argonaut" % "6.1"
|
||||
),
|
||||
versionReconciliation += "*" % "*" % "semver"
|
||||
csrReconciliations += ModuleMatchers.all -> Reconciliation.SemVer
|
||||
)
|
||||
|
||||
lazy val semver62 = project
|
||||
|
|
@ -16,7 +18,7 @@ lazy val semver62 = project
|
|||
"com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M11",
|
||||
"io.argonaut" %% "argonaut" % "6.2"
|
||||
),
|
||||
versionReconciliation += "*" % "*" % "semver"
|
||||
csrReconciliations += ModuleMatchers.all -> Reconciliation.SemVer
|
||||
)
|
||||
|
||||
lazy val strict62 = project
|
||||
|
|
@ -26,6 +28,6 @@ lazy val strict62 = project
|
|||
"com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M11",
|
||||
"io.argonaut" %% "argonaut" % "6.2"
|
||||
),
|
||||
versionReconciliation += "*" % "*" % "strict"
|
||||
csrReconciliations += ModuleMatchers.all -> Reconciliation.Strict
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
$ delete output
|
||||
> run
|
||||
> runBlock
|
||||
$ exists output
|
||||
> updateSbtClassifiers
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
import lmcoursier.definitions.*
|
||||
import lmcoursier.syntax.*
|
||||
|
||||
lazy val shared = Seq(
|
||||
scalaVersion := "2.12.8",
|
||||
libraryDependencies ++= Seq(
|
||||
|
|
@ -26,5 +29,9 @@ lazy val c = project
|
|||
"com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0",
|
||||
"com.chuusai" %% "shapeless" % "2.3.2"
|
||||
),
|
||||
versionReconciliation += "com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "strict"
|
||||
csrReconciliations += {
|
||||
val sv = scalaBinaryVersion.value
|
||||
ModuleMatchers.only("com.github.alexarchambault", s"argonaut-shapeless_6.2_$sv") -> Reconciliation.Strict
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ lazy val a = project
|
|||
.settings(
|
||||
organization := org,
|
||||
name := nme,
|
||||
publishArtifact.in(Test) := true,
|
||||
version := ver
|
||||
Test / publishArtifact := true,
|
||||
version := ver,
|
||||
Compile / doc / sources := Seq.empty, // TODO fix doc task
|
||||
Test / doc / sources := Seq.empty
|
||||
)
|
||||
|
||||
lazy val b = project
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
scalaOrganization := "org.typelevel"
|
||||
scalaVersion := "2.11.7"
|
||||
scalacOptions += "-Xexperimental"
|
||||
|
||||
// no effect, as the right version is forced anyway (to scalaVersion.value)
|
||||
libraryDependencies += "org.typelevel" % "scala-library" % "2.11.12345"
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
object Main extends App {
|
||||
val n': 2.type = 2
|
||||
|
||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
$ delete output
|
||||
> run
|
||||
$ exists output
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
scalaVersion := "2.12.2-bin-typelevel-4"
|
||||
scalaOrganization := "org.typelevel"
|
||||
scalacOptions += "-Yinduction-heuristics"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"com.47deg" %% "freestyle" % "0.1.0",
|
||||
compilerPlugin("org.scalamacros" %% "paradise" % "2.1.1" cross CrossVersion.patch)
|
||||
)
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import freestyle._
|
||||
|
||||
@free trait Foo {
|
||||
def bzz: FS[java.lang.String]
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
> compile
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
scalaOrganization := "org.typelevel"
|
||||
scalaVersion := "2.11.7"
|
||||
scalacOptions += "-Xexperimental"
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
object Main extends App {
|
||||
val n': 2.type = 2
|
||||
|
||||
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
$ delete output
|
||||
> run
|
||||
$ exists output
|
||||
|
|
@ -43,8 +43,5 @@ updateSbtClassifiersCheck := {
|
|||
|
||||
ensureHasArtifact("org.scala-lang" -> "scala-library")
|
||||
ensureHasArtifact("org.scala-lang.modules" -> s"scala-xml_${scalaBinaryVersion.value}")
|
||||
ensureHasArtifact(
|
||||
"io.get-coursier" -> s"lm-coursier_${scalaBinaryVersion.value}",
|
||||
"io.get-coursier" -> s"lm-coursier-shaded_${scalaBinaryVersion.value}"
|
||||
)
|
||||
ensureHasArtifact("org.scala-sbt" -> s"librarymanagement-coursier_${scalaBinaryVersion.value}")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.0")
|
||||
|
|
@ -43,8 +43,5 @@ updateSbtClassifiersCheck := {
|
|||
|
||||
ensureHasArtifact("org.scala-lang" -> "scala-library")
|
||||
ensureHasArtifact("org.scala-lang.modules" -> s"scala-xml_${scalaBinaryVersion.value}")
|
||||
ensureHasArtifact(
|
||||
"io.get-coursier" -> s"lm-coursier_${scalaBinaryVersion.value}",
|
||||
"io.get-coursier" -> s"lm-coursier-shaded_${scalaBinaryVersion.value}"
|
||||
)
|
||||
ensureHasArtifact("org.scala-sbt" -> s"librarymanagement-coursier_${scalaBinaryVersion.value}")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import lmcoursier.definitions.*
|
||||
import lmcoursier.syntax.*
|
||||
|
||||
lazy val shared = Seq(
|
||||
scalaVersion := "2.12.8",
|
||||
|
|
@ -5,7 +7,7 @@ lazy val shared = Seq(
|
|||
"com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M4",
|
||||
"com.chuusai" %% "shapeless" % "2.3.3"
|
||||
),
|
||||
versionReconciliation += "*" % "*" % "strict"
|
||||
csrReconciliations += ModuleMatchers.all -> Reconciliation.Strict
|
||||
)
|
||||
|
||||
lazy val a = project
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
$ delete output
|
||||
> run
|
||||
> runBlock
|
||||
$ exists output
|
||||
|
|
|
|||
|
|
@ -18,18 +18,8 @@ else
|
|||
SBT="sbt.bat"
|
||||
fi
|
||||
|
||||
if [ "$TEST_GROUP" = 1 ]; then
|
||||
SCRIPTED_EXTRA="sbt-lm-coursier/*"
|
||||
elif [ "$TEST_GROUP" = 2 ]; then
|
||||
SCRIPTED_EXTRA="scala-211/*"
|
||||
else
|
||||
SCRIPTED_EXTRA=""
|
||||
fi
|
||||
|
||||
# publishing locally to ensure shading runs fine
|
||||
./lm-coursier/metadata/scripts/with-test-repo.sh $SBT \
|
||||
lmCoursierShaded/publishLocal \
|
||||
lmCoursierShadedPublishing/publishLocal \
|
||||
lmCoursier/test \
|
||||
# +lm-coursier-shaded/publishLocal \
|
||||
# +lm-coursier/test \
|
||||
# "sbt-lm-coursier/scripted shared-$TEST_GROUP/* $SCRIPTED_EXTRA"
|
||||
'scripted lm-coursier/*'
|
||||
|
|
|
|||
Loading…
Reference in New Issue