-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This splits the core of LM and Ivy-based implementation. - InlineConfiguration is renamed to ModuleConfiguration - IvyScala is renamed to ScalaModuleInfo - UpdateConfiguration, RetrieveConfiguration, PublishConfiguration are refactored to use builder pattern. - Adds ConfigRef for referencing Configuration - Moves syntax related things into `sbt.librarymagement.syntax`
- Loading branch information
Showing
246 changed files
with
2,441 additions
and
1,632 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
librarymanagement module for sbt | ||
================================ | ||
|
||
``` | ||
git clone --no-hardlinks --branch 0.13 sbt sbt-modules/librarymanagement | ||
cd sbt-modules/librarymanagement | ||
git filter-branch --index-filter 'git rm --cached -qr -- . && git reset -q $GIT_COMMIT -- ivy util/cross' --prune-empty | ||
git reset --hard | ||
git gc --aggressive | ||
git prune | ||
git cb 1.0 | ||
```scala | ||
scala> import java.io.File | ||
import java.io.File | ||
|
||
scala> import sbt.librarymanagement._, syntax._ | ||
import sbt.librarymanagement._ | ||
import syntax._ | ||
|
||
scala> val log = sbt.util.LogExchange.logger("test") | ||
log: sbt.internal.util.ManagedLogger = sbt.internal.util.ManagedLogger@c439b0f | ||
|
||
scala> val lm = { | ||
import sbt.librarymanagement.ivy._ | ||
val ivyConfig = InlineIvyConfiguration().withLog(log) | ||
IvyLibraryManagement(ivyConfig) | ||
} | ||
lm: sbt.librarymanagement.LibraryManagement = sbt.librarymanagement.ivy.IvyLibraryManagement@11c07acb | ||
|
||
scala> val module = "commons-io" % "commons-io" % "2.5" | ||
module: sbt.librarymanagement.ModuleID = commons-io:commons-io:2.5 | ||
|
||
scala> lm.retrieve(module, scalaModuleInfo = None, new File("target"), log) | ||
res0: Either[sbt.librarymanagement.UnresolvedWarning,Vector[java.io.File]] = Right(Vector(target/jars/commons-io/commons-io/commons-io-2.5.jar, target/jars/commons-io/commons-io/commons-io-2.5.jar, target/jars/commons-io/commons-io/commons-io-2.5.jar)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
48 changes: 48 additions & 0 deletions
48
core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfiguration.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. | ||
*/ | ||
|
||
// DO NOT EDIT MANUALLY | ||
package sbt.librarymanagement | ||
final class GetClassifiersConfiguration private ( | ||
val module: sbt.librarymanagement.GetClassifiersModule, | ||
val excludes: Vector[scala.Tuple2[sbt.librarymanagement.ModuleID, scala.Vector[sbt.librarymanagement.ConfigRef]]], | ||
val updateConfiguration: sbt.librarymanagement.UpdateConfiguration, | ||
val sourceArtifactTypes: Vector[String], | ||
val docArtifactTypes: Vector[String]) extends Serializable { | ||
|
||
|
||
|
||
override def equals(o: Any): Boolean = o match { | ||
case x: GetClassifiersConfiguration => (this.module == x.module) && (this.excludes == x.excludes) && (this.updateConfiguration == x.updateConfiguration) && (this.sourceArtifactTypes == x.sourceArtifactTypes) && (this.docArtifactTypes == x.docArtifactTypes) | ||
case _ => false | ||
} | ||
override def hashCode: Int = { | ||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "GetClassifiersConfiguration".##) + module.##) + excludes.##) + updateConfiguration.##) + sourceArtifactTypes.##) + docArtifactTypes.##) | ||
} | ||
override def toString: String = { | ||
"GetClassifiersConfiguration(" + module + ", " + excludes + ", " + updateConfiguration + ", " + sourceArtifactTypes + ", " + docArtifactTypes + ")" | ||
} | ||
protected[this] def copy(module: sbt.librarymanagement.GetClassifiersModule = module, excludes: Vector[scala.Tuple2[sbt.librarymanagement.ModuleID, scala.Vector[sbt.librarymanagement.ConfigRef]]] = excludes, updateConfiguration: sbt.librarymanagement.UpdateConfiguration = updateConfiguration, sourceArtifactTypes: Vector[String] = sourceArtifactTypes, docArtifactTypes: Vector[String] = docArtifactTypes): GetClassifiersConfiguration = { | ||
new GetClassifiersConfiguration(module, excludes, updateConfiguration, sourceArtifactTypes, docArtifactTypes) | ||
} | ||
def withModule(module: sbt.librarymanagement.GetClassifiersModule): GetClassifiersConfiguration = { | ||
copy(module = module) | ||
} | ||
def withExcludes(excludes: Vector[scala.Tuple2[sbt.librarymanagement.ModuleID, scala.Vector[sbt.librarymanagement.ConfigRef]]]): GetClassifiersConfiguration = { | ||
copy(excludes = excludes) | ||
} | ||
def withUpdateConfiguration(updateConfiguration: sbt.librarymanagement.UpdateConfiguration): GetClassifiersConfiguration = { | ||
copy(updateConfiguration = updateConfiguration) | ||
} | ||
def withSourceArtifactTypes(sourceArtifactTypes: Vector[String]): GetClassifiersConfiguration = { | ||
copy(sourceArtifactTypes = sourceArtifactTypes) | ||
} | ||
def withDocArtifactTypes(docArtifactTypes: Vector[String]): GetClassifiersConfiguration = { | ||
copy(docArtifactTypes = docArtifactTypes) | ||
} | ||
} | ||
object GetClassifiersConfiguration { | ||
|
||
def apply(module: sbt.librarymanagement.GetClassifiersModule, excludes: Vector[scala.Tuple2[sbt.librarymanagement.ModuleID, scala.Vector[sbt.librarymanagement.ConfigRef]]], updateConfiguration: sbt.librarymanagement.UpdateConfiguration, sourceArtifactTypes: Vector[String], docArtifactTypes: Vector[String]): GetClassifiersConfiguration = new GetClassifiersConfiguration(module, excludes, updateConfiguration, sourceArtifactTypes, docArtifactTypes) | ||
} |
35 changes: 35 additions & 0 deletions
35
.../src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfigurationFormats.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. | ||
*/ | ||
|
||
// DO NOT EDIT MANUALLY | ||
package sbt.librarymanagement | ||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } | ||
trait GetClassifiersConfigurationFormats { self: sbt.librarymanagement.GetClassifiersModuleFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.UpdateConfigurationFormats with sjsonnew.BasicJsonProtocol => | ||
implicit lazy val GetClassifiersConfigurationFormat: JsonFormat[sbt.librarymanagement.GetClassifiersConfiguration] = new JsonFormat[sbt.librarymanagement.GetClassifiersConfiguration] { | ||
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.GetClassifiersConfiguration = { | ||
jsOpt match { | ||
case Some(js) => | ||
unbuilder.beginObject(js) | ||
val module = unbuilder.readField[sbt.librarymanagement.GetClassifiersModule]("module") | ||
val excludes = unbuilder.readField[Vector[scala.Tuple2[sbt.librarymanagement.ModuleID, scala.Vector[sbt.librarymanagement.ConfigRef]]]]("excludes") | ||
val updateConfiguration = unbuilder.readField[sbt.librarymanagement.UpdateConfiguration]("updateConfiguration") | ||
val sourceArtifactTypes = unbuilder.readField[Vector[String]]("sourceArtifactTypes") | ||
val docArtifactTypes = unbuilder.readField[Vector[String]]("docArtifactTypes") | ||
unbuilder.endObject() | ||
sbt.librarymanagement.GetClassifiersConfiguration(module, excludes, updateConfiguration, sourceArtifactTypes, docArtifactTypes) | ||
case None => | ||
deserializationError("Expected JsObject but found None") | ||
} | ||
} | ||
override def write[J](obj: sbt.librarymanagement.GetClassifiersConfiguration, builder: Builder[J]): Unit = { | ||
builder.beginObject() | ||
builder.addField("module", obj.module) | ||
builder.addField("excludes", obj.excludes) | ||
builder.addField("updateConfiguration", obj.updateConfiguration) | ||
builder.addField("sourceArtifactTypes", obj.sourceArtifactTypes) | ||
builder.addField("docArtifactTypes", obj.docArtifactTypes) | ||
builder.endObject() | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. | ||
*/ | ||
|
||
// DO NOT EDIT MANUALLY | ||
package sbt.librarymanagement | ||
final class GetClassifiersModule private ( | ||
val id: sbt.librarymanagement.ModuleID, | ||
val scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo], | ||
val dependencies: Vector[sbt.librarymanagement.ModuleID], | ||
val configurations: Vector[sbt.librarymanagement.Configuration], | ||
val classifiers: Vector[String]) extends Serializable { | ||
|
||
|
||
|
||
override def equals(o: Any): Boolean = o match { | ||
case x: GetClassifiersModule => (this.id == x.id) && (this.scalaModuleInfo == x.scalaModuleInfo) && (this.dependencies == x.dependencies) && (this.configurations == x.configurations) && (this.classifiers == x.classifiers) | ||
case _ => false | ||
} | ||
override def hashCode: Int = { | ||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "GetClassifiersModule".##) + id.##) + scalaModuleInfo.##) + dependencies.##) + configurations.##) + classifiers.##) | ||
} | ||
override def toString: String = { | ||
"GetClassifiersModule(" + id + ", " + scalaModuleInfo + ", " + dependencies + ", " + configurations + ", " + classifiers + ")" | ||
} | ||
protected[this] def copy(id: sbt.librarymanagement.ModuleID = id, scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo] = scalaModuleInfo, dependencies: Vector[sbt.librarymanagement.ModuleID] = dependencies, configurations: Vector[sbt.librarymanagement.Configuration] = configurations, classifiers: Vector[String] = classifiers): GetClassifiersModule = { | ||
new GetClassifiersModule(id, scalaModuleInfo, dependencies, configurations, classifiers) | ||
} | ||
def withId(id: sbt.librarymanagement.ModuleID): GetClassifiersModule = { | ||
copy(id = id) | ||
} | ||
def withScalaModuleInfo(scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo]): GetClassifiersModule = { | ||
copy(scalaModuleInfo = scalaModuleInfo) | ||
} | ||
def withScalaModuleInfo(scalaModuleInfo: sbt.librarymanagement.ScalaModuleInfo): GetClassifiersModule = { | ||
copy(scalaModuleInfo = Option(scalaModuleInfo)) | ||
} | ||
def withDependencies(dependencies: Vector[sbt.librarymanagement.ModuleID]): GetClassifiersModule = { | ||
copy(dependencies = dependencies) | ||
} | ||
def withConfigurations(configurations: Vector[sbt.librarymanagement.Configuration]): GetClassifiersModule = { | ||
copy(configurations = configurations) | ||
} | ||
def withClassifiers(classifiers: Vector[String]): GetClassifiersModule = { | ||
copy(classifiers = classifiers) | ||
} | ||
} | ||
object GetClassifiersModule { | ||
|
||
def apply(id: sbt.librarymanagement.ModuleID, scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo], dependencies: Vector[sbt.librarymanagement.ModuleID], configurations: Vector[sbt.librarymanagement.Configuration], classifiers: Vector[String]): GetClassifiersModule = new GetClassifiersModule(id, scalaModuleInfo, dependencies, configurations, classifiers) | ||
def apply(id: sbt.librarymanagement.ModuleID, scalaModuleInfo: sbt.librarymanagement.ScalaModuleInfo, dependencies: Vector[sbt.librarymanagement.ModuleID], configurations: Vector[sbt.librarymanagement.Configuration], classifiers: Vector[String]): GetClassifiersModule = new GetClassifiersModule(id, Option(scalaModuleInfo), dependencies, configurations, classifiers) | ||
} |
35 changes: 35 additions & 0 deletions
35
core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModuleFormats.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. | ||
*/ | ||
|
||
// DO NOT EDIT MANUALLY | ||
package sbt.librarymanagement | ||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } | ||
trait GetClassifiersModuleFormats { self: sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ScalaModuleInfoFormats with sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol => | ||
implicit lazy val GetClassifiersModuleFormat: JsonFormat[sbt.librarymanagement.GetClassifiersModule] = new JsonFormat[sbt.librarymanagement.GetClassifiersModule] { | ||
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.GetClassifiersModule = { | ||
jsOpt match { | ||
case Some(js) => | ||
unbuilder.beginObject(js) | ||
val id = unbuilder.readField[sbt.librarymanagement.ModuleID]("id") | ||
val scalaModuleInfo = unbuilder.readField[Option[sbt.librarymanagement.ScalaModuleInfo]]("scalaModuleInfo") | ||
val dependencies = unbuilder.readField[Vector[sbt.librarymanagement.ModuleID]]("dependencies") | ||
val configurations = unbuilder.readField[Vector[sbt.librarymanagement.Configuration]]("configurations") | ||
val classifiers = unbuilder.readField[Vector[String]]("classifiers") | ||
unbuilder.endObject() | ||
sbt.librarymanagement.GetClassifiersModule(id, scalaModuleInfo, dependencies, configurations, classifiers) | ||
case None => | ||
deserializationError("Expected JsObject but found None") | ||
} | ||
} | ||
override def write[J](obj: sbt.librarymanagement.GetClassifiersModule, builder: Builder[J]): Unit = { | ||
builder.beginObject() | ||
builder.addField("id", obj.id) | ||
builder.addField("scalaModuleInfo", obj.scalaModuleInfo) | ||
builder.addField("dependencies", obj.dependencies) | ||
builder.addField("configurations", obj.configurations) | ||
builder.addField("classifiers", obj.classifiers) | ||
builder.endObject() | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
49 changes: 49 additions & 0 deletions
49
core/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfiguration.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. | ||
*/ | ||
|
||
// DO NOT EDIT MANUALLY | ||
package sbt.librarymanagement | ||
final class IvyFileConfiguration private ( | ||
validate: Boolean, | ||
scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo], | ||
val file: java.io.File, | ||
val autoScalaTools: Boolean) extends sbt.librarymanagement.ModuleSettings(validate, scalaModuleInfo) with Serializable { | ||
|
||
private def this(file: java.io.File, autoScalaTools: Boolean) = this(false, None, file, autoScalaTools) | ||
|
||
override def equals(o: Any): Boolean = o match { | ||
case x: IvyFileConfiguration => (this.validate == x.validate) && (this.scalaModuleInfo == x.scalaModuleInfo) && (this.file == x.file) && (this.autoScalaTools == x.autoScalaTools) | ||
case _ => false | ||
} | ||
override def hashCode: Int = { | ||
37 * (37 * (37 * (37 * (37 * (17 + "IvyFileConfiguration".##) + validate.##) + scalaModuleInfo.##) + file.##) + autoScalaTools.##) | ||
} | ||
override def toString: String = { | ||
"IvyFileConfiguration(" + validate + ", " + scalaModuleInfo + ", " + file + ", " + autoScalaTools + ")" | ||
} | ||
protected[this] def copy(validate: Boolean = validate, scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo] = scalaModuleInfo, file: java.io.File = file, autoScalaTools: Boolean = autoScalaTools): IvyFileConfiguration = { | ||
new IvyFileConfiguration(validate, scalaModuleInfo, file, autoScalaTools) | ||
} | ||
def withValidate(validate: Boolean): IvyFileConfiguration = { | ||
copy(validate = validate) | ||
} | ||
def withScalaModuleInfo(scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo]): IvyFileConfiguration = { | ||
copy(scalaModuleInfo = scalaModuleInfo) | ||
} | ||
def withScalaModuleInfo(scalaModuleInfo: sbt.librarymanagement.ScalaModuleInfo): IvyFileConfiguration = { | ||
copy(scalaModuleInfo = Option(scalaModuleInfo)) | ||
} | ||
def withFile(file: java.io.File): IvyFileConfiguration = { | ||
copy(file = file) | ||
} | ||
def withAutoScalaTools(autoScalaTools: Boolean): IvyFileConfiguration = { | ||
copy(autoScalaTools = autoScalaTools) | ||
} | ||
} | ||
object IvyFileConfiguration { | ||
|
||
def apply(file: java.io.File, autoScalaTools: Boolean): IvyFileConfiguration = new IvyFileConfiguration(false, None, file, autoScalaTools) | ||
def apply(validate: Boolean, scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo], file: java.io.File, autoScalaTools: Boolean): IvyFileConfiguration = new IvyFileConfiguration(validate, scalaModuleInfo, file, autoScalaTools) | ||
def apply(validate: Boolean, scalaModuleInfo: sbt.librarymanagement.ScalaModuleInfo, file: java.io.File, autoScalaTools: Boolean): IvyFileConfiguration = new IvyFileConfiguration(validate, Option(scalaModuleInfo), file, autoScalaTools) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.