Merge pull request #712 from coursier/topic/update-report-exclusions

Write exclusions and transitiveness in sbt update reports, add sbt-shared module
This commit is contained in:
Alexandre Archambault 2017-12-11 17:50:27 +01:00 committed by GitHub
commit 617fe5cc3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 109 additions and 6 deletions

View File

@ -18,8 +18,8 @@ build_script:
- sbt ++2.11.11 clean compile coreJVM/publishLocal cli/publishLocal
- sbt ++2.12.4 http-server/publishLocal
- sbt ++2.10.6 clean compile
- sbt ++2.12.4 coreJVM/publishLocal cache/publishLocal extra/publishLocal # to make the scripted sbt 1.0 tests happy
- sbt ++2.10.6 coreJVM/publishLocal cache/publishLocal extra/publishLocal # to make the scripted sbt 0.13 tests happy
- sbt ++2.12.4 coreJVM/publishLocal cache/publishLocal extra/publishLocal sbt-shared/publishLocal # to make the scripted sbt 1.0 tests happy
- sbt ++2.10.6 coreJVM/publishLocal cache/publishLocal extra/publishLocal sbt-shared/publishLocal # to make the scripted sbt 0.13 tests happy
test_script:
- ps: Start-Job -filepath .\scripts\start-it-auth-server.ps1 -ArgumentList $pwd
- ps: Start-Sleep -s 15 # wait for the first server to have downloaded its dependencies

View File

@ -217,8 +217,15 @@ lazy val doc = project
tutTargetDirectory := baseDirectory.in(LocalRootProject).value
)
lazy val `sbt-shared` = project
.dependsOn(coreJvm, cache)
.settings(
plugin,
utest
)
lazy val `sbt-coursier` = project
.dependsOn(coreJvm, cache, extra)
.dependsOn(coreJvm, cache, extra, `sbt-shared`)
.settings(
plugin,
utest
@ -307,6 +314,7 @@ lazy val jvm = project
bootstrap,
extra,
cli,
`sbt-shared`,
`sbt-coursier`,
`sbt-pgp-coursier`,
`sbt-shading`,
@ -343,6 +351,7 @@ lazy val `sbt-plugins` = project
coreJvm,
cache,
extra,
`sbt-shared`,
`sbt-coursier`,
`sbt-pgp-coursier`,
`sbt-shading`
@ -366,6 +375,7 @@ lazy val coursier = project
bootstrap,
extra,
cli,
`sbt-shared`,
`sbt-coursier`,
`sbt-pgp-coursier`,
`sbt-shading`,

View File

@ -185,6 +185,9 @@ object Settings {
)
}
val sbt013Version = "0.13.8"
val sbt10Version = "1.0.2"
lazy val plugin =
javaScalaPluginShared ++
divertThingsPlugin ++
@ -205,8 +208,8 @@ object Settings {
scalaVersion := appConfiguration.value.provider.scalaProvider.version, // required with sbt 0.13.16-M1, to avoid cyclic references
sbtVersion := {
scalaBinaryVersion.value match {
case "2.10" => "0.13.8"
case "2.12" => "1.0.2"
case "2.10" => sbt013Version
case "2.12" => sbt10Version
case _ => sbtVersion.value
}
},

View File

@ -0,0 +1,32 @@
import Compatibility._
lazy val noJbossInterceptorCheck = TaskKey[Unit]("noJbossInterceptorCheck")
noJbossInterceptorCheck := {
val log = streams.value.log
val configReport = updateSbtClassifiers.value
.configuration(Default)
.getOrElse {
throw new Exception(
"compile configuration not found in update report"
)
}
val artifacts = configReport
.modules
.flatMap(_.artifacts)
.map(_._1)
val jbossInterceptorArtifacts = artifacts
.filter { a =>
a.name.contains("jboss-interceptor")
}
for (a <- jbossInterceptorArtifacts)
log.error(s"Found jboss-interceptor artifact $a")
assert(jbossInterceptorArtifacts.isEmpty)
}

View File

@ -0,0 +1,13 @@
{
val pluginVersion = sys.props.getOrElse(
"plugin.version",
throw new RuntimeException(
"""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
)
)
addSbtPlugin("io.get-coursier" % "sbt-coursier" % pluginVersion)
}
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")

View File

@ -0,0 +1,11 @@
{
val pluginVersion = sys.props.getOrElse(
"plugin.version",
throw new RuntimeException(
"""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
)
)
addSbtPlugin("io.get-coursier" % "sbt-coursier" % pluginVersion)
}

View File

@ -0,0 +1,8 @@
object Compatibility {
implicit class UpdateReportOps(val rep: sbt.UpdateReport) extends AnyVal {
def configuration(conf: sbt.Configuration) =
rep.configuration(conf.name)
}
}

View File

@ -0,0 +1 @@
> noJbossInterceptorCheck

View File

@ -23,6 +23,10 @@ object SbtCompatibility {
id.copy(configurations = configurations)
def withExtraAttributes(extraAttributes: Map[String, String]): sbt.ModuleID =
id.copy(extraAttributes = extraAttributes)
def withExclusions(exclusions: Seq[sbt.librarymanagement.InclExclRule]): sbt.ModuleID =
exclusions.foldLeft(id)((id0, rule) => id0.exclude(rule.org, rule.name))
def withIsTransitive(isTransitive: Boolean): sbt.ModuleID =
id.copy(isTransitive = isTransitive)
}
implicit class ArtifactOps(val artifact: sbt.Artifact) extends AnyVal {

View File

@ -0,0 +1,8 @@
package sbt.librarymanagement
final case class InclExclRule(org: String = "*", name: String = "*") {
def withOrganization(org: String): InclExclRule =
copy(org = org)
def withName(name: String): InclExclRule =
copy(name = name)
}

View File

@ -33,6 +33,18 @@ object ToSbt {
Some(dependency.configuration)
).withExtraAttributes(
dependency.module.attributes ++ extraProperties
).withExclusions(
dependency
.exclusions
.toVector
.map {
case (org, name) =>
sbt.librarymanagement.InclExclRule()
.withOrganization(org)
.withName(name)
}
).withIsTransitive(
dependency.transitive
)
}

View File

@ -80,7 +80,7 @@ runSbtCoursierTests() {
}
runSbtShadingTests() {
sbt ++$SCALA_VERSION coreJVM/publishLocal cache/publishLocal extra/publishLocal sbt-coursier/publishLocal "sbt-shading/scripted sbt-shading/*"
sbt ++$SCALA_VERSION coreJVM/publishLocal cache/publishLocal extra/publishLocal sbt-shared/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