mirror of https://github.com/sbt/sbt.git
scripted tests
This commit is contained in:
parent
9821f5e1b4
commit
ec3eda3cc2
|
|
@ -132,19 +132,23 @@ jobs:
|
|||
if: ${{ matrix.jobtype == 2 }}
|
||||
shell: bash
|
||||
run: |
|
||||
./sbt -v "scripted actions/* apiinfo/* compiler-project/* ivy-deps-management/* reporter/* tests/* watch/* classloader-cache/* package/*"
|
||||
./sbt -v "scripted actions/* apiinfo/* compiler-project/* ivy-deps-management/* reporter/* tests/* classloader-cache/* package/*"
|
||||
# ./sbt -v "scripted watch/*"
|
||||
- name: Build and test (3)
|
||||
if: ${{ matrix.jobtype == 3 }}
|
||||
shell: bash
|
||||
run: |
|
||||
# ./sbt -v "dependencyTreeProj/publishLocal; scripted dependency-graph/*"
|
||||
./sbt -v --client "scripted dependency-management/* plugins/* project-load/* java/* run/* nio/*"
|
||||
./sbt -v --client "scripted dependency-management/* project-load/* java/* run/*"
|
||||
# ./sbt -v --client "scripted plugins/*"
|
||||
# ./sbt -v --client "scripted nio/*"
|
||||
- name: Build and test (4)
|
||||
if: ${{ matrix.jobtype == 4 }}
|
||||
shell: bash
|
||||
run: |
|
||||
# ./sbt -v "repoOverrideTest:scripted dependency-management/*"
|
||||
./sbt -v "scripted source-dependencies/* project/*"
|
||||
./sbt -v "scripted source-dependencies/*"
|
||||
# ./sbt -v "scripted project/*"
|
||||
# - name: Build and test (5)
|
||||
# if: ${{ matrix.jobtype == 5 }}
|
||||
# shell: bash
|
||||
|
|
|
|||
|
|
@ -28,6 +28,16 @@ package object sbt
|
|||
with sbt.OptionSyntax
|
||||
with sbt.SlashSyntax
|
||||
with sbt.Import:
|
||||
export Project.{
|
||||
validProjectID,
|
||||
fillTaskAxis,
|
||||
mapScope,
|
||||
transform,
|
||||
transformRef,
|
||||
inThisBuild,
|
||||
inScope,
|
||||
normalizeModuleID
|
||||
}
|
||||
// IO
|
||||
def uri(s: String): URI = new URI(s)
|
||||
def file(s: String): File = new File(s)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package test.nested
|
||||
|
||||
trait Foo {
|
||||
def xyz(x: test.Nested)
|
||||
def xyz(x: test.Nested): Unit
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
ThisBuild / scalaVersion := "2.12.17"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"com.novocode" % "junit-interface" % "0.5" % Test,
|
||||
"junit" % "junit" % "4.13.1" % Test,
|
||||
"com.novocode" % "junit-interface" % "0.5" % Test,
|
||||
"junit" % "junit" % "4.13.1" % Test,
|
||||
"commons-io" % "commons-io" % "2.5" % Runtime,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ lazy val root = (project in file("."))
|
|||
// https://github.com/sbt/sbt/pull/1620
|
||||
// sbt resolves dependencies every compile when using %% with dependencyOverrides
|
||||
TaskKey[Unit]("check") := {
|
||||
val s = (streams in update).value
|
||||
val s = (update / streams).value
|
||||
|
||||
val cacheDirectory = crossTarget.value / "update" / updateCacheName.value
|
||||
val cacheStoreFactory = sbt.util.CacheStoreFactory.directory(cacheDirectory)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-c
|
|||
def commonSettings: Seq[Def.Setting[_]] =
|
||||
Seq(
|
||||
ivyPaths := IvyPaths((ThisBuild / baseDirectory).value, Some((LocalRootProject / target).value / "ivy-cache")),
|
||||
dependencyCacheDirectory := (baseDirectory in LocalRootProject).value / "dependency",
|
||||
dependencyCacheDirectory := (LocalRootProject / baseDirectory).value / "dependency",
|
||||
scalaVersion := "2.10.4",
|
||||
resolvers += Resolver.sonatypeRepo("snapshots")
|
||||
)
|
||||
|
|
@ -16,7 +16,7 @@ lazy val classifierTest = project.
|
|||
settings(commonSettings: _*).
|
||||
settings(
|
||||
libraryDependencies := Seq(
|
||||
"net.sf.json-lib" % "json-lib" % "2.4" classifier "jdk15" intransitive(),
|
||||
("net.sf.json-lib" % "json-lib" % "2.4").classifier("jdk15").intransitive(),
|
||||
"commons-io" % "commons-io" % "1.4"
|
||||
)
|
||||
)
|
||||
|
|
@ -34,11 +34,11 @@ lazy val a = project.
|
|||
settings(commonSettings: _*).
|
||||
settings(
|
||||
updateOptions := updateOptions.value.withCachedResolution(true),
|
||||
artifact in (Compile, packageBin) := Artifact("demo"),
|
||||
(Compile / packageBin / artifact) := Artifact("demo"),
|
||||
libraryDependencies := Seq(
|
||||
"com.typesafe.akka" %% "akka-remote" % "2.3.4" exclude("com.typesafe.akka", "akka-actor_2.10"),
|
||||
"net.databinder" %% "unfiltered-uploads" % "0.8.0",
|
||||
"commons-io" % "commons-io" % "1.4" classifier "sources",
|
||||
("commons-io" % "commons-io" % "1.4").classifier("sources"),
|
||||
"com.typesafe" % "config" % "0.4.9-SNAPSHOT"
|
||||
)
|
||||
)
|
||||
|
|
@ -50,7 +50,7 @@ lazy val b = project.
|
|||
libraryDependencies := Seq(
|
||||
"com.typesafe.akka" %% "akka-remote" % "2.3.4" exclude("com.typesafe.akka", "akka-actor_2.10"),
|
||||
"net.databinder" %% "unfiltered-uploads" % "0.8.0",
|
||||
"commons-io" % "commons-io" % "1.4" classifier "sources",
|
||||
("commons-io" % "commons-io" % "1.4").classifier("sources"),
|
||||
"com.typesafe" % "config" % "0.4.9-SNAPSHOT"
|
||||
)
|
||||
)
|
||||
|
|
@ -64,8 +64,8 @@ lazy val c = project.
|
|||
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
organization in ThisBuild := "org.example",
|
||||
version in ThisBuild := "1.0",
|
||||
(ThisBuild / organization) := "org.example",
|
||||
(ThisBuild / version) := "1.0",
|
||||
check := {
|
||||
val acp = (a / Compile / externalDependencyClasspath).value.map {_.data.getName}.sorted
|
||||
val bcp = (b / Compile / externalDependencyClasspath).value.map {_.data.getName}.sorted
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
import xsbti.AppConfiguration
|
||||
|
||||
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
|
||||
ThisBuild / scalaVersion := "2.12.17"
|
||||
|
||||
def commonSettings: Vector[Def.Setting[_]] =
|
||||
Vector(
|
||||
organization := "com.example",
|
||||
ivyPaths := IvyPaths((ThisBuild / baseDirectory).value, Some((LocalRootProject / target).value / "ivy-cache")),
|
||||
dependencyCacheDirectory := (baseDirectory in LocalRootProject).value / "dependency",
|
||||
dependencyCacheDirectory := (LocalRootProject / baseDirectory).value / "dependency",
|
||||
scalaCompilerBridgeResolvers += userLocalFileResolver(appConfiguration.value),
|
||||
resolvers += Resolver.file("buggy", (baseDirectory in LocalRootProject).value / "repo")(
|
||||
resolvers += Resolver.file("buggy", (LocalRootProject / baseDirectory).value / "repo")(
|
||||
Patterns(
|
||||
ivyPatterns = Vector("[organization]/[module]/[revision]/ivy.xml"),
|
||||
artifactPatterns = Vector("[organization]/[module]/[revision]/[artifact]"),
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ inThisBuild(Seq(
|
|||
|
||||
def commonSettings: Seq[Def.Setting[_]] = Seq(
|
||||
ivyPaths := IvyPaths((ThisBuild / baseDirectory).value, Some((LocalRootProject / target).value / "ivy-cache")),
|
||||
dependencyCacheDirectory := (baseDirectory in LocalRootProject).value / "dependency",
|
||||
dependencyCacheDirectory := (LocalRootProject / baseDirectory).value / "dependency",
|
||||
fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project")
|
||||
)
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ val y1 = project.settings(
|
|||
libraryDependencies ++= Seq(
|
||||
"com.ning" % "async-http-client" % "1.8.14", // this includes slf4j 1.7.5
|
||||
"com.twitter" % "summingbird-core_2.10" % "0.5.0", // this includes slf4j 1.6.6
|
||||
"org.slf4j" % "slf4j-api" % "1.6.6" force(),
|
||||
("org.slf4j" % "slf4j-api" % "1.6.6").force(),
|
||||
"commons-logging" % "commons-logging" % "1.1" // this includes servlet-api 2.3
|
||||
)
|
||||
)
|
||||
|
|
@ -42,7 +42,7 @@ val y2 = project.settings(
|
|||
)
|
||||
|
||||
TaskKey[Unit]("check") := {
|
||||
val x1cp = (externalDependencyClasspath in Compile in x1).value.map(_.data.getName).sorted
|
||||
val x1cp = (x1 / Compile / externalDependencyClasspath).value.map(_.data.getName).sorted
|
||||
def x1cpStr = x1cp.mkString("\n* ", "\n* ", "")
|
||||
|
||||
// if (!(x1cp contains "slf4j-api-1.6.6.jar"))
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-c
|
|||
def commonSettings: Seq[Def.Setting[_]] =
|
||||
Seq(
|
||||
ivyPaths := IvyPaths((ThisBuild / baseDirectory).value, Some((LocalRootProject / target).value / "ivy-cache")),
|
||||
dependencyCacheDirectory := (baseDirectory in LocalRootProject).value / "dependency",
|
||||
dependencyCacheDirectory := (LocalRootProject / baseDirectory).value / "dependency",
|
||||
scalaVersion := "2.10.4",
|
||||
resolvers += Resolver.sonatypeRepo("snapshots")
|
||||
)
|
||||
|
|
@ -19,10 +19,10 @@ lazy val a = project.
|
|||
settings(cachedResolutionSettings: _*).
|
||||
settings(
|
||||
libraryDependencies := Seq(
|
||||
"org.springframework" % "spring-core" % "3.2.2.RELEASE" force() exclude("org.springframework", "spring-asm"),
|
||||
"org.springframework" % "spring-tx" % "3.1.2.RELEASE" force() exclude("org.springframework", "spring-asm"),
|
||||
"org.springframework" % "spring-beans" % "3.2.2.RELEASE" force() exclude("org.springframework", "spring-asm"),
|
||||
"org.springframework" % "spring-context" % "3.1.2.RELEASE" force() exclude("org.springframework", "spring-asm")
|
||||
("org.springframework" % "spring-core" % "3.2.2.RELEASE").force().exclude("org.springframework", "spring-asm"),
|
||||
("org.springframework" % "spring-tx" % "3.1.2.RELEASE").force().exclude("org.springframework", "spring-asm"),
|
||||
("org.springframework" % "spring-beans" % "3.2.2.RELEASE").force().exclude("org.springframework", "spring-asm"),
|
||||
("org.springframework" % "spring-context" % "3.1.2.RELEASE").force().exclude("org.springframework", "spring-asm")
|
||||
)
|
||||
)
|
||||
|
||||
|
|
@ -30,10 +30,10 @@ lazy val b = project.
|
|||
settings(commonSettings: _*).
|
||||
settings(
|
||||
libraryDependencies := Seq(
|
||||
"org.springframework" % "spring-core" % "3.2.2.RELEASE" force() exclude("org.springframework", "spring-asm"),
|
||||
"org.springframework" % "spring-tx" % "3.1.2.RELEASE" force() exclude("org.springframework", "spring-asm"),
|
||||
"org.springframework" % "spring-beans" % "3.2.2.RELEASE" force() exclude("org.springframework", "spring-asm"),
|
||||
"org.springframework" % "spring-context" % "3.1.2.RELEASE" force() exclude("org.springframework", "spring-asm")
|
||||
("org.springframework" % "spring-core" % "3.2.2.RELEASE").force().exclude("org.springframework", "spring-asm"),
|
||||
("org.springframework" % "spring-tx" % "3.1.2.RELEASE").force().exclude("org.springframework", "spring-asm"),
|
||||
("org.springframework" % "spring-beans" % "3.2.2.RELEASE").force().exclude("org.springframework", "spring-asm"),
|
||||
("org.springframework" % "spring-context" % "3.1.2.RELEASE").force().exclude("org.springframework", "spring-asm")
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-c
|
|||
def commonSettings: Seq[Def.Setting[_]] =
|
||||
Seq(
|
||||
ivyPaths := IvyPaths((ThisBuild / baseDirectory).value, Some((LocalRootProject / target).value / "ivy-cache")),
|
||||
dependencyCacheDirectory := (baseDirectory in LocalRootProject).value / "dependency",
|
||||
dependencyCacheDirectory := (LocalRootProject / baseDirectory).value / "dependency",
|
||||
resolvers += Resolver.sonatypeRepo("snapshots")
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ ThisBuild / version := "1.0"
|
|||
def commonSettings: Seq[Def.Setting[_]] =
|
||||
Seq(
|
||||
ivyPaths := IvyPaths((ThisBuild / baseDirectory).value, Some((LocalRootProject / target).value / "ivy-cache")),
|
||||
dependencyCacheDirectory := (baseDirectory in LocalRootProject).value / "dependency",
|
||||
dependencyCacheDirectory := (LocalRootProject / baseDirectory).value / "dependency",
|
||||
libraryDependencies := Seq(
|
||||
"net.databinder" %% "unfiltered-uploads" % "0.8.0",
|
||||
"commons-io" % "commons-io" % "1.3",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ lazy val check = taskKey[Unit]("Runs the check")
|
|||
|
||||
def commonSettings: Seq[Def.Setting[_]] =
|
||||
Seq(
|
||||
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache")),
|
||||
ivyPaths := IvyPaths( (ThisBuild / baseDirectory).value, Some((LocalRootProject / target).value / "ivy-cache")),
|
||||
scalaVersion := "2.10.4",
|
||||
fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project"),
|
||||
updateOptions := updateOptions.value.withCircularDependencyLevel(CircularDependencyLevel.Error)
|
||||
|
|
@ -39,6 +39,6 @@ lazy val c = project.
|
|||
lazy val root = (project in file(".")).
|
||||
settings(commonSettings: _*).
|
||||
settings(
|
||||
organization in ThisBuild := "org.example",
|
||||
version in ThisBuild := "1.0-SNAPSHOT"
|
||||
(ThisBuild / organization) := "org.example",
|
||||
(ThisBuild / version) := "1.0-SNAPSHOT"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ resolvers += Resolver.typesafeIvyRepo("releases")
|
|||
libraryDependencies += "bad" % "mvn" % "1.0"
|
||||
|
||||
TaskKey[Unit]("check") := {
|
||||
val cp = (fullClasspath in Compile).value
|
||||
val cp = (Compile / fullClasspath).value
|
||||
def isTestJar(n: String): Boolean =
|
||||
(n contains "scalacheck") ||
|
||||
(n contains "specs2")
|
||||
|
|
|
|||
|
|
@ -3,19 +3,19 @@ ThisBuild / organization := "org.example"
|
|||
ThisBuild / version := "1.0"
|
||||
|
||||
lazy val a = project.settings(common: _*).settings(
|
||||
// verifies that a can be published as an ivy.xml file and preserve the extra artifact information,
|
||||
// such as a classifier
|
||||
libraryDependencies := Seq("net.sf.json-lib" % "json-lib" % "2.4" classifier "jdk15" intransitive()),
|
||||
// verifies that an artifact without an explicit configuration gets published in all public configurations
|
||||
artifact in (Compile,packageBin) := Artifact("demo")
|
||||
// verifies that a can be published as an ivy.xml file and preserve the extra artifact information,
|
||||
// such as a classifier
|
||||
libraryDependencies := Seq(("net.sf.json-lib" % "json-lib" % "2.4").classifier("jdk15").intransitive()),
|
||||
// verifies that an artifact without an explicit configuration gets published in all public configurations
|
||||
(Compile / packageBin / artifact) := Artifact("demo")
|
||||
)
|
||||
|
||||
lazy val b = project.settings(common: _*).settings(
|
||||
libraryDependencies := Seq(organization.value %% "a" % version.value)
|
||||
libraryDependencies := Seq(organization.value %% "a" % version.value)
|
||||
)
|
||||
|
||||
lazy val common = Seq(
|
||||
autoScalaLibrary := false, // avoid downloading fresh scala-library/scala-compiler
|
||||
managedScalaInstance := false,
|
||||
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache"))
|
||||
autoScalaLibrary := false, // avoid downloading fresh scala-library/scala-compiler
|
||||
managedScalaInstance := false,
|
||||
ivyPaths := IvyPaths( (ThisBuild / baseDirectory).value, Some((LocalRootProject / target).value / "ivy-cache"))
|
||||
)
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ lazy val b = (project in file("b")).
|
|||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
check := {
|
||||
(update in a).value
|
||||
(update in b).value
|
||||
val acp = (externalDependencyClasspath in Compile in a).value.sortBy {_.data.getName}
|
||||
val bcp = (externalDependencyClasspath in Compile in b).value.sortBy {_.data.getName}
|
||||
(a / update).value
|
||||
(b / update).value
|
||||
val acp = (a / Compile / externalDependencyClasspath).value.sortBy {_.data.getName}
|
||||
val bcp = (b / Compile / externalDependencyClasspath).value.sortBy {_.data.getName}
|
||||
|
||||
if (acp exists { _.data.getName contains "slf4j-api-1.7.5.jar" }) {
|
||||
sys.error("slf4j-api-1.7.5.jar found when it should NOT be included: " + acp.toString)
|
||||
|
|
@ -36,7 +36,7 @@ lazy val root = (project in file(".")).
|
|||
sys.error("dispatch-core_2.11-0.11.1.jar found when it should NOT be included: " + bcp.toString)
|
||||
}
|
||||
|
||||
val bPomXml = makePomXml(streams.value.log, (makePomConfiguration in b).value, (ivyModule in b).value)
|
||||
val bPomXml = makePomXml(streams.value.log, (b / makePomConfiguration).value, (b / ivyModule).value)
|
||||
|
||||
val repatchTwitterXml = bPomXml \ "dependencies" \ "dependency" find { d =>
|
||||
(d \ "groupId").text == "com.eed3si9n" && (d \ "artifactId").text == "repatch-twitter-core_2.11"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ lazy val root = (project in file(".")).
|
|||
scalaOverride := check("scala.App").value
|
||||
)
|
||||
|
||||
def check(className: String): Def.Initialize[Task[Unit]] = fullClasspath in Compile map { cp =>
|
||||
def check(className: String): Def.Initialize[Task[Unit]] = (Compile / fullClasspath) map { cp =>
|
||||
val existing = cp.files.filter(_.getName contains "scala-library")
|
||||
println("Full classpath: " + cp.mkString("\n\t", "\n\t", ""))
|
||||
println("scala-library.jar: " + existing.mkString("\n\t", "\n\t", ""))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
|
||||
ThisBuild / scalaVersion := "2.12.17"
|
||||
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
|
|
@ -12,7 +13,7 @@ def transitive(dep: ModuleID)(base: File) =
|
|||
if((base / "transitive").exists) dep else dep.intransitive()
|
||||
|
||||
def check(transitive: Boolean) =
|
||||
(dependencyClasspath in Compile) map { downloaded =>
|
||||
(Compile / dependencyClasspath) map { downloaded =>
|
||||
val jars = downloaded.size
|
||||
if(transitive) {
|
||||
if (jars <= 2)
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ lazy val root = (project in file(".")).
|
|||
|
||||
def libraryDeps(base: File) = {
|
||||
val slf4j = Seq("org.slf4j" % "slf4j-log4j12" % "1.1.0") // Uses log4j 1.2.13
|
||||
if ((base / "force").exists) slf4j :+ ("log4j" % "log4j" % "1.2.14" force()) else slf4j
|
||||
if ((base / "force").exists) slf4j :+ ("log4j" % "log4j" % "1.2.14").force() else slf4j
|
||||
}
|
||||
|
||||
def check(ver: String) =
|
||||
(dependencyClasspath in Compile) map { jars =>
|
||||
(Compile / dependencyClasspath) map { jars =>
|
||||
val log4j = jars map (_.data) collect {
|
||||
case f if f.getName contains "log4j-" => f.getName
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ def inlineXML(addInfo: Boolean, organization: String, moduleID: String, version:
|
|||
<dependency org="org.scala-tools.testing" name="scalacheck_2.9.1" rev="1.9"/>
|
||||
|
||||
def checkDownload = Def task {
|
||||
if ((dependencyClasspath in Compile).value.isEmpty) sys.error("Dependency not downloaded"); ()
|
||||
if ((Compile / dependencyClasspath).value.isEmpty) sys.error("Dependency not downloaded"); ()
|
||||
}
|
||||
|
||||
def checkInfo = Def task {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ ivyPaths := baseDirectory( dir => IvyPaths(dir, Some(dir / "ivy-home"))).value
|
|||
|
||||
TaskKey[Unit]("check") := {
|
||||
val report = update.value
|
||||
val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
|
||||
assert(files.nonEmpty, "ScalaCheck module not found in update report")
|
||||
val missing = files.filter(! _.exists)
|
||||
assert(missing.isEmpty, "Reported ScalaCheck artifact files don't exist: " + missing.mkString(", "))
|
||||
val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
|
||||
assert(files.nonEmpty, "ScalaCheck module not found in update report")
|
||||
val missing = files.filter(! _.exists)
|
||||
assert(missing.isEmpty, "Reported ScalaCheck artifact files don't exist: " + missing.mkString(", "))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ ThisBuild / useCoursier := false
|
|||
lazy val commonSettings = Seq(
|
||||
autoScalaLibrary := false,
|
||||
scalaModuleInfo := None,
|
||||
unmanagedJars in Compile ++= (scalaInstance map (_.allJars.toSeq)).value,
|
||||
publishArtifact in packageSrc := false,
|
||||
publishArtifact in packageDoc := false,
|
||||
(Compile / unmanagedJars) ++= (scalaInstance map (_.allJars.toSeq)).value,
|
||||
(packageSrc / publishArtifact) := false,
|
||||
(packageDoc / publishArtifact) := false,
|
||||
publishMavenStyle := false
|
||||
)
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ lazy val dep = project.
|
|||
commonSettings,
|
||||
organization := "org.example",
|
||||
version := "1.0",
|
||||
publishTo := (baseDirectory in ThisBuild apply { base =>
|
||||
publishTo := ((ThisBuild / baseDirectory) apply { base =>
|
||||
Some(Resolver.file("file", base / "repo")(Resolver.ivyStylePatterns))
|
||||
}).value
|
||||
)
|
||||
|
|
@ -28,7 +28,7 @@ lazy val use = project.
|
|||
Some(Resolver.file("file", base / "repo")(Resolver.ivyStylePatterns))
|
||||
}).value,
|
||||
TaskKey[Unit]("check") := (baseDirectory map {base =>
|
||||
val inCache = ( (base / "target" / "use-cache") ** "*.jar").get
|
||||
val inCache = ( (base / "target" / "use-cache") ** "*.jar").get()
|
||||
assert(inCache.isEmpty, "Cache contained jars: " + inCache)
|
||||
}).value
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
lazy val p1 = (project in file("p1")).
|
||||
settings(
|
||||
checkTask(expectedMongo),
|
||||
libraryDependencies += "org.mongodb" %% "casbah" % "2.4.1" pomOnly(),
|
||||
libraryDependencies += ("org.mongodb" %% "casbah" % "2.4.1").pomOnly(),
|
||||
inThisBuild(List(
|
||||
organization := "org.example",
|
||||
version := "1.0",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ moduleName := "asdf"
|
|||
crossPaths := false
|
||||
|
||||
TaskKey[Unit]("checkName") := Def task {
|
||||
val path = (packageBin in Compile).value.getAbsolutePath
|
||||
val path = (Compile / packageBin).value.getAbsolutePath
|
||||
val module = moduleName.value
|
||||
val n = name.value
|
||||
assert(path contains module, s"Path $path did not contain module name $module")
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ libraryDependencies ++= Seq("natives-windows", "natives-linux", "natives-osx") m
|
|||
|
||||
autoScalaLibrary := false
|
||||
|
||||
TaskKey[Unit]("check") := (dependencyClasspath in Compile map { cp =>
|
||||
TaskKey[Unit]("check") := ((Compile / dependencyClasspath) map { cp =>
|
||||
assert(cp.size == 3, "Expected 3 jars, got: " + cp.files.mkString("(", ", ", ")"))
|
||||
}).value
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
libraryDependencies ++= Seq(
|
||||
"org.easytesting" % "fest-assert" % "1.4",
|
||||
"org.easytesting" % "fest-assert" % "1.4" % "test" intransitive())
|
||||
"org.easytesting" % "fest-assert" % "1.4",
|
||||
("org.easytesting" % "fest-assert" % "1.4" % Test).intransitive(),
|
||||
)
|
||||
|
||||
autoScalaLibrary := false
|
||||
|
||||
TaskKey[Unit]("check") := {
|
||||
val cp = (externalDependencyClasspath in Compile).value
|
||||
val tcp = (externalDependencyClasspath in Test).value
|
||||
val cp = (Compile / externalDependencyClasspath).value
|
||||
val tcp = (Test / externalDependencyClasspath).value
|
||||
assert(cp.size == 2, "Expected 2 jars on compile classpath, got: " + cp.files.mkString("(", ", ", ")"))
|
||||
// this should really be 1 because of intransitive(), but Ivy doesn't handle this.
|
||||
// So, this test can only check that the assertion reported in #582 isn't triggered.
|
||||
// this should really be 1 because of intransitive(), but Ivy doesn't handle this.
|
||||
// So, this test can only check that the assertion reported in #582 isn't triggered.
|
||||
assert(tcp.size == 2, "Expected 2 jar on test classpath, got: " + tcp.files.mkString("(", ", ", ")"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ autoScalaLibrary := false
|
|||
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache"))
|
||||
|
||||
scalaModuleInfo := Some(sbt.librarymanagement.ScalaModuleInfo(
|
||||
(scalaVersion in update).value,
|
||||
(scalaBinaryVersion in update).value,
|
||||
(update / scalaVersion).value,
|
||||
(update / scalaBinaryVersion).value,
|
||||
Vector.empty,
|
||||
checkExplicit = false,
|
||||
filterImplicit = false,
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ val local = "local-maven-repo" at "file://" + (Path.userHome / ".m2" /"repositor
|
|||
|
||||
def pomIncludeRepository(base: File, prev: MavenRepository => Boolean): MavenRepository => Boolean = {
|
||||
case r: MavenRepository if (r.name == "local-preloaded") => false
|
||||
case r: MavenRepository if (base / "repo.none" exists) => false
|
||||
case r: MavenRepository if (base / "repo.all" exists) => true
|
||||
case r: MavenRepository if (base / "repo.none").exists => false
|
||||
case r: MavenRepository if (base / "repo.all").exists => true
|
||||
case r: MavenRepository => prev(r)
|
||||
}
|
||||
|
||||
|
|
@ -31,9 +31,9 @@ def addSlash(s: String): String = s match {
|
|||
case _ => s + "/"
|
||||
}
|
||||
|
||||
def checkPomRepositories(file: File, args: Seq[String], s: TaskStreams) {
|
||||
def checkPomRepositories(file: File, args: Seq[String], s: TaskStreams): Unit = {
|
||||
val repositories = scala.xml.XML.loadFile(file) \\ "repository"
|
||||
val extracted = repositories.map { repo => MavenRepository(repo \ "name" text, addSlash(repo \ "url" text)) }
|
||||
val extracted = repositories.map { repo => MavenRepository((repo \ "name").text, addSlash((repo \ "url").text)) }
|
||||
val expected = args.map(GlobFilter.apply)
|
||||
s.log.info("Extracted: " + extracted.mkString("\n\t", "\n\t", "\n"))
|
||||
s.log.info("Expected: " + args.mkString("\n\t", "\n\t", "\n"))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ lazy val root = (project in file(".")).
|
|||
externalPom(),
|
||||
scalaVersion := "2.9.0-1",
|
||||
check := checkTask.evaluated,
|
||||
managedClasspath in Provided := Classpaths.managedJars(Provided, classpathTypes.value, update.value)
|
||||
(Provided / managedClasspath) := Classpaths.managedJars(Provided, classpathTypes.value, update.value)
|
||||
)
|
||||
|
||||
def checkTask = Def.inputTask {
|
||||
|
|
@ -16,18 +16,17 @@ def checkTask = Def.inputTask {
|
|||
val (conf, names) = result
|
||||
println("Checking: " + conf.name)
|
||||
checkClasspath(conf match {
|
||||
case Provided => managedClasspath in Provided value
|
||||
case Compile => fullClasspath in Compile value
|
||||
case Test => fullClasspath in Test value
|
||||
case Runtime => fullClasspath in Runtime value
|
||||
case Provided => (Provided / managedClasspath).value
|
||||
case Compile => (Compile / fullClasspath).value
|
||||
case Test => (Test / fullClasspath).value
|
||||
case Runtime => (Runtime / fullClasspath).value
|
||||
}, names.toSet)
|
||||
}
|
||||
|
||||
lazy val check = InputKey[Unit]("check")
|
||||
def parser: Parser[(Configuration,Seq[String])] = (Space ~> token(cp(Compile) | cp(Runtime) | cp(Provided) | cp(Test))) ~ spaceDelimited("<module-names>")
|
||||
def cp(c: Configuration): Parser[Configuration] = c.name ^^^ c
|
||||
def checkClasspath(cp: Seq[Attributed[File]], names: Set[String]) =
|
||||
{
|
||||
def checkClasspath(cp: Seq[Attributed[File]], names: Set[String]) = {
|
||||
val fs = cp.files filter { _.getName endsWith ".jar" }
|
||||
val intersect = fs filter { f => names exists { f.getName startsWith _ } }
|
||||
assert(intersect == fs, "Expected:" + seqStr(names.toSeq) + "Got: " + seqStr(fs))
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@ val root = project in file(".")
|
|||
|
||||
val subJar = project in file("subJar")
|
||||
|
||||
def warArtifact = artifact in (Compile, packageBin) ~= (_ withType "war" withExtension "war")
|
||||
def warArtifact = (Compile / packageBin / artifact) ~= (_ withType "war" withExtension "war")
|
||||
val subWar = project in file("subWar") settings warArtifact
|
||||
|
||||
val subParent = project in file("subParent") settings (publishArtifact in Compile := false)
|
||||
val subParent = project in file("subParent") settings ((Compile / publishArtifact) := false)
|
||||
|
||||
val checkPom = taskKey[Unit]("")
|
||||
checkPom in ThisBuild := {
|
||||
checkPackaging((makePom in subJar).value, "jar")
|
||||
checkPackaging((makePom in subWar).value, "war")
|
||||
checkPackaging((makePom in subParent).value, "pom")
|
||||
(ThisBuild / checkPom) := {
|
||||
checkPackaging((subJar / makePom).value, "jar")
|
||||
checkPackaging((subWar / makePom).value, "war")
|
||||
checkPackaging((subParent / makePom).value, "pom")
|
||||
}
|
||||
|
||||
def checkPackaging(pom: File, expected: String) = {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ val checkIvyXml = taskKey[Unit]("Checks the ivy.xml transform was correct")
|
|||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
name := "test-parent-pom",
|
||||
ivyPaths := IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache")),
|
||||
ivyPaths := IvyPaths( (ThisBuild / baseDirectory).value, Some((LocalRootProject / target).value / "ivy-cache")),
|
||||
resolvers += MavenCache("Maven2 Local Test", baseDirectory.value / "local-repo"),
|
||||
libraryDependencies += "com.example" % "example-child" % "1.0-SNAPSHOT",
|
||||
libraryDependencies += "org.apache.geronimo.specs" % "geronimo-jta_1.1_spec" % "1.1.1",
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@ lazy val checkPom = taskKey[Unit]("check pom to ensure no <type> sections are ge
|
|||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
scalaVersion := "2.10.6",
|
||||
libraryDependencies += "org.scala-tools.sbinary" %% "sbinary" % "0.4.1" withSources() withJavadoc(),
|
||||
libraryDependencies += "org.scala-sbt" % "io" % "0.13.8" intransitive(),
|
||||
libraryDependencies += { ("org.scala-tools.sbinary" %% "sbinary" % "0.4.1").withSources().withJavadoc() },
|
||||
libraryDependencies += { ("org.scala-sbt" % "io" % "0.13.8").intransitive() },
|
||||
checkPom := {
|
||||
val pomFile = makePom.value
|
||||
val pom = xml.XML.loadFile(pomFile)
|
||||
val tpe = pom \\ "type"
|
||||
if(tpe.nonEmpty) {
|
||||
if (tpe.nonEmpty) {
|
||||
sys.error("Expected no <type> sections, got: " + tpe + " in \n\n" + pom)
|
||||
}
|
||||
val ur = update.value
|
||||
val dir = (streams in update).value.cacheDirectory / "out"
|
||||
val dir = (update / streams).value.cacheDirectory / "out"
|
||||
val lines = IO.readLines(dir)
|
||||
val hasError = lines exists { line => line contains "Found intransitive dependency "}
|
||||
assert(hasError, s"Failed to detect intransitive dependencies, got: ${lines.mkString("\n")}")
|
||||
|
|
|
|||
|
|
@ -1,19 +1,22 @@
|
|||
ThisBuild / scalaVersion := "2.12.17"
|
||||
def configIvyScala =
|
||||
scalaModuleInfo ~= (_ map (_ withCheckExplicit false))
|
||||
|
||||
val declared = SettingKey[Boolean]("declared")
|
||||
lazy val a = project.
|
||||
settings(
|
||||
lazy val a = project
|
||||
.settings(
|
||||
libraryDependencies += "org.scala-tools.sbinary" %% "sbinary" % "0.4.0" % "provided",
|
||||
configIvyScala,
|
||||
scalaBinaryVersion in update := "2.9.0"
|
||||
update / scalaBinaryVersion := "2.9.0",
|
||||
)
|
||||
|
||||
lazy val b = project.
|
||||
dependsOn(a).
|
||||
settings(
|
||||
libraryDependencies := declared(d => if(d) Seq("org.scala-tools.sbinary" %% "sbinary" % "0.4.0" % "provided") else Nil).value,
|
||||
declared := baseDirectory(_ / "declare.lib" exists).value,
|
||||
lazy val b = project
|
||||
.dependsOn(a)
|
||||
.settings(
|
||||
libraryDependencies := declared((d) =>
|
||||
if (d) Seq("org.scala-tools.sbinary" %% "sbinary" % "0.4.0" % "provided")
|
||||
else Nil).value,
|
||||
declared := baseDirectory((dir) => (dir / "declare.lib").exists).value,
|
||||
configIvyScala,
|
||||
scalaBinaryVersion in update := "2.9.0"
|
||||
update / scalaBinaryVersion := "2.9.0"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,20 +5,20 @@ val check = InputKey[Unit]("check")
|
|||
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
provided := (baseDirectory.value / "useProvided" exists),
|
||||
provided := (baseDirectory.value / "useProvided").exists,
|
||||
configuration := (if (provided.value) Provided else Compile),
|
||||
libraryDependencies += "javax.servlet" % "servlet-api" % "2.5" % configuration.value.name,
|
||||
managedClasspath in Provided := Classpaths.managedJars(Provided, classpathTypes.value, update.value),
|
||||
Provided / managedClasspath := Classpaths.managedJars(Provided, classpathTypes.value, update.value),
|
||||
check := {
|
||||
val result = (
|
||||
Space ~> token(Compile.name.id | Runtime.name | Provided.name | Test.name) ~ token(Space ~> Bool)
|
||||
).parsed
|
||||
val (conf, expected) = result
|
||||
val cp = conf match {
|
||||
case Compile.name => (fullClasspath in Compile).value
|
||||
case Runtime.name => (fullClasspath in Runtime).value
|
||||
case Provided.name => (managedClasspath in Provided).value
|
||||
case Test.name => (fullClasspath in Test).value
|
||||
case Compile.name => (Compile / fullClasspath).value
|
||||
case Runtime.name => (Runtime / fullClasspath).value
|
||||
case Provided.name => (Provided / managedClasspath).value
|
||||
case Test.name => (Test / fullClasspath).value
|
||||
case _ => sys.error(s"Invalid config: $conf")
|
||||
}
|
||||
checkServletAPI(cp.files, expected, conf)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ scalaOrganization := "org.other"
|
|||
|
||||
scalaVersion := "2.11.8"
|
||||
|
||||
resolvers += Resolver.file("buggy", (baseDirectory in LocalRootProject).value / "repo")(
|
||||
resolvers += Resolver.file("buggy", (LocalRootProject / baseDirectory).value / "repo")(
|
||||
Patterns(
|
||||
ivyPatterns = Vector("[organization]/[module]/[revision]/ivy.xml"),
|
||||
artifactPatterns = Vector("[organization]/[module]/[revision]/dummy.jar"),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.12.17"
|
||||
autoScalaLibrary := false
|
||||
|
||||
libraryDependencies += "org.scala-lang" % "scala-library" % scalaVersion.value % "test"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ ThisBuild / useCoursier := false
|
|||
scalaOrganization := "org.other"
|
||||
scalaVersion := "3.0.0-M2"
|
||||
|
||||
resolvers += Resolver.file("buggy", (baseDirectory in LocalRootProject).value / "repo")(
|
||||
resolvers += Resolver.file("buggy", (LocalRootProject / baseDirectory).value / "repo")(
|
||||
Patterns(
|
||||
ivyPatterns = Vector("[organization]/[module]/[revision]/ivy.xml"),
|
||||
artifactPatterns = Vector("[organization]/[module]/[revision]/dummy.jar"),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ ThisBuild / scalaVersion := "2.12.12"
|
|||
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
|
||||
|
||||
def customIvyPaths: Seq[Def.Setting[_]] = Seq(
|
||||
ivyPaths := IvyPaths((baseDirectory in ThisBuild).value, Some((baseDirectory in ThisBuild).value / "ivy-cache"))
|
||||
ivyPaths := IvyPaths((ThisBuild / baseDirectory).value, Some((ThisBuild / baseDirectory).value / "ivy-cache"))
|
||||
)
|
||||
|
||||
lazy val sharedResolver: Resolver = {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ lazy val dependent = project
|
|||
TaskKey[Unit]("dumpResolvers") := {
|
||||
val log = streams.value.log
|
||||
log.info(s" -- dependent/fullResolvers -- ")
|
||||
(fullResolvers in dependent).value foreach { r =>
|
||||
(dependent / fullResolvers).value foreach { r =>
|
||||
log.info(s" * ${r}")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ ThisBuild / useCoursier := false
|
|||
|
||||
lazy val root = (project in file("."))
|
||||
.settings(
|
||||
libraryDependencies += "net.liftweb" % "lift-webkit" % "1.0" intransitive(),
|
||||
libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5" intransitive(),
|
||||
libraryDependencies += ("net.liftweb" % "lift-webkit" % "1.0").intransitive(),
|
||||
libraryDependencies += ("org.scalacheck" % "scalacheck" % "1.5").intransitive(),
|
||||
autoScalaLibrary := false,
|
||||
managedScalaInstance := false,
|
||||
transitiveClassifiers := Seq("sources"),
|
||||
TaskKey[Unit]("checkSources") := (updateClassifiers map checkSources).value,
|
||||
TaskKey[Unit]("checkBinaries") := (update map checkBinaries).value
|
||||
TaskKey[Unit]("checkBinaries") := (update map checkBinaries).value,
|
||||
)
|
||||
|
||||
def getSources(report: UpdateReport) = report.matching(artifactFilter(`classifier` = "sources") )
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ version := "2.0"
|
|||
|
||||
publishTo := Some(Resolver.file("example", baseDirectory.value / "ivy-repo"))
|
||||
|
||||
publishArtifact in Test := true
|
||||
Test / publishArtifact := true
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ libraryDependencies += "exclude.test" % "app" % "1.0.0"
|
|||
val checkDependencies = taskKey[Unit]("Checks that dependencies are correct.")
|
||||
|
||||
checkDependencies := {
|
||||
val hasBadJar = (fullClasspath in Compile).value.exists { jar => jar.data.getName contains "bottom-1.0.0.jar"}
|
||||
val errorJarString = (fullClasspath in Compile).value.map(_.data.getName).mkString(" * ", "\n * ", "")
|
||||
val hasBadMiddleJar = (fullClasspath in Compile).value.exists { jar => jar.data.getName contains "middle-1.0.0.jar"}
|
||||
val hasBadJar = (Compile / fullClasspath).value.exists { jar => jar.data.getName contains "bottom-1.0.0.jar"}
|
||||
val errorJarString = (Compile / fullClasspath).value.map(_.data.getName).mkString(" * ", "\n * ", "")
|
||||
val hasBadMiddleJar = (Compile / fullClasspath).value.exists { jar => jar.data.getName contains "middle-1.0.0.jar"}
|
||||
assert(!hasBadMiddleJar, s"Failed to exclude excluded dependency on classpath!\nFound:\n$errorJarString")
|
||||
assert(!hasBadJar, s"Failed to exclude transitive excluded dependency on classpath!\nFound:\n$errorJarString")
|
||||
val modules =
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ lazy val root = (project in file(".")).
|
|||
)
|
||||
|
||||
def checkClasspath(conf: Configuration) =
|
||||
fullClasspath in conf map { cp =>
|
||||
(conf / fullClasspath) map { cp =>
|
||||
try {
|
||||
val loader = ClasspathUtilities.toLoader(cp.files)
|
||||
Class.forName("org.jsoup.Jsoup", false, loader)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
scalaSource in Configurations.Compile := (sourceDirectory.value / " scala test ")
|
||||
javaSource in Configurations.Compile := (sourceDirectory.value / " java test ")
|
||||
Configurations.Compile / scalaSource := (sourceDirectory.value / " scala test ")
|
||||
Configurations.Compile / javaSource := (sourceDirectory.value / " java test ")
|
||||
|
||||
TaskKey[Unit]("init") := {
|
||||
val ss = (scalaSource in Configurations.Compile).value
|
||||
val js = ( javaSource in Configurations.Compile).value
|
||||
val ss = (Configurations.Compile / scalaSource).value
|
||||
val js = (Configurations.Compile / javaSource).value
|
||||
import IO._
|
||||
createDirectories(ss :: js :: Nil)
|
||||
copyFile(file("changes") / "Test.scala", ss / " Test s.scala")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
object Test
|
||||
{
|
||||
def main(args: Array[String])
|
||||
{
|
||||
println(new a.A)
|
||||
}
|
||||
}
|
||||
object Test {
|
||||
def main(args: Array[String]): Unit = {
|
||||
println(new a.A)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
import complete.DefaultParsers._
|
||||
val parser = token(Space ~> ( ("exists" ^^^ true) | ("absent" ^^^ false) ) )
|
||||
InputKey[Unit]("checkOutput") := {
|
||||
val shouldExist = parser.parsed
|
||||
val dir = (classDirectory in Compile).value
|
||||
if((dir / "Anon.class").exists != shouldExist)
|
||||
sys.error("Top level class incorrect" )
|
||||
else if( (dir / "Anon$1.class").exists != shouldExist)
|
||||
sys.error("Inner class incorrect" )
|
||||
else
|
||||
()
|
||||
}
|
||||
import complete.DefaultParsers._
|
||||
val parser = token(Space ~> ( ("exists" ^^^ true) | ("absent" ^^^ false) ) )
|
||||
InputKey[Unit]("checkOutput") := {
|
||||
val shouldExist = parser.parsed
|
||||
val dir = (Compile / classDirectory).value
|
||||
if((dir / "Anon.class").exists != shouldExist)
|
||||
sys.error("Top level class incorrect" )
|
||||
else if( (dir / "Anon$1.class").exists != shouldExist)
|
||||
sys.error("Inner class incorrect" )
|
||||
else
|
||||
()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ package name.example {
|
|||
|
||||
import autoImport._
|
||||
override def projectSettings = Seq[Setting[_]](
|
||||
checkMaxErrors := (Keys.maxErrors mapN { me => assert(me == xyz, "Expected maxErrors to be " + xyz + ", but it was " + me ) }).value,
|
||||
checkName := (Keys.name mapN { n => assert(n == "Demo", "Expected name to be 'Demo', but it was '" + n + "'" ) }).value
|
||||
checkMaxErrors := (Keys.maxErrors map { me => assert(me == xyz, "Expected maxErrors to be " + xyz + ", but it was " + me ) }).value,
|
||||
checkName := (Keys.name map { n => assert(n == "Demo", "Expected name to be 'Demo', but it was '" + n + "'" ) }).value
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.12.17"
|
||||
lazy val root = (project in file("."))
|
||||
lazy val sub1 = (project in file("sub1"))
|
||||
lazy val sub2 = (project in file("sub2"))
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ val root = (project in file("."))
|
|||
|
||||
TaskKey[Unit]("checkScalaVersion", "test") := {
|
||||
val sv = scalaVersion.value
|
||||
assert(sv startsWith "2.12.", s"Found $sv!")
|
||||
assert(sv startsWith "3.", s"Found $sv!")
|
||||
}
|
||||
|
||||
TaskKey[Unit]("checkArtifacts", "test") := {
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@ lazy val customE = taskKey[String]("custom E")
|
|||
lazy val globalDepE = taskKey[String]("globally defined dependency of E")
|
||||
lazy val projectDepE = taskKey[String]("per-project dependency of E")
|
||||
|
||||
organization in Global := "org.example"
|
||||
(Global / organization) := "org.example"
|
||||
|
||||
version in Global := "1.0"
|
||||
(Global / version) := "1.0"
|
||||
|
||||
customC in Global := "base"
|
||||
(Global / customC) := "base"
|
||||
|
||||
name in Global := "global-name"
|
||||
(Global / name) := "global-name"
|
||||
|
||||
globalDepE in Global := "globalE"
|
||||
(Global / globalDepE) := "globalE"
|
||||
|
||||
// ---------------- Derived settings
|
||||
|
||||
|
|
@ -61,30 +61,30 @@ def same[T](x: T, y: T): Unit = {
|
|||
}
|
||||
|
||||
check := {
|
||||
val aa = (customA in a).value
|
||||
val aa = (a / customA).value
|
||||
same(aa, "a-b-a")
|
||||
val bb = (customB in b).value
|
||||
val bb = (b / customB).value
|
||||
same(bb, explicit)
|
||||
val ac = (customC in a).value
|
||||
val ac = (a / customC).value
|
||||
// TODO - Setting with multiple triggers is no longer added just once...
|
||||
//same(ac, "org.example-base-1.0")
|
||||
val globalD = (customD in Global).?.value
|
||||
val globalD = (Global / customD).?.value
|
||||
same(globalD, None)
|
||||
val aD = (customD in a).value
|
||||
val bD = (customD in b).value
|
||||
val aD = (a / customD).value
|
||||
val bD = (b / customD).value
|
||||
same(aD, "a")
|
||||
same(bD, "b")
|
||||
val globalE = (customE in Global).?.value
|
||||
val globalE = (Global / customE).?.value
|
||||
same(globalE, None)
|
||||
val aE = (customE in a).value
|
||||
val bE = (customE in b).value
|
||||
val aE = (a / customE).value
|
||||
val bE = (b / customE).value
|
||||
same(aE, "globalE-A")
|
||||
same(bE, "globalE-B")
|
||||
}
|
||||
|
||||
checkEvery := {
|
||||
val aD = (customD in a).value
|
||||
val aD = (a / customD).value
|
||||
same(aD, "every")
|
||||
val gD = (customD in b).value
|
||||
val gD = (b / customD).value
|
||||
same(gD, "every")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ lazy val root = (project in file(".")).
|
|||
|
||||
def addExtra(name: String, f: (State, Seq[File]) => State) =
|
||||
Command.command(name) { s =>
|
||||
f(s, (file("lib_managed") ** "*.jar").get)
|
||||
f(s, (file("lib_managed") ** "*.jar").get())
|
||||
}
|
||||
def checkExtra =
|
||||
Command.command("check") { s =>
|
||||
|
|
@ -23,23 +23,24 @@ def checkExtra =
|
|||
assert(loader eq sbtLoader, "Different loader for sbt and extra: " + sbtLoader + " and " + loader)
|
||||
s
|
||||
}
|
||||
|
||||
def addExtra1(s: State, extra: Seq[File]): State =
|
||||
{
|
||||
val cs = s.configuration.provider.components()
|
||||
val copied = cs.addToComponent("extra", extra.toArray)
|
||||
if(copied) s.reload else s
|
||||
}
|
||||
def addExtra2(s: State, extra: Seq[File]): State =
|
||||
|
||||
def addExtra2(s: State, extra: Seq[File]): State = {
|
||||
val reload = State.defaultReload(s)
|
||||
val currentID = reload.app
|
||||
val currentExtra = currentID.classpathExtra
|
||||
val newExtra = (currentExtra ++ extra).distinct
|
||||
if(newExtra.length == currentExtra.length)
|
||||
s
|
||||
else
|
||||
{
|
||||
val reload = State.defaultReload(s)
|
||||
val currentID = reload.app
|
||||
val currentExtra = currentID.classpathExtra
|
||||
val newExtra = (currentExtra ++ extra).distinct
|
||||
if(newExtra.length == currentExtra.length)
|
||||
s
|
||||
else
|
||||
{
|
||||
val newID = ApplicationID(currentID).copy(extra = extra)
|
||||
s.setNext(new State.Return(reload.copy(app = newID)))
|
||||
}
|
||||
val newID = ApplicationID(currentID).copy(extra = extra)
|
||||
s.setNext(new State.Return(reload.copy(app = newID)))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ lazy val root = (project in file("."))
|
|||
unmanagedSources / includeFilter := "*.java" | "*.scala"
|
||||
)
|
||||
|
||||
def forConfig(conf: Configuration, name: String) = Project.inConfig(conf)( unpackageSettings(name) )
|
||||
def forConfig(conf: Configuration, name: String) = inConfig(conf)( unpackageSettings(name) )
|
||||
|
||||
def unpackageSettings(name: String) = Seq(
|
||||
unmanagedSourceDirectories := (baseDirectory.value / name) :: Nil,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
ThisBuild / scalaVersion := "2.12.17"
|
||||
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
|
||||
|
||||
val commonSettings = Seq(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
ThisBuild / scalaVersion := "2.12.17"
|
||||
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
|
||||
|
||||
organization := "com.example"
|
||||
version := "0.1.0"
|
||||
ivyPaths := IvyPaths((baseDirectory in LocalRootProject).value, Some((target in LocalRootProject).value / "ivy-cache"))
|
||||
ivyPaths := IvyPaths((LocalRootProject / baseDirectory).value, Some((LocalRootProject / target).value / "ivy-cache"))
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
val rootRef = LocalProject("root")
|
||||
val sub = project
|
||||
val superRoot = project in file("super") dependsOn rootRef
|
||||
val superRoot = (project in file("super")).dependsOn(rootRef)
|
||||
|
||||
val root = (project in file(".")).
|
||||
dependsOn(sub % "provided->test").
|
||||
settings (
|
||||
lazy val root = (project in file("."))
|
||||
.dependsOn(sub % "provided->test")
|
||||
.settings(
|
||||
TaskKey[Unit]("check") := {
|
||||
check0((sub / Test / fullClasspath).value, "sub test", true)
|
||||
check0((superRoot / Compile / fullClasspath).value, "superRoot main", false)
|
||||
|
|
@ -14,16 +14,14 @@ val root = (project in file(".")).
|
|||
}
|
||||
)
|
||||
|
||||
def check0(cp: Seq[Attributed[File]], label: String, shouldSucceed: Boolean): Unit = {
|
||||
def check0(cp: Seq[Attributed[File]], label: String, shouldSucceed: Boolean): Unit =
|
||||
import sbt.internal.inc.classpath.ClasspathUtilities
|
||||
val loader = ClasspathUtilities.toLoader(cp.files)
|
||||
println("Checking " + label)
|
||||
val err = try { Class.forName("org.example.ProvidedTest", false, loader); None }
|
||||
catch { case e: Exception => Some(e) }
|
||||
|
||||
(err, shouldSucceed) match {
|
||||
val err =
|
||||
try { Class.forName("org.example.ProvidedTest", false, loader); None }
|
||||
catch { case e: Exception => Some(e) }
|
||||
(err, shouldSucceed) match
|
||||
case (None, true) | (Some(_), false) => ()
|
||||
case (None, false) => sys.error("Expected failure")
|
||||
case (Some(x), true) => throw x
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
ThisBuild / scalaVersion := "2.12.17"
|
||||
|
||||
lazy val sub1 = project
|
||||
|
||||
lazy val sub2 = project
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
object warney {
|
||||
def foo = {
|
||||
def foo = {
|
||||
0
|
||||
0
|
||||
}
|
||||
0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,12 @@ lazy val assertAbsolutePathConversion = taskKey[Unit]("checks source mappers con
|
|||
lazy val assertVirtualFile = taskKey[Unit]("checks source mappers handle virtual files")
|
||||
lazy val resetMessages = taskKey[Unit]("empties the messages list")
|
||||
|
||||
ThisBuild / scalaVersion := "2.12.17"
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.settings(
|
||||
extraAppenders := { s => Seq(ConsoleAppender(FakePrintWriter)) },
|
||||
Compile / compile / compileOptions ~= { old: CompileOptions =>
|
||||
Compile / compile / compileOptions ~= { (old: CompileOptions) =>
|
||||
old.withSources(StringVirtualFile("/tmp/A.scala",
|
||||
"""object X""") +: old.sources) },
|
||||
assertEmptySourcePositionMappers := {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
externalDependencyClasspath in Runtime += file("conf")
|
||||
(Runtime / externalDependencyClasspath) += file("conf")
|
||||
|
|
@ -1,40 +1,40 @@
|
|||
lazy val runTest = taskKey[Unit]("Run the test applications.")
|
||||
|
||||
def runTestTask(pre: Def.Initialize[Task[Unit]]) =
|
||||
runTest := {
|
||||
val _ = pre.value
|
||||
val r = (runner in (Compile, run)).value
|
||||
val cp = (fullClasspath in Compile).value
|
||||
val main = (mainClass in Compile).value getOrElse sys.error("No main class found")
|
||||
val args = baseDirectory.value.getAbsolutePath :: Nil
|
||||
r.run(main, cp.files, args, streams.value.log).get
|
||||
}
|
||||
runTest := {
|
||||
val _ = pre.value
|
||||
val r = (Compile / run / runner).value
|
||||
val cp = (Compile / fullClasspath).value
|
||||
val main = (Compile / mainClass).value getOrElse sys.error("No main class found")
|
||||
val args = baseDirectory.value.getAbsolutePath :: Nil
|
||||
r.run(main, cp.files, args, streams.value.log).get
|
||||
}
|
||||
|
||||
lazy val b = project.settings(
|
||||
runTestTask( waitForCStart ),
|
||||
runTest := {
|
||||
val _ = runTest.value
|
||||
val cFinished = (baseDirectory in c).value / "finished"
|
||||
assert( !cFinished.exists, "C finished before B")
|
||||
IO.touch(baseDirectory.value / "finished")
|
||||
}
|
||||
runTestTask( waitForCStart ),
|
||||
runTest := {
|
||||
val _ = runTest.value
|
||||
val cFinished = (c / baseDirectory).value / "finished"
|
||||
assert( !cFinished.exists, "C finished before B")
|
||||
IO.touch(baseDirectory.value / "finished")
|
||||
}
|
||||
)
|
||||
|
||||
lazy val c = project.settings( runTestTask( Def.task() ) )
|
||||
lazy val c = project.settings( runTestTask( Def.task(()) ) )
|
||||
|
||||
// need at least 2 concurrently executing tasks to proceed
|
||||
concurrentRestrictions in Global := Seq(
|
||||
Tags.limitAll(math.max(EvaluateTask.SystemProcessors, 2) )
|
||||
(Global / concurrentRestrictions) := Seq(
|
||||
Tags.limitAll(math.max(EvaluateTask.SystemProcessors, 2) )
|
||||
)
|
||||
|
||||
def waitForCStart =
|
||||
Def.task {
|
||||
waitFor( (baseDirectory in c).value / "started" )
|
||||
}
|
||||
Def.task {
|
||||
waitFor( (c / baseDirectory).value / "started" )
|
||||
}
|
||||
|
||||
def waitFor(f: File): Unit = {
|
||||
if(!f.exists) {
|
||||
Thread.sleep(300)
|
||||
waitFor(f)
|
||||
}
|
||||
if(!f.exists) {
|
||||
Thread.sleep(300)
|
||||
waitFor(f)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import java.io.File
|
||||
|
||||
object B {
|
||||
def main(args: Array[String]) {
|
||||
Thread.sleep(1000)
|
||||
}
|
||||
}
|
||||
def main(args: Array[String]): Unit = {
|
||||
Thread.sleep(1000)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
object Daemon
|
||||
{
|
||||
def main(args: Array[String])
|
||||
{
|
||||
val t = new Thread {
|
||||
override def run(): Unit = synchronized { wait() }
|
||||
}
|
||||
t.setDaemon(true);
|
||||
t.start
|
||||
}
|
||||
object Daemon {
|
||||
def main(args: Array[String]): Unit = {
|
||||
val t = new Thread {
|
||||
override def run(): Unit = synchronized { wait() }
|
||||
}
|
||||
t.setDaemon(true);
|
||||
t.start
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
lazy val main = project.settings(
|
||||
organization := "org.scala-sbt.testsuite.example",
|
||||
name := "has-main",
|
||||
|
|
@ -8,15 +6,14 @@ lazy val main = project.settings(
|
|||
|
||||
lazy val user = project.settings(
|
||||
fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project"),
|
||||
libraryDependencies += (projectID in main).value,
|
||||
mainClass in Compile := Some("Test")
|
||||
libraryDependencies += (main / projectID).value,
|
||||
(Compile / mainClass) := Some("Test")
|
||||
)
|
||||
|
||||
// NOTE - This will NOT work, as mainClass must be scoped by Compile (and optionally task) to function correctly).
|
||||
lazy val user2 = project.settings(
|
||||
fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project"),
|
||||
libraryDependencies += (projectID in main).value,
|
||||
libraryDependencies += (main / projectID).value,
|
||||
mainClass := Some("Test")
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,27 +4,23 @@
|
|||
// This thread waits another second before calling System.exit. The first thread hangs around to
|
||||
// ensure that TrapExit actually processes the exit.
|
||||
|
||||
object Spawn
|
||||
{
|
||||
def main(args: Array[String])
|
||||
{
|
||||
(new ThreadA).start
|
||||
}
|
||||
class ThreadA extends Thread
|
||||
{
|
||||
override def run()
|
||||
{
|
||||
Thread.sleep(1000)
|
||||
(new ThreadB).start()
|
||||
synchronized { wait() }
|
||||
}
|
||||
}
|
||||
class ThreadB extends Thread
|
||||
{
|
||||
override def run()
|
||||
{
|
||||
Thread.sleep(1000)
|
||||
System.exit(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
object Spawn {
|
||||
def main(args: Array[String]): Unit = {
|
||||
(new ThreadA).start
|
||||
}
|
||||
|
||||
class ThreadA extends Thread {
|
||||
override def run(): Unit = {
|
||||
Thread.sleep(1000)
|
||||
(new ThreadB).start()
|
||||
synchronized { wait() }
|
||||
}
|
||||
}
|
||||
|
||||
class ThreadB extends Thread {
|
||||
override def run(): Unit = {
|
||||
Thread.sleep(1000)
|
||||
System.exit(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ val recordPreviousIterations = taskKey[Unit]("Record previous iterations.")
|
|||
recordPreviousIterations := {
|
||||
val log = streams.value.log
|
||||
CompileState.previousIterations = {
|
||||
val previousAnalysis = (previousCompile in Compile).value.analysis.asScala
|
||||
val previousAnalysis = (Compile / previousCompile).value.analysis.asScala
|
||||
previousAnalysis match {
|
||||
case None =>
|
||||
log.info("No previous analysis detected")
|
||||
|
|
@ -20,6 +20,6 @@ val checkIterations = inputKey[Unit]("Verifies the accumulated number of iterati
|
|||
|
||||
checkIterations := {
|
||||
val expected: Int = (Space ~> NatBasic).parsed
|
||||
val actual: Int = ((compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size }) - CompileState.previousIterations
|
||||
val actual: Int = ((Compile / compile).value match { case a: Analysis => a.compilations.allCompilations.size }) - CompileState.previousIterations
|
||||
assert(expected == actual, s"Expected $expected compilations, got $actual")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ lazy val dep = project
|
|||
|
||||
lazy val use = project.
|
||||
settings(
|
||||
unmanagedJars in Compile += (packageBin in (dep, Compile) map Attributed.blank).value
|
||||
(Compile / unmanagedJars) += ((dep / Compile / packageBin) map Attributed.blank).value
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ val recordPreviousIterations = taskKey[Unit]("Record previous iterations.")
|
|||
recordPreviousIterations := {
|
||||
val log = streams.value.log
|
||||
CompileState.previousIterations = {
|
||||
val previousAnalysis = (previousCompile in Compile).value.analysis.asScala
|
||||
val previousAnalysis = (Compile / previousCompile).value.analysis.asScala
|
||||
previousAnalysis match {
|
||||
case None =>
|
||||
log.info("No previous analysis detected")
|
||||
|
|
@ -20,6 +20,6 @@ val checkIterations = inputKey[Unit]("Verifies the accumulated number of iterati
|
|||
|
||||
checkIterations := {
|
||||
val expected: Int = (Space ~> NatBasic).parsed
|
||||
val actual: Int = ((compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size }) - CompileState.previousIterations
|
||||
val actual: Int = ((Compile / compile).value match { case a: Analysis => a.compilations.allCompilations.size }) - CompileState.previousIterations
|
||||
assert(expected == actual, s"Expected $expected compilations, got $actual")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
TaskKey[Unit]("outputEmpty") := (classDirectory in Configurations.Compile map { outputDirectory =>
|
||||
def classes = (outputDirectory ** "*.class").get
|
||||
if(!classes.isEmpty) sys.error("Classes existed:\n\t" + classes.mkString("\n\t")) else ()
|
||||
TaskKey[Unit]("outputEmpty") := ((Configurations.Compile / classDirectory) map { outputDirectory =>
|
||||
def classes = (outputDirectory ** "*.class").get()
|
||||
if (!classes.isEmpty) sys.error("Classes existed:\n\t" + classes.mkString("\n\t")) else ()
|
||||
}).value
|
||||
|
||||
// apparently Travis CI stopped allowing long file names
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
ThisBuild / scalaVersion := "2.12.17"
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
ThisBuild / scalaVersion := "2.12.17"
|
||||
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
import sbt.internal.inc.Analysis
|
||||
name := "test"
|
||||
ThisBuild / scalaVersion := "2.12.17"
|
||||
|
||||
TaskKey[Unit]("checkSame") := (compile in Configurations.Compile map { case analysis: Analysis =>
|
||||
analysis.apis.internal foreach { case (_, api) =>
|
||||
assert( xsbt.api.SameAPI(api.api, api.api) )
|
||||
}
|
||||
TaskKey[Unit]("checkSame") := ((Configurations.Compile / compile) map {
|
||||
case analysis: Analysis =>
|
||||
analysis.apis.internal foreach { case (_, api) =>
|
||||
assert( xsbt.api.SameAPI(api.api, api.api) )
|
||||
}
|
||||
}).value
|
||||
|
|
|
|||
|
|
@ -6,28 +6,28 @@ val commonSettings = Seq(
|
|||
scalacOptions ++= Seq(""),
|
||||
resolvers += Resolver.sonatypeRepo("snapshots"),
|
||||
resolvers += Resolver.sonatypeRepo("releases"),
|
||||
addCompilerPlugin("org.scalamacros" % "paradise" % paradiseVersion cross CrossVersion.full)
|
||||
addCompilerPlugin(("org.scalamacros" % "paradise" % paradiseVersion).cross(CrossVersion.full)),
|
||||
)
|
||||
|
||||
lazy val root = (project in file(".")).
|
||||
aggregate(macros, core).
|
||||
settings(
|
||||
lazy val root = (project in file("."))
|
||||
.aggregate(macros, core)
|
||||
.settings(
|
||||
commonSettings,
|
||||
run := (run in Compile in core).evaluated
|
||||
run := (core / Compile / run).evaluated,
|
||||
)
|
||||
|
||||
lazy val macros = (project in file("macros")).
|
||||
settings(
|
||||
lazy val macros = (project in file("macros"))
|
||||
.settings(
|
||||
commonSettings,
|
||||
libraryDependencies += (scalaVersion)("org.scala-lang" % "scala-reflect" % _).value,
|
||||
libraryDependencies ++= (
|
||||
if (scalaVersion.value.startsWith("2.10")) List("org.scalamacros" %% "quasiquotes" % paradiseVersion)
|
||||
else Nil
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
lazy val core = (project in file("core")).
|
||||
dependsOn(macros).
|
||||
settings(
|
||||
commonSettings
|
||||
lazy val core = (project in file("core"))
|
||||
.dependsOn(macros)
|
||||
.settings(
|
||||
commonSettings,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ lazy val root = (project in file(".")).
|
|||
)
|
||||
|
||||
def checkTask(className: String) =
|
||||
fullClasspath in Configurations.Runtime map { runClasspath =>
|
||||
(Configurations.Runtime / fullClasspath) map { runClasspath =>
|
||||
val cp = runClasspath.map(_.data.toURI.toURL).toArray
|
||||
Class.forName(className, false, new URLClassLoader(cp))
|
||||
()
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import sbt.internal.inc.Analysis
|
||||
import complete.DefaultParsers._
|
||||
|
||||
crossTarget in Compile := target.value
|
||||
(Compile / crossTarget) := target.value
|
||||
|
||||
// Reset compiler iterations, necessary because tests run in batch mode
|
||||
val recordPreviousIterations = taskKey[Unit]("Record previous iterations.")
|
||||
recordPreviousIterations := {
|
||||
val log = streams.value.log
|
||||
CompileState.previousIterations = {
|
||||
val previousAnalysis = (previousCompile in Compile).value.analysis.asScala
|
||||
val previousAnalysis = (Compile / previousCompile).value.analysis.asScala
|
||||
previousAnalysis match {
|
||||
case None =>
|
||||
log.info("No previous analysis detected")
|
||||
|
|
@ -23,6 +23,6 @@ val checkIterations = inputKey[Unit]("Verifies the accumulated number of iterati
|
|||
|
||||
checkIterations := {
|
||||
val expected: Int = (Space ~> NatBasic).parsed
|
||||
val actual: Int = ((compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size }) - CompileState.previousIterations
|
||||
val actual: Int = ((Compile / compile).value match { case a: Analysis => a.compilations.allCompilations.size }) - CompileState.previousIterations
|
||||
assert(expected == actual, s"Expected $expected compilations, got $actual")
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue