mirror of https://github.com/sbt/sbt.git
Upgrade from sbt/datatype to sbt/contraband
This commit is contained in:
parent
946f307082
commit
71fddd5e3f
|
|
@ -49,7 +49,7 @@ lazy val lm = (project in file("librarymanagement")).
|
|||
libraryDependencies ++= scalaXml.value,
|
||||
resourceGenerators in Compile += Def.task(Util.generateVersionFile(version.value, resourceManaged.value, streams.value, (compile in Compile).value)).taskValue,
|
||||
binaryIssueFilters ++= Seq(),
|
||||
datatypeFormatsForType in generateDatatypes in Compile := DatatypeConfig.getFormats,
|
||||
contrabandFormatsForType in generateContrabands in Compile := DatatypeConfig.getFormats,
|
||||
// WORKAROUND sbt/sbt#2205 include managed sources in packageSrc
|
||||
mappings in (Compile, packageSrc) ++= {
|
||||
val srcs = (managedSources in Compile).value
|
||||
|
|
@ -59,7 +59,7 @@ lazy val lm = (project in file("librarymanagement")).
|
|||
}
|
||||
).
|
||||
configure(addSbtIO, addSbtUtilLogging, addSbtUtilTesting, addSbtUtilCollection, addSbtUtilCompletion, addSbtUtilCache).
|
||||
enablePlugins(DatatypePlugin, JsonCodecPlugin)
|
||||
enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
||||
|
||||
def customCommands: Seq[Setting[_]] = Seq(
|
||||
commands += Command.command("release") { state =>
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
{ "name": "name", "type": "String" },
|
||||
{ "name": "type", "type": "String", "default": "Artifact.DefaultType", "since": "0.0.1" },
|
||||
{ "name": "extension", "type": "String", "default": "Artifact.DefaultExtension", "since": "0.0.1" },
|
||||
{ "name": "classifier", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "classifier", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "configurations", "type": "sbt.librarymanagement.Configuration*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "url", "type": "java.net.URL?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "url", "type": "Option[java.net.URL]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "extraAttributes", "type": "Map[String, String]", "default": "Map.empty", "since": "0.0.1" }
|
||||
],
|
||||
"parentsCompanion": "sbt.librarymanagement.ArtifactFunctions"
|
||||
|
|
@ -208,14 +208,14 @@
|
|||
"target": "Scala",
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{ "name": "scalaFullVersion", "type": "String" },
|
||||
{ "name": "scalaBinaryVersion", "type": "String" },
|
||||
{ "name": "configurations", "type": "sbt.librarymanagement.Configuration*" },
|
||||
{ "name": "checkExplicit", "type": "boolean" },
|
||||
{ "name": "filterImplicit", "type": "boolean" },
|
||||
{ "name": "overrideScalaVersion", "type": "boolean" },
|
||||
{ "name": "scalaOrganization", "type": "String", "default": "sbt.librarymanagement.ScalaArtifacts.Organization", "since": "0.0.1" },
|
||||
{ "name": "scalaArtifacts", "type": "String*", "default": "sbt.librarymanagement.ScalaArtifacts.Artifacts", "since": "0.0.1" }
|
||||
{ "name": "scalaFullVersion", "type": "String" },
|
||||
{ "name": "scalaBinaryVersion", "type": "String" },
|
||||
{ "name": "configurations", "type": "sbt.librarymanagement.Configuration*" },
|
||||
{ "name": "checkExplicit", "type": "boolean" },
|
||||
{ "name": "filterImplicit", "type": "boolean" },
|
||||
{ "name": "overrideScalaVersion", "type": "boolean" },
|
||||
{ "name": "scalaOrganization", "type": "String", "default": "sbt.librarymanagement.ScalaArtifacts.Organization", "since": "0.0.1" },
|
||||
{ "name": "scalaArtifacts", "type": "scala.Vector[String]", "default": "sbt.librarymanagement.ScalaArtifacts.Artifacts", "since": "0.0.1" }
|
||||
],
|
||||
"parentsCompanion": "sbt.librarymanagement.IvyScalaFunctions"
|
||||
},
|
||||
|
|
@ -245,7 +245,7 @@
|
|||
{ "name": "organization", "type": "String" },
|
||||
{ "name": "name", "type": "String" },
|
||||
{ "name": "revision", "type": "String" },
|
||||
{ "name": "configurations", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "configurations", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "isChanging", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||
{ "name": "isTransitive", "type": "boolean", "default": "true", "since": "0.0.1" },
|
||||
{ "name": "isForce", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||
|
|
@ -254,7 +254,7 @@
|
|||
{ "name": "exclusions", "type": "sbt.librarymanagement.InclExclRule*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "extraAttributes", "type": "Map[String, String]", "default": "Map.empty", "since": "0.0.1" },
|
||||
{ "name": "crossVersion", "type": "sbt.librarymanagement.CrossVersion", "default": "sbt.librarymanagement.Disabled()", "since": "0.0.1" },
|
||||
{ "name": "branchName", "type": "String?", "default": "None", "since": "0.0.1" }
|
||||
{ "name": "branchName", "type": "Option[String]", "default": "None", "since": "0.0.1" }
|
||||
],
|
||||
"toString": [
|
||||
"organization + \":\" + name + \":\" + revision +",
|
||||
|
|
@ -270,15 +270,15 @@
|
|||
"type": "record",
|
||||
"doc": "Additional information about a project module",
|
||||
"fields": [
|
||||
{ "name": "nameFormal", "type": "String" },
|
||||
{ "name": "description", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "homepage", "type": "java.net.URL?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "startYear", "type": "int?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "licenses", "type": "scala.Tuple2[String, java.net.URL]*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "organizationName", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "organizationHomepage", "type": "java.net.URL?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "scmInfo", "type": "sbt.librarymanagement.ScmInfo?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "developers", "type": "sbt.librarymanagement.Developer*", "default": "Vector.empty", "since": "0.0.1" }
|
||||
{ "name": "nameFormal", "type": "String" },
|
||||
{ "name": "description", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "homepage", "type": "Option[java.net.URL]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "startYear", "type": "Option[Int]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "licenses", "type": "scala.Tuple2[String, java.net.URL]*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "organizationName", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "organizationHomepage", "type": "Option[java.net.URL]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "scmInfo", "type": "Option[sbt.librarymanagement.ScmInfo]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "developers", "type": "sbt.librarymanagement.Developer*", "default": "Vector.empty", "since": "0.0.1" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -295,18 +295,18 @@
|
|||
{ "name": "module", "type": "sbt.librarymanagement.ModuleID" },
|
||||
{ "name": "artifacts", "type": "scala.Tuple2[sbt.librarymanagement.Artifact, java.io.File]*" },
|
||||
{ "name": "missingArtifacts", "type": "sbt.librarymanagement.Artifact*" },
|
||||
{ "name": "status", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "publicationDate", "type": "java.util.Date?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "resolver", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "artifactResolver", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "status", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "publicationDate", "type": "Option[java.util.Date]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "resolver", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "artifactResolver", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "evicted", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||
{ "name": "evictedData", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "evictedReason", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "problem", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "homepage", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "evictedData", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "evictedReason", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "problem", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "homepage", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "extraAttributes", "type": "Map[String, String]", "default": "Map.empty", "since": "0.0.1" },
|
||||
{ "name": "isDefault", "type": "boolean?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "branch", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "isDefault", "type": "Option[Boolean]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "branch", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "configurations", "type": "String*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "licenses", "type": "scala.Tuple2[String, Option[String]]*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "callers", "type": "sbt.librarymanagement.Caller*", "default": "Vector.empty", "since": "0.0.1" }
|
||||
|
|
@ -359,7 +359,7 @@
|
|||
{ "name": "excludes", "type": "sbt.internal.librarymanagement.SbtExclusionRule*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "ivyXML", "type": "scala.xml.NodeSeq", "default": "scala.xml.NodeSeq.Empty", "since": "0.0.1" },
|
||||
{ "name": "configurations", "type": "sbt.librarymanagement.Configuration*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "defaultConfiguration", "type": "sbt.librarymanagement.Configuration?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "defaultConfiguration", "type": "Option[sbt.librarymanagement.Configuration]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "conflictManager", "type": "sbt.librarymanagement.ConflictManager", "default": "sbt.librarymanagement.ConflictManager.default", "since": "0.0.1" }
|
||||
],
|
||||
"parentsCompanion": "sbt.internal.librarymanagement.InlineConfigurationFunctions"
|
||||
|
|
@ -754,10 +754,10 @@
|
|||
"target": "Scala",
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{ "name": "retrieveDirectory", "type": "java.io.File" },
|
||||
{ "name": "outputPattern", "type": "String" },
|
||||
{ "name": "sync", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||
{ "name": "configurationsToRetrieve", "type": "Set[sbt.librarymanagement.Configuration]?", "default": "None", "since": "0.0.1" }
|
||||
{ "name": "retrieveDirectory", "type": "java.io.File" },
|
||||
{ "name": "outputPattern", "type": "String" },
|
||||
{ "name": "sync", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||
{ "name": "configurationsToRetrieve", "type": "Option[Set[sbt.librarymanagement.Configuration]]", "default": "None", "since": "0.0.1" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -90,7 +90,7 @@ class IvyCache(val ivyHome: Option[File], fileToStore: File => CacheStore) {
|
|||
private def basicLocalIvy(lock: Option[xsbti.GlobalLock], log: Logger) =
|
||||
{
|
||||
val local = Resolver.defaultLocal
|
||||
val paths = new IvyPaths(new File("."), ivyHome)
|
||||
val paths = IvyPaths(new File("."), ivyHome)
|
||||
val conf = new InlineIvyConfiguration(paths, Vector(local), Vector.empty, Vector.empty, false, lock, IvySbt.DefaultChecksums, None, UpdateOptions(), log)
|
||||
(new IvySbt(conf, fileToStore), local)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ object IvyRetrieve {
|
|||
case Some(dd) => (toExtraAttributes(dd.getExtraAttributes), dd.isForce, dd.isChanging, dd.isTransitive, false)
|
||||
case None => (Map.empty[String, String], false, false, true, false)
|
||||
}
|
||||
new Caller(m, callerConfigurations, extraAttributes, isForce, isChanging, isTransitive, isDirectlyForce)
|
||||
Caller(m, callerConfigurations, extraAttributes, isForce, isChanging, isTransitive, isDirectlyForce)
|
||||
}
|
||||
val revId = dep.getResolvedId
|
||||
val moduleId = toModuleID(revId)
|
||||
|
|
@ -142,7 +142,7 @@ object IvyRetrieve {
|
|||
val callers = dep.getCallers(confReport.getConfiguration).toVector map { toCaller }
|
||||
val (resolved, missing) = artifacts(moduleId, confReport getDownloadReports revId)
|
||||
|
||||
new ModuleReport(moduleId, resolved, missing, status, publicationDate, resolver, artifactResolver,
|
||||
ModuleReport(moduleId, resolved, missing, status, publicationDate, resolver, artifactResolver,
|
||||
evicted, evictedData, evictedReason, problem, homepage, extraAttributes, isDefault, branch,
|
||||
configurations, licenses, callers)
|
||||
}
|
||||
|
|
@ -161,11 +161,11 @@ object IvyRetrieve {
|
|||
}
|
||||
|
||||
def updateReport(report: ResolveReport, cachedDescriptor: File): UpdateReport =
|
||||
new UpdateReport(cachedDescriptor, reports(report) map configurationReport, updateStats(report), Map.empty) recomputeStamps ()
|
||||
UpdateReport(cachedDescriptor, reports(report) map configurationReport, updateStats(report), Map.empty) recomputeStamps ()
|
||||
def updateStats(report: ResolveReport): UpdateStats =
|
||||
new UpdateStats(report.getResolveTime, report.getDownloadTime, report.getDownloadSize, false)
|
||||
UpdateStats(report.getResolveTime, report.getDownloadTime, report.getDownloadSize, false)
|
||||
def configurationReport(confReport: ConfigurationResolveReport): ConfigurationReport =
|
||||
new ConfigurationReport(confReport.getConfiguration, moduleReports(confReport), organizationArtifactReports(confReport))
|
||||
ConfigurationReport(confReport.getConfiguration, moduleReports(confReport), organizationArtifactReports(confReport))
|
||||
|
||||
/**
|
||||
* Tries to find Ivy graph path the from node to target.
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ private[sbt] class JsonUtil(fileToStore: File => CacheStore) {
|
|||
def toLite(ur: UpdateReport): UpdateReportLite =
|
||||
UpdateReportLite(ur.configurations map { cr =>
|
||||
ConfigurationReportLite(cr.configuration, cr.details map { oar =>
|
||||
new OrganizationArtifactReport(oar.organization, oar.name, oar.modules map { mr =>
|
||||
new ModuleReport(
|
||||
OrganizationArtifactReport(oar.organization, oar.name, oar.modules map { mr =>
|
||||
ModuleReport(
|
||||
mr.module, mr.artifacts, mr.missingArtifacts, mr.status,
|
||||
mr.publicationDate, mr.resolver, mr.artifactResolver,
|
||||
mr.evicted, mr.evictedData, mr.evictedReason,
|
||||
|
|
@ -63,7 +63,7 @@ private[sbt] class JsonUtil(fileToStore: File => CacheStore) {
|
|||
|
||||
def fromLite(lite: UpdateReportLite, cachedDescriptor: File): UpdateReport =
|
||||
{
|
||||
val stats = new UpdateStats(0L, 0L, 0L, false)
|
||||
val stats = UpdateStats(0L, 0L, 0L, false)
|
||||
val configReports = lite.configurations map { cr =>
|
||||
val details = cr.details
|
||||
val modules = details flatMap {
|
||||
|
|
@ -71,8 +71,8 @@ private[sbt] class JsonUtil(fileToStore: File => CacheStore) {
|
|||
!mr.evicted && mr.problem.isEmpty
|
||||
}
|
||||
}
|
||||
new ConfigurationReport(cr.configuration, modules, details)
|
||||
ConfigurationReport(cr.configuration, modules, details)
|
||||
}
|
||||
new UpdateReport(cachedDescriptor, configReports, stats, Map.empty)
|
||||
UpdateReport(cachedDescriptor, configReports, stats, Map.empty)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ final class RichUpdateReport(report: UpdateReport) {
|
|||
{
|
||||
val files = report.cachedDescriptor +: allFiles
|
||||
val stamps = files.map(f => (f, f.lastModified)).toMap
|
||||
new UpdateReport(report.cachedDescriptor, report.configurations, report.stats, stamps)
|
||||
UpdateReport(report.cachedDescriptor, report.configurations, report.stats, stamps)
|
||||
}
|
||||
|
||||
import DependencyFilter._
|
||||
|
|
@ -64,8 +64,8 @@ final class RichUpdateReport(report: UpdateReport) {
|
|||
val newConfigurations = report.configurations.map { confReport =>
|
||||
import confReport._
|
||||
val newModules = modules map { modReport => f(configuration, modReport) }
|
||||
new ConfigurationReport(configuration, newModules, details)
|
||||
ConfigurationReport(configuration, newModules, details)
|
||||
}
|
||||
new UpdateReport(report.cachedDescriptor, newConfigurations, report.stats, report.stamps)
|
||||
UpdateReport(report.cachedDescriptor, newConfigurations, report.stats, report.stamps)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -402,13 +402,13 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
val cachedDescriptor = getSettings.getResolutionCacheManager.getResolvedIvyFileInCache(md0.getModuleRevisionId)
|
||||
val rootModuleConfigs = md0.getConfigurations.toVector
|
||||
val cachedReports = reports filter { !_.stats.cached }
|
||||
val stats = new UpdateStats(resolveTime, (cachedReports map { _.stats.downloadTime }).sum, (cachedReports map { _.stats.downloadSize }).sum, false)
|
||||
val stats = UpdateStats(resolveTime, (cachedReports map { _.stats.downloadTime }).sum, (cachedReports map { _.stats.downloadSize }).sum, false)
|
||||
val configReports = rootModuleConfigs map { conf =>
|
||||
log.debug("::: -----------")
|
||||
val crs = reports flatMap { _.configurations filter { _.configuration == conf.getName } }
|
||||
mergeConfigurationReports(conf.getName, crs, os, log)
|
||||
}
|
||||
new UpdateReport(cachedDescriptor, configReports, stats, Map.empty)
|
||||
UpdateReport(cachedDescriptor, configReports, stats, Map.empty)
|
||||
}
|
||||
// memory usage 62%, of which 58% is in mergeOrganizationArtifactReports
|
||||
def mergeConfigurationReports(rootModuleConf: String, reports: Vector[ConfigurationReport], os: Vector[IvyOverride], log: Logger): ConfigurationReport =
|
||||
|
|
@ -420,7 +420,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
!mr.evicted && mr.problem.isEmpty
|
||||
}
|
||||
}
|
||||
new ConfigurationReport(rootModuleConf, modules, details)
|
||||
ConfigurationReport(rootModuleConf, modules, details)
|
||||
}
|
||||
/**
|
||||
* Returns a tuple of (merged org + name combo, newly evicted modules)
|
||||
|
|
@ -579,7 +579,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
val notEvicted = (survivor ++ newlyEvicted) filter { m => !m.evicted }
|
||||
log.debug("::: adds " + (notEvicted map { _.module }).mkString(", "))
|
||||
log.debug("::: evicted " + (evicted map { _.module }).mkString(", "))
|
||||
val x = new OrganizationArtifactReport(organization, name, survivor ++ newlyEvicted)
|
||||
val x = OrganizationArtifactReport(organization, name, survivor ++ newlyEvicted)
|
||||
val nextModules = transitivelyEvict(rootModuleConf, rest, allModules, evicted, log)
|
||||
x :: resolveConflicts(rest, nextModules)
|
||||
})
|
||||
|
|
@ -644,7 +644,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
}
|
||||
val newlyEvicted = affected map { _.withEvicted(true).withEvictedReason(Some("transitive-evict")) }
|
||||
if (affected.isEmpty) oar
|
||||
else new OrganizationArtifactReport(organization, name, unaffected ++ newlyEvicted)
|
||||
else OrganizationArtifactReport(organization, name, unaffected ++ newlyEvicted)
|
||||
}
|
||||
Seq(((organization, name), oars))
|
||||
}
|
||||
|
|
@ -761,7 +761,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
}
|
||||
mergeConfigurationReports(conf0.getName, remappedCRs, os, log)
|
||||
}
|
||||
new UpdateReport(ur.cachedDescriptor, configurations, ur.stats, ur.stamps)
|
||||
UpdateReport(ur.cachedDescriptor, configurations, ur.stats, ur.stamps)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ abstract class ArtifactFunctions {
|
|||
def apply(name: String, url: URL): Artifact = Artifact(name, extract(url, DefaultType), extract(url, DefaultExtension), None, Vector.empty, Some(url))
|
||||
|
||||
def apply(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Vector[Configuration], url: Option[URL]): Artifact =
|
||||
Artifact(name, `type`, extension, classifier, configurations, url, Map.empty)
|
||||
Artifact(name, `type`, extension, classifier, configurations, url, Map.empty[String, String])
|
||||
|
||||
val DefaultExtension = "jar"
|
||||
val DefaultType = "jar"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
package sbt.librarymanagement
|
||||
|
||||
object Configurations {
|
||||
def config(name: String) = new Configuration(name)
|
||||
def config(name: String) = Configuration(name)
|
||||
def default: Seq[Configuration] = defaultMavenConfigurations
|
||||
def defaultMavenConfigurations: Seq[Configuration] = Seq(Compile, Runtime, Test, Provided, Optional)
|
||||
def defaultInternal: Seq[Configuration] = Seq(CompileInternal, RuntimeInternal, TestInternal)
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ abstract class CrossVersionFunctions {
|
|||
val TransitionSbtVersion = CrossVersionUtil.TransitionSbtVersion
|
||||
|
||||
/** Cross-versions a module with the full version (typically the full Scala version). */
|
||||
def full: CrossVersion = new Full()
|
||||
def full: CrossVersion = Full()
|
||||
|
||||
/** Cross-versions a module with the binary version (typically the binary Scala version). */
|
||||
def binary: CrossVersion = new Binary()
|
||||
def binary: CrossVersion = Binary()
|
||||
|
||||
private[sbt] def append(s: String): Option[String => String] = Some(x => crossName(x, s))
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import org.apache.ivy.core.module.descriptor
|
|||
import org.apache.ivy.util.filter.{ Filter => IvyFilter }
|
||||
|
||||
abstract class InclExclRuleFunctions {
|
||||
def everything = new InclExclRule("*", "*", "*", Vector.empty)
|
||||
def everything = InclExclRule("*", "*", "*", Vector.empty)
|
||||
}
|
||||
|
||||
abstract class ArtifactTypeFilterExtra {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ final class RawRepository(val resolver: DependencyResolver) extends Resolver(res
|
|||
|
||||
abstract class MavenRepositoryFunctions {
|
||||
def apply(name: String, root: String, localIfFile: Boolean = true): MavenRepository =
|
||||
new MavenRepo(name, root, localIfFile)
|
||||
MavenRepo(name, root, localIfFile)
|
||||
}
|
||||
|
||||
abstract class PatternsFunctions {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ abstract class ConfigurationReportExtra {
|
|||
}
|
||||
|
||||
def retrieve(f: (String, ModuleID, Artifact, File) => File): ConfigurationReport =
|
||||
new ConfigurationReport(configuration, modules map { _.retrieve((mid, art, file) => f(configuration, mid, art, file)) }, details)
|
||||
ConfigurationReport(configuration, modules map { _.retrieve((mid, art, file) => f(configuration, mid, art, file)) }, details)
|
||||
}
|
||||
|
||||
abstract class ModuleReportExtra {
|
||||
|
|
@ -141,7 +141,7 @@ abstract class UpdateReportExtra {
|
|||
}
|
||||
|
||||
def retrieve(f: (String, ModuleID, Artifact, File) => File): UpdateReport =
|
||||
new UpdateReport(cachedDescriptor, configurations map { _ retrieve f }, stats, stamps)
|
||||
UpdateReport(cachedDescriptor, configurations map { _ retrieve f }, stats, stamps)
|
||||
|
||||
/** Gets the report for the given configuration, or `None` if the configuration was not resolved.*/
|
||||
def configuration(s: String) = configurations.find(_.configuration == s)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ trait BaseIvySpecification extends UnitSpec {
|
|||
def module(moduleId: ModuleID, deps: Vector[ModuleID], scalaFullVersion: Option[String],
|
||||
uo: UpdateOptions = UpdateOptions(), overrideScalaVersion: Boolean = true): IvySbt#Module = {
|
||||
val ivyScala = scalaFullVersion map { fv =>
|
||||
new IvyScala(
|
||||
IvyScala(
|
||||
scalaFullVersion = fv,
|
||||
scalaBinaryVersion = CrossVersionUtil.binaryScalaVersion(fv),
|
||||
configurations = Vector.empty,
|
||||
|
|
@ -56,7 +56,7 @@ trait BaseIvySpecification extends UnitSpec {
|
|||
def chainResolver = ChainedResolver("sbt-chain", resolvers)
|
||||
|
||||
def mkIvyConfiguration(uo: UpdateOptions): IvyConfiguration = {
|
||||
val paths = new IvyPaths(currentBase, Some(currentTarget))
|
||||
val paths = IvyPaths(currentBase, Some(currentTarget))
|
||||
val other = Vector.empty
|
||||
val moduleConfs = Vector(ModuleConfiguration("*", chainResolver))
|
||||
val off = false
|
||||
|
|
@ -66,8 +66,8 @@ trait BaseIvySpecification extends UnitSpec {
|
|||
}
|
||||
|
||||
def makeUpdateConfiguration: UpdateConfiguration = {
|
||||
val retrieveConfig = new RetrieveConfiguration(currentManaged, Resolver.defaultRetrievePattern).withSync(false)
|
||||
new UpdateConfiguration(Some(retrieveConfig), false, UpdateLogging.Full, ArtifactTypeFilter.forbid(Set("src", "doc")))
|
||||
val retrieveConfig = RetrieveConfiguration(currentManaged, Resolver.defaultRetrievePattern).withSync(false)
|
||||
UpdateConfiguration(Some(retrieveConfig), false, UpdateLogging.Full, ArtifactTypeFilter.forbid(Set("src", "doc")))
|
||||
}
|
||||
|
||||
def ivyUpdateEither(module: IvySbt#Module): Either[UnresolvedWarning, UpdateReport] = {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class CustomPomParserTest extends UnitSpec {
|
|||
withTemporaryDirectory { cacheDir =>
|
||||
val repoUrl = getClass.getResource("/test-maven-repo")
|
||||
val local = MavenRepository("Test Repo", repoUrl.toExternalForm)
|
||||
val paths = new IvyPaths(new File("."), Some(cacheDir))
|
||||
val paths = IvyPaths(new File("."), Some(cacheDir))
|
||||
val conf = new InlineIvyConfiguration(paths, Vector(local), Vector.empty, Vector.empty, false, None, Vector("sha1", "md5"), None, UpdateOptions(), log)
|
||||
val ivySbt = new IvySbt(conf, DefaultFileToStore)
|
||||
val resolveOpts = new ResolveOptions().setConfs(Array("default"))
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@ class DMSerializationSpec extends UnitSpec {
|
|||
}
|
||||
|
||||
lazy val updateReportExample =
|
||||
new UpdateReport(new File("./foo"), Vector(configurationReportExample),
|
||||
new UpdateStats(0, 0, 0, false), Map(new File("./foo") -> 0))
|
||||
UpdateReport(new File("./foo"), Vector(configurationReportExample),
|
||||
UpdateStats(0, 0, 0, false), Map(new File("./foo") -> 0))
|
||||
lazy val configurationReportExample =
|
||||
new ConfigurationReport("compile", Vector(moduleReportExample),
|
||||
ConfigurationReport("compile", Vector(moduleReportExample),
|
||||
Vector(organizationArtifactReportExample))
|
||||
lazy val organizationArtifactReportExample =
|
||||
new OrganizationArtifactReport("org", "name", Vector(moduleReportExample))
|
||||
OrganizationArtifactReport("org", "name", Vector(moduleReportExample))
|
||||
lazy val moduleReportExample =
|
||||
ModuleReport(ModuleID("org", "name", "1.0"), Vector.empty, Vector.empty)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,24 @@
|
|||
import sbt.datatype.{ CodecCodeGen, TpeRef }
|
||||
import sbt.contraband.ast._
|
||||
import sbt.contraband.CodecCodeGen
|
||||
|
||||
object DatatypeConfig {
|
||||
|
||||
/** Extract the only type parameter from a TpeRef */
|
||||
def oneArg(tpe: TpeRef): TpeRef = {
|
||||
val pat = s"""${CodecCodeGen.removeTypeParameters(tpe.name)}[<\\[](.+?)[>\\]]""".r
|
||||
def oneArg(tpe: Type): Type = {
|
||||
val pat = s"""${tpe.removeTypeParameters.name}[<\\[](.+?)[>\\]]""".r
|
||||
val pat(arg0) = tpe.name
|
||||
TpeRef(arg0, false, false, false)
|
||||
NamedType(arg0 split '.' toList)
|
||||
}
|
||||
|
||||
/** Extract the two type parameters from a TpeRef */
|
||||
def twoArgs(tpe: TpeRef): List[TpeRef] = {
|
||||
val pat = s"""${CodecCodeGen.removeTypeParameters(tpe.name)}[<\\[](.+?), (.+?)[>\\]]""".r
|
||||
def twoArgs(tpe: Type): List[Type] = {
|
||||
val pat = s"""${tpe.removeTypeParameters.name}[<\\[](.+?), (.+?)[>\\]]""".r
|
||||
val pat(arg0, arg1) = tpe.name
|
||||
TpeRef(arg0, false, false, false) :: TpeRef(arg1, false, false, false) :: Nil
|
||||
NamedType(arg0 split '.' toList) :: NamedType(arg1 split '.' toList) :: Nil
|
||||
}
|
||||
|
||||
/** Codecs that were manually written. */
|
||||
val myCodecs: PartialFunction[String, TpeRef => List[String]] = {
|
||||
val myCodecs: PartialFunction[String, Type => List[String]] = {
|
||||
case "java.util.Date" => { _ => "sbt.internal.librarymanagement.formats.DateFormat" :: Nil }
|
||||
|
||||
case "scala.xml.NodeSeq" => { _ => "sbt.internal.librarymanagement.formats.NodeSeqFormat" :: Nil }
|
||||
|
|
@ -32,7 +33,7 @@ object DatatypeConfig {
|
|||
{ _ => "sbt.internal.librarymanagement.formats.UpdateOptionsFormat" :: Nil }
|
||||
|
||||
// TODO: These are handled by BasicJsonProtocol, and sbt-datatype should handle them by default, imo
|
||||
case "Option" | "Set" => { tpe => getFormats(oneArg(tpe)) }
|
||||
case "Option" | "Set" | "scala.Vector" => { tpe => getFormats(oneArg(tpe)) }
|
||||
case "Map" | "Tuple2" | "scala.Tuple2" => { tpe => twoArgs(tpe).flatMap(getFormats) }
|
||||
case "Int" | "Long" => { _ => Nil }
|
||||
}
|
||||
|
|
@ -43,13 +44,13 @@ object DatatypeConfig {
|
|||
"sbt.librarymanagement.ExclusionRule")
|
||||
|
||||
/** Returns the list of formats required to encode the given `TpeRef`. */
|
||||
val getFormats: TpeRef => List[String] =
|
||||
val getFormats: Type => List[String] =
|
||||
CodecCodeGen.extensibleFormatsForType {
|
||||
case TpeRef("sbt.internal.librarymanagement.RetrieveConfiguration", false, false, false) =>
|
||||
case NamedType(List("sbt", "internal", "librarymanagement", "RetrieveConfiguration"), _) =>
|
||||
"sbt.librarymanagement.RetrieveConfigurationFormats" :: Nil
|
||||
case tpe @ TpeRef(name, _, _, _) if myCodecs isDefinedAt CodecCodeGen.removeTypeParameters(name) =>
|
||||
myCodecs(CodecCodeGen.removeTypeParameters(name))(tpe)
|
||||
case TpeRef(name, _, _, _) if excluded contains CodecCodeGen.removeTypeParameters(name) =>
|
||||
case tpe: Type if myCodecs isDefinedAt tpe.removeTypeParameters.name =>
|
||||
myCodecs(tpe.removeTypeParameters.name)(tpe)
|
||||
case tpe: Type if excluded contains tpe.removeTypeParameters.name =>
|
||||
Nil
|
||||
case other =>
|
||||
CodecCodeGen.formatsForType(other)
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import Keys._
|
|||
object Dependencies {
|
||||
val scala211 = "2.11.8"
|
||||
|
||||
private val ioVersion = "1.0.0-M6"
|
||||
private val utilVersion = "0.1.0-M15"
|
||||
private val ioVersion = "1.0.0-M9"
|
||||
private val utilVersion = "1.0.0-M17"
|
||||
|
||||
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ object Dependencies {
|
|||
val jsch = "com.jcraft" % "jsch" % "0.1.46" intransitive ()
|
||||
val scalaReflect = Def.setting { "org.scala-lang" % "scala-reflect" % scalaVersion.value }
|
||||
val scalaXml = scala211Module("scala-xml", "1.0.5")
|
||||
val sjsonnewVersion = "0.4.1"
|
||||
val sjsonnewVersion = "0.7.0"
|
||||
val sjsonnewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % sjsonnewVersion
|
||||
|
||||
private def scala211Module(name: String, moduleVersion: String) =
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M3")
|
||||
|
|
@ -1 +0,0 @@
|
|||
addSbtPlugin("org.scala-sbt" % "sbt-datatype" % "0.2.8")
|
||||
Loading…
Reference in New Issue