mirror of https://github.com/sbt/sbt.git
Merge pull request #610 from coursier/topic/sbt-1.0.0-RC2
Switch to sbt 1.0.0-RC2
This commit is contained in:
commit
ce00dcc231
|
|
@ -2,7 +2,7 @@
|
|||
import sbt._
|
||||
import sbt.Defaults.itSettings
|
||||
import sbt.Keys._
|
||||
import sbt.ScriptedPlugin.scriptedSettings
|
||||
import sbt.ScriptedPlugin.{scriptedConf, scriptedLaunchConf, scriptedSbt, scriptedSettings}
|
||||
|
||||
import com.typesafe.sbt.SbtProguard.proguardSettings
|
||||
|
||||
|
|
@ -10,7 +10,24 @@ object Aliases {
|
|||
|
||||
def libs = libraryDependencies
|
||||
|
||||
def withScriptedTests = scriptedSettings
|
||||
def withScriptedTests =
|
||||
// see https://github.com/sbt/sbt/issues/3325#issuecomment-315670424
|
||||
scriptedSettings.filterNot(_.key.key.label == libraryDependencies.key.label) ++ Seq(
|
||||
libraryDependencies ++= {
|
||||
CrossVersion.binarySbtVersion(scriptedSbt.value) match {
|
||||
case "0.13" =>
|
||||
Seq(
|
||||
"org.scala-sbt" % "scripted-sbt" % scriptedSbt.value % scriptedConf.toString,
|
||||
"org.scala-sbt" % "sbt-launch" % scriptedSbt.value % scriptedLaunchConf.toString
|
||||
)
|
||||
case _ =>
|
||||
Seq(
|
||||
"org.scala-sbt" %% "scripted-sbt" % scriptedSbt.value % scriptedConf.toString,
|
||||
"org.scala-sbt" % "sbt-launch" % scriptedSbt.value % scriptedLaunchConf.toString
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
def hasITs = itSettings
|
||||
|
||||
|
|
|
|||
|
|
@ -178,59 +178,6 @@ object Settings {
|
|||
)
|
||||
}
|
||||
|
||||
lazy val scripted100M6Workaround = {
|
||||
|
||||
// see https://github.com/sbt/sbt/issues/3245#issuecomment-306045952
|
||||
|
||||
ScriptedPlugin.scripted := Def.inputTask {
|
||||
|
||||
val args = ScriptedPlugin
|
||||
.asInstanceOf[{
|
||||
def scriptedParser(f: File): complete.Parser[Seq[String]]
|
||||
}]
|
||||
.scriptedParser(sbtTestDirectory.value)
|
||||
.parsed
|
||||
|
||||
val prereq: Unit = scriptedDependencies.value
|
||||
val scriptedTests = ScriptedPlugin.scriptedTests.value
|
||||
|
||||
val testDir = sbtTestDirectory.value
|
||||
val log = scriptedBufferLog.value
|
||||
val args0 = args.toArray
|
||||
val launcher = sbtLauncher.value
|
||||
val opts = scriptedLaunchOpts.value.toArray
|
||||
|
||||
val sbtv = sbtVersion.in(pluginCrossBuild).value
|
||||
|
||||
try {
|
||||
if(sbtv == "1.0.0-M6")
|
||||
scriptedTests.asInstanceOf[{
|
||||
def run(
|
||||
x1: File,
|
||||
x2: Boolean,
|
||||
x3: Array[String],
|
||||
x4: File,
|
||||
x5: Array[String],
|
||||
x6: java.util.List[File]
|
||||
): Unit
|
||||
}].run(testDir, log, args0, launcher, opts, new java.util.ArrayList)
|
||||
else
|
||||
scriptedTests.asInstanceOf[{
|
||||
def run(
|
||||
x1: File,
|
||||
x2: Boolean,
|
||||
x3: Array[String],
|
||||
x4: File,
|
||||
x5: Array[String]
|
||||
): Unit
|
||||
}].run(testDir, log, args0, launcher, opts)
|
||||
} catch {
|
||||
case e: java.lang.reflect.InvocationTargetException =>
|
||||
throw e.getCause
|
||||
}
|
||||
}.evaluated
|
||||
}
|
||||
|
||||
lazy val plugin =
|
||||
javaScalaPluginShared ++
|
||||
divertThingsPlugin ++
|
||||
|
|
@ -262,7 +209,6 @@ object Settings {
|
|||
|
||||
jar
|
||||
},
|
||||
scripted100M6Workaround,
|
||||
scriptedLaunchOpts ++= Seq(
|
||||
"-Xmx1024M",
|
||||
"-Dplugin.version=" + version.value,
|
||||
|
|
@ -279,7 +225,7 @@ object Settings {
|
|||
sbtVersion := {
|
||||
scalaBinaryVersion.value match {
|
||||
case "2.10" => "0.13.8"
|
||||
case "2.12" => "1.0.0-M6"
|
||||
case "2.12" => "1.0.0-RC2"
|
||||
case _ => sbtVersion.value
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import scala.language.implicitConversions
|
|||
|
||||
object SbtCompatibility {
|
||||
|
||||
final case class ConfigRef(name: String) extends AnyVal
|
||||
implicit def configRefToString(ref: ConfigRef): String = ref.name
|
||||
|
||||
val GetClassifiersModule = sbt.GetClassifiersModule
|
||||
type GetClassifiersModule = sbt.GetClassifiersModule
|
||||
|
||||
|
|
@ -45,12 +48,29 @@ object SbtCompatibility {
|
|||
implicit class ConfigurationOps(val config: sbt.Configuration) extends AnyVal {
|
||||
def withExtendsConfigs(extendsConfigs: Vector[sbt.Configuration]): sbt.Configuration =
|
||||
config.copy(extendsConfigs = extendsConfigs.toList)
|
||||
def toConfigRef: ConfigRef =
|
||||
ConfigRef(config.name)
|
||||
}
|
||||
|
||||
implicit def configurationToConfigRef(config: sbt.Configuration): ConfigRef =
|
||||
config.toConfigRef
|
||||
|
||||
implicit class ConfigurationCompanionOps(val companion: sbt.Configuration.type) extends AnyVal {
|
||||
def of(
|
||||
id: String,
|
||||
name: String,
|
||||
description: String,
|
||||
isPublic: Boolean,
|
||||
extendsConfigs: Vector[sbt.Configuration],
|
||||
transitive: Boolean
|
||||
): sbt.Configuration =
|
||||
sbt.Configuration(name, description, isPublic, extendsConfigs.toList, transitive)
|
||||
}
|
||||
|
||||
implicit class CallerCompanionOps(val companion: sbt.Caller.type) extends AnyVal {
|
||||
def apply(
|
||||
caller: sbt.ModuleID,
|
||||
callerConfigurations: Vector[String],
|
||||
callerConfigurations: Vector[ConfigRef],
|
||||
callerExtraAttributes: Map[String, String],
|
||||
isForceDependency: Boolean,
|
||||
isChangingDependency: Boolean,
|
||||
|
|
@ -59,7 +79,7 @@ object SbtCompatibility {
|
|||
): sbt.Caller =
|
||||
new sbt.Caller(
|
||||
caller,
|
||||
callerConfigurations,
|
||||
callerConfigurations.map(_.name),
|
||||
callerExtraAttributes,
|
||||
isForceDependency,
|
||||
isChangingDependency,
|
||||
|
|
@ -117,4 +137,8 @@ object SbtCompatibility {
|
|||
implicit def configListToVector(configs: List[sbt.Configuration]): Vector[sbt.Configuration] =
|
||||
configs.toVector
|
||||
|
||||
implicit class GetClassifiersModuleOps(val module: GetClassifiersModule) extends AnyVal {
|
||||
def dependencies = module.modules
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ class ModuleReportOps(val report: sbt.ModuleReport) extends AnyVal {
|
|||
report.copy(homepage = homepage)
|
||||
def withExtraAttributes(extraAttributes: Map[String, String]): sbt.ModuleReport =
|
||||
report.copy(extraAttributes = extraAttributes)
|
||||
def withConfigurations(configurations: Vector[String]): sbt.ModuleReport =
|
||||
report.copy(configurations = configurations)
|
||||
def withConfigurations(configurations: Vector[coursier.SbtCompatibility.ConfigRef]): sbt.ModuleReport =
|
||||
report.copy(configurations = configurations.map(_.name))
|
||||
def withLicenses(licenses: Vector[(String, Option[String])]): sbt.ModuleReport =
|
||||
report.copy(licenses = licenses)
|
||||
def withCallers(callers: Vector[sbt.Caller]): sbt.ModuleReport =
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@ package coursier
|
|||
|
||||
object SbtCompatibility {
|
||||
|
||||
val GetClassifiersModule = sbt.internal.librarymanagement.GetClassifiersModule
|
||||
type GetClassifiersModule = sbt.internal.librarymanagement.GetClassifiersModule
|
||||
val ConfigRef = sbt.librarymanagement.ConfigRef
|
||||
type ConfigRef = sbt.librarymanagement.ConfigRef
|
||||
|
||||
val GetClassifiersModule = sbt.librarymanagement.GetClassifiersModule
|
||||
type GetClassifiersModule = sbt.librarymanagement.GetClassifiersModule
|
||||
|
||||
object SbtPomExtraProperties {
|
||||
def POM_INFO_KEY_PREFIX = sbt.internal.librarymanagement.mavenint.SbtPomExtraProperties.POM_INFO_KEY_PREFIX
|
||||
|
|
|
|||
|
|
@ -69,15 +69,14 @@ object CoursierPlugin extends AutoPlugin {
|
|||
shadedConfigOpt: Option[(String, String)]
|
||||
): Setting[Task[T]] =
|
||||
// not 100% sure that make writeFiles below happen before the actions triggered by task.value...
|
||||
task := {
|
||||
task := task.dependsOn(Def.task {
|
||||
val currentProject = {
|
||||
val proj = coursierProject.value
|
||||
val publications = coursierPublications.value
|
||||
proj.copy(publications = publications)
|
||||
}
|
||||
IvyXml.writeFiles(currentProject, shadedConfigOpt, ivySbt.value, streams.value.log)
|
||||
task.value
|
||||
}
|
||||
}).value
|
||||
|
||||
def coursierSettings(
|
||||
shadedConfigOpt: Option[(String, String)],
|
||||
|
|
@ -96,8 +95,8 @@ object CoursierPlugin extends AutoPlugin {
|
|||
withClassifiers = true,
|
||||
sbtClassifiers = true
|
||||
).value,
|
||||
makeIvyXmlBefore(deliverLocalConfiguration, shadedConfigOpt),
|
||||
makeIvyXmlBefore(deliverConfiguration, shadedConfigOpt),
|
||||
makeIvyXmlBefore(publishLocalConfiguration, shadedConfigOpt),
|
||||
makeIvyXmlBefore(publishConfiguration, shadedConfigOpt),
|
||||
update := Tasks.updateTask(
|
||||
shadedConfigOpt,
|
||||
withClassifiers = false
|
||||
|
|
@ -128,7 +127,7 @@ object CoursierPlugin extends AutoPlugin {
|
|||
coursierResolutions
|
||||
.value
|
||||
.collectFirst {
|
||||
case (configs, res) if (configs(config)) =>
|
||||
case (configs, res) if configs(config) =>
|
||||
res
|
||||
}
|
||||
.getOrElse {
|
||||
|
|
@ -149,13 +148,31 @@ object CoursierPlugin extends AutoPlugin {
|
|||
if (names("sources"))
|
||||
None
|
||||
else
|
||||
Some(Configuration("sources", "", isPublic = true, extendsConfigs = Vector.empty, transitive = false))
|
||||
Some(
|
||||
Configuration.of(
|
||||
id = "Sources",
|
||||
name = "sources",
|
||||
description = "",
|
||||
isPublic = true,
|
||||
extendsConfigs = Vector.empty,
|
||||
transitive = false
|
||||
)
|
||||
)
|
||||
|
||||
val extraDocs =
|
||||
if (names("docs"))
|
||||
None
|
||||
else
|
||||
Some(Configuration("docs", "", isPublic = true, extendsConfigs = Vector.empty, transitive = false))
|
||||
Some(
|
||||
Configuration.of(
|
||||
id = "Docs",
|
||||
name = "docs",
|
||||
description = "",
|
||||
isPublic = true,
|
||||
extendsConfigs = Vector.empty,
|
||||
transitive = false
|
||||
)
|
||||
)
|
||||
|
||||
confs ++ extraSources.toSeq ++ extraDocs.toSeq
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import coursier.ivy.{IvyRepository, PropertiesPattern}
|
|||
import coursier.Keys._
|
||||
import coursier.Structure._
|
||||
import coursier.util.Print
|
||||
import coursier.SbtCompatibility._
|
||||
import sbt.{Classpaths, Def, Resolver, UpdateReport}
|
||||
import sbt.Keys._
|
||||
|
||||
|
|
@ -331,12 +332,13 @@ object Tasks {
|
|||
// Seems that SBT does that - if an artifact has no configs,
|
||||
// it puts it in all of them. See for example what happens to
|
||||
// the standalone JAR artifact of the coursier cli module.
|
||||
def allConfigsIfEmpty(configs: Iterable[sbt.Configuration]): Iterable[sbt.Configuration] =
|
||||
if (configs.isEmpty) ivyConfs else configs
|
||||
def allConfigsIfEmpty(configs: Iterable[ConfigRef]): Iterable[ConfigRef] =
|
||||
if (configs.isEmpty) ivyConfs.filter(_.isPublic).map(_.toConfigRef) else configs
|
||||
|
||||
val extraSbtArtifactsPublication = for {
|
||||
artifact <- extraSbtArtifacts
|
||||
config <- allConfigsIfEmpty(artifact.configurations) if config.isPublic
|
||||
config <- allConfigsIfEmpty(artifact.configurations.map(x => x: ConfigRef))
|
||||
// FIXME If some configurations from artifact.configurations are not public, they may leak here :\
|
||||
} yield config.name -> artifactPublication(artifact)
|
||||
|
||||
sbtArtifactsPublication ++ extraSbtArtifactsPublication
|
||||
|
|
@ -550,14 +552,14 @@ object Tasks {
|
|||
if (sbtClassifiers) {
|
||||
val proj = FromSbt.project(
|
||||
cm.id,
|
||||
cm.modules,
|
||||
cm.dependencies,
|
||||
cm.configurations.map(cfg => cfg.name -> cfg.extendsConfigs.map(_.name)).toMap,
|
||||
sv,
|
||||
sbv
|
||||
)
|
||||
|
||||
val fallbackDeps = FromSbt.fallbackDependencies(
|
||||
cm.modules,
|
||||
cm.dependencies,
|
||||
sv,
|
||||
sbv
|
||||
)
|
||||
|
|
@ -1112,7 +1114,7 @@ object Tasks {
|
|||
if (sbtClassifiers)
|
||||
FromSbt.project(
|
||||
cm.id,
|
||||
cm.modules,
|
||||
cm.dependencies,
|
||||
cm.configurations.map(cfg => cfg.name -> cfg.extendsConfigs.map(_.name)).toMap,
|
||||
sv,
|
||||
sbv
|
||||
|
|
@ -1277,7 +1279,7 @@ object Tasks {
|
|||
if (sbtClassifiers)
|
||||
FromSbt.project(
|
||||
cm.id,
|
||||
cm.modules,
|
||||
cm.dependencies,
|
||||
cm.configurations.map(cfg => cfg.name -> cfg.extendsConfigs.map(_.name)).toMap,
|
||||
sv,
|
||||
sbv
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ object ToSbt {
|
|||
case (dependee, dependeeProj) =>
|
||||
Caller(
|
||||
ToSbt.moduleId(dependee, dependeeProj.properties.toMap),
|
||||
dependeeProj.configurations.keys.toVector,
|
||||
dependeeProj.configurations.keys.toVector.map(ConfigRef(_)),
|
||||
dependee.module.attributes ++ dependeeProj.properties,
|
||||
// FIXME Set better values here
|
||||
isForceDependency = false,
|
||||
|
|
@ -101,7 +101,7 @@ object ToSbt {
|
|||
.withExtraAttributes(dependency.module.attributes ++ project.properties)
|
||||
// .withIsDefault(None)
|
||||
// .withBranch(None)
|
||||
.withConfigurations(project.configurations.keys.toVector)
|
||||
.withConfigurations(project.configurations.keys.toVector.map(ConfigRef(_)))
|
||||
.withLicenses(project.info.licenses.toVector)
|
||||
.withCallers(callers.toVector)
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ object ToSbt {
|
|||
)
|
||||
|
||||
ConfigurationReport(
|
||||
config,
|
||||
ConfigRef(config),
|
||||
reports.toVector,
|
||||
Vector()
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ check := {
|
|||
val configReport = report
|
||||
.configurations
|
||||
.find { confRep =>
|
||||
confRep.configuration == "compile"
|
||||
// .toString required with sbt 1.0 (ConfigRef -> String)
|
||||
confRep.configuration.toString == "compile"
|
||||
}
|
||||
.getOrElse {
|
||||
sys.error("No configuration report found for configuration 'compile'")
|
||||
|
|
|
|||
|
|
@ -15,10 +15,24 @@ object ShadingPlugin extends AutoPlugin {
|
|||
override def requires = sbt.plugins.IvyPlugin
|
||||
|
||||
private val baseSbtConfiguration = Compile
|
||||
val Shading = Configuration("shading", "", isPublic = false, Vector(baseSbtConfiguration), transitive = true)
|
||||
val Shading = Configuration.of(
|
||||
id = "Shading",
|
||||
name = "shading",
|
||||
description = "",
|
||||
isPublic = false,
|
||||
Vector(baseSbtConfiguration),
|
||||
transitive = true
|
||||
)
|
||||
|
||||
private val baseDependencyConfiguration = "compile"
|
||||
val Shaded = Configuration("shaded", "", isPublic = true, Vector(), transitive = true)
|
||||
val Shaded = Configuration.of(
|
||||
id = "Shaded",
|
||||
name = "shaded",
|
||||
description = "",
|
||||
isPublic = true,
|
||||
Vector(),
|
||||
transitive = true
|
||||
)
|
||||
|
||||
// make that a setting?
|
||||
val shadingNamespace = SettingKey[String]("shading-namespace")
|
||||
|
|
|
|||
Loading…
Reference in New Issue