mirror of https://github.com/sbt/sbt.git
Fix scripted tests in sbt 1.0
This commit is contained in:
parent
6b3c763874
commit
86f06a14a8
|
|
@ -33,8 +33,8 @@ test_script:
|
|||
- sbt ++2.12.1 testsJVM/test testsJVM/it:test # Would node be around for testsJS/test?
|
||||
- sbt ++2.11.11 testsJVM/test testsJVM/it:test
|
||||
- sbt ++2.10.6 testsJVM/test testsJVM/it:test
|
||||
- sbt ++2.12.1 sbt-coursier/scripted sbt-coursier/publishLocal sbt-shading/scripted # for sbt 1.0
|
||||
- sbt ++2.10.6 sbt-coursier/scripted sbt-coursier/publishLocal sbt-shading/scripted # for sbt 0.13
|
||||
- sbt ++2.12.1 "sbt-coursier/scripted sbt-coursier/*" sbt-coursier/publishLocal "sbt-shading/scripted sbt-shading/*" # for sbt 1.0
|
||||
- sbt ++2.10.6 "sbt-coursier/scripted sbt-coursier/*" "sbt-coursier/scripted sbt-coursier-0.13/*" sbt-coursier/publishLocal "sbt-shading/scripted sbt-shading/*" "sbt-shading/scripted sbt-shading-0.13/*" # for sbt 0.13
|
||||
cache:
|
||||
- C:\Users\appveyor\.ivy2\cache
|
||||
- C:\Users\appveyor\.m2
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package coursier
|
|||
import sbt._
|
||||
import sbt.Keys._
|
||||
|
||||
import SbtCompatibility._
|
||||
|
||||
object CoursierPlugin extends AutoPlugin {
|
||||
|
||||
override def trigger = allRequirements
|
||||
|
|
@ -123,7 +125,28 @@ object CoursierPlugin extends AutoPlugin {
|
|||
coursierResolution := Tasks.resolutionTask().value,
|
||||
coursierSbtClassifiersResolution := Tasks.resolutionTask(
|
||||
sbtClassifiers = true
|
||||
).value
|
||||
).value,
|
||||
ivyConfigurations := {
|
||||
val confs = ivyConfigurations.value
|
||||
val names = confs.map(_.name).toSet
|
||||
|
||||
// Yes, adding those back in sbt 1.0. Can't distinguish between config test (whose jars with classifier tests ought to
|
||||
// be added), and sources / docs else (if their JARs are in compile, they would get added too then).
|
||||
|
||||
val extraSources =
|
||||
if (names("sources"))
|
||||
None
|
||||
else
|
||||
Some(Configuration("sources", "", isPublic = true, extendsConfigs = Vector.empty, transitive = false))
|
||||
|
||||
val extraDocs =
|
||||
if (names("docs"))
|
||||
None
|
||||
else
|
||||
Some(Configuration("docs", "", isPublic = true, extendsConfigs = Vector.empty, transitive = false))
|
||||
|
||||
confs ++ extraSources.toSeq ++ extraDocs.toSeq
|
||||
}
|
||||
)
|
||||
|
||||
override lazy val projectSettings = coursierSettings(None, Seq(Compile, Test).map(c => c -> c.name)) ++
|
||||
|
|
|
|||
|
|
@ -146,9 +146,7 @@ object Tasks {
|
|||
allDependencies <- allDependenciesTask
|
||||
} yield {
|
||||
|
||||
val configMap = configurations
|
||||
.map { cfg => cfg.name -> cfg.extendsConfigs.map(_.name) }
|
||||
.toMap
|
||||
val configMap = configurations.map(cfg => cfg.name -> cfg.extendsConfigs.map(_.name)).toMap
|
||||
|
||||
val proj = FromSbt.project(
|
||||
projId,
|
||||
|
|
@ -190,6 +188,18 @@ object Tasks {
|
|||
val sbv = sbt.Keys.scalaBinaryVersion.value
|
||||
val ivyConfs = sbt.Keys.ivyConfigurations.value
|
||||
|
||||
val sourcesConfigOpt =
|
||||
if (ivyConfigurations.value.exists(_.name == "sources"))
|
||||
Some("sources")
|
||||
else
|
||||
None
|
||||
|
||||
val docsConfigOpt =
|
||||
if (ivyConfigurations.value.exists(_.name == "docs"))
|
||||
Some("docs")
|
||||
else
|
||||
None
|
||||
|
||||
val sbtBinArtifacts =
|
||||
for ((config, targetConfig) <- configsMap) yield {
|
||||
|
||||
|
|
@ -211,7 +221,7 @@ object Tasks {
|
|||
}
|
||||
|
||||
val sbtSourceArtifacts =
|
||||
for ((config, _) <- configsMap) yield {
|
||||
for ((config, targetConfig) <- configsMap) yield {
|
||||
|
||||
val publish = publishArtifact
|
||||
.in(projectRef)
|
||||
|
|
@ -225,13 +235,13 @@ object Tasks {
|
|||
.in(packageSrc)
|
||||
.in(config)
|
||||
.find(state)
|
||||
.map("sources" -> _)
|
||||
.map(sourcesConfigOpt.getOrElse(targetConfig) -> _)
|
||||
else
|
||||
None
|
||||
}
|
||||
|
||||
val sbtDocArtifacts =
|
||||
for ((config, _) <- configsMap) yield {
|
||||
for ((config, targetConfig) <- configsMap) yield {
|
||||
|
||||
val publish = publishArtifact
|
||||
.in(projectRef)
|
||||
|
|
@ -245,7 +255,7 @@ object Tasks {
|
|||
.in(packageDoc)
|
||||
.in(config)
|
||||
.find(state)
|
||||
.map("docs" -> _)
|
||||
.map(docsConfigOpt.getOrElse(targetConfig) -> _)
|
||||
else
|
||||
None
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
|
||||
// for SbtExclusionRule with sbt 1.0
|
||||
import sbt.internal.librarymanagement._
|
||||
|
||||
scalaVersion := "2.11.8"
|
||||
|
||||
organization := "io.get-coursier.test"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
package sbt.internal.librarymanagement
|
||||
|
||||
// dummy object, to be able to do
|
||||
// import sbt.internal.librarymanagement._
|
||||
// from build.sbt, even in 0.13
|
||||
// That import is required in 1.0 for SbtExclusionRule
|
||||
|
||||
object Dummy
|
||||
|
|
@ -16,8 +16,10 @@ resolvers += Resolver.url(
|
|||
Patterns(
|
||||
Resolver.ivyStylePatterns.ivyPatterns,
|
||||
Resolver.ivyStylePatterns.artifactPatterns,
|
||||
isMavenCompatible = true
|
||||
isMavenCompatible = true,
|
||||
descriptorOptional = false,
|
||||
skipConsistencyCheck = false
|
||||
)
|
||||
)
|
||||
|
||||
libraryDependencies += "org.scalaz.stream" %% "scalaz-stream" % "0.7.1"
|
||||
libraryDependencies += "org.scalaz.stream" %% "scalaz-stream" % "0.7.1"
|
||||
|
|
|
|||
|
|
@ -57,10 +57,22 @@ lazy val shared = Seq(
|
|||
val compileDocArtifacts = artifacts("compile", Some("javadoc"))
|
||||
val docArtifacts = artifacts("compile", Some("javadoc"), useClassifiersReport = true)
|
||||
|
||||
assert(compileSourceArtifacts.isEmpty)
|
||||
assert(sourceArtifacts.length == 2)
|
||||
assert(compileDocArtifacts.isEmpty)
|
||||
assert(docArtifacts.length == 2)
|
||||
assert(
|
||||
compileSourceArtifacts.isEmpty,
|
||||
"Expected no source artifact in main update report"
|
||||
)
|
||||
assert(
|
||||
sourceArtifacts.length == 2,
|
||||
"Expected 2 source artifacts in classifier report"
|
||||
)
|
||||
assert(
|
||||
compileDocArtifacts.isEmpty,
|
||||
"Expected no doc artifact in main update report"
|
||||
)
|
||||
assert(
|
||||
docArtifacts.length == 2,
|
||||
"Expected 2 doc artifacts in classifier report"
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
// for SbtExclusionRule with sbt 1.0
|
||||
import sbt.internal.librarymanagement._
|
||||
|
||||
enablePlugins(coursier.ShadingPlugin)
|
||||
shadingNamespace := "test.shaded"
|
||||
shadeNamespaces += "argonaut"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
package sbt.internal.librarymanagement
|
||||
|
||||
// dummy object, to be able to do
|
||||
// import sbt.internal.librarymanagement._
|
||||
// from build.sbt, even in 0.13
|
||||
// That import is required in 1.0 for SbtExclusionRule
|
||||
|
||||
object Dummy
|
||||
|
|
@ -67,11 +67,17 @@ is212() {
|
|||
}
|
||||
|
||||
runSbtCoursierTests() {
|
||||
sbt ++$SCALA_VERSION coreJVM/publishLocal cache/publishLocal sbt-coursier/scripted
|
||||
sbt ++$SCALA_VERSION coreJVM/publishLocal cache/publishLocal "sbt-coursier/scripted sbt-coursier/*"
|
||||
if [ "$SCALA_VERSION" = "2.10" ]; then
|
||||
sbt ++$SCALA_VERSION "sbt-coursier/scripted sbt-coursier-0.13/*"
|
||||
fi
|
||||
}
|
||||
|
||||
runSbtShadingTests() {
|
||||
sbt ++$SCALA_VERSION sbt-coursier/publishLocal sbt-shading/scripted
|
||||
sbt ++$SCALA_VERSION coreJVM/publishLocal cache/publishLocal sbt-coursier/publishLocal "sbt-shading/scripted sbt-shading/*"
|
||||
if [ "$SCALA_VERSION" = "2.10" ]; then
|
||||
sbt ++$SCALA_VERSION "sbt-shading/scripted sbt-shading-0.13/*"
|
||||
fi
|
||||
}
|
||||
|
||||
jsCompile() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue