-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from sbt/topic/api
Library management API
- Loading branch information
Showing
249 changed files
with
2,696 additions
and
1,683 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) | ||
IvyDependencyResolution(ivyConfig) | ||
} | ||
lm: sbt.librarymanagement.DependencyResolution = sbt.librarymanagement.DependencyResolution@6a9b40f8 | ||
|
||
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.
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
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 + "sbt.librarymanagement.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 + "sbt.librarymanagement.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) | ||
} |
Oops, something went wrong.