diff --git a/README.md b/README.md index a265c06e..f8a08933 100644 --- a/README.md +++ b/README.md @@ -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)) ``` diff --git a/build.sbt b/build.sbt index 890d24ff..9fbe4fa0 100644 --- a/build.sbt +++ b/build.sbt @@ -31,7 +31,7 @@ def commonSettings: Seq[Setting[_]] = Seq( ) lazy val lmRoot = (project in file(".")) - .aggregate(lm) + .aggregate(lmCore, lmIvy) .settings( inThisBuild( Seq( @@ -60,12 +60,12 @@ lazy val lmRoot = (project in file(".")) customCommands ) -lazy val lm = (project in file("librarymanagement")) +lazy val lmCore = (project in file("core")) + .enablePlugins(ContrabandPlugin, JsonCodecPlugin) .settings( commonSettings, - name := "librarymanagement", - libraryDependencies ++= Seq(ivy, - jsch, + name := "librarymanagement-core", + libraryDependencies ++= Seq(jsch, scalaReflect.value, scalaCompiler.value, launcherInterface, @@ -94,7 +94,20 @@ lazy val lm = (project in file("librarymanagement")) } ) .configure(addSbtIO, addSbtUtilLogging, addSbtUtilPosition, addSbtUtilCache) + +lazy val lmIvy = (project in file("ivy")) .enablePlugins(ContrabandPlugin, JsonCodecPlugin) + .dependsOn(lmCore) + .settings( + commonSettings, + name := "librarymanagement-ivy", + libraryDependencies ++= Seq(ivy, scalaTest, scalaCheck), + managedSourceDirectories in Compile += + baseDirectory.value / "src" / "main" / "contraband-scala", + sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala", + contrabandFormatsForType in generateContrabands in Compile := DatatypeConfig.getFormats, + scalacOptions in (Compile, console) --= Vector("-Ywarn-unused-import", "-Ywarn-unused", "-Xlint"), + ) def customCommands: Seq[Setting[_]] = Seq( commands += Command.command("release") { state => diff --git a/librarymanagement/NOTICE b/core/NOTICE similarity index 100% rename from librarymanagement/NOTICE rename to core/NOTICE diff --git a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/ConfigurationReportLite.scala b/core/src/main/contraband-scala/sbt/internal/librarymanagement/ConfigurationReportLite.scala similarity index 91% rename from librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/ConfigurationReportLite.scala rename to core/src/main/contraband-scala/sbt/internal/librarymanagement/ConfigurationReportLite.scala index f63313b9..7570d335 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/ConfigurationReportLite.scala +++ b/core/src/main/contraband-scala/sbt/internal/librarymanagement/ConfigurationReportLite.scala @@ -15,7 +15,7 @@ final class ConfigurationReportLite private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "ConfigurationReportLite".##) + configuration.##) + details.##) + 37 * (37 * (37 * (17 + "sbt.internal.librarymanagement.ConfigurationReportLite".##) + configuration.##) + details.##) } override def toString: String = { "ConfigurationReportLite(" + configuration + ", " + details + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/UpdateReportLite.scala b/core/src/main/contraband-scala/sbt/internal/librarymanagement/UpdateReportLite.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/UpdateReportLite.scala rename to core/src/main/contraband-scala/sbt/internal/librarymanagement/UpdateReportLite.scala index 4d927be0..350fff04 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/UpdateReportLite.scala +++ b/core/src/main/contraband-scala/sbt/internal/librarymanagement/UpdateReportLite.scala @@ -14,7 +14,7 @@ final class UpdateReportLite private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (17 + "UpdateReportLite".##) + configurations.##) + 37 * (37 * (17 + "sbt.internal.librarymanagement.UpdateReportLite".##) + configurations.##) } override def toString: String = { "UpdateReportLite(" + configurations + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Artifact.scala b/core/src/main/contraband-scala/sbt/librarymanagement/Artifact.scala similarity index 95% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Artifact.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/Artifact.scala index df5d51f0..a676be24 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Artifact.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/Artifact.scala @@ -21,7 +21,7 @@ final class Artifact private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "Artifact".##) + name.##) + `type`.##) + extension.##) + classifier.##) + configurations.##) + url.##) + extraAttributes.##) + checksum.##) + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.Artifact".##) + name.##) + `type`.##) + extension.##) + classifier.##) + configurations.##) + url.##) + extraAttributes.##) + checksum.##) } override def toString: String = { "Artifact(" + name + ", " + `type` + ", " + extension + ", " + classifier + ", " + configurations + ", " + url + ", " + extraAttributes + ", " + checksum + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ArtifactFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ArtifactFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ArtifactFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ArtifactFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ArtifactTypeFilter.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ArtifactTypeFilter.scala similarity index 94% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ArtifactTypeFilter.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ArtifactTypeFilter.scala index 9b64bf71..3086e498 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ArtifactTypeFilter.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ArtifactTypeFilter.scala @@ -22,7 +22,7 @@ final class ArtifactTypeFilter private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "ArtifactTypeFilter".##) + types.##) + inverted.##) + 37 * (37 * (37 * (17 + "sbt.librarymanagement.ArtifactTypeFilter".##) + types.##) + inverted.##) } override def toString: String = { "ArtifactTypeFilter(" + types + ", " + inverted + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ArtifactTypeFilterFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ArtifactTypeFilterFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ArtifactTypeFilterFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ArtifactTypeFilterFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Binary.scala b/core/src/main/contraband-scala/sbt/librarymanagement/Binary.scala similarity index 93% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Binary.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/Binary.scala index 323002dd..f06902d2 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Binary.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/Binary.scala @@ -21,7 +21,7 @@ final class Binary private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "Binary".##) + prefix.##) + suffix.##) + 37 * (37 * (37 * (17 + "sbt.librarymanagement.Binary".##) + prefix.##) + suffix.##) } override def toString: String = { "Binary(" + prefix + ", " + suffix + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/BinaryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/BinaryFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/BinaryFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/BinaryFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Caller.scala b/core/src/main/contraband-scala/sbt/librarymanagement/Caller.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Caller.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/Caller.scala index 3cfd9290..cbf57fa1 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Caller.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/Caller.scala @@ -20,7 +20,7 @@ final class Caller private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "Caller".##) + caller.##) + callerConfigurations.##) + callerExtraAttributes.##) + isForceDependency.##) + isChangingDependency.##) + isTransitiveDependency.##) + isDirectlyForceDependency.##) + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.Caller".##) + caller.##) + callerConfigurations.##) + callerExtraAttributes.##) + isForceDependency.##) + isChangingDependency.##) + isTransitiveDependency.##) + isDirectlyForceDependency.##) } override def toString: String = { s"$caller" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/CallerFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/CallerFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/CallerFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/CallerFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ChainedResolver.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ChainedResolver.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ChainedResolver.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ChainedResolver.scala index 75978cc0..19215a7c 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ChainedResolver.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ChainedResolver.scala @@ -15,7 +15,7 @@ final class ChainedResolver private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "ChainedResolver".##) + name.##) + resolvers.##) + 37 * (37 * (37 * (17 + "sbt.librarymanagement.ChainedResolver".##) + name.##) + resolvers.##) } override def toString: String = { "ChainedResolver(" + name + ", " + resolvers + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ChainedResolverFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ChainedResolverFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ChainedResolverFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ChainedResolverFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Checksum.scala b/core/src/main/contraband-scala/sbt/librarymanagement/Checksum.scala similarity index 91% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Checksum.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/Checksum.scala index dd2db590..2a699be3 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Checksum.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/Checksum.scala @@ -15,7 +15,7 @@ final class Checksum private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "Checksum".##) + digest.##) + `type`.##) + 37 * (37 * (37 * (17 + "sbt.librarymanagement.Checksum".##) + digest.##) + `type`.##) } override def toString: String = { "Checksum(" + digest + ", " + `type` + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ChecksumFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ChecksumFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ChecksumFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ChecksumFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigRef.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ConfigRef.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigRef.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ConfigRef.scala index 2fd00af2..78e47af4 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigRef.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ConfigRef.scala @@ -16,7 +16,7 @@ final class ConfigRef private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (17 + "ConfigRef".##) + name.##) + 37 * (37 * (17 + "sbt.librarymanagement.ConfigRef".##) + name.##) } override def toString: String = { name diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigRefFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ConfigRefFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigRefFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ConfigRefFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReport.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReport.scala similarity index 94% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReport.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReport.scala index 5929ae95..a11155f7 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReport.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReport.scala @@ -20,7 +20,7 @@ final class ConfigurationReport private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (17 + "ConfigurationReport".##) + configuration.##) + modules.##) + details.##) + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ConfigurationReport".##) + configuration.##) + modules.##) + details.##) } override def toString: String = { s"\t$configuration:\n" + diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportLiteFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportLiteFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportLiteFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportLiteFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConflictManager.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ConflictManager.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConflictManager.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ConflictManager.scala index 84cfeefa..d7adb882 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConflictManager.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ConflictManager.scala @@ -17,7 +17,7 @@ final class ConflictManager private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (17 + "ConflictManager".##) + name.##) + organization.##) + module.##) + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ConflictManager".##) + name.##) + organization.##) + module.##) } override def toString: String = { "ConflictManager(" + name + ", " + organization + ", " + module + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConflictManagerFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ConflictManagerFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConflictManagerFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ConflictManagerFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Constant.scala b/core/src/main/contraband-scala/sbt/librarymanagement/Constant.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Constant.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/Constant.scala index bca95bb2..25ca45c3 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Constant.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/Constant.scala @@ -15,7 +15,7 @@ final class Constant private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (17 + "Constant".##) + value.##) + 37 * (37 * (17 + "sbt.librarymanagement.Constant".##) + value.##) } override def toString: String = { "Constant(" + value + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConstantFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ConstantFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConstantFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ConstantFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/CrossVersion.scala b/core/src/main/contraband-scala/sbt/librarymanagement/CrossVersion.scala similarity index 90% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/CrossVersion.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/CrossVersion.scala index c1f65822..321be761 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/CrossVersion.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/CrossVersion.scala @@ -15,7 +15,7 @@ override def equals(o: Any): Boolean = o match { case _ => false } override def hashCode: Int = { - 37 * (17 + "CrossVersion".##) + 37 * (17 + "sbt.librarymanagement.CrossVersion".##) } override def toString: String = { "CrossVersion()" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/CrossVersionFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/CrossVersionFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/CrossVersionFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/CrossVersionFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Developer.scala b/core/src/main/contraband-scala/sbt/librarymanagement/Developer.scala similarity index 91% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Developer.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/Developer.scala index 0689fccf..d1c69eec 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Developer.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/Developer.scala @@ -17,7 +17,7 @@ final class Developer private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (17 + "Developer".##) + id.##) + name.##) + email.##) + url.##) + 37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.Developer".##) + id.##) + name.##) + email.##) + url.##) } override def toString: String = { "Developer(" + id + ", " + name + ", " + email + ", " + url + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/DeveloperFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/DeveloperFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/DeveloperFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/DeveloperFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Disabled.scala b/core/src/main/contraband-scala/sbt/librarymanagement/Disabled.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Disabled.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/Disabled.scala index c1f3339d..1c03d422 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Disabled.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/Disabled.scala @@ -14,7 +14,7 @@ override def equals(o: Any): Boolean = o match { case _ => false } override def hashCode: Int = { - 37 * (17 + "Disabled".##) + 37 * (17 + "sbt.librarymanagement.Disabled".##) } override def toString: String = { "Disabled()" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/DisabledFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/DisabledFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/DisabledFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/DisabledFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FileConfiguration.scala b/core/src/main/contraband-scala/sbt/librarymanagement/FileConfiguration.scala similarity index 93% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FileConfiguration.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/FileConfiguration.scala index c74be319..4787d4bf 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FileConfiguration.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/FileConfiguration.scala @@ -16,7 +16,7 @@ final class FileConfiguration private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "FileConfiguration".##) + isLocal.##) + isTransactional.##) + 37 * (37 * (37 * (17 + "sbt.librarymanagement.FileConfiguration".##) + isLocal.##) + isTransactional.##) } override def toString: String = { "FileConfiguration(" + isLocal + ", " + isTransactional + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FileConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/FileConfigurationFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FileConfigurationFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/FileConfigurationFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FileRepository.scala b/core/src/main/contraband-scala/sbt/librarymanagement/FileRepository.scala similarity index 94% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FileRepository.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/FileRepository.scala index 77d2d306..8bbf9f97 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FileRepository.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/FileRepository.scala @@ -18,7 +18,7 @@ final class FileRepository private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (17 + "FileRepository".##) + name.##) + patterns.##) + configuration.##) + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.FileRepository".##) + name.##) + patterns.##) + configuration.##) } override def toString: String = { "FileRepository(" + name + ", " + patterns + ", " + configuration + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FileRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/FileRepositoryFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FileRepositoryFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/FileRepositoryFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Full.scala b/core/src/main/contraband-scala/sbt/librarymanagement/Full.scala similarity index 93% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Full.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/Full.scala index 3ad99a43..c51ccd0d 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Full.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/Full.scala @@ -21,7 +21,7 @@ final class Full private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "Full".##) + prefix.##) + suffix.##) + 37 * (37 * (37 * (17 + "sbt.librarymanagement.Full".##) + prefix.##) + suffix.##) } override def toString: String = { "Full(" + prefix + ", " + suffix + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FullFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/FullFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/FullFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/FullFormats.scala diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfiguration.scala b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfiguration.scala new file mode 100644 index 00000000..200aa87f --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfiguration.scala @@ -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) +} diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfigurationFormats.scala new file mode 100644 index 00000000..f93af3a8 --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfigurationFormats.scala @@ -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() + } +} +} diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModule.scala b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModule.scala new file mode 100644 index 00000000..147ba44a --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModule.scala @@ -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) +} diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModuleFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModuleFormats.scala new file mode 100644 index 00000000..8bedbe9a --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModuleFormats.scala @@ -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() + } +} +} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/InclExclRule.scala b/core/src/main/contraband-scala/sbt/librarymanagement/InclExclRule.scala similarity index 94% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/InclExclRule.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/InclExclRule.scala index dde013ed..e93c8ac2 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/InclExclRule.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/InclExclRule.scala @@ -27,7 +27,7 @@ final class InclExclRule private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (17 + "InclExclRule".##) + organization.##) + name.##) + artifact.##) + configurations.##) + crossVersion.##) + 37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.InclExclRule".##) + organization.##) + name.##) + artifact.##) + configurations.##) + crossVersion.##) } override def toString: String = { "InclExclRule(" + organization + ", " + name + ", " + artifact + ", " + configurations + ", " + crossVersion + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/InclExclRuleFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/InclExclRuleFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/InclExclRuleFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/InclExclRuleFormats.scala diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfiguration.scala b/core/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfiguration.scala new file mode 100644 index 00000000..cd0a38af --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfiguration.scala @@ -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 + "sbt.librarymanagement.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) +} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfigurationFormats.scala similarity index 79% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfigurationFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfigurationFormats.scala index c675f442..1747cef6 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfigurationFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfigurationFormats.scala @@ -5,18 +5,18 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait IvyFileConfigurationFormats { self: sbt.librarymanagement.IvyScalaFormats with sjsonnew.BasicJsonProtocol => +trait IvyFileConfigurationFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sjsonnew.BasicJsonProtocol => implicit lazy val IvyFileConfigurationFormat: JsonFormat[sbt.librarymanagement.IvyFileConfiguration] = new JsonFormat[sbt.librarymanagement.IvyFileConfiguration] { override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.IvyFileConfiguration = { jsOpt match { case Some(js) => unbuilder.beginObject(js) val validate = unbuilder.readField[Boolean]("validate") - val ivyScala = unbuilder.readField[Option[sbt.librarymanagement.IvyScala]]("ivyScala") + val scalaModuleInfo = unbuilder.readField[Option[sbt.librarymanagement.ScalaModuleInfo]]("scalaModuleInfo") val file = unbuilder.readField[java.io.File]("file") val autoScalaTools = unbuilder.readField[Boolean]("autoScalaTools") unbuilder.endObject() - sbt.librarymanagement.IvyFileConfiguration(validate, ivyScala, file, autoScalaTools) + sbt.librarymanagement.IvyFileConfiguration(validate, scalaModuleInfo, file, autoScalaTools) case None => deserializationError("Expected JsObject but found None") } @@ -24,7 +24,7 @@ implicit lazy val IvyFileConfigurationFormat: JsonFormat[sbt.librarymanagement.I override def write[J](obj: sbt.librarymanagement.IvyFileConfiguration, builder: Builder[J]): Unit = { builder.beginObject() builder.addField("validate", obj.validate) - builder.addField("ivyScala", obj.ivyScala) + builder.addField("scalaModuleInfo", obj.scalaModuleInfo) builder.addField("file", obj.file) builder.addField("autoScalaTools", obj.autoScalaTools) builder.endObject() diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/KeyFileAuthentication.scala b/core/src/main/contraband-scala/sbt/librarymanagement/KeyFileAuthentication.scala similarity index 93% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/KeyFileAuthentication.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/KeyFileAuthentication.scala index 33742d37..e696a61d 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/KeyFileAuthentication.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/KeyFileAuthentication.scala @@ -16,7 +16,7 @@ final class KeyFileAuthentication private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (17 + "KeyFileAuthentication".##) + user.##) + keyfile.##) + password.##) + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.KeyFileAuthentication".##) + user.##) + keyfile.##) + password.##) } override def toString: String = { "KeyFileAuthentication(" + user + ", " + keyfile + ", " + password + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/KeyFileAuthenticationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/KeyFileAuthenticationFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/KeyFileAuthenticationFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/KeyFileAuthenticationFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/LibraryManagementCodec.scala b/core/src/main/contraband-scala/sbt/librarymanagement/LibraryManagementCodec.scala similarity index 84% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/LibraryManagementCodec.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/LibraryManagementCodec.scala index 08e493b4..493571ed 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/LibraryManagementCodec.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/LibraryManagementCodec.scala @@ -6,9 +6,13 @@ package sbt.librarymanagement trait LibraryManagementCodec extends sjsonnew.BasicJsonProtocol with sbt.librarymanagement.ConfigRefFormats + with sbt.librarymanagement.RetrieveConfigurationFormats + with sbt.librarymanagement.UpdateLoggingFormats + with sbt.internal.librarymanagement.formats.LogicalClockFormats + with sbt.librarymanagement.ArtifactTypeFilterFormats + with sbt.librarymanagement.UpdateConfigurationFormats with sbt.librarymanagement.ChecksumFormats with sbt.librarymanagement.ArtifactFormats - with sbt.librarymanagement.ArtifactTypeFilterFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats @@ -17,6 +21,11 @@ trait LibraryManagementCodec extends sjsonnew.BasicJsonProtocol with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.ModuleIDFormats + with sbt.librarymanagement.ConfigurationFormats + with sbt.librarymanagement.ScalaModuleInfoFormats + with sbt.librarymanagement.GetClassifiersModuleFormats + with sbt.librarymanagement.GetClassifiersConfigurationFormats + with sbt.librarymanagement.PublishConfigurationFormats with sbt.librarymanagement.CallerFormats with sbt.librarymanagement.ModuleReportFormats with sbt.librarymanagement.OrganizationArtifactReportFormats @@ -24,8 +33,6 @@ trait LibraryManagementCodec extends sjsonnew.BasicJsonProtocol with sbt.librarymanagement.ConflictManagerFormats with sbt.librarymanagement.DeveloperFormats with sbt.librarymanagement.FileConfigurationFormats - with sbt.librarymanagement.ConfigurationFormats - with sbt.librarymanagement.IvyScalaFormats with sbt.librarymanagement.ChainedResolverFormats with sbt.librarymanagement.MavenRepoFormats with sbt.librarymanagement.MavenCacheFormats @@ -45,23 +52,13 @@ trait LibraryManagementCodec extends sjsonnew.BasicJsonProtocol with sbt.librarymanagement.IvyFileConfigurationFormats with sbt.librarymanagement.PomConfigurationFormats with sbt.internal.librarymanagement.formats.NodeSeqFormat - with sbt.librarymanagement.InlineConfigurationFormats + with sbt.librarymanagement.ModuleDescriptorConfigurationFormats with sbt.librarymanagement.ModuleSettingsFormats with sbt.librarymanagement.MavenRepositoryFormats with sbt.librarymanagement.PatternsBasedRepositoryFormats with sbt.librarymanagement.SshBasedRepositoryFormats - with sbt.librarymanagement.RetrieveConfigurationFormats - with sbt.librarymanagement.UpdateLoggingFormats - with sbt.librarymanagement.UpdateConfigurationFormats with sbt.librarymanagement.UpdateStatsFormats with sbt.librarymanagement.UpdateReportFormats with sbt.librarymanagement.ConfigurationReportLiteFormats - with sbt.internal.librarymanagement.formats.GlobalLockFormat - with sbt.internal.librarymanagement.formats.LoggerFormat - with sbt.internal.librarymanagement.formats.UpdateOptionsFormat - with sbt.librarymanagement.IvyPathsFormats - with sbt.librarymanagement.InlineIvyConfigurationFormats - with sbt.librarymanagement.ExternalIvyConfigurationFormats - with sbt.librarymanagement.IvyConfigurationFormats with sbt.librarymanagement.UpdateReportLiteFormats object LibraryManagementCodec extends LibraryManagementCodec \ No newline at end of file diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenCache.scala b/core/src/main/contraband-scala/sbt/librarymanagement/MavenCache.scala similarity index 93% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenCache.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/MavenCache.scala index 5ecbb917..a99bb5da 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenCache.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/MavenCache.scala @@ -22,7 +22,7 @@ final class MavenCache private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (17 + "MavenCache".##) + name.##) + root.##) + localIfFile.##) + rootFile.##) + 37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.MavenCache".##) + name.##) + root.##) + localIfFile.##) + rootFile.##) } override def toString: String = { s"cache:$name: ${rootFile.getAbsolutePath}" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenCacheFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/MavenCacheFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenCacheFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/MavenCacheFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenRepo.scala b/core/src/main/contraband-scala/sbt/librarymanagement/MavenRepo.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenRepo.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/MavenRepo.scala index 1374e2d0..f964670f 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenRepo.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/MavenRepo.scala @@ -16,7 +16,7 @@ final class MavenRepo private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (17 + "MavenRepo".##) + name.##) + root.##) + localIfFile.##) + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.MavenRepo".##) + name.##) + root.##) + localIfFile.##) } override def toString: String = { s"$name: $root" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenRepoFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/MavenRepoFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenRepoFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/MavenRepoFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenRepository.scala b/core/src/main/contraband-scala/sbt/librarymanagement/MavenRepository.scala similarity index 88% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenRepository.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/MavenRepository.scala index b3487a7d..f1bbb608 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenRepository.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/MavenRepository.scala @@ -18,7 +18,7 @@ abstract class MavenRepository( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (17 + "MavenRepository".##) + name.##) + root.##) + localIfFile.##) + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.MavenRepository".##) + name.##) + root.##) + localIfFile.##) } override def toString: String = { "MavenRepository(" + name + ", " + root + ", " + localIfFile + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/MavenRepositoryFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/MavenRepositoryFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/MavenRepositoryFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleConfiguration.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleConfiguration.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleConfiguration.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ModuleConfiguration.scala index 7198727a..38accc41 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleConfiguration.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleConfiguration.scala @@ -17,7 +17,7 @@ final class ModuleConfiguration private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (17 + "ModuleConfiguration".##) + organization.##) + name.##) + revision.##) + resolver.##) + 37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ModuleConfiguration".##) + organization.##) + name.##) + revision.##) + resolver.##) } override def toString: String = { "ModuleConfiguration(" + organization + ", " + name + ", " + revision + ", " + resolver + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleConfigurationFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleConfigurationFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ModuleConfigurationFormats.scala diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/ModuleDescriptorConfiguration.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleDescriptorConfiguration.scala new file mode 100644 index 00000000..92c7a3a9 --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleDescriptorConfiguration.scala @@ -0,0 +1,80 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package sbt.librarymanagement +final class ModuleDescriptorConfiguration private ( + validate: Boolean, + scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo], + val module: sbt.librarymanagement.ModuleID, + val moduleInfo: sbt.librarymanagement.ModuleInfo, + val dependencies: Vector[sbt.librarymanagement.ModuleID], + val overrides: Vector[sbt.librarymanagement.ModuleID], + val excludes: Vector[sbt.librarymanagement.InclExclRule], + val ivyXML: scala.xml.NodeSeq, + val configurations: Vector[sbt.librarymanagement.Configuration], + val defaultConfiguration: Option[sbt.librarymanagement.Configuration], + val conflictManager: sbt.librarymanagement.ConflictManager) extends sbt.librarymanagement.ModuleSettings(validate, scalaModuleInfo) with Serializable { + + private def this(module: sbt.librarymanagement.ModuleID, moduleInfo: sbt.librarymanagement.ModuleInfo) = this(false, None, module, moduleInfo, Vector.empty, Vector.empty, Vector.empty, scala.xml.NodeSeq.Empty, sbt.librarymanagement.Configurations.default, Option(sbt.librarymanagement.Configurations.Compile), sbt.librarymanagement.ConflictManager.default) + + override def equals(o: Any): Boolean = o match { + case x: ModuleDescriptorConfiguration => (this.validate == x.validate) && (this.scalaModuleInfo == x.scalaModuleInfo) && (this.module == x.module) && (this.moduleInfo == x.moduleInfo) && (this.dependencies == x.dependencies) && (this.overrides == x.overrides) && (this.excludes == x.excludes) && (this.ivyXML == x.ivyXML) && (this.configurations == x.configurations) && (this.defaultConfiguration == x.defaultConfiguration) && (this.conflictManager == x.conflictManager) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ModuleDescriptorConfiguration".##) + validate.##) + scalaModuleInfo.##) + module.##) + moduleInfo.##) + dependencies.##) + overrides.##) + excludes.##) + ivyXML.##) + configurations.##) + defaultConfiguration.##) + conflictManager.##) + } + override def toString: String = { + "ModuleDescriptorConfiguration(" + validate + ", " + scalaModuleInfo + ", " + module + ", " + moduleInfo + ", " + dependencies + ", " + overrides + ", " + excludes + ", " + ivyXML + ", " + configurations + ", " + defaultConfiguration + ", " + conflictManager + ")" + } + protected[this] def copy(validate: Boolean = validate, scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo] = scalaModuleInfo, module: sbt.librarymanagement.ModuleID = module, moduleInfo: sbt.librarymanagement.ModuleInfo = moduleInfo, dependencies: Vector[sbt.librarymanagement.ModuleID] = dependencies, overrides: Vector[sbt.librarymanagement.ModuleID] = overrides, excludes: Vector[sbt.librarymanagement.InclExclRule] = excludes, ivyXML: scala.xml.NodeSeq = ivyXML, configurations: Vector[sbt.librarymanagement.Configuration] = configurations, defaultConfiguration: Option[sbt.librarymanagement.Configuration] = defaultConfiguration, conflictManager: sbt.librarymanagement.ConflictManager = conflictManager): ModuleDescriptorConfiguration = { + new ModuleDescriptorConfiguration(validate, scalaModuleInfo, module, moduleInfo, dependencies, overrides, excludes, ivyXML, configurations, defaultConfiguration, conflictManager) + } + def withValidate(validate: Boolean): ModuleDescriptorConfiguration = { + copy(validate = validate) + } + def withScalaModuleInfo(scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo]): ModuleDescriptorConfiguration = { + copy(scalaModuleInfo = scalaModuleInfo) + } + def withScalaModuleInfo(scalaModuleInfo: sbt.librarymanagement.ScalaModuleInfo): ModuleDescriptorConfiguration = { + copy(scalaModuleInfo = Option(scalaModuleInfo)) + } + def withModule(module: sbt.librarymanagement.ModuleID): ModuleDescriptorConfiguration = { + copy(module = module) + } + def withModuleInfo(moduleInfo: sbt.librarymanagement.ModuleInfo): ModuleDescriptorConfiguration = { + copy(moduleInfo = moduleInfo) + } + def withDependencies(dependencies: Vector[sbt.librarymanagement.ModuleID]): ModuleDescriptorConfiguration = { + copy(dependencies = dependencies) + } + def withOverrides(overrides: Vector[sbt.librarymanagement.ModuleID]): ModuleDescriptorConfiguration = { + copy(overrides = overrides) + } + def withExcludes(excludes: Vector[sbt.librarymanagement.InclExclRule]): ModuleDescriptorConfiguration = { + copy(excludes = excludes) + } + def withIvyXML(ivyXML: scala.xml.NodeSeq): ModuleDescriptorConfiguration = { + copy(ivyXML = ivyXML) + } + def withConfigurations(configurations: Vector[sbt.librarymanagement.Configuration]): ModuleDescriptorConfiguration = { + copy(configurations = configurations) + } + def withDefaultConfiguration(defaultConfiguration: Option[sbt.librarymanagement.Configuration]): ModuleDescriptorConfiguration = { + copy(defaultConfiguration = defaultConfiguration) + } + def withDefaultConfiguration(defaultConfiguration: sbt.librarymanagement.Configuration): ModuleDescriptorConfiguration = { + copy(defaultConfiguration = Option(defaultConfiguration)) + } + def withConflictManager(conflictManager: sbt.librarymanagement.ConflictManager): ModuleDescriptorConfiguration = { + copy(conflictManager = conflictManager) + } +} +object ModuleDescriptorConfiguration extends sbt.internal.librarymanagement.InlineConfigurationFunctions { + + def apply(module: sbt.librarymanagement.ModuleID, moduleInfo: sbt.librarymanagement.ModuleInfo): ModuleDescriptorConfiguration = new ModuleDescriptorConfiguration(false, None, module, moduleInfo, Vector.empty, Vector.empty, Vector.empty, scala.xml.NodeSeq.Empty, sbt.librarymanagement.Configurations.default, Option(sbt.librarymanagement.Configurations.Compile), sbt.librarymanagement.ConflictManager.default) + def apply(validate: Boolean, scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo], module: sbt.librarymanagement.ModuleID, moduleInfo: sbt.librarymanagement.ModuleInfo, dependencies: Vector[sbt.librarymanagement.ModuleID], overrides: Vector[sbt.librarymanagement.ModuleID], excludes: Vector[sbt.librarymanagement.InclExclRule], ivyXML: scala.xml.NodeSeq, configurations: Vector[sbt.librarymanagement.Configuration], defaultConfiguration: Option[sbt.librarymanagement.Configuration], conflictManager: sbt.librarymanagement.ConflictManager): ModuleDescriptorConfiguration = new ModuleDescriptorConfiguration(validate, scalaModuleInfo, module, moduleInfo, dependencies, overrides, excludes, ivyXML, configurations, defaultConfiguration, conflictManager) + def apply(validate: Boolean, scalaModuleInfo: sbt.librarymanagement.ScalaModuleInfo, module: sbt.librarymanagement.ModuleID, moduleInfo: sbt.librarymanagement.ModuleInfo, dependencies: Vector[sbt.librarymanagement.ModuleID], overrides: Vector[sbt.librarymanagement.ModuleID], excludes: Vector[sbt.librarymanagement.InclExclRule], ivyXML: scala.xml.NodeSeq, configurations: Vector[sbt.librarymanagement.Configuration], defaultConfiguration: sbt.librarymanagement.Configuration, conflictManager: sbt.librarymanagement.ConflictManager): ModuleDescriptorConfiguration = new ModuleDescriptorConfiguration(validate, Option(scalaModuleInfo), module, moduleInfo, dependencies, overrides, excludes, ivyXML, configurations, Option(defaultConfiguration), conflictManager) +} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/InlineConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleDescriptorConfigurationFormats.scala similarity index 60% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/InlineConfigurationFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ModuleDescriptorConfigurationFormats.scala index 13cc6724..2062ac0f 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/InlineConfigurationFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleDescriptorConfigurationFormats.scala @@ -5,33 +5,33 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait InlineConfigurationFormats { self: sbt.librarymanagement.IvyScalaFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ModuleInfoFormats with sbt.librarymanagement.InclExclRuleFormats with sbt.internal.librarymanagement.formats.NodeSeqFormat with sbt.librarymanagement.ConfigurationFormats with sbt.librarymanagement.ConflictManagerFormats with sjsonnew.BasicJsonProtocol => -implicit lazy val InlineConfigurationFormat: JsonFormat[sbt.internal.librarymanagement.InlineConfiguration] = new JsonFormat[sbt.internal.librarymanagement.InlineConfiguration] { - override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.librarymanagement.InlineConfiguration = { +trait ModuleDescriptorConfigurationFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ModuleInfoFormats with sbt.librarymanagement.InclExclRuleFormats with sbt.internal.librarymanagement.formats.NodeSeqFormat with sbt.librarymanagement.ConfigurationFormats with sbt.librarymanagement.ConflictManagerFormats with sjsonnew.BasicJsonProtocol => +implicit lazy val ModuleDescriptorConfigurationFormat: JsonFormat[sbt.librarymanagement.ModuleDescriptorConfiguration] = new JsonFormat[sbt.librarymanagement.ModuleDescriptorConfiguration] { + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ModuleDescriptorConfiguration = { jsOpt match { case Some(js) => unbuilder.beginObject(js) val validate = unbuilder.readField[Boolean]("validate") - val ivyScala = unbuilder.readField[Option[sbt.librarymanagement.IvyScala]]("ivyScala") + val scalaModuleInfo = unbuilder.readField[Option[sbt.librarymanagement.ScalaModuleInfo]]("scalaModuleInfo") val module = unbuilder.readField[sbt.librarymanagement.ModuleID]("module") val moduleInfo = unbuilder.readField[sbt.librarymanagement.ModuleInfo]("moduleInfo") val dependencies = unbuilder.readField[Vector[sbt.librarymanagement.ModuleID]]("dependencies") - val overrides = unbuilder.readField[Set[sbt.librarymanagement.ModuleID]]("overrides") + val overrides = unbuilder.readField[Vector[sbt.librarymanagement.ModuleID]]("overrides") val excludes = unbuilder.readField[Vector[sbt.librarymanagement.InclExclRule]]("excludes") val ivyXML = unbuilder.readField[scala.xml.NodeSeq]("ivyXML") val configurations = unbuilder.readField[Vector[sbt.librarymanagement.Configuration]]("configurations") val defaultConfiguration = unbuilder.readField[Option[sbt.librarymanagement.Configuration]]("defaultConfiguration") val conflictManager = unbuilder.readField[sbt.librarymanagement.ConflictManager]("conflictManager") unbuilder.endObject() - sbt.internal.librarymanagement.InlineConfiguration(validate, ivyScala, module, moduleInfo, dependencies, overrides, excludes, ivyXML, configurations, defaultConfiguration, conflictManager) + sbt.librarymanagement.ModuleDescriptorConfiguration(validate, scalaModuleInfo, module, moduleInfo, dependencies, overrides, excludes, ivyXML, configurations, defaultConfiguration, conflictManager) case None => deserializationError("Expected JsObject but found None") } } - override def write[J](obj: sbt.internal.librarymanagement.InlineConfiguration, builder: Builder[J]): Unit = { + override def write[J](obj: sbt.librarymanagement.ModuleDescriptorConfiguration, builder: Builder[J]): Unit = { builder.beginObject() builder.addField("validate", obj.validate) - builder.addField("ivyScala", obj.ivyScala) + builder.addField("scalaModuleInfo", obj.scalaModuleInfo) builder.addField("module", obj.module) builder.addField("moduleInfo", obj.moduleInfo) builder.addField("dependencies", obj.dependencies) diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleID.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleID.scala similarity index 94% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleID.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ModuleID.scala index 4e117921..822f7d2d 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleID.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleID.scala @@ -26,7 +26,7 @@ final class ModuleID private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "ModuleID".##) + organization.##) + name.##) + revision.##) + configurations.##) + isChanging.##) + isTransitive.##) + isForce.##) + explicitArtifacts.##) + inclusions.##) + exclusions.##) + extraAttributes.##) + crossVersion.##) + branchName.##) + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ModuleID".##) + organization.##) + name.##) + revision.##) + configurations.##) + isChanging.##) + isTransitive.##) + isForce.##) + explicitArtifacts.##) + inclusions.##) + exclusions.##) + extraAttributes.##) + crossVersion.##) + branchName.##) } override def toString: String = { this.toStringImpl diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleIDFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleIDFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleIDFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ModuleIDFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleInfo.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleInfo.scala similarity index 94% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleInfo.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ModuleInfo.scala index ef9dc5ac..ae7d42f5 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleInfo.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleInfo.scala @@ -23,7 +23,7 @@ final class ModuleInfo private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "ModuleInfo".##) + nameFormal.##) + description.##) + homepage.##) + startYear.##) + licenses.##) + organizationName.##) + organizationHomepage.##) + scmInfo.##) + developers.##) + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ModuleInfo".##) + nameFormal.##) + description.##) + homepage.##) + startYear.##) + licenses.##) + organizationName.##) + organizationHomepage.##) + scmInfo.##) + developers.##) } override def toString: String = { "ModuleInfo(" + nameFormal + ", " + description + ", " + homepage + ", " + startYear + ", " + licenses + ", " + organizationName + ", " + organizationHomepage + ", " + scmInfo + ", " + developers + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleInfoFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleInfoFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleInfoFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ModuleInfoFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleReport.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleReport.scala similarity index 94% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleReport.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ModuleReport.scala index 13f44f54..0c2526b1 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleReport.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleReport.scala @@ -35,7 +35,7 @@ final class ModuleReport private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "ModuleReport".##) + module.##) + artifacts.##) + missingArtifacts.##) + status.##) + publicationDate.##) + resolver.##) + artifactResolver.##) + evicted.##) + evictedData.##) + evictedReason.##) + problem.##) + homepage.##) + extraAttributes.##) + isDefault.##) + branch.##) + configurations.##) + licenses.##) + callers.##) + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ModuleReport".##) + module.##) + artifacts.##) + missingArtifacts.##) + status.##) + publicationDate.##) + resolver.##) + artifactResolver.##) + evicted.##) + evictedData.##) + evictedReason.##) + problem.##) + homepage.##) + extraAttributes.##) + isDefault.##) + branch.##) + configurations.##) + licenses.##) + callers.##) } override def toString: String = { s"\t\t$module: " + diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleReportFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleReportFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleReportFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ModuleReportFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleSettings.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleSettings.scala similarity index 57% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleSettings.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ModuleSettings.scala index e70a3b1f..2ce752c2 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleSettings.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleSettings.scala @@ -6,20 +6,20 @@ package sbt.librarymanagement abstract class ModuleSettings( val validate: Boolean, - val ivyScala: Option[sbt.librarymanagement.IvyScala]) extends Serializable { - + val scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo]) extends Serializable { + def this() = this(false, None) override def equals(o: Any): Boolean = o match { - case x: ModuleSettings => (this.validate == x.validate) && (this.ivyScala == x.ivyScala) + case x: ModuleSettings => (this.validate == x.validate) && (this.scalaModuleInfo == x.scalaModuleInfo) case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "ModuleSettings".##) + validate.##) + ivyScala.##) + 37 * (37 * (37 * (17 + "sbt.librarymanagement.ModuleSettings".##) + validate.##) + scalaModuleInfo.##) } override def toString: String = { - "ModuleSettings(" + validate + ", " + ivyScala + ")" + "ModuleSettings(" + validate + ", " + scalaModuleInfo + ")" } } object ModuleSettings { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/ModuleSettingsFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleSettingsFormats.scala new file mode 100644 index 00000000..09a7a077 --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleSettingsFormats.scala @@ -0,0 +1,11 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package sbt.librarymanagement + +import _root_.sjsonnew.JsonFormat +trait ModuleSettingsFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.IvyFileConfigurationFormats with sbt.librarymanagement.PomConfigurationFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ModuleInfoFormats with sbt.librarymanagement.InclExclRuleFormats with sbt.internal.librarymanagement.formats.NodeSeqFormat with sbt.librarymanagement.ConfigurationFormats with sbt.librarymanagement.ConflictManagerFormats with sbt.librarymanagement.ModuleDescriptorConfigurationFormats => +implicit lazy val ModuleSettingsFormat: JsonFormat[sbt.librarymanagement.ModuleSettings] = flatUnionFormat3[sbt.librarymanagement.ModuleSettings, sbt.librarymanagement.IvyFileConfiguration, sbt.librarymanagement.PomConfiguration, sbt.librarymanagement.ModuleDescriptorConfiguration]("type") +} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReport.scala b/core/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReport.scala similarity index 94% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReport.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReport.scala index daceb565..3b62b191 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReport.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReport.scala @@ -27,7 +27,7 @@ final class OrganizationArtifactReport private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (17 + "OrganizationArtifactReport".##) + organization.##) + name.##) + modules.##) + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.OrganizationArtifactReport".##) + organization.##) + name.##) + modules.##) } override def toString: String = { "OrganizationArtifactReport(" + organization + ", " + name + ", " + modules + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReportFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReportFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReportFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReportFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PasswordAuthentication.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PasswordAuthentication.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PasswordAuthentication.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/PasswordAuthentication.scala index ff71e1e0..a67739cc 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PasswordAuthentication.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/PasswordAuthentication.scala @@ -15,7 +15,7 @@ final class PasswordAuthentication private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "PasswordAuthentication".##) + user.##) + password.##) + 37 * (37 * (37 * (17 + "sbt.librarymanagement.PasswordAuthentication".##) + user.##) + password.##) } override def toString: String = { "PasswordAuthentication(" + user + ", " + password + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PasswordAuthenticationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PasswordAuthenticationFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PasswordAuthenticationFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/PasswordAuthenticationFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Patch.scala b/core/src/main/contraband-scala/sbt/librarymanagement/Patch.scala similarity index 93% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Patch.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/Patch.scala index f6cefff4..ffdf666e 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Patch.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/Patch.scala @@ -17,7 +17,7 @@ override def equals(o: Any): Boolean = o match { case _ => false } override def hashCode: Int = { - 37 * (17 + "Patch".##) + 37 * (17 + "sbt.librarymanagement.Patch".##) } override def toString: String = { "Patch()" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PatchFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PatchFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PatchFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/PatchFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Patterns.scala b/core/src/main/contraband-scala/sbt/librarymanagement/Patterns.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Patterns.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/Patterns.scala index 5457c8a4..ea43d552 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Patterns.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/Patterns.scala @@ -18,7 +18,7 @@ final class Patterns private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (17 + "Patterns".##) + ivyPatterns.##) + artifactPatterns.##) + isMavenCompatible.##) + descriptorOptional.##) + skipConsistencyCheck.##) + 37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.Patterns".##) + ivyPatterns.##) + artifactPatterns.##) + isMavenCompatible.##) + descriptorOptional.##) + skipConsistencyCheck.##) } override def toString: String = { "Patterns(ivyPatterns=%s, artifactPatterns=%s, isMavenCompatible=%s, descriptorOptional=%s, skipConsistencyCheck=%s)".format( diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepository.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepository.scala similarity index 88% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepository.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepository.scala index 8354c6b4..93e62428 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepository.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepository.scala @@ -17,7 +17,7 @@ abstract class PatternsBasedRepository( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "PatternsBasedRepository".##) + name.##) + patterns.##) + 37 * (37 * (37 * (17 + "sbt.librarymanagement.PatternsBasedRepository".##) + name.##) + patterns.##) } override def toString: String = { "PatternsBasedRepository(" + name + ", " + patterns + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepositoryFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepositoryFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepositoryFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PatternsFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PatternsFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PatternsFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/PatternsFormats.scala diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/PomConfiguration.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PomConfiguration.scala new file mode 100644 index 00000000..93fdbc39 --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/PomConfiguration.scala @@ -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 PomConfiguration 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: PomConfiguration => (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 + "sbt.librarymanagement.PomConfiguration".##) + validate.##) + scalaModuleInfo.##) + file.##) + autoScalaTools.##) + } + override def toString: String = { + "PomConfiguration(" + 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): PomConfiguration = { + new PomConfiguration(validate, scalaModuleInfo, file, autoScalaTools) + } + def withValidate(validate: Boolean): PomConfiguration = { + copy(validate = validate) + } + def withScalaModuleInfo(scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo]): PomConfiguration = { + copy(scalaModuleInfo = scalaModuleInfo) + } + def withScalaModuleInfo(scalaModuleInfo: sbt.librarymanagement.ScalaModuleInfo): PomConfiguration = { + copy(scalaModuleInfo = Option(scalaModuleInfo)) + } + def withFile(file: java.io.File): PomConfiguration = { + copy(file = file) + } + def withAutoScalaTools(autoScalaTools: Boolean): PomConfiguration = { + copy(autoScalaTools = autoScalaTools) + } +} +object PomConfiguration { + + def apply(file: java.io.File, autoScalaTools: Boolean): PomConfiguration = new PomConfiguration(false, None, file, autoScalaTools) + def apply(validate: Boolean, scalaModuleInfo: Option[sbt.librarymanagement.ScalaModuleInfo], file: java.io.File, autoScalaTools: Boolean): PomConfiguration = new PomConfiguration(validate, scalaModuleInfo, file, autoScalaTools) + def apply(validate: Boolean, scalaModuleInfo: sbt.librarymanagement.ScalaModuleInfo, file: java.io.File, autoScalaTools: Boolean): PomConfiguration = new PomConfiguration(validate, Option(scalaModuleInfo), file, autoScalaTools) +} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PomConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PomConfigurationFormats.scala similarity index 75% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PomConfigurationFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/PomConfigurationFormats.scala index e8a2a787..44c8bb00 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PomConfigurationFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/PomConfigurationFormats.scala @@ -5,18 +5,18 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait PomConfigurationFormats { self: sbt.librarymanagement.IvyScalaFormats with sjsonnew.BasicJsonProtocol => +trait PomConfigurationFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sjsonnew.BasicJsonProtocol => implicit lazy val PomConfigurationFormat: JsonFormat[sbt.librarymanagement.PomConfiguration] = new JsonFormat[sbt.librarymanagement.PomConfiguration] { override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.PomConfiguration = { jsOpt match { case Some(js) => unbuilder.beginObject(js) val validate = unbuilder.readField[Boolean]("validate") - val ivyScala = unbuilder.readField[Option[sbt.librarymanagement.IvyScala]]("ivyScala") + val scalaModuleInfo = unbuilder.readField[Option[sbt.librarymanagement.ScalaModuleInfo]]("scalaModuleInfo") val file = unbuilder.readField[java.io.File]("file") val autoScalaTools = unbuilder.readField[Boolean]("autoScalaTools") unbuilder.endObject() - sbt.librarymanagement.PomConfiguration(validate, ivyScala, file, autoScalaTools) + sbt.librarymanagement.PomConfiguration(validate, scalaModuleInfo, file, autoScalaTools) case None => deserializationError("Expected JsObject but found None") } @@ -24,7 +24,7 @@ implicit lazy val PomConfigurationFormat: JsonFormat[sbt.librarymanagement.PomCo override def write[J](obj: sbt.librarymanagement.PomConfiguration, builder: Builder[J]): Unit = { builder.beginObject() builder.addField("validate", obj.validate) - builder.addField("ivyScala", obj.ivyScala) + builder.addField("scalaModuleInfo", obj.scalaModuleInfo) builder.addField("file", obj.file) builder.addField("autoScalaTools", obj.autoScalaTools) builder.endObject() diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/PublishConfiguration.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PublishConfiguration.scala new file mode 100644 index 00000000..8dcd7d7a --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/PublishConfiguration.scala @@ -0,0 +1,81 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package sbt.librarymanagement +final class PublishConfiguration private ( + val publishMavenStyle: Boolean, + val deliverIvyPattern: Option[String], + val status: Option[String], + val configurations: Option[scala.Vector[sbt.librarymanagement.ConfigRef]], + val resolverName: Option[String], + val artifacts: Vector[scala.Tuple2[sbt.librarymanagement.Artifact, java.io.File]], + val checksums: scala.Vector[String], + val logging: Option[sbt.librarymanagement.UpdateLogging], + val overwrite: Boolean) extends Serializable { + + private def this() = this(true, None, None, None, None, Vector(), Vector("sha1", "md5"), None, false) + + override def equals(o: Any): Boolean = o match { + case x: PublishConfiguration => (this.publishMavenStyle == x.publishMavenStyle) && (this.deliverIvyPattern == x.deliverIvyPattern) && (this.status == x.status) && (this.configurations == x.configurations) && (this.resolverName == x.resolverName) && (this.artifacts == x.artifacts) && (this.checksums == x.checksums) && (this.logging == x.logging) && (this.overwrite == x.overwrite) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.PublishConfiguration".##) + publishMavenStyle.##) + deliverIvyPattern.##) + status.##) + configurations.##) + resolverName.##) + artifacts.##) + checksums.##) + logging.##) + overwrite.##) + } + override def toString: String = { + "PublishConfiguration(" + publishMavenStyle + ", " + deliverIvyPattern + ", " + status + ", " + configurations + ", " + resolverName + ", " + artifacts + ", " + checksums + ", " + logging + ", " + overwrite + ")" + } + protected[this] def copy(publishMavenStyle: Boolean = publishMavenStyle, deliverIvyPattern: Option[String] = deliverIvyPattern, status: Option[String] = status, configurations: Option[scala.Vector[sbt.librarymanagement.ConfigRef]] = configurations, resolverName: Option[String] = resolverName, artifacts: Vector[scala.Tuple2[sbt.librarymanagement.Artifact, java.io.File]] = artifacts, checksums: scala.Vector[String] = checksums, logging: Option[sbt.librarymanagement.UpdateLogging] = logging, overwrite: Boolean = overwrite): PublishConfiguration = { + new PublishConfiguration(publishMavenStyle, deliverIvyPattern, status, configurations, resolverName, artifacts, checksums, logging, overwrite) + } + def withPublishMavenStyle(publishMavenStyle: Boolean): PublishConfiguration = { + copy(publishMavenStyle = publishMavenStyle) + } + def withDeliverIvyPattern(deliverIvyPattern: Option[String]): PublishConfiguration = { + copy(deliverIvyPattern = deliverIvyPattern) + } + def withDeliverIvyPattern(deliverIvyPattern: String): PublishConfiguration = { + copy(deliverIvyPattern = Option(deliverIvyPattern)) + } + def withStatus(status: Option[String]): PublishConfiguration = { + copy(status = status) + } + def withStatus(status: String): PublishConfiguration = { + copy(status = Option(status)) + } + def withConfigurations(configurations: Option[scala.Vector[sbt.librarymanagement.ConfigRef]]): PublishConfiguration = { + copy(configurations = configurations) + } + def withConfigurations(configurations: scala.Vector[sbt.librarymanagement.ConfigRef]): PublishConfiguration = { + copy(configurations = Option(configurations)) + } + def withResolverName(resolverName: Option[String]): PublishConfiguration = { + copy(resolverName = resolverName) + } + def withResolverName(resolverName: String): PublishConfiguration = { + copy(resolverName = Option(resolverName)) + } + def withArtifacts(artifacts: Vector[scala.Tuple2[sbt.librarymanagement.Artifact, java.io.File]]): PublishConfiguration = { + copy(artifacts = artifacts) + } + def withChecksums(checksums: scala.Vector[String]): PublishConfiguration = { + copy(checksums = checksums) + } + def withLogging(logging: Option[sbt.librarymanagement.UpdateLogging]): PublishConfiguration = { + copy(logging = logging) + } + def withLogging(logging: sbt.librarymanagement.UpdateLogging): PublishConfiguration = { + copy(logging = Option(logging)) + } + def withOverwrite(overwrite: Boolean): PublishConfiguration = { + copy(overwrite = overwrite) + } +} +object PublishConfiguration { + + def apply(): PublishConfiguration = new PublishConfiguration(true, None, None, None, None, Vector(), Vector("sha1", "md5"), None, false) + def apply(publishMavenStyle: Boolean, deliverIvyPattern: Option[String], status: Option[String], configurations: Option[scala.Vector[sbt.librarymanagement.ConfigRef]], resolverName: Option[String], artifacts: Vector[scala.Tuple2[sbt.librarymanagement.Artifact, java.io.File]], checksums: scala.Vector[String], logging: Option[sbt.librarymanagement.UpdateLogging], overwrite: Boolean): PublishConfiguration = new PublishConfiguration(publishMavenStyle, deliverIvyPattern, status, configurations, resolverName, artifacts, checksums, logging, overwrite) + def apply(publishMavenStyle: Boolean, deliverIvyPattern: String, status: String, configurations: scala.Vector[sbt.librarymanagement.ConfigRef], resolverName: String, artifacts: Vector[scala.Tuple2[sbt.librarymanagement.Artifact, java.io.File]], checksums: scala.Vector[String], logging: sbt.librarymanagement.UpdateLogging, overwrite: Boolean): PublishConfiguration = new PublishConfiguration(publishMavenStyle, Option(deliverIvyPattern), Option(status), Option(configurations), Option(resolverName), artifacts, checksums, Option(logging), overwrite) +} diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/PublishConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PublishConfigurationFormats.scala new file mode 100644 index 00000000..14990899 --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/PublishConfigurationFormats.scala @@ -0,0 +1,43 @@ +/** + * 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 PublishConfigurationFormats { self: sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.UpdateLoggingFormats with sjsonnew.BasicJsonProtocol => +implicit lazy val PublishConfigurationFormat: JsonFormat[sbt.librarymanagement.PublishConfiguration] = new JsonFormat[sbt.librarymanagement.PublishConfiguration] { + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.PublishConfiguration = { + jsOpt match { + case Some(js) => + unbuilder.beginObject(js) + val publishMavenStyle = unbuilder.readField[Boolean]("publishMavenStyle") + val deliverIvyPattern = unbuilder.readField[Option[String]]("deliverIvyPattern") + val status = unbuilder.readField[Option[String]]("status") + val configurations = unbuilder.readField[Option[scala.Vector[sbt.librarymanagement.ConfigRef]]]("configurations") + val resolverName = unbuilder.readField[Option[String]]("resolverName") + val artifacts = unbuilder.readField[Vector[scala.Tuple2[sbt.librarymanagement.Artifact, java.io.File]]]("artifacts") + val checksums = unbuilder.readField[scala.Vector[String]]("checksums") + val logging = unbuilder.readField[Option[sbt.librarymanagement.UpdateLogging]]("logging") + val overwrite = unbuilder.readField[Boolean]("overwrite") + unbuilder.endObject() + sbt.librarymanagement.PublishConfiguration(publishMavenStyle, deliverIvyPattern, status, configurations, resolverName, artifacts, checksums, logging, overwrite) + case None => + deserializationError("Expected JsObject but found None") + } + } + override def write[J](obj: sbt.librarymanagement.PublishConfiguration, builder: Builder[J]): Unit = { + builder.beginObject() + builder.addField("publishMavenStyle", obj.publishMavenStyle) + builder.addField("deliverIvyPattern", obj.deliverIvyPattern) + builder.addField("status", obj.status) + builder.addField("configurations", obj.configurations) + builder.addField("resolverName", obj.resolverName) + builder.addField("artifacts", obj.artifacts) + builder.addField("checksums", obj.checksums) + builder.addField("logging", obj.logging) + builder.addField("overwrite", obj.overwrite) + builder.endObject() + } +} +} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Resolver.scala b/core/src/main/contraband-scala/sbt/librarymanagement/Resolver.scala similarity index 88% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Resolver.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/Resolver.scala index 792d0daa..c6caf7ea 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Resolver.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/Resolver.scala @@ -15,7 +15,7 @@ abstract class Resolver( case _ => false } override def hashCode: Int = { - 37 * (37 * (17 + "Resolver".##) + name.##) + 37 * (37 * (17 + "sbt.librarymanagement.Resolver".##) + name.##) } override def toString: String = { "Resolver(" + name + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ResolverFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ResolverFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ResolverFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ResolverFormats.scala diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/RetrieveConfiguration.scala b/core/src/main/contraband-scala/sbt/librarymanagement/RetrieveConfiguration.scala new file mode 100644 index 00000000..7a063b47 --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/RetrieveConfiguration.scala @@ -0,0 +1,58 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package sbt.librarymanagement +final class RetrieveConfiguration private ( + val retrieveDirectory: Option[java.io.File], + val outputPattern: Option[String], + val sync: Boolean, + val configurationsToRetrieve: Option[scala.Vector[sbt.librarymanagement.ConfigRef]]) extends Serializable { + + private def this() = this(None, None, false, None) + private def this(retrieveDirectory: Option[java.io.File], outputPattern: Option[String]) = this(retrieveDirectory, outputPattern, false, None) + + override def equals(o: Any): Boolean = o match { + case x: RetrieveConfiguration => (this.retrieveDirectory == x.retrieveDirectory) && (this.outputPattern == x.outputPattern) && (this.sync == x.sync) && (this.configurationsToRetrieve == x.configurationsToRetrieve) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.RetrieveConfiguration".##) + retrieveDirectory.##) + outputPattern.##) + sync.##) + configurationsToRetrieve.##) + } + override def toString: String = { + "RetrieveConfiguration(" + retrieveDirectory + ", " + outputPattern + ", " + sync + ", " + configurationsToRetrieve + ")" + } + protected[this] def copy(retrieveDirectory: Option[java.io.File] = retrieveDirectory, outputPattern: Option[String] = outputPattern, sync: Boolean = sync, configurationsToRetrieve: Option[scala.Vector[sbt.librarymanagement.ConfigRef]] = configurationsToRetrieve): RetrieveConfiguration = { + new RetrieveConfiguration(retrieveDirectory, outputPattern, sync, configurationsToRetrieve) + } + def withRetrieveDirectory(retrieveDirectory: Option[java.io.File]): RetrieveConfiguration = { + copy(retrieveDirectory = retrieveDirectory) + } + def withRetrieveDirectory(retrieveDirectory: java.io.File): RetrieveConfiguration = { + copy(retrieveDirectory = Option(retrieveDirectory)) + } + def withOutputPattern(outputPattern: Option[String]): RetrieveConfiguration = { + copy(outputPattern = outputPattern) + } + def withOutputPattern(outputPattern: String): RetrieveConfiguration = { + copy(outputPattern = Option(outputPattern)) + } + def withSync(sync: Boolean): RetrieveConfiguration = { + copy(sync = sync) + } + def withConfigurationsToRetrieve(configurationsToRetrieve: Option[scala.Vector[sbt.librarymanagement.ConfigRef]]): RetrieveConfiguration = { + copy(configurationsToRetrieve = configurationsToRetrieve) + } + def withConfigurationsToRetrieve(configurationsToRetrieve: scala.Vector[sbt.librarymanagement.ConfigRef]): RetrieveConfiguration = { + copy(configurationsToRetrieve = Option(configurationsToRetrieve)) + } +} +object RetrieveConfiguration { + + def apply(): RetrieveConfiguration = new RetrieveConfiguration(None, None, false, None) + def apply(retrieveDirectory: Option[java.io.File], outputPattern: Option[String]): RetrieveConfiguration = new RetrieveConfiguration(retrieveDirectory, outputPattern, false, None) + def apply(retrieveDirectory: java.io.File, outputPattern: String): RetrieveConfiguration = new RetrieveConfiguration(Option(retrieveDirectory), Option(outputPattern), false, None) + def apply(retrieveDirectory: Option[java.io.File], outputPattern: Option[String], sync: Boolean, configurationsToRetrieve: Option[scala.Vector[sbt.librarymanagement.ConfigRef]]): RetrieveConfiguration = new RetrieveConfiguration(retrieveDirectory, outputPattern, sync, configurationsToRetrieve) + def apply(retrieveDirectory: java.io.File, outputPattern: String, sync: Boolean, configurationsToRetrieve: scala.Vector[sbt.librarymanagement.ConfigRef]): RetrieveConfiguration = new RetrieveConfiguration(Option(retrieveDirectory), Option(outputPattern), sync, Option(configurationsToRetrieve)) +} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/RetrieveConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/RetrieveConfigurationFormats.scala similarity index 59% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/RetrieveConfigurationFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/RetrieveConfigurationFormats.scala index 158e305c..bd12840f 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/RetrieveConfigurationFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/RetrieveConfigurationFormats.scala @@ -6,22 +6,22 @@ package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } trait RetrieveConfigurationFormats { self: sbt.librarymanagement.ConfigRefFormats with sjsonnew.BasicJsonProtocol => -implicit lazy val RetrieveConfigurationFormat: JsonFormat[sbt.internal.librarymanagement.RetrieveConfiguration] = new JsonFormat[sbt.internal.librarymanagement.RetrieveConfiguration] { - override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.librarymanagement.RetrieveConfiguration = { +implicit lazy val RetrieveConfigurationFormat: JsonFormat[sbt.librarymanagement.RetrieveConfiguration] = new JsonFormat[sbt.librarymanagement.RetrieveConfiguration] { + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.RetrieveConfiguration = { jsOpt match { case Some(js) => unbuilder.beginObject(js) - val retrieveDirectory = unbuilder.readField[java.io.File]("retrieveDirectory") - val outputPattern = unbuilder.readField[String]("outputPattern") + val retrieveDirectory = unbuilder.readField[Option[java.io.File]]("retrieveDirectory") + val outputPattern = unbuilder.readField[Option[String]]("outputPattern") val sync = unbuilder.readField[Boolean]("sync") - val configurationsToRetrieve = unbuilder.readField[Option[Set[sbt.librarymanagement.ConfigRef]]]("configurationsToRetrieve") + val configurationsToRetrieve = unbuilder.readField[Option[scala.Vector[sbt.librarymanagement.ConfigRef]]]("configurationsToRetrieve") unbuilder.endObject() - sbt.internal.librarymanagement.RetrieveConfiguration(retrieveDirectory, outputPattern, sync, configurationsToRetrieve) + sbt.librarymanagement.RetrieveConfiguration(retrieveDirectory, outputPattern, sync, configurationsToRetrieve) case None => deserializationError("Expected JsObject but found None") } } - override def write[J](obj: sbt.internal.librarymanagement.RetrieveConfiguration, builder: Builder[J]): Unit = { + override def write[J](obj: sbt.librarymanagement.RetrieveConfiguration, builder: Builder[J]): Unit = { builder.beginObject() builder.addField("retrieveDirectory", obj.retrieveDirectory) builder.addField("outputPattern", obj.outputPattern) diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyScala.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ScalaModuleInfo.scala similarity index 53% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyScala.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ScalaModuleInfo.scala index 4bbde0de..73afbfcb 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyScala.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ScalaModuleInfo.scala @@ -4,7 +4,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement -final class IvyScala private ( +final class ScalaModuleInfo private ( val scalaFullVersion: String, val scalaBinaryVersion: String, val configurations: Vector[sbt.librarymanagement.Configuration], @@ -17,45 +17,45 @@ final class IvyScala private ( private def this(scalaFullVersion: String, scalaBinaryVersion: String, configurations: Vector[sbt.librarymanagement.Configuration], checkExplicit: Boolean, filterImplicit: Boolean, overrideScalaVersion: Boolean) = this(scalaFullVersion, scalaBinaryVersion, configurations, checkExplicit, filterImplicit, overrideScalaVersion, sbt.librarymanagement.ScalaArtifacts.Organization, sbt.librarymanagement.ScalaArtifacts.Artifacts) override def equals(o: Any): Boolean = o match { - case x: IvyScala => (this.scalaFullVersion == x.scalaFullVersion) && (this.scalaBinaryVersion == x.scalaBinaryVersion) && (this.configurations == x.configurations) && (this.checkExplicit == x.checkExplicit) && (this.filterImplicit == x.filterImplicit) && (this.overrideScalaVersion == x.overrideScalaVersion) && (this.scalaOrganization == x.scalaOrganization) && (this.scalaArtifacts == x.scalaArtifacts) + case x: ScalaModuleInfo => (this.scalaFullVersion == x.scalaFullVersion) && (this.scalaBinaryVersion == x.scalaBinaryVersion) && (this.configurations == x.configurations) && (this.checkExplicit == x.checkExplicit) && (this.filterImplicit == x.filterImplicit) && (this.overrideScalaVersion == x.overrideScalaVersion) && (this.scalaOrganization == x.scalaOrganization) && (this.scalaArtifacts == x.scalaArtifacts) case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "IvyScala".##) + scalaFullVersion.##) + scalaBinaryVersion.##) + configurations.##) + checkExplicit.##) + filterImplicit.##) + overrideScalaVersion.##) + scalaOrganization.##) + scalaArtifacts.##) + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ScalaModuleInfo".##) + scalaFullVersion.##) + scalaBinaryVersion.##) + configurations.##) + checkExplicit.##) + filterImplicit.##) + overrideScalaVersion.##) + scalaOrganization.##) + scalaArtifacts.##) } override def toString: String = { - "IvyScala(" + scalaFullVersion + ", " + scalaBinaryVersion + ", " + configurations + ", " + checkExplicit + ", " + filterImplicit + ", " + overrideScalaVersion + ", " + scalaOrganization + ", " + scalaArtifacts + ")" + "ScalaModuleInfo(" + scalaFullVersion + ", " + scalaBinaryVersion + ", " + configurations + ", " + checkExplicit + ", " + filterImplicit + ", " + overrideScalaVersion + ", " + scalaOrganization + ", " + scalaArtifacts + ")" } - protected[this] def copy(scalaFullVersion: String = scalaFullVersion, scalaBinaryVersion: String = scalaBinaryVersion, configurations: Vector[sbt.librarymanagement.Configuration] = configurations, checkExplicit: Boolean = checkExplicit, filterImplicit: Boolean = filterImplicit, overrideScalaVersion: Boolean = overrideScalaVersion, scalaOrganization: String = scalaOrganization, scalaArtifacts: scala.Vector[String] = scalaArtifacts): IvyScala = { - new IvyScala(scalaFullVersion, scalaBinaryVersion, configurations, checkExplicit, filterImplicit, overrideScalaVersion, scalaOrganization, scalaArtifacts) + protected[this] def copy(scalaFullVersion: String = scalaFullVersion, scalaBinaryVersion: String = scalaBinaryVersion, configurations: Vector[sbt.librarymanagement.Configuration] = configurations, checkExplicit: Boolean = checkExplicit, filterImplicit: Boolean = filterImplicit, overrideScalaVersion: Boolean = overrideScalaVersion, scalaOrganization: String = scalaOrganization, scalaArtifacts: scala.Vector[String] = scalaArtifacts): ScalaModuleInfo = { + new ScalaModuleInfo(scalaFullVersion, scalaBinaryVersion, configurations, checkExplicit, filterImplicit, overrideScalaVersion, scalaOrganization, scalaArtifacts) } - def withScalaFullVersion(scalaFullVersion: String): IvyScala = { + def withScalaFullVersion(scalaFullVersion: String): ScalaModuleInfo = { copy(scalaFullVersion = scalaFullVersion) } - def withScalaBinaryVersion(scalaBinaryVersion: String): IvyScala = { + def withScalaBinaryVersion(scalaBinaryVersion: String): ScalaModuleInfo = { copy(scalaBinaryVersion = scalaBinaryVersion) } - def withConfigurations(configurations: Vector[sbt.librarymanagement.Configuration]): IvyScala = { + def withConfigurations(configurations: Vector[sbt.librarymanagement.Configuration]): ScalaModuleInfo = { copy(configurations = configurations) } - def withCheckExplicit(checkExplicit: Boolean): IvyScala = { + def withCheckExplicit(checkExplicit: Boolean): ScalaModuleInfo = { copy(checkExplicit = checkExplicit) } - def withFilterImplicit(filterImplicit: Boolean): IvyScala = { + def withFilterImplicit(filterImplicit: Boolean): ScalaModuleInfo = { copy(filterImplicit = filterImplicit) } - def withOverrideScalaVersion(overrideScalaVersion: Boolean): IvyScala = { + def withOverrideScalaVersion(overrideScalaVersion: Boolean): ScalaModuleInfo = { copy(overrideScalaVersion = overrideScalaVersion) } - def withScalaOrganization(scalaOrganization: String): IvyScala = { + def withScalaOrganization(scalaOrganization: String): ScalaModuleInfo = { copy(scalaOrganization = scalaOrganization) } - def withScalaArtifacts(scalaArtifacts: scala.Vector[String]): IvyScala = { + def withScalaArtifacts(scalaArtifacts: scala.Vector[String]): ScalaModuleInfo = { copy(scalaArtifacts = scalaArtifacts) } } -object IvyScala extends sbt.librarymanagement.IvyScalaFunctions { +object ScalaModuleInfo { - def apply(scalaFullVersion: String, scalaBinaryVersion: String, configurations: Vector[sbt.librarymanagement.Configuration], checkExplicit: Boolean, filterImplicit: Boolean, overrideScalaVersion: Boolean): IvyScala = new IvyScala(scalaFullVersion, scalaBinaryVersion, configurations, checkExplicit, filterImplicit, overrideScalaVersion, sbt.librarymanagement.ScalaArtifacts.Organization, sbt.librarymanagement.ScalaArtifacts.Artifacts) - def apply(scalaFullVersion: String, scalaBinaryVersion: String, configurations: Vector[sbt.librarymanagement.Configuration], checkExplicit: Boolean, filterImplicit: Boolean, overrideScalaVersion: Boolean, scalaOrganization: String, scalaArtifacts: scala.Vector[String]): IvyScala = new IvyScala(scalaFullVersion, scalaBinaryVersion, configurations, checkExplicit, filterImplicit, overrideScalaVersion, scalaOrganization, scalaArtifacts) + def apply(scalaFullVersion: String, scalaBinaryVersion: String, configurations: Vector[sbt.librarymanagement.Configuration], checkExplicit: Boolean, filterImplicit: Boolean, overrideScalaVersion: Boolean): ScalaModuleInfo = new ScalaModuleInfo(scalaFullVersion, scalaBinaryVersion, configurations, checkExplicit, filterImplicit, overrideScalaVersion, sbt.librarymanagement.ScalaArtifacts.Organization, sbt.librarymanagement.ScalaArtifacts.Artifacts) + def apply(scalaFullVersion: String, scalaBinaryVersion: String, configurations: Vector[sbt.librarymanagement.Configuration], checkExplicit: Boolean, filterImplicit: Boolean, overrideScalaVersion: Boolean, scalaOrganization: String, scalaArtifacts: scala.Vector[String]): ScalaModuleInfo = new ScalaModuleInfo(scalaFullVersion, scalaBinaryVersion, configurations, checkExplicit, filterImplicit, overrideScalaVersion, scalaOrganization, scalaArtifacts) } diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyScalaFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ScalaModuleInfoFormats.scala similarity index 74% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyScalaFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ScalaModuleInfoFormats.scala index b1220710..c3996cbe 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyScalaFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ScalaModuleInfoFormats.scala @@ -5,9 +5,9 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait IvyScalaFormats { self: sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol => -implicit lazy val IvyScalaFormat: JsonFormat[sbt.librarymanagement.IvyScala] = new JsonFormat[sbt.librarymanagement.IvyScala] { - override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.IvyScala = { +trait ScalaModuleInfoFormats { self: sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol => +implicit lazy val ScalaModuleInfoFormat: JsonFormat[sbt.librarymanagement.ScalaModuleInfo] = new JsonFormat[sbt.librarymanagement.ScalaModuleInfo] { + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ScalaModuleInfo = { jsOpt match { case Some(js) => unbuilder.beginObject(js) @@ -20,12 +20,12 @@ implicit lazy val IvyScalaFormat: JsonFormat[sbt.librarymanagement.IvyScala] = n val scalaOrganization = unbuilder.readField[String]("scalaOrganization") val scalaArtifacts = unbuilder.readField[scala.Vector[String]]("scalaArtifacts") unbuilder.endObject() - sbt.librarymanagement.IvyScala(scalaFullVersion, scalaBinaryVersion, configurations, checkExplicit, filterImplicit, overrideScalaVersion, scalaOrganization, scalaArtifacts) + sbt.librarymanagement.ScalaModuleInfo(scalaFullVersion, scalaBinaryVersion, configurations, checkExplicit, filterImplicit, overrideScalaVersion, scalaOrganization, scalaArtifacts) case None => deserializationError("Expected JsObject but found None") } } - override def write[J](obj: sbt.librarymanagement.IvyScala, builder: Builder[J]): Unit = { + override def write[J](obj: sbt.librarymanagement.ScalaModuleInfo, builder: Builder[J]): Unit = { builder.beginObject() builder.addField("scalaFullVersion", obj.scalaFullVersion) builder.addField("scalaBinaryVersion", obj.scalaBinaryVersion) diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ScmInfo.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ScmInfo.scala similarity index 93% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ScmInfo.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ScmInfo.scala index 701bfc4b..19766ac5 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ScmInfo.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ScmInfo.scala @@ -17,7 +17,7 @@ final class ScmInfo private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (17 + "ScmInfo".##) + browseUrl.##) + connection.##) + devConnection.##) + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ScmInfo".##) + browseUrl.##) + connection.##) + devConnection.##) } override def toString: String = { "ScmInfo(" + browseUrl + ", " + connection + ", " + devConnection + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ScmInfoFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ScmInfoFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ScmInfoFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/ScmInfoFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SftpRepository.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SftpRepository.scala similarity index 94% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SftpRepository.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/SftpRepository.scala index b2a4fe6f..63734d7e 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SftpRepository.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/SftpRepository.scala @@ -18,7 +18,7 @@ final class SftpRepository private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (17 + "SftpRepository".##) + name.##) + patterns.##) + connection.##) + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.SftpRepository".##) + name.##) + patterns.##) + connection.##) } override def toString: String = { "SftpRepository(" + name + ", " + patterns + ", " + connection + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SftpRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SftpRepositoryFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SftpRepositoryFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/SftpRepositoryFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshAuthentication.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SshAuthentication.scala similarity index 88% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshAuthentication.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/SshAuthentication.scala index 96b0ec55..af49207c 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshAuthentication.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/SshAuthentication.scala @@ -14,7 +14,7 @@ override def equals(o: Any): Boolean = o match { case _ => false } override def hashCode: Int = { - 37 * (17 + "SshAuthentication".##) + 37 * (17 + "sbt.librarymanagement.SshAuthentication".##) } override def toString: String = { "SshAuthentication()" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshAuthenticationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SshAuthenticationFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshAuthenticationFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/SshAuthenticationFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepository.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepository.scala similarity index 88% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepository.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepository.scala index 484b7477..95843983 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepository.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepository.scala @@ -18,7 +18,7 @@ abstract class SshBasedRepository( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (17 + "SshBasedRepository".##) + name.##) + patterns.##) + connection.##) + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.SshBasedRepository".##) + name.##) + patterns.##) + connection.##) } override def toString: String = { "SshBasedRepository(" + name + ", " + patterns + ", " + connection + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepositoryFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepositoryFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepositoryFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshConnection.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SshConnection.scala similarity index 94% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshConnection.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/SshConnection.scala index 185d9b8f..5e105ebe 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshConnection.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/SshConnection.scala @@ -16,7 +16,7 @@ final class SshConnection private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (17 + "SshConnection".##) + authentication.##) + hostname.##) + port.##) + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.SshConnection".##) + authentication.##) + hostname.##) + port.##) } override def toString: String = { "SshConnection(" + authentication + ", " + hostname + ", " + port + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshConnectionFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SshConnectionFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshConnectionFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/SshConnectionFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshRepository.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SshRepository.scala similarity index 95% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshRepository.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/SshRepository.scala index 9a65cfea..ca7af27e 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshRepository.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/SshRepository.scala @@ -19,7 +19,7 @@ final class SshRepository private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (17 + "SshRepository".##) + name.##) + patterns.##) + connection.##) + publishPermissions.##) + 37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.SshRepository".##) + name.##) + patterns.##) + connection.##) + publishPermissions.##) } override def toString: String = { "SshRepository(" + name + ", " + patterns + ", " + connection + ", " + publishPermissions + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SshRepositoryFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/SshRepositoryFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/SshRepositoryFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/URLRepository.scala b/core/src/main/contraband-scala/sbt/librarymanagement/URLRepository.scala similarity index 92% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/URLRepository.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/URLRepository.scala index 2120a339..41a52e65 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/URLRepository.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/URLRepository.scala @@ -15,7 +15,7 @@ final class URLRepository private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "URLRepository".##) + name.##) + patterns.##) + 37 * (37 * (37 * (17 + "sbt.librarymanagement.URLRepository".##) + name.##) + patterns.##) } override def toString: String = { "URLRepository(" + name + ", " + patterns + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/URLRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/URLRepositoryFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/URLRepositoryFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/URLRepositoryFormats.scala diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/UpdateConfiguration.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateConfiguration.scala new file mode 100644 index 00000000..b62d6e71 --- /dev/null +++ b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateConfiguration.scala @@ -0,0 +1,82 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package sbt.librarymanagement +final class UpdateConfiguration private ( + /** + * If set to some RetrieveConfiguration, this enables retrieving dependencies to the specified directory. + * Otherwise, dependencies are used directly from the cache. + */ + val retrieveManaged: Option[sbt.librarymanagement.RetrieveConfiguration], + /** + * If set to true, it ignores when artifacts are missing. + * This setting could be uses when retrieving source/javadocs jars opportunistically. + */ + val missingOk: Boolean, + /** Logging setting used specifially for library management. */ + val logging: sbt.librarymanagement.UpdateLogging, + /** The clock that may be used for caching. */ + val logicalClock: sbt.librarymanagement.LogicalClock, + /** The base directory that may be used to store metadata. */ + val metadataDirectory: Option[java.io.File], + val artifactFilter: Option[sbt.librarymanagement.ArtifactTypeFilter], + val offline: Boolean, + val frozen: Boolean) extends Serializable { + + private def this() = this(None, false, sbt.librarymanagement.UpdateLogging.Default, sbt.librarymanagement.LogicalClock.unknown, None, None, false, false) + + override def equals(o: Any): Boolean = o match { + case x: UpdateConfiguration => (this.retrieveManaged == x.retrieveManaged) && (this.missingOk == x.missingOk) && (this.logging == x.logging) && (this.logicalClock == x.logicalClock) && (this.metadataDirectory == x.metadataDirectory) && (this.artifactFilter == x.artifactFilter) && (this.offline == x.offline) && (this.frozen == x.frozen) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.UpdateConfiguration".##) + retrieveManaged.##) + missingOk.##) + logging.##) + logicalClock.##) + metadataDirectory.##) + artifactFilter.##) + offline.##) + frozen.##) + } + override def toString: String = { + "UpdateConfiguration(" + retrieveManaged + ", " + missingOk + ", " + logging + ", " + logicalClock + ", " + metadataDirectory + ", " + artifactFilter + ", " + offline + ", " + frozen + ")" + } + protected[this] def copy(retrieveManaged: Option[sbt.librarymanagement.RetrieveConfiguration] = retrieveManaged, missingOk: Boolean = missingOk, logging: sbt.librarymanagement.UpdateLogging = logging, logicalClock: sbt.librarymanagement.LogicalClock = logicalClock, metadataDirectory: Option[java.io.File] = metadataDirectory, artifactFilter: Option[sbt.librarymanagement.ArtifactTypeFilter] = artifactFilter, offline: Boolean = offline, frozen: Boolean = frozen): UpdateConfiguration = { + new UpdateConfiguration(retrieveManaged, missingOk, logging, logicalClock, metadataDirectory, artifactFilter, offline, frozen) + } + def withRetrieveManaged(retrieveManaged: Option[sbt.librarymanagement.RetrieveConfiguration]): UpdateConfiguration = { + copy(retrieveManaged = retrieveManaged) + } + def withRetrieveManaged(retrieveManaged: sbt.librarymanagement.RetrieveConfiguration): UpdateConfiguration = { + copy(retrieveManaged = Option(retrieveManaged)) + } + def withMissingOk(missingOk: Boolean): UpdateConfiguration = { + copy(missingOk = missingOk) + } + def withLogging(logging: sbt.librarymanagement.UpdateLogging): UpdateConfiguration = { + copy(logging = logging) + } + def withLogicalClock(logicalClock: sbt.librarymanagement.LogicalClock): UpdateConfiguration = { + copy(logicalClock = logicalClock) + } + def withMetadataDirectory(metadataDirectory: Option[java.io.File]): UpdateConfiguration = { + copy(metadataDirectory = metadataDirectory) + } + def withMetadataDirectory(metadataDirectory: java.io.File): UpdateConfiguration = { + copy(metadataDirectory = Option(metadataDirectory)) + } + def withArtifactFilter(artifactFilter: Option[sbt.librarymanagement.ArtifactTypeFilter]): UpdateConfiguration = { + copy(artifactFilter = artifactFilter) + } + def withArtifactFilter(artifactFilter: sbt.librarymanagement.ArtifactTypeFilter): UpdateConfiguration = { + copy(artifactFilter = Option(artifactFilter)) + } + def withOffline(offline: Boolean): UpdateConfiguration = { + copy(offline = offline) + } + def withFrozen(frozen: Boolean): UpdateConfiguration = { + copy(frozen = frozen) + } +} +object UpdateConfiguration { + + def apply(): UpdateConfiguration = new UpdateConfiguration(None, false, sbt.librarymanagement.UpdateLogging.Default, sbt.librarymanagement.LogicalClock.unknown, None, None, false, false) + def apply(retrieveManaged: Option[sbt.librarymanagement.RetrieveConfiguration], missingOk: Boolean, logging: sbt.librarymanagement.UpdateLogging, logicalClock: sbt.librarymanagement.LogicalClock, metadataDirectory: Option[java.io.File], artifactFilter: Option[sbt.librarymanagement.ArtifactTypeFilter], offline: Boolean, frozen: Boolean): UpdateConfiguration = new UpdateConfiguration(retrieveManaged, missingOk, logging, logicalClock, metadataDirectory, artifactFilter, offline, frozen) + def apply(retrieveManaged: sbt.librarymanagement.RetrieveConfiguration, missingOk: Boolean, logging: sbt.librarymanagement.UpdateLogging, logicalClock: sbt.librarymanagement.LogicalClock, metadataDirectory: java.io.File, artifactFilter: sbt.librarymanagement.ArtifactTypeFilter, offline: Boolean, frozen: Boolean): UpdateConfiguration = new UpdateConfiguration(Option(retrieveManaged), missingOk, logging, logicalClock, Option(metadataDirectory), Option(artifactFilter), offline, frozen) +} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateConfigurationFormats.scala similarity index 63% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateConfigurationFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/UpdateConfigurationFormats.scala index fe2d4795..bf14c2e9 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateConfigurationFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateConfigurationFormats.scala @@ -5,29 +5,33 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait UpdateConfigurationFormats { self: sbt.librarymanagement.RetrieveConfigurationFormats with sbt.librarymanagement.UpdateLoggingFormats with sbt.librarymanagement.ArtifactTypeFilterFormats with sjsonnew.BasicJsonProtocol => +trait UpdateConfigurationFormats { self: sbt.librarymanagement.RetrieveConfigurationFormats with sbt.librarymanagement.UpdateLoggingFormats with sbt.internal.librarymanagement.formats.LogicalClockFormats with sbt.librarymanagement.ArtifactTypeFilterFormats with sjsonnew.BasicJsonProtocol => implicit lazy val UpdateConfigurationFormat: JsonFormat[sbt.librarymanagement.UpdateConfiguration] = new JsonFormat[sbt.librarymanagement.UpdateConfiguration] { override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.UpdateConfiguration = { jsOpt match { case Some(js) => unbuilder.beginObject(js) - val retrieve = unbuilder.readField[Option[sbt.internal.librarymanagement.RetrieveConfiguration]]("retrieve") + val retrieveManaged = unbuilder.readField[Option[sbt.librarymanagement.RetrieveConfiguration]]("retrieveManaged") val missingOk = unbuilder.readField[Boolean]("missingOk") val logging = unbuilder.readField[sbt.librarymanagement.UpdateLogging]("logging") - val artifactFilter = unbuilder.readField[sbt.librarymanagement.ArtifactTypeFilter]("artifactFilter") + val logicalClock = unbuilder.readField[sbt.librarymanagement.LogicalClock]("logicalClock") + val metadataDirectory = unbuilder.readField[Option[java.io.File]]("metadataDirectory") + val artifactFilter = unbuilder.readField[Option[sbt.librarymanagement.ArtifactTypeFilter]]("artifactFilter") val offline = unbuilder.readField[Boolean]("offline") val frozen = unbuilder.readField[Boolean]("frozen") unbuilder.endObject() - sbt.librarymanagement.UpdateConfiguration(retrieve, missingOk, logging, artifactFilter, offline, frozen) + sbt.librarymanagement.UpdateConfiguration(retrieveManaged, missingOk, logging, logicalClock, metadataDirectory, artifactFilter, offline, frozen) case None => deserializationError("Expected JsObject but found None") } } override def write[J](obj: sbt.librarymanagement.UpdateConfiguration, builder: Builder[J]): Unit = { builder.beginObject() - builder.addField("retrieve", obj.retrieve) + builder.addField("retrieveManaged", obj.retrieveManaged) builder.addField("missingOk", obj.missingOk) builder.addField("logging", obj.logging) + builder.addField("logicalClock", obj.logicalClock) + builder.addField("metadataDirectory", obj.metadataDirectory) builder.addField("artifactFilter", obj.artifactFilter) builder.addField("offline", obj.offline) builder.addField("frozen", obj.frozen) diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateLogging.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateLogging.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateLogging.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/UpdateLogging.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateLoggingFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateLoggingFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateLoggingFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/UpdateLoggingFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateReport.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReport.scala similarity index 94% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateReport.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/UpdateReport.scala index 00b9e822..91da1363 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateReport.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReport.scala @@ -25,7 +25,7 @@ final class UpdateReport private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (17 + "UpdateReport".##) + cachedDescriptor.##) + configurations.##) + stats.##) + stamps.##) + 37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.UpdateReport".##) + cachedDescriptor.##) + configurations.##) + stats.##) + stamps.##) } override def toString: String = { "Update report:\n\t" + stats + "\n" + configurations.mkString diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateReportFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateReportFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateReportLiteFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportLiteFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateReportLiteFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportLiteFormats.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateStats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateStats.scala similarity index 91% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateStats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/UpdateStats.scala index 6b33803d..408223e2 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateStats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateStats.scala @@ -17,7 +17,7 @@ final class UpdateStats private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (17 + "UpdateStats".##) + resolveTime.##) + downloadTime.##) + downloadSize.##) + cached.##) + 37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.UpdateStats".##) + resolveTime.##) + downloadTime.##) + downloadSize.##) + cached.##) } override def toString: String = { Seq("Resolve time: " + resolveTime + " ms", "Download time: " + downloadTime + " ms", "Download size: " + downloadSize + " bytes").mkString(", ") diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateStatsFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateStatsFormats.scala similarity index 100% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateStatsFormats.scala rename to core/src/main/contraband-scala/sbt/librarymanagement/UpdateStatsFormats.scala diff --git a/librarymanagement/src/main/contraband/librarymanagement.json b/core/src/main/contraband/librarymanagement.json similarity index 84% rename from librarymanagement/src/main/contraband/librarymanagement.json rename to core/src/main/contraband/librarymanagement.json index 28422cfd..fa7506f9 100644 --- a/librarymanagement/src/main/contraband/librarymanagement.json +++ b/core/src/main/contraband/librarymanagement.json @@ -2,6 +2,133 @@ "codecNamespace": "sbt.librarymanagement", "fullCodec": "LibraryManagementCodec", "types": [ + { + "name": "UpdateConfiguration", + "namespace": "sbt.librarymanagement", + "target": "Scala", + "type": "record", + "fields": [ + { + "name": "retrieveManaged", + "doc": [ + "If set to some RetrieveConfiguration, this enables retrieving dependencies to the specified directory.", + "Otherwise, dependencies are used directly from the cache." + ], + "type": "sbt.librarymanagement.RetrieveConfiguration?", + "default": "None", + "since": "0.0.1" + }, + { + "name": "missingOk", + "doc": [ + "If set to true, it ignores when artifacts are missing.", + "This setting could be uses when retrieving source/javadocs jars opportunistically." + ], + "type": "boolean", + "default": "false", + "since": "0.0.1" + }, + { + "name": "logging", + "doc": [ + "Logging setting used specifially for library management." + ], + "type": "sbt.librarymanagement.UpdateLogging", + "default": "sbt.librarymanagement.UpdateLogging.Default", + "since": "0.0.1" + }, + { + "name": "logicalClock", + "doc": [ + "The clock that may be used for caching." + ], + "type": "sbt.librarymanagement.LogicalClock", + "default": "sbt.librarymanagement.LogicalClock.unknown", + "since": "0.0.1" + }, + { + "name": "metadataDirectory", + "doc": [ + "The base directory that may be used to store metadata." + ], + "type": "java.io.File?", + "default": "None", + "since": "0.0.1" + }, + { "name": "artifactFilter", "type": "sbt.librarymanagement.ArtifactTypeFilter?", "default": "None", "since": "0.0.1" }, + { + "name": "offline", + "type": "boolean", + "default": "false", + "since": "0.0.1" + }, + { + "name": "frozen", + "type": "boolean", + "default": "false", + "since": "0.0.1" + } + ] + }, + { + "name": "RetrieveConfiguration", + "namespace": "sbt.librarymanagement", + "target": "Scala", + "type": "record", + "fields": [ + { "name": "retrieveDirectory", "type": "java.io.File?", "default": "None", "since": "0.0.1" }, + { "name": "outputPattern", "type": "String?", "default": "None", "since": "0.0.1" }, + { "name": "sync", "type": "boolean", "default": "false", "since": "0.0.2" }, + { "name": "configurationsToRetrieve", "type": "scala.Vector[sbt.librarymanagement.ConfigRef]?", "default": "None", "since": "0.0.2" } + ] + }, + { + "name": "GetClassifiersConfiguration", + "namespace": "sbt.librarymanagement", + "target": "Scala", + "type": "record", + "fields": [ + { "name": "module", "type": "sbt.librarymanagement.GetClassifiersModule" }, + { "name": "excludes", "type": "scala.Tuple2[sbt.librarymanagement.ModuleID, scala.Vector[sbt.librarymanagement.ConfigRef]]*" }, + { "name": "updateConfiguration", "type": "sbt.librarymanagement.UpdateConfiguration" }, + { "name": "sourceArtifactTypes", "type": "String*" }, + { "name": "docArtifactTypes", "type": "String*" } + ] + }, + { + "name": "GetClassifiersModule", + "namespace": "sbt.librarymanagement", + "target": "Scala", + "type": "record", + "fields": [ + { "name": "id", "type": "sbt.librarymanagement.ModuleID" }, + { "name": "scalaModuleInfo", "type": "sbt.librarymanagement.ScalaModuleInfo?" }, + { "name": "dependencies", "type": "sbt.librarymanagement.ModuleID*" }, + { "name": "configurations", "type": "sbt.librarymanagement.Configuration*" }, + { "name": "classifiers", "type": "String*" } + ] + }, + { + "name": "PublishConfiguration", + "namespace": "sbt.librarymanagement", + "target": "Scala", + "type": "record", + "fields": [ + { "name": "publishMavenStyle", "type": "boolean", "default": "true", "since": "0.0.1" }, + { "name": "deliverIvyPattern", "type": "String?", "default": "None", "since": "0.0.1" }, + { "name": "status", "type": "String?", "default": "None", "since": "0.0.1" }, + { "name": "configurations", "type": "scala.Vector[sbt.librarymanagement.ConfigRef]?", "default": "None", "since": "0.0.1" }, + { "name": "resolverName", "type": "String?", "default": "None", "since": "0.0.1" }, + { "name": "artifacts", "type": "scala.Tuple2[sbt.librarymanagement.Artifact, java.io.File]*", "default": "Vector()", "since": "0.0.1" }, + { + "name": "checksums", + "type": "scala.Vector[String]", + "default": "Vector(\"sha1\", \"md5\")", + "since": "0.0.1" }, + { "name": "logging", "type": "sbt.librarymanagement.UpdateLogging?", "default": "None", "since": "0.0.1" }, + { "name": "overwrite", "type": "boolean", "default": "false", "since": "0.0.1" } + ] + }, { "name": "Artifact", "namespace": "sbt.librarymanagement", @@ -240,7 +367,7 @@ "parentsCompanion": "sbt.librarymanagement.InclExclRuleFunctions" }, { - "name": "IvyScala", + "name": "ScalaModuleInfo", "namespace": "sbt.librarymanagement", "target": "Scala", "type": "record", @@ -253,8 +380,7 @@ { "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" + ] }, { "name": "ModuleConfiguration", @@ -367,8 +493,18 @@ "target": "Scala", "type": "interface", "fields": [ - { "name": "validate", "type": "boolean" }, - { "name": "ivyScala", "type": "sbt.librarymanagement.IvyScala?" } + { + "name": "validate", + "type": "boolean", + "default": "false", + "since": "0.0.1" + }, + { + "name": "scalaModuleInfo", + "type": "sbt.librarymanagement.ScalaModuleInfo?", + "default": "None", + "since": "0.0.1" + } ], "types": [ { @@ -392,20 +528,49 @@ ] }, { - "name": "InlineConfiguration", - "namespace": "sbt.internal.librarymanagement", + "name": "ModuleDescriptorConfiguration", + "docs": [ + "A module descriptor that represents a subproject, formerly known as an InlineConfiguration." + ], + "namespace": "sbt.librarymanagement", "target": "Scala", "type": "record", "fields": [ - { "name": "module", "type": "sbt.librarymanagement.ModuleID" }, - { "name": "moduleInfo", "type": "sbt.librarymanagement.ModuleInfo" }, - { "name": "dependencies", "type": "sbt.librarymanagement.ModuleID*" }, - { "name": "overrides", "type": "Set[sbt.librarymanagement.ModuleID]", "default": "Set.empty", "since": "0.0.1" }, - { "name": "excludes", "type": "sbt.librarymanagement.InclExclRule*", "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": "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" } + { + "name": "module", + "type": "sbt.librarymanagement.ModuleID" + }, + { + "name": "moduleInfo", + "type": "sbt.librarymanagement.ModuleInfo" + }, + { + "name": "dependencies", + "type": "sbt.librarymanagement.ModuleID*", + "default": "Vector.empty", + "since": "0.0.1" + }, + { + "name": "overrides", + "type": "sbt.librarymanagement.ModuleID*", + "default": "Vector.empty", + "since": "0.0.1" + }, + { "name": "excludes", "type": "sbt.librarymanagement.InclExclRule*", "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": "sbt.librarymanagement.Configurations.default", + "since": "0.0.1" + }, + { + "name": "defaultConfiguration", + "type": "sbt.librarymanagement.Configuration?", + "default": "Option(sbt.librarymanagement.Configurations.Compile)", + "since": "0.0.1" + }, + { "name": "conflictManager", "type": "sbt.librarymanagement.ConflictManager", "default": "sbt.librarymanagement.ConflictManager.default", "since": "0.0.1" } ], "parentsCompanion": "sbt.internal.librarymanagement.InlineConfigurationFunctions" } @@ -650,20 +815,6 @@ { "name": "port", "type": "int?" } ] }, - { - "name": "UpdateConfiguration", - "namespace": "sbt.librarymanagement", - "target": "Scala", - "type": "record", - "fields": [ - { "name": "retrieve", "type": "sbt.internal.librarymanagement.RetrieveConfiguration?" }, - { "name": "missingOk", "type": "boolean" }, - { "name": "logging", "type": "sbt.librarymanagement.UpdateLogging" }, - { "name": "artifactFilter", "type": "sbt.librarymanagement.ArtifactTypeFilter" }, - { "name": "offline", "type": "boolean" }, - { "name": "frozen", "type": "boolean" } - ] - }, { "name": "UpdateLogging", "namespace": "sbt.librarymanagement", @@ -733,83 +884,6 @@ { "name": "details", "type": "sbt.librarymanagement.OrganizationArtifactReport*" } ] }, - { - "name": "IvyConfiguration", - "namespace": "sbt.internal.librarymanagement", - "target": "Scala", - "type": "interface", - "fields": [ - { "name": "lock", "type": "xsbti.GlobalLock?" }, - { "name": "baseDirectory", "type": "java.io.File" }, - { "name": "log", "type": "xsbti.Logger" }, - { "name": "updateOptions", "type": "sbt.librarymanagement.UpdateOptions" } - ], - "types": [ - { - "name": "InlineIvyConfiguration", - "namespace": "sbt.internal.librarymanagement", - "target": "Scala", - "type": "record", - "fields": [ - { "name": "paths", "type": "sbt.internal.librarymanagement.IvyPaths" }, - { "name": "resolvers", "type": "sbt.librarymanagement.Resolver*" }, - { "name": "otherResolvers", "type": "sbt.librarymanagement.Resolver*" }, - { "name": "moduleConfigurations", "type": "sbt.librarymanagement.ModuleConfiguration*" }, - { "name": "checksums", "type": "String*" }, - { "name": "managedChecksums", "type": "Boolean" }, - { "name": "resolutionCacheDir", "type": "java.io.File?" } - ], - "extra": [ - "def this(", - " paths: sbt.internal.librarymanagement.IvyPaths,", - " resolvers: Vector[sbt.librarymanagement.Resolver],", - " otherResolvers: Vector[sbt.librarymanagement.Resolver],", - " moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration],", - " lock: Option[xsbti.GlobalLock],", - " checksums: Vector[String],", - " managedChecksums: Boolean,", - " resolutionCacheDir: Option[java.io.File],", - " updateOptions: sbt.librarymanagement.UpdateOptions,", - " log: xsbti.Logger", - ") =", - " this(lock, paths.baseDirectory, log, updateOptions, paths, resolvers, otherResolvers,", - " moduleConfigurations, checksums, managedChecksums, resolutionCacheDir)" - ] - }, - { - "name": "ExternalIvyConfiguration", - "namespace": "sbt.internal.librarymanagement", - "target": "Scala", - "type": "record", - "fields": [ - { "name": "uri", "type": "java.net.URI" }, - { "name": "extraResolvers", "type": "sbt.librarymanagement.Resolver*" } - ] - } - ] - }, - { - "name": "IvyPaths", - "namespace": "sbt.internal.librarymanagement", - "target": "Scala", - "type": "record", - "fields": [ - { "name": "baseDirectory", "type": "java.io.File" }, - { "name": "ivyHome", "type": "java.io.File?" } - ] - }, - { - "name": "RetrieveConfiguration", - "namespace": "sbt.internal.librarymanagement", - "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": "Option[Set[sbt.librarymanagement.ConfigRef]]", "default": "None", "since": "0.0.1" } - ] - }, { "name": "UpdateReportLite", "namespace": "sbt.internal.librarymanagement", diff --git a/librarymanagement/src/main/java/sbt/internal/librarymanagement/mavenint/SbtPomExtraProperties.java b/core/src/main/java/sbt/internal/librarymanagement/mavenint/SbtPomExtraProperties.java similarity index 100% rename from librarymanagement/src/main/java/sbt/internal/librarymanagement/mavenint/SbtPomExtraProperties.java rename to core/src/main/java/sbt/internal/librarymanagement/mavenint/SbtPomExtraProperties.java diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/CompatibilityWarning.scala b/core/src/main/scala/sbt/internal/librarymanagement/CompatibilityWarning.scala similarity index 86% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/CompatibilityWarning.scala rename to core/src/main/scala/sbt/internal/librarymanagement/CompatibilityWarning.scala index 42d3e6ca..3ad19257 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/CompatibilityWarning.scala +++ b/core/src/main/scala/sbt/internal/librarymanagement/CompatibilityWarning.scala @@ -26,7 +26,7 @@ object CompatibilityWarningOptions { private[sbt] object CompatibilityWarning { def run( config: CompatibilityWarningOptions, - module: IvySbt#Module, + module: ModuleDescriptor, mavenStyle: Boolean, log: Logger ): Unit = { @@ -36,20 +36,16 @@ private[sbt] object CompatibilityWarning { } def processIntransitive( config: CompatibilityWarningOptions, - module: IvySbt#Module, + module: ModuleDescriptor, log: Logger ): Unit = { val monitoredConfigsStr: Set[String] = (config.configurations map { _.name }).toSet - val directDependencies: Seq[ModuleID] = module.moduleSettings match { - case x: InlineConfiguration => x.dependencies - case _ => Seq() - } def inMonitoredConfigs(configOpt: Option[String]): Boolean = configOpt match { case Some(c) => (c.split(",").toSet intersect monitoredConfigsStr).nonEmpty case None => monitoredConfigsStr contains "compile" } - directDependencies foreach { m => + module.directDependencies foreach { m => if (!m.isTransitive && inMonitoredConfigs(m.configurations)) { log.warn( s"""Found intransitive dependency ($m) while publishMavenStyle is true, but Maven repositories diff --git a/core/src/main/scala/sbt/internal/librarymanagement/InternalDefaults.scala b/core/src/main/scala/sbt/internal/librarymanagement/InternalDefaults.scala new file mode 100644 index 00000000..277d54db --- /dev/null +++ b/core/src/main/scala/sbt/internal/librarymanagement/InternalDefaults.scala @@ -0,0 +1,29 @@ +package sbt +package internal.librarymanagement + +import java.io.File +import sbt.librarymanagement._ +import sbt.io.syntax._ + +/** + * This is a list of functions with default values. + */ +object InternalDefaults { + val sbtOrgTemp = JsonUtil.sbtOrgTemp + val modulePrefixTemp = "temp-module-" + + def getArtifactTypeFilter(opt: Option[ArtifactTypeFilter]): ArtifactTypeFilter = + opt.getOrElse(Artifact.defaultArtifactTypeFilter) + + def defaultRetrieveDirectory: File = + (new File(".")).getAbsoluteFile / "lib_managed" + + def getRetrieveDirectory(opt: Option[File]): File = + opt.getOrElse(defaultRetrieveDirectory) + + def getRetrievePattern(opt: Option[String]): String = + opt.getOrElse(Resolver.defaultRetrievePattern) + + def getDeliverStatus(opt: Option[String]): String = + opt.getOrElse("release") +} diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyConfigurations.scala b/core/src/main/scala/sbt/internal/librarymanagement/IvyConfigurations.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyConfigurations.scala rename to core/src/main/scala/sbt/internal/librarymanagement/IvyConfigurations.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/JsonUtil.scala b/core/src/main/scala/sbt/internal/librarymanagement/JsonUtil.scala similarity index 97% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/JsonUtil.scala rename to core/src/main/scala/sbt/internal/librarymanagement/JsonUtil.scala index 4532b019..85f5c387 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/JsonUtil.scala +++ b/core/src/main/scala/sbt/internal/librarymanagement/JsonUtil.scala @@ -1,17 +1,15 @@ package sbt.internal.librarymanagement import java.io.File -import org.apache.ivy.core.module.descriptor.ModuleDescriptor -import sbt.io.IO import sbt.util.{ CacheStore, Logger } import sbt.librarymanagement._, LibraryManagementCodec._ +import sbt.io.IO private[sbt] object JsonUtil { def sbtOrgTemp = "org.scala-sbt.temp" def fakeCallerOrganization = "org.scala-sbt.temp-callers" def parseUpdateReport( - md: ModuleDescriptor, path: File, cachedDescriptor: File, log: Logger diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/StringUtilities.scala b/core/src/main/scala/sbt/internal/librarymanagement/StringUtilities.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/StringUtilities.scala rename to core/src/main/scala/sbt/internal/librarymanagement/StringUtilities.scala diff --git a/core/src/main/scala/sbt/internal/librarymanagement/UpdateClassifiersUtil.scala b/core/src/main/scala/sbt/internal/librarymanagement/UpdateClassifiersUtil.scala new file mode 100644 index 00000000..c01e781a --- /dev/null +++ b/core/src/main/scala/sbt/internal/librarymanagement/UpdateClassifiersUtil.scala @@ -0,0 +1,79 @@ +package sbt.internal.librarymanagement + +import java.io.File +import sbt.librarymanagement._ + +object UpdateClassifiersUtil { + + def restrictedCopy(m: ModuleID, confs: Boolean) = + ModuleID(m.organization, m.name, m.revision) + .withCrossVersion(m.crossVersion) + .withExtraAttributes(m.extraAttributes) + .withConfigurations(if (confs) m.configurations else None) + .branch(m.branchName) + + // This version adds explicit artifact + def classifiedArtifacts( + classifiers: Vector[String], + exclude: Map[ModuleID, Set[ConfigRef]], + artifacts: Vector[(String, ModuleID, Artifact, File)] + )(m: ModuleID): Option[ModuleID] = { + def sameModule(m1: ModuleID, m2: ModuleID): Boolean = + m1.organization == m2.organization && m1.name == m2.name && m1.revision == m2.revision + def explicitArtifacts = { + val arts = (artifacts collect { + case (_, x, art, _) if sameModule(m, x) && art.classifier.isDefined => art + }).distinct + if (arts.isEmpty) None + else Some(intransitiveModuleWithExplicitArts(m, arts)) + } + def hardcodedArtifacts = classifiedArtifacts(classifiers, exclude)(m) + explicitArtifacts orElse hardcodedArtifacts + } + + def classifiedArtifacts( + classifiers: Vector[String], + exclude: Map[ModuleID, Set[ConfigRef]] + )(m: ModuleID): Option[ModuleID] = { + val excluded: Set[ConfigRef] = exclude getOrElse (restrictedCopy(m, false), Set.empty) + val exls = excluded map { _.name } + val included = classifiers filterNot exls + if (included.isEmpty) None + else { + Some( + intransitiveModuleWithExplicitArts( + module = m, + arts = classifiedArtifacts(m.name, included) + ) + ) + } + } + + def classifiedArtifacts(name: String, classifiers: Vector[String]): Vector[Artifact] = + classifiers map { c => + Artifact.classified(name, c) + } + + /** + * Explicitly set an "include all" rule (the default) because otherwise, if we declare ANY explicitArtifacts, + * [[org.apache.ivy.core.resolve.IvyNode#getArtifacts]] (in Ivy 2.3.0-rc1) will not merge in the descriptor's + * artifacts and will only keep the explicitArtifacts. + *
+ * Look for the comment saying {{{ + * // and now we filter according to include rules + * }}} + * in `IvyNode`, which iterates on `includes`, which will ordinarily be empty because higher up, in {{{ + * addAllIfNotNull(includes, usage.getDependencyIncludesSet(rootModuleConf)); + * }}} + * `usage.getDependencyIncludesSet` returns null if there are no (explicit) include rules. + */ + private def intransitiveModuleWithExplicitArts( + module: ModuleID, + arts: Vector[Artifact] + ): ModuleID = + module + .withIsTransitive(false) + .withExplicitArtifacts(arts) + .withInclusions(Vector(InclExclRule.everything)) + +} diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/VersionRange.scala b/core/src/main/scala/sbt/internal/librarymanagement/VersionRange.scala similarity index 94% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/VersionRange.scala rename to core/src/main/scala/sbt/internal/librarymanagement/VersionRange.scala index 38c5661b..eed2eebb 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/VersionRange.scala +++ b/core/src/main/scala/sbt/internal/librarymanagement/VersionRange.scala @@ -20,14 +20,14 @@ object VersionRange { if (isVersionRange(version)) { val noSpace = version.replaceAllLiterally(" ", "") noSpace match { - case MavenVersionSetPattern(open1, x1, comma, x2, close1, rest) => + case MavenVersionSetPattern(open1, x1, comma, x2, close1, _) => // http://maven.apache.org/components/enforcer/enforcer-rules/versionRanges.html (open1, Option(x1), Option(comma), Option(x2), close1) match { case (_, None, _, Some(x2), "]") => Some(x2) // a good upper bound is unknown - case (_, None, _, Some(x2), ")") => None - case (_, Some(x1), _, None, _) => Some(x1) - case _ => None + case (_, None, _, Some(_), ")") => None + case (_, Some(x1), _, None, _) => Some(x1) + case _ => None } case _ => None } @@ -68,7 +68,7 @@ object VersionRange { case _ => revision } } catch { - case e: NumberFormatException => + case _: NumberFormatException => // TODO - if the version doesn't meet our expectations, maybe we just issue a hard // error instead of softly ignoring the attempt to rewrite. //sys.error(s"Could not fix version [$revision] into maven style version") diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/cross/CrossVersionUtil.scala b/core/src/main/scala/sbt/internal/librarymanagement/cross/CrossVersionUtil.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/cross/CrossVersionUtil.scala rename to core/src/main/scala/sbt/internal/librarymanagement/cross/CrossVersionUtil.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/GlobalLockFormat.scala b/core/src/main/scala/sbt/internal/librarymanagement/formats/GlobalLockFormat.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/GlobalLockFormat.scala rename to core/src/main/scala/sbt/internal/librarymanagement/formats/GlobalLockFormat.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/LoggerFormat.scala b/core/src/main/scala/sbt/internal/librarymanagement/formats/LoggerFormat.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/LoggerFormat.scala rename to core/src/main/scala/sbt/internal/librarymanagement/formats/LoggerFormat.scala diff --git a/core/src/main/scala/sbt/internal/librarymanagement/formats/LogicalClockFormats.scala b/core/src/main/scala/sbt/internal/librarymanagement/formats/LogicalClockFormats.scala new file mode 100644 index 00000000..9daca4a9 --- /dev/null +++ b/core/src/main/scala/sbt/internal/librarymanagement/formats/LogicalClockFormats.scala @@ -0,0 +1,13 @@ +package sbt.internal.librarymanagement.formats + +import sjsonnew._ + +import sbt.librarymanagement.LogicalClock + +trait LogicalClockFormats { self: BasicJsonProtocol => + implicit lazy val LogicalClockFormat: JsonFormat[LogicalClock] = + projectFormat[LogicalClock, String]( + cl => cl.toString, + str => LogicalClock(str) + ) +} diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/NodeSeqFormat.scala b/core/src/main/scala/sbt/internal/librarymanagement/formats/NodeSeqFormat.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/NodeSeqFormat.scala rename to core/src/main/scala/sbt/internal/librarymanagement/formats/NodeSeqFormat.scala diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/ArtifactExtra.scala b/core/src/main/scala/sbt/librarymanagement/ArtifactExtra.scala similarity index 93% rename from librarymanagement/src/main/scala/sbt/librarymanagement/ArtifactExtra.scala rename to core/src/main/scala/sbt/librarymanagement/ArtifactExtra.scala index 62fac2e6..3bd58fe5 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/ArtifactExtra.scala +++ b/core/src/main/scala/sbt/librarymanagement/ArtifactExtra.scala @@ -70,8 +70,11 @@ abstract class ArtifactFunctions { def pom(name: String) = Artifact(name, PomType, PomType, None, Vector(Pom), None) // Possible ivy artifact types such that sbt will treat those artifacts at sources / docs - val DefaultSourceTypes = Set("src", "source", "sources") - val DefaultDocTypes = Set("doc", "docs", "javadoc", "javadocs") + val DefaultSourceTypes: Set[String] = Set("src", "source", "sources") + val DefaultDocTypes: Set[String] = Set("doc", "docs", "javadoc", "javadocs") + val specialArtifactTypes: Set[String] = DefaultSourceTypes union DefaultDocTypes + val defaultArtifactTypeFilter: ArtifactTypeFilter = + ArtifactTypeFilter.forbid(specialArtifactTypes) val DocClassifier = "javadoc" val SourceClassifier = "sources" diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/Configuration.scala b/core/src/main/scala/sbt/librarymanagement/Configuration.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/librarymanagement/Configuration.scala rename to core/src/main/scala/sbt/librarymanagement/Configuration.scala diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala b/core/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala similarity index 86% rename from librarymanagement/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala rename to core/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala index 954a3eea..6f19e572 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala +++ b/core/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala @@ -7,14 +7,15 @@ import scala.annotation.tailrec import scala.language.experimental.macros object Configurations { - def config(name: String) = macro ConfigurationMacro.configMacroImpl - def default: Seq[Configuration] = defaultMavenConfigurations - def defaultMavenConfigurations: Seq[Configuration] = - Seq(Compile, Runtime, Test, Provided, Optional) - def defaultInternal: Seq[Configuration] = Seq(CompileInternal, RuntimeInternal, TestInternal) - def auxiliary: Seq[Configuration] = Seq(Pom) - def names(cs: Seq[Configuration]) = cs.map(_.name) - def refs(cs: Seq[Configuration]) = cs.map(_.toConfigRef) + def config(name: String): Configuration = macro ConfigurationMacro.configMacroImpl + def default: Vector[Configuration] = defaultMavenConfigurations + def defaultMavenConfigurations: Vector[Configuration] = + Vector(Compile, Runtime, Test, Provided, Optional) + def defaultInternal: Vector[Configuration] = + Vector(CompileInternal, RuntimeInternal, TestInternal) + def auxiliary: Vector[Configuration] = Vector(Pom) + def names(cs: Vector[Configuration]): Vector[String] = cs.map(_.name) + def refs(cs: Vector[Configuration]): Vector[ConfigRef] = cs.map(_.toConfigRef) lazy val RuntimeInternal = optionalInternal(Runtime) lazy val TestInternal = fullInternal(Test) @@ -103,7 +104,7 @@ abstract class ConfigurationExtra { private[sbt] object ConfigurationMacro { import scala.reflect.macros._ - def configMacroImpl(c: Context)(name: c.Expr[String]): c.Expr[Configuration] = { + def configMacroImpl(c: blackbox.Context)(name: c.Expr[String]): c.Expr[Configuration] = { import c.universe._ val enclosingValName = definingValName( c, @@ -120,10 +121,10 @@ private[sbt] object ConfigurationMacro { n.decodedName.toString.trim // trim is not strictly correct, but macros don't expose the API necessary @tailrec def enclosingVal(trees: List[c.Tree]): String = { trees match { - case vd @ ValDef(_, name, _, _) :: ts => processName(name) + case ValDef(_, name, _, _) :: _ => processName(name) case (_: ApplyTree | _: Select | _: TypeApply) :: xs => enclosingVal(xs) // lazy val x: X = has this form for some reason (only when the explicit type is present, though) - case Block(_, _) :: DefDef(mods, name, _, _, _, _) :: xs if mods.hasFlag(Flag.LAZY) => + case Block(_, _) :: DefDef(mods, name, _, _, _, _) :: _ if mods.hasFlag(Flag.LAZY) => processName(name) case _ => c.error(c.enclosingPosition, invalidEnclosingTree(methodName.decodedName.toString)) diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/ConfigurationFormats.scala b/core/src/main/scala/sbt/librarymanagement/ConfigurationFormats.scala similarity index 95% rename from librarymanagement/src/main/scala/sbt/librarymanagement/ConfigurationFormats.scala rename to core/src/main/scala/sbt/librarymanagement/ConfigurationFormats.scala index 30c09a45..c292cbc2 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/ConfigurationFormats.scala +++ b/core/src/main/scala/sbt/librarymanagement/ConfigurationFormats.scala @@ -4,7 +4,8 @@ package sbt package librarymanagement -import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder } +import _root_.sjsonnew.{ deserializationError, Builder, JsonFormat, Unbuilder } + trait ConfigurationFormats { self: sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol => implicit lazy val ConfigurationFormat: JsonFormat[sbt.librarymanagement.Configuration] = diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/ConflictWarning.scala b/core/src/main/scala/sbt/librarymanagement/ConflictWarning.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/librarymanagement/ConflictWarning.scala rename to core/src/main/scala/sbt/librarymanagement/ConflictWarning.scala diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/CrossVersionExtra.scala b/core/src/main/scala/sbt/librarymanagement/CrossVersionExtra.scala similarity index 96% rename from librarymanagement/src/main/scala/sbt/librarymanagement/CrossVersionExtra.scala rename to core/src/main/scala/sbt/librarymanagement/CrossVersionExtra.scala index 0ce279c2..93c28a19 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/CrossVersionExtra.scala +++ b/core/src/main/scala/sbt/librarymanagement/CrossVersionExtra.scala @@ -1,6 +1,7 @@ package sbt.librarymanagement import sbt.internal.librarymanagement.cross.CrossVersionUtil +import sbt.librarymanagement.syntax._ final case class ScalaVersion(full: String, binary: String) @@ -79,11 +80,11 @@ abstract class CrossVersionFunctions { } /** Constructs the cross-version function defined by `module` and `is`, if one is configured. */ - def apply(module: ModuleID, is: IvyScala): Option[String => String] = + def apply(module: ModuleID, is: ScalaModuleInfo): Option[String => String] = CrossVersion(module.crossVersion, is.scalaFullVersion, is.scalaBinaryVersion) /** Constructs the cross-version function defined by `module` and `is`, if one is configured. */ - def apply(module: ModuleID, is: Option[IvyScala]): Option[String => String] = + def apply(module: ModuleID, is: Option[ScalaModuleInfo]): Option[String => String] = is.flatMap(i => apply(module, i)) /** Cross-version each `Artifact` in `artifacts` according to cross-version function `cross`. */ @@ -108,7 +109,7 @@ abstract class CrossVersionFunctions { /** Cross-versions `exclude` according to its `crossVersion`. */ private[sbt] def substituteCross( exclude: ExclusionRule, - is: Option[IvyScala] + is: Option[ScalaModuleInfo] ): ExclusionRule = { val fopt: Option[String => String] = is flatMap { i => diff --git a/core/src/main/scala/sbt/librarymanagement/DependencyBuilders.scala b/core/src/main/scala/sbt/librarymanagement/DependencyBuilders.scala new file mode 100755 index 00000000..09b1d846 --- /dev/null +++ b/core/src/main/scala/sbt/librarymanagement/DependencyBuilders.scala @@ -0,0 +1,75 @@ +/* sbt -- Simple Build Tool + * Copyright 2009,2010 Mark Harrah + */ +package sbt.librarymanagement + +import sbt.internal.librarymanagement.StringUtilities.nonEmpty + +/** + * DependencyBuilders implements the implicits for % and %% DSL. + */ +trait DependencyBuilders { + // See http://www.scala-lang.org/news/2.12.0#traits-compile-to-interfaces + // Avoid defining fields (val or var, but a constant is ok – final val without result type) + // Avoid calling super + // Avoid initializer statements in the body + + import DependencyBuilders._ + + implicit def stringToOrganization(organization: String): Organization = { + nonEmpty(organization, "Organization") + new Organization(organization) + } + + implicit def toRepositoryName(name: String): RepositoryName = { + nonEmpty(name, "Repository name") + new RepositoryName(name) + } + + implicit def moduleIDConfigurable(m: ModuleID): ModuleIDConfigurable = { + require(m.configurations.isEmpty, "Configurations already specified for module " + m) + new ModuleIDConfigurable(m) + } +} + +object DependencyBuilders { + final class Organization private[sbt] (private[sbt] val organization: String) { + def %(name: String) = organizationArtifact(name, Disabled()) + def %%(name: String): OrganizationArtifactName = + organizationArtifact(name, CrossVersion.binary) + + private def organizationArtifact(name: String, cross: CrossVersion) = { + nonEmpty(name, "Name") + new OrganizationArtifactName(organization, name, cross) + } + } + + final class OrganizationArtifactName private[sbt] ( + private[sbt] val organization: String, + private[sbt] val name: String, + private[sbt] val crossVersion: CrossVersion + ) { + def %(revision: String): ModuleID = { + nonEmpty(revision, "Revision") + ModuleID(organization, name, revision).cross(crossVersion) + } + } + + final class ModuleIDConfigurable private[sbt] (moduleID: ModuleID) { + def %(configuration: Configuration): ModuleID = %(configuration.name) + def %(configuration: ConfigRef): ModuleID = %(configuration.name) + + def %(configurations: String): ModuleID = { + nonEmpty(configurations, "Configurations") + val c = configurations + moduleID.withConfigurations(configurations = Some(c)) + } + } + + final class RepositoryName private[sbt] (name: String) { + def at(location: String) = { + nonEmpty(location, "Repository location") + MavenRepository(name, location) + } + } +} diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/DependencyFilter.scala b/core/src/main/scala/sbt/librarymanagement/DependencyFilter.scala similarity index 94% rename from librarymanagement/src/main/scala/sbt/librarymanagement/DependencyFilter.scala rename to core/src/main/scala/sbt/librarymanagement/DependencyFilter.scala index 969271fe..2f2adf76 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/DependencyFilter.scala +++ b/core/src/main/scala/sbt/librarymanagement/DependencyFilter.scala @@ -6,6 +6,11 @@ package sbt.librarymanagement import sbt.io.{ AllPassFilter, NameFilter } trait DependencyFilterExtra { + // See http://www.scala-lang.org/news/2.12.0#traits-compile-to-interfaces + // Avoid defining fields (val or var, but a constant is ok – final val without result type) + // Avoid calling super + // Avoid initializer statements in the body + def moduleFilter( organization: NameFilter = AllPassFilter, name: NameFilter = AllPassFilter, @@ -15,6 +20,7 @@ trait DependencyFilterExtra { def apply(m: ModuleID): Boolean = organization.accept(m.organization) && name.accept(m.name) && revision.accept(m.revision) } + def artifactFilter( name: NameFilter = AllPassFilter, `type`: NameFilter = AllPassFilter, @@ -26,11 +32,13 @@ trait DependencyFilterExtra { name.accept(a.name) && `type`.accept(a.`type`) && extension.accept(a.extension) && classifier .accept(a.classifier getOrElse "") } + def configurationFilter(name: NameFilter = AllPassFilter): ConfigurationFilter = new ConfigurationFilter { def apply(c: ConfigRef): Boolean = name.accept(c.name) } } + object DependencyFilter extends DependencyFilterExtra { def make( configuration: ConfigurationFilter = configurationFilter(), diff --git a/core/src/main/scala/sbt/librarymanagement/DependencyResolution.scala b/core/src/main/scala/sbt/librarymanagement/DependencyResolution.scala new file mode 100644 index 00000000..f9f2f41c --- /dev/null +++ b/core/src/main/scala/sbt/librarymanagement/DependencyResolution.scala @@ -0,0 +1,203 @@ +package sbt.librarymanagement + +import java.io.File +import sbt.util.Logger +import sbt.io.Hash +import sbt.librarymanagement.syntax._ + +/** + * Library management API to resolve dependencies. + */ +class DependencyResolution private[sbt] (lmEngine: DependencyResolutionInterface) { + import sbt.internal.librarymanagement.InternalDefaults._ + import sbt.internal.librarymanagement.UpdateClassifiersUtil._ + + /** + * Builds a ModuleDescriptor that describes a subproject with dependencies. + * + * @param moduleSetting It contains the information about the module including the dependencies. + * @return A `ModuleDescriptor` describing a subproject and its dependencies. + */ + def moduleDescriptor(moduleSetting: ModuleDescriptorConfiguration): ModuleDescriptor = + lmEngine.moduleDescriptor(moduleSetting) + + /** + * Build a ModuleDescriptor that describes a subproject with dependencies. + * + * @param moduleId The root module for which to create a `ModuleDescriptor`. + * @param directDependencies The direct dependencies of the module. + * @param scalaModuleInfo The information about the Scala version used, if any. + * @param configurations The configurations that this module has. + * @return A `ModuleDescriptor` describing a subproject and its dependencies. + */ + def moduleDescriptor(moduleId: ModuleID, + directDependencies: Vector[ModuleID], + scalaModuleInfo: Option[ScalaModuleInfo]): ModuleDescriptor = { + val moduleSetting = ModuleDescriptorConfiguration(moduleId, ModuleInfo(moduleId.name)) + .withScalaModuleInfo(scalaModuleInfo) + .withDependencies(directDependencies) + moduleDescriptor(moduleSetting) + } + + /** + * Resolves the given module's dependencies performing a retrieval. + * + * @param module The module to be resolved. + * @param configuration The update configuration. + * @param uwconfig The configuration to handle unresolved warnings. + * @param log The logger. + * @return The result, either an unresolved warning or an update report. Note that this + * update report will or will not be successful depending on the `missingOk` option. + */ + def update(module: ModuleDescriptor, + configuration: UpdateConfiguration, + uwconfig: UnresolvedWarningConfiguration, + log: Logger): Either[UnresolvedWarning, UpdateReport] = + lmEngine.update(module, configuration, uwconfig, log) + + /** + * Returns a `ModuleDescriptor` that depends on `dependencyId`. + * + * @param dependencyId The module to depend on. + * @return A `ModuleDescriptor` that depends on `dependencyId`. + */ + def wrapDependencyInModule(dependencyId: ModuleID): ModuleDescriptor = + wrapDependencyInModule(dependencyId, None) + + /** + * Returns a `ModuleDescriptor` that depends on `dependencyId`. + * + * @param dependencyId The module to depend on. + * @param scalaModuleInfo The information about the Scala verson used, if any. + * @return A `ModuleDescriptor` that depends on `dependencyId`. + */ + def wrapDependencyInModule(dependencyId: ModuleID, + scalaModuleInfo: Option[ScalaModuleInfo]): ModuleDescriptor = { + val sha1 = Hash.toHex(Hash(dependencyId.name)) + val dummyID = ModuleID(sbtOrgTemp, modulePrefixTemp + sha1, dependencyId.revision) + .withConfigurations(dependencyId.configurations) + moduleDescriptor(dummyID, Vector(dependencyId), scalaModuleInfo) + } + + /** + * Resolves the given dependency, and retrieves the artifacts to a directory. + * + * @param dependencyId The dependency to be resolved. + * @param scalaModuleInfo The module info about Scala. + * @param retrieveDirectory The directory to retrieve the files. + * @param log The logger. + * @return The result, either an unresolved warning or a sequence of files. + */ + def retrieve(dependencyId: ModuleID, + scalaModuleInfo: Option[ScalaModuleInfo], + retrieveDirectory: File, + log: Logger): Either[UnresolvedWarning, Vector[File]] = + retrieve(wrapDependencyInModule(dependencyId, scalaModuleInfo), retrieveDirectory, log) + + /** + * Resolves the given module's dependencies, and retrieves the artifacts to a directory. + * + * @param module The module to be resolved. + * @param retrieveDirectory The directory to retrieve the files. + * @param log The logger. + * @return The result, either an unresolved warning or a sequence of files. + */ + def retrieve(module: ModuleDescriptor, + retrieveDirectory: File, + log: Logger): Either[UnresolvedWarning, Vector[File]] = { + // Using the default artifact type filter here, so sources and docs are excluded. + val retrieveConfiguration = RetrieveConfiguration() + .withRetrieveDirectory(retrieveDirectory) + val updateConfiguration = UpdateConfiguration() + .withRetrieveManaged(retrieveConfiguration) + // .withMissingOk(true) + log.debug(s"Attempting to fetch ${directDependenciesNames(module)}. This operation may fail.") + update( + module, + updateConfiguration, + UnresolvedWarningConfiguration(), + log + ) match { + case Left(unresolvedWarning) => Left(unresolvedWarning) + case Right(updateReport) => + val allFiles = + for { + conf <- updateReport.configurations + m <- conf.modules + (_, f) <- m.artifacts + } yield f + log.debug(s"Files retrieved for ${directDependenciesNames(module)}:") + log.debug(allFiles mkString ", ") + // allFiles filter predicate match { + // case Seq() => None + // case files => Some(files) + // } + Right(allFiles) + } + } + + /** + * Creates explicit artifacts for each classifier in `config.module`, and then attempts to resolve them directly. This + * is for Maven compatibility, where these artifacts are not "published" in the POM, so they don't end up in the Ivy + * that sbt generates for them either.
+ * Artifacts can be obtained from calling toSeq on UpdateReport.
+ * In addition, retrieves specific Ivy artifacts if they have one of the requested `config.configuration.types`. + * @param config important to set `config.configuration.types` to only allow artifact types that can correspond to + * "classified" artifacts (sources and javadocs). + */ + def updateClassifiers( + config: GetClassifiersConfiguration, + uwconfig: UnresolvedWarningConfiguration, + artifacts: Vector[(String, ModuleID, Artifact, File)], + log: Logger + ): Either[UnresolvedWarning, UpdateReport] = { + import config.{ updateConfiguration => c, module => mod, _ } + import mod.{ configurations => confs, _ } + val artifactFilter = getArtifactTypeFilter(c.artifactFilter) + assert(classifiers.nonEmpty, "classifiers cannot be empty") + assert(artifactFilter.types.nonEmpty, "UpdateConfiguration must filter on some types") + val baseModules = dependencies map { m => + restrictedCopy(m, true) + } + // Adding list of explicit artifacts here. + val exls = Map(excludes map { case (k, v) => (k, v.toSet) }: _*) + val deps = baseModules.distinct flatMap classifiedArtifacts(classifiers, exls, artifacts) + val base = restrictedCopy(id, true).withName(id.name + classifiers.mkString("$", "_", "")) + val moduleSetting = ModuleDescriptorConfiguration(base, ModuleInfo(base.name)) + .withScalaModuleInfo(scalaModuleInfo) + .withDependencies(deps) + .withConfigurations(confs) + val module = moduleDescriptor(moduleSetting) + + // c.copy ensures c.types is preserved too + val upConf = c.withMissingOk(true) + update(module, upConf, uwconfig, log) match { + case Right(r) => + // The artifacts that came from Ivy don't have their classifier set, let's set it according to + // FIXME: this is only done because IDE plugins depend on `classifier` to determine type. They + val typeClassifierMap: Map[String, String] = + ((sourceArtifactTypes.toIterable map (_ -> Artifact.SourceClassifier)) + :: (docArtifactTypes.toIterable map (_ -> Artifact.DocClassifier)) :: Nil).flatten.toMap + Right(r.substitute { (conf, mid, artFileSeq) => + artFileSeq map { + case (art, f) => + // Deduce the classifier from the type if no classifier is present already + art.withClassifier(art.classifier orElse typeClassifierMap.get(art.`type`)) -> f + } + }) + case Left(w) => Left(w) + } + } + + protected def directDependenciesNames(module: ModuleDescriptor): String = + (module.directDependencies map { + case mID: ModuleID => + import mID._ + s"$organization % $name % $revision" + }).mkString(", ") +} + +object DependencyResolution { + def apply(lmEngine: DependencyResolutionInterface): DependencyResolution = + new DependencyResolution(lmEngine) +} diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/EvictionWarning.scala b/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala similarity index 90% rename from librarymanagement/src/main/scala/sbt/librarymanagement/EvictionWarning.scala rename to core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala index 7316be80..36aebacc 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/EvictionWarning.scala +++ b/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala @@ -5,7 +5,6 @@ import Configurations.Compile import ScalaArtifacts.{ LibraryID, CompilerID } import sbt.util.Logger import sbt.util.ShowLines -import sbt.internal.librarymanagement.{ InlineConfiguration, IvySbt } final class EvictionWarningOptions private[sbt] ( val configurations: Seq[ConfigRef], @@ -14,7 +13,7 @@ final class EvictionWarningOptions private[sbt] ( val warnTransitiveEvictions: Boolean, val infoAllEvictions: Boolean, val showCallers: Boolean, - val guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean] + val guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[ScalaModuleInfo]), Boolean] ) { def withConfigurations(configurations: Seq[ConfigRef]): EvictionWarningOptions = copy(configurations = configurations) @@ -29,7 +28,7 @@ final class EvictionWarningOptions private[sbt] ( def withShowCallers(showCallers: Boolean): EvictionWarningOptions = copy(showCallers = showCallers) def withGuessCompatible( - guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean] + guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[ScalaModuleInfo]), Boolean] ): EvictionWarningOptions = copy(guessCompatible = guessCompatible) @@ -40,7 +39,7 @@ final class EvictionWarningOptions private[sbt] ( warnTransitiveEvictions: Boolean = warnTransitiveEvictions, infoAllEvictions: Boolean = infoAllEvictions, showCallers: Boolean = showCallers, - guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean] = + guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[ScalaModuleInfo]), Boolean] = guessCompatible ): EvictionWarningOptions = new EvictionWarningOptions( @@ -84,13 +83,14 @@ object EvictionWarningOptions { defaultGuess ) - lazy val defaultGuess: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean] = + lazy val defaultGuess + : Function1[(ModuleID, Option[ModuleID], Option[ScalaModuleInfo]), Boolean] = guessSecondSegment orElse guessSemVer orElse guessFalse lazy val guessSecondSegment - : PartialFunction[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean] = { - case (m1, Some(m2), Some(ivyScala)) - if m2.name.endsWith("_" + ivyScala.scalaFullVersion) || m2.name.endsWith( - "_" + ivyScala.scalaBinaryVersion + : PartialFunction[(ModuleID, Option[ModuleID], Option[ScalaModuleInfo]), Boolean] = { + case (m1, Some(m2), Some(scalaModuleInfo)) + if m2.name.endsWith("_" + scalaModuleInfo.scalaFullVersion) || m2.name.endsWith( + "_" + scalaModuleInfo.scalaBinaryVersion ) => (m1.revision, m2.revision) match { case (VersionNumber(ns1, ts1, es1), VersionNumber(ns2, ts2, es2)) => @@ -100,7 +100,7 @@ object EvictionWarningOptions { } } lazy val guessSemVer - : PartialFunction[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean] = { + : PartialFunction[(ModuleID, Option[ModuleID], Option[ScalaModuleInfo]), Boolean] = { case (m1, Some(m2), _) => (m1.revision, m2.revision) match { case (VersionNumber(ns1, ts1, es1), VersionNumber(ns2, ts2, es2)) => @@ -109,7 +109,8 @@ object EvictionWarningOptions { case _ => false } } - lazy val guessFalse: PartialFunction[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean] = { + lazy val guessFalse + : PartialFunction[(ModuleID, Option[ModuleID], Option[ScalaModuleInfo]), Boolean] = { case (_, _, _) => false } } @@ -176,7 +177,7 @@ final class EvictionWarning private[sbt] ( object EvictionWarning { def apply( - module: IvySbt#Module, + module: ModuleDescriptor, options: EvictionWarningOptions, report: UpdateReport, log: Logger @@ -207,11 +208,11 @@ object EvictionWarning { } private[sbt] def isScalaArtifact( - module: IvySbt#Module, + module: ModuleDescriptor, organization: String, name: String ): Boolean = - module.moduleSettings.ivyScala match { + module.scalaModuleInfo match { case Some(s) => organization == s.scalaOrganization && (name == LibraryID) || (name == CompilerID) @@ -219,14 +220,11 @@ object EvictionWarning { } private[sbt] def processEvictions( - module: IvySbt#Module, + module: ModuleDescriptor, options: EvictionWarningOptions, reports: Seq[OrganizationArtifactReport] ): EvictionWarning = { - val directDependencies = module.moduleSettings match { - case x: InlineConfiguration => x.dependencies - case _ => Vector.empty - } + val directDependencies = module.directDependencies val pairs = reports map { detail => val evicteds = detail.modules filter { _.evicted } val winner = (detail.modules filterNot { _.evicted }).headOption @@ -250,12 +248,12 @@ object EvictionWarning { def guessCompatible(p: EvictionPair): Boolean = p.evicteds forall { r => options.guessCompatible( - (r.module, p.winner map { _.module }, module.moduleSettings.ivyScala) + (r.module, p.winner map { _.module }, module.scalaModuleInfo) ) } pairs foreach { case p if isScalaArtifact(module, p.organization, p.name) => - (module.moduleSettings.ivyScala, p.winner) match { + (module.scalaModuleInfo, p.winner) match { case (Some(s), Some(winner)) if (s.scalaFullVersion != winner.module.revision) && options.warnScalaVersionEviction => scalaEvictions += p diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/IvyInterface.scala b/core/src/main/scala/sbt/librarymanagement/Extra.scala similarity index 71% rename from librarymanagement/src/main/scala/sbt/librarymanagement/IvyInterface.scala rename to core/src/main/scala/sbt/librarymanagement/Extra.scala index 25eb5bc1..8c6eebf1 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/IvyInterface.scala +++ b/core/src/main/scala/sbt/librarymanagement/Extra.scala @@ -3,9 +3,7 @@ */ package sbt.librarymanagement -import org.apache.ivy.core.module.descriptor -import org.apache.ivy.util.filter.{ Filter => IvyFilter } -import sbt.internal.librarymanagement.impl.{ GroupArtifactID, GroupID } +import sbt.librarymanagement.DependencyBuilders.{ Organization, OrganizationArtifactName } abstract class InclExclRuleFunctions { def everything = InclExclRule("*", "*", "*", Vector.empty, Disabled()) @@ -15,12 +13,13 @@ abstract class InclExclRuleFunctions { def apply(organization: String): InclExclRule = apply(organization, "*") - implicit def groupIdToExclusionRule(organization: GroupID): InclExclRule = - apply(organization.groupID) + implicit def organizationToExclusionRule(organization: Organization): InclExclRule = + apply(organization.organization) implicit def stringToExclusionRule(organization: String): InclExclRule = apply(organization) - implicit def groupArtifactIDToExclusionRule(gaid: GroupArtifactID): InclExclRule = - InclExclRule(gaid.groupID, gaid.artifactID, "*", Vector.empty, gaid.crossVersion) + implicit def organizationArtifactNameToExclusionRule( + oa: OrganizationArtifactName): InclExclRule = + InclExclRule(oa.organization, oa.name, "*", Vector.empty, oa.crossVersion) implicit def moduleIDToExclusionRule(moduleID: ModuleID): InclExclRule = { val org = moduleID.organization @@ -41,18 +40,11 @@ abstract class ArtifactTypeFilterExtra { ): ArtifactTypeFilter def invert = copy(inverted = !inverted) - def apply(a: descriptor.Artifact): Boolean = (types contains a.getType) ^ inverted } abstract class ArtifactTypeFilterFunctions { def allow(types: Set[String]) = ArtifactTypeFilter(types, false) def forbid(types: Set[String]) = ArtifactTypeFilter(types, true) - - implicit def toIvyFilter(f: ArtifactTypeFilter): IvyFilter = new IvyFilter { - override def accept(o: Object): Boolean = Option(o) exists { - case a: descriptor.Artifact => f.apply(a) - } - } } abstract class ConflictManagerFunctions { diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/Http.scala b/core/src/main/scala/sbt/librarymanagement/Http.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/librarymanagement/Http.scala rename to core/src/main/scala/sbt/librarymanagement/Http.scala diff --git a/core/src/main/scala/sbt/librarymanagement/LibraryManagementInterface.scala b/core/src/main/scala/sbt/librarymanagement/LibraryManagementInterface.scala new file mode 100644 index 00000000..6afc27e2 --- /dev/null +++ b/core/src/main/scala/sbt/librarymanagement/LibraryManagementInterface.scala @@ -0,0 +1,84 @@ +package sbt.librarymanagement + +import java.io.File +import sbt.util.Logger + +/** + * Interface for dependency resolution intended for engine authors. + */ +trait DependencyResolutionInterface { + + /** + * Builds a ModuleDescriptor that describes a subproject with dependencies. + * + * @param moduleSetting It contains the information about the module including the dependencies. + * @return A `ModuleDescriptor` describing a subproject and its dependencies. + */ + def moduleDescriptor(moduleSetting: ModuleDescriptorConfiguration): ModuleDescriptor + + /** + * Resolves the given module's dependencies performing a retrieval. + * + * @param module The module to be resolved. + * @param configuration The update configuration. + * @param uwconfig The configuration to handle unresolved warnings. + * @param log The logger. + * @return The result, either an unresolved warning or an update report. Note that this + * update report will or will not be successful depending on the `missingOk` option. + */ + def update(module: ModuleDescriptor, + configuration: UpdateConfiguration, + uwconfig: UnresolvedWarningConfiguration, + log: Logger): Either[UnresolvedWarning, UpdateReport] +} + +/** + * Interface for publishing modules. + */ +trait PublisherInterface { + + /** + * Builds a ModuleDescriptor that describes a subproject with dependencies. + * + * @param moduleSetting It contains the information about the module including the dependencies. + * @return A `ModuleDescriptor` describing a subproject and its dependencies. + */ + def moduleDescriptor(moduleSetting: ModuleDescriptorConfiguration): ModuleDescriptor + + /** + * Publishes the given module. + * + * @param module The module to be published. + * @param configuration The publish configuration. + * @param log The logger. + */ + def publish(module: ModuleDescriptor, configuration: PublishConfiguration, log: Logger): Unit + + /** + * Makes the `pom.xml` file for the given module. + * + * @param module The module for which a `.pom` file is to be created. + * @param configuration The makePomFile configuration. + * @param log The logger. + * @return The `File` containing the POM descriptor. + */ + def makePomFile(module: ModuleDescriptor, configuration: MakePomConfiguration, log: Logger): File +} + +/** + * Decribes the representation of a module, inclding its dependencies + * and the version of Scala it uses, if any. + */ +trait ModuleDescriptor { + + /** + * The direct dependencies of this module. + */ + def directDependencies: Vector[ModuleID] + + /** + * The information and module about the scala version that this module requires, + * if any. + */ + def scalaModuleInfo: Option[ScalaModuleInfo] +} diff --git a/core/src/main/scala/sbt/librarymanagement/LibraryManagementSyntax.scala b/core/src/main/scala/sbt/librarymanagement/LibraryManagementSyntax.scala new file mode 100644 index 00000000..8d177c83 --- /dev/null +++ b/core/src/main/scala/sbt/librarymanagement/LibraryManagementSyntax.scala @@ -0,0 +1,39 @@ +package sbt.librarymanagement + +trait LibraryManagementSyntax0 { + // See http://www.scala-lang.org/news/2.12.0#traits-compile-to-interfaces + // Avoid defining fields (val or var, but a constant is ok – final val without result type) + // Avoid calling super + // Avoid initializer statements in the body + + implicit def richUpdateReport(ur: UpdateReport): RichUpdateReport = new RichUpdateReport(ur) +} + +trait LibraryManagementSyntax + extends LibraryManagementSyntax0 + with DependencyBuilders + with DependencyFilterExtra { + // See http://www.scala-lang.org/news/2.12.0#traits-compile-to-interfaces + // Avoid defining fields (val or var, but a constant is ok – final val without result type) + // Avoid calling super + // Avoid initializer statements in the body + + type ExclusionRule = InclExclRule + final val ExclusionRule = InclExclRule + + type InclusionRule = InclExclRule + final val InclusionRule = InclExclRule + + import sbt.librarymanagement.{ Configurations => C } + final val Compile = C.Compile + final val Test = C.Test + final val Runtime = C.Runtime + final val IntegrationTest = C.IntegrationTest + final val Default = C.Default + final val Provided = C.Provided + // java.lang.System is more important, so don't alias this one + // final val System = C.System + final val Optional = C.Optional +} + +object syntax extends LibraryManagementSyntax diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/LogicalClock.scala b/core/src/main/scala/sbt/librarymanagement/LogicalClock.scala similarity index 94% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/LogicalClock.scala rename to core/src/main/scala/sbt/librarymanagement/LogicalClock.scala index b8ce426e..f55a61b8 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/LogicalClock.scala +++ b/core/src/main/scala/sbt/librarymanagement/LogicalClock.scala @@ -1,4 +1,4 @@ -package sbt.internal.librarymanagement +package sbt.librarymanagement /** * Represents a logical time point for dependency resolution. diff --git a/core/src/main/scala/sbt/librarymanagement/MakePomConfiguration.scala b/core/src/main/scala/sbt/librarymanagement/MakePomConfiguration.scala new file mode 100644 index 00000000..87f0a5cc --- /dev/null +++ b/core/src/main/scala/sbt/librarymanagement/MakePomConfiguration.scala @@ -0,0 +1,136 @@ +package sbt.librarymanagement + +import java.io.File +import scala.xml.{ Node => XNode, NodeSeq } + +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ +final class MakePomConfiguration private (val file: Option[File], + val moduleInfo: Option[ModuleInfo], + val configurations: Option[Vector[Configuration]], + val extra: Option[NodeSeq], + val process: XNode => XNode, + val filterRepositories: MavenRepository => Boolean, + val allRepositories: Boolean, + val includeTypes: Set[String]) + extends Serializable { + private def this() = + this(None, + None, + None, + None, + identity, + MakePomConfiguration.constTrue, + true, + Set(Artifact.DefaultType, Artifact.PomType)) + + override def equals(o: Any): Boolean = o match { + case x: MakePomConfiguration => + (this.file == x.file) && (this.moduleInfo == x.moduleInfo) && (this.configurations == x.configurations) && (this.extra == x.extra) && (this.process == x.process) && (this.filterRepositories == x.filterRepositories) && (this.allRepositories == x.allRepositories) && (this.includeTypes == x.includeTypes) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.MakePomConfiguration".##) + file.##) + moduleInfo.##) + configurations.##) + extra.##) + process.##) + filterRepositories.##) + allRepositories.##) + includeTypes.##) + } + override def toString: String = { + "MakePomConfiguration(" + file + ", " + moduleInfo + ", " + configurations + ", " + extra + ", " + process + ", " + filterRepositories + ", " + allRepositories + ", " + includeTypes + ")" + } + protected[this] def copy(file: Option[File] = file, + moduleInfo: Option[ModuleInfo] = moduleInfo, + configurations: Option[Vector[Configuration]] = configurations, + extra: Option[NodeSeq] = extra, + process: XNode => XNode = process, + filterRepositories: MavenRepository => Boolean = filterRepositories, + allRepositories: Boolean = allRepositories, + includeTypes: Set[String] = includeTypes): MakePomConfiguration = { + new MakePomConfiguration(file, + moduleInfo, + configurations, + extra, + process, + filterRepositories, + allRepositories, + includeTypes) + } + def withFile(file: Option[File]): MakePomConfiguration = { + copy(file = file) + } + def withFile(file: File): MakePomConfiguration = { + copy(file = Option(file)) + } + def withModuleInfo(moduleInfo: Option[ModuleInfo]): MakePomConfiguration = { + copy(moduleInfo = moduleInfo) + } + def withModuleInfo(moduleInfo: ModuleInfo): MakePomConfiguration = { + copy(moduleInfo = Option(moduleInfo)) + } + def withConfigurations(configurations: Option[Vector[Configuration]]): MakePomConfiguration = { + copy(configurations = configurations) + } + def withExtra(extra: Option[NodeSeq]): MakePomConfiguration = { + copy(extra = extra) + } + def withExtra(extra: NodeSeq): MakePomConfiguration = { + copy(extra = Option(extra)) + } + def withProcess(process: XNode => XNode): MakePomConfiguration = { + copy(process = process) + } + def withFilterRepositories( + filterRepositories: MavenRepository => Boolean): MakePomConfiguration = { + copy(filterRepositories = filterRepositories) + } + def withAllRepositories(allRepositories: Boolean): MakePomConfiguration = { + copy(allRepositories = allRepositories) + } + def withIncludeTypes(includeTypes: Set[String]): MakePomConfiguration = { + copy(includeTypes = includeTypes) + } +} + +object MakePomConfiguration { + private[sbt] lazy val constTrue: MavenRepository => Boolean = _ => true + + def apply(): MakePomConfiguration = + new MakePomConfiguration(None, + None, + None, + None, + identity, + constTrue, + true, + Set(Artifact.DefaultType, Artifact.PomType)) + def apply(file: Option[File], + moduleInfo: Option[ModuleInfo], + configurations: Option[Vector[Configuration]], + extra: Option[NodeSeq], + process: XNode => XNode, + filterRepositories: MavenRepository => Boolean, + allRepositories: Boolean, + includeTypes: Set[String]): MakePomConfiguration = + new MakePomConfiguration(file, + moduleInfo, + configurations, + extra, + process, + filterRepositories, + allRepositories, + includeTypes) + def apply(file: File, + moduleInfo: ModuleInfo, + configurations: Vector[Configuration], + extra: NodeSeq, + process: XNode => XNode, + filterRepositories: MavenRepository => Boolean, + allRepositories: Boolean, + includeTypes: Set[String]): MakePomConfiguration = + new MakePomConfiguration(Option(file), + Option(moduleInfo), + Option(configurations), + Option(extra), + process, + filterRepositories, + allRepositories, + includeTypes) +} diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/ModuleIDExtra.scala b/core/src/main/scala/sbt/librarymanagement/ModuleIDExtra.scala similarity index 99% rename from librarymanagement/src/main/scala/sbt/librarymanagement/ModuleIDExtra.scala rename to core/src/main/scala/sbt/librarymanagement/ModuleIDExtra.scala index 5b89b541..7d9bfece 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/ModuleIDExtra.scala +++ b/core/src/main/scala/sbt/librarymanagement/ModuleIDExtra.scala @@ -7,6 +7,7 @@ import java.net.URL import sbt.internal.librarymanagement.mavenint.SbtPomExtraProperties import scala.collection.mutable.ListBuffer +import sbt.librarymanagement.syntax._ abstract class ModuleIDExtra { def organization: String diff --git a/core/src/main/scala/sbt/librarymanagement/Publisher.scala b/core/src/main/scala/sbt/librarymanagement/Publisher.scala new file mode 100644 index 00000000..da3e09e6 --- /dev/null +++ b/core/src/main/scala/sbt/librarymanagement/Publisher.scala @@ -0,0 +1,47 @@ +package sbt.librarymanagement + +import java.io.File +import sbt.util.Logger + +/** + * Library management API to publish artifacts. + */ +class Publisher private[sbt] (publisherEngine: PublisherInterface) { + + /** + * Builds a ModuleDescriptor that describes a subproject with dependencies. + * + * @param moduleSetting It contains the information about the module including the dependencies. + * @return A `ModuleDescriptor` describing a subproject and its dependencies. + */ + def moduleDescriptor(moduleSetting: ModuleDescriptorConfiguration): ModuleDescriptor = + publisherEngine.moduleDescriptor(moduleSetting) + + /** + * Publishes the given module. + * + * @param module The module to be published. + * @param configuration The publish configuration. + * @param log The logger. + */ + def publish(module: ModuleDescriptor, configuration: PublishConfiguration, log: Logger): Unit = + publisherEngine.publish(module, configuration, log) + + /** + * Makes the `pom.xml` file for the given module. + * + * @param module The module for which a `.pom` file is to be created. + * @param configuration The makePomFile configuration. + * @param log The logger. + * @return The `File` containing the POM descriptor. + */ + def makePomFile(module: ModuleDescriptor, + configuration: MakePomConfiguration, + log: Logger): File = + publisherEngine.makePomFile(module, configuration, log) +} + +object Publisher { + def apply(publisherEngine: PublisherInterface): Publisher = + new Publisher(publisherEngine) +} diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/ResolverExtra.scala b/core/src/main/scala/sbt/librarymanagement/ResolverExtra.scala similarity index 93% rename from librarymanagement/src/main/scala/sbt/librarymanagement/ResolverExtra.scala rename to core/src/main/scala/sbt/librarymanagement/ResolverExtra.scala index 077c3ae1..52e0b7fd 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/ResolverExtra.scala +++ b/core/src/main/scala/sbt/librarymanagement/ResolverExtra.scala @@ -6,10 +6,9 @@ package sbt.librarymanagement import java.io.{ IOException, File } import java.net.URL import scala.xml.XML -import org.apache.ivy.plugins.resolver.DependencyResolver import org.xml.sax.SAXParseException -final class RawRepository(val resolver: DependencyResolver) extends Resolver(resolver.getName) { +final class RawRepository(val resolver: AnyRef, name: String) extends Resolver(name) { override def toString = "Raw(" + resolver.toString + ")" override def equals(o: Any): Boolean = o match { @@ -90,15 +89,8 @@ trait SftpRepositoryExtra extends SshBasedRepositoryExtra { } /** A repository that conforms to sbt launcher's interface */ -private[sbt] class FakeRepository(resolver: DependencyResolver) extends xsbti.Repository { - def rawRepository = new RawRepository(resolver) -} - -trait ResolversSyntax { - import Resolver._ - val DefaultMavenRepository = MavenRepository("public", centralRepositoryRoot(useSecureResolvers)) - val JavaNet2Repository = MavenRepository(JavaNet2RepositoryName, JavaNet2RepositoryRoot) - val JCenterRepository = MavenRepository(JCenterRepositoryName, JCenterRepositoryRoot) +private[sbt] class FakeRepository(resolver: AnyRef, name: String) extends xsbti.Repository { + def rawRepository = new RawRepository(resolver, name) } abstract class ResolverFunctions { @@ -115,6 +107,14 @@ abstract class ResolverFunctions { val JCenterRepositoryName = "jcenter" val JCenterRepositoryRoot = "https://jcenter.bintray.com/" val DefaultMavenRepositoryRoot = "https://repo1.maven.org/maven2/" + val DefaultMavenRepository = + MavenRepository("public", centralRepositoryRoot(useSecureResolvers)) + val JavaNet2Repository = MavenRepository(JavaNet2RepositoryName, JavaNet2RepositoryRoot) + val JCenterRepository = MavenRepository(JCenterRepositoryName, JCenterRepositoryRoot) + + def mavenCentral: Resolver = DefaultMavenRepository + def defaults: Vector[Resolver] = Vector(mavenCentral) + // TODO: This switch is only kept for backward compatibility. Hardcode to HTTPS in the future. private[sbt] def centralRepositoryRoot(secure: Boolean) = (if (secure) "https" else "http") + "://repo1.maven.org/maven2/" @@ -162,27 +162,28 @@ abstract class ResolverFunctions { def jcenterRepo = JCenterRepository /** Add the local and Maven Central repositories to the user repositories. */ - def withDefaultResolvers(userResolvers: Seq[Resolver]): Seq[Resolver] = - withDefaultResolvers(userResolvers, mavenCentral = true) + def combineDefaultResolvers(userResolvers: Vector[Resolver]): Vector[Resolver] = + combineDefaultResolvers(userResolvers, mavenCentral = true) /** * Add the local Ivy repository to the user repositories. * If `mavenCentral` is true, add the Maven Central repository. */ - def withDefaultResolvers(userResolvers: Seq[Resolver], mavenCentral: Boolean): Seq[Resolver] = - withDefaultResolvers(userResolvers, jcenter = false, mavenCentral) + def combineDefaultResolvers(userResolvers: Vector[Resolver], + mavenCentral: Boolean): Vector[Resolver] = + combineDefaultResolvers(userResolvers, jcenter = false, mavenCentral) /** * Add the local Ivy repository to the user repositories. * If `jcenter` is true, add the JCenter. * If `mavenCentral` is true, add the Maven Central repository. */ - def withDefaultResolvers( - userResolvers: Seq[Resolver], + def combineDefaultResolvers( + userResolvers: Vector[Resolver], jcenter: Boolean, mavenCentral: Boolean - ): Seq[Resolver] = - Seq(Resolver.defaultLocal) ++ + ): Vector[Resolver] = + Vector(Resolver.defaultLocal) ++ userResolvers ++ single(JCenterRepository, jcenter) ++ single(DefaultMavenRepository, mavenCentral) @@ -193,24 +194,25 @@ abstract class ResolverFunctions { * If `mavenCentral` is true, add the Maven Central repository. */ private[sbt] def reorganizeAppResolvers( - appResolvers: Seq[Resolver], + appResolvers: Vector[Resolver], jcenter: Boolean, mavenCentral: Boolean - ): Seq[Resolver] = + ): Vector[Resolver] = appResolvers.partition(_ == Resolver.defaultLocal) match { case (locals, xs) => locals ++ (xs.partition(_ == JCenterRepository) match { - case (jc, xs) => + case (_, xs) => single(JCenterRepository, jcenter) ++ (xs.partition(_ == DefaultMavenRepository) match { - case (m, xs) => + case (_, xs) => single(DefaultMavenRepository, mavenCentral) ++ xs // TODO - Do we need to filter out duplicates? }) }) } - private def single[T](value: T, nonEmpty: Boolean): Seq[T] = if (nonEmpty) Seq(value) else Nil + private def single[T](value: T, nonEmpty: Boolean): Vector[T] = + if (nonEmpty) Vector(value) else Vector.empty /** A base class for defining factories for interfaces to Ivy repositories that require a hostname , port, and patterns. */ sealed abstract class Define[RepositoryType <: SshBasedRepository] { diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/RichUpdateReport.scala b/core/src/main/scala/sbt/librarymanagement/RichUpdateReport.scala similarity index 98% rename from librarymanagement/src/main/scala/sbt/librarymanagement/RichUpdateReport.scala rename to core/src/main/scala/sbt/librarymanagement/RichUpdateReport.scala index e4b9d104..297611b6 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/RichUpdateReport.scala +++ b/core/src/main/scala/sbt/librarymanagement/RichUpdateReport.scala @@ -58,7 +58,7 @@ final class RichUpdateReport(report: UpdateReport) { modReport .withArtifacts( modReport.artifacts filter { - case (art, file) => f(configuration, modReport.module, art) + case (art, _) => f(configuration, modReport.module, art) } ) .withMissingArtifacts( diff --git a/core/src/main/scala/sbt/librarymanagement/ScalaArtifacts.scala b/core/src/main/scala/sbt/librarymanagement/ScalaArtifacts.scala new file mode 100644 index 00000000..e0b1b6be --- /dev/null +++ b/core/src/main/scala/sbt/librarymanagement/ScalaArtifacts.scala @@ -0,0 +1,42 @@ +package sbt.librarymanagement + +object ScalaArtifacts { + val Organization = "org.scala-lang" + val LibraryID = "scala-library" + val CompilerID = "scala-compiler" + val ReflectID = "scala-reflect" + val ActorsID = "scala-actors" + val ScalapID = "scalap" + val Artifacts = Vector(LibraryID, CompilerID, ReflectID, ActorsID, ScalapID) + val DottyIDPrefix = "dotty" + + def dottyID(binaryVersion: String): String = s"${DottyIDPrefix}_${binaryVersion}" + + def libraryDependency(version: String): ModuleID = ModuleID(Organization, LibraryID, version) + + private[sbt] def toolDependencies( + org: String, + version: String, + isDotty: Boolean = false + ): Seq[ModuleID] = + if (isDotty) + Seq( + ModuleID(org, DottyIDPrefix, version) + .withConfigurations(Some(Configurations.ScalaTool.name + "->default(compile)")) + .withCrossVersion(CrossVersion.binary) + ) + else + Seq( + scalaToolDependency(org, ScalaArtifacts.CompilerID, version), + scalaToolDependency(org, ScalaArtifacts.LibraryID, version) + ) + + private[this] def scalaToolDependency(org: String, id: String, version: String): ModuleID = + ModuleID(org, id, version).withConfigurations( + Some(Configurations.ScalaTool.name + "->default,optional(default)") + ) +} + +object SbtArtifacts { + val Organization = "org.scala-sbt" +} diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/TrackLevel.scala b/core/src/main/scala/sbt/librarymanagement/TrackLevel.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/librarymanagement/TrackLevel.scala rename to core/src/main/scala/sbt/librarymanagement/TrackLevel.scala diff --git a/core/src/main/scala/sbt/librarymanagement/UnresolvedWarning.scala b/core/src/main/scala/sbt/librarymanagement/UnresolvedWarning.scala new file mode 100644 index 00000000..99017ba8 --- /dev/null +++ b/core/src/main/scala/sbt/librarymanagement/UnresolvedWarning.scala @@ -0,0 +1,88 @@ +package sbt.librarymanagement + +import collection.mutable +import sbt.util.ShowLines +import sbt.internal.util.{ SourcePosition, LinePosition, RangePosition, LineRange } + +final class ResolveException( + val messages: Seq[String], + val failed: Seq[ModuleID], + val failedPaths: Map[ModuleID, Seq[ModuleID]] +) extends RuntimeException(messages.mkString("\n")) { + def this(messages: Seq[String], failed: Seq[ModuleID]) = + this(messages, failed, Map(failed map { m => + m -> Nil + }: _*)) +} + +/** + * Represents unresolved dependency warning, which displays reconstructed dependency tree + * along with source position of each node. + */ +final class UnresolvedWarning( + val resolveException: ResolveException, + val failedPaths: Seq[Seq[(ModuleID, Option[SourcePosition])]] +) + +object UnresolvedWarning { + def apply( + err: ResolveException, + config: UnresolvedWarningConfiguration + ): UnresolvedWarning = { + def modulePosition(m0: ModuleID): Option[SourcePosition] = + config.modulePositions.find { + case (m, _) => + (m.organization == m0.organization) && + (m0.name startsWith m.name) && + (m.revision == m0.revision) + } map { + case (_, p) => p + } + val failedPaths = err.failed map { x: ModuleID => + err.failedPaths(x).toList.reverse map { id => + (id, modulePosition(id)) + } + } + new UnresolvedWarning(err, failedPaths) + } + + private[sbt] def sourcePosStr(posOpt: Option[SourcePosition]): String = + posOpt match { + case Some(LinePosition(path, start)) => s" ($path#L$start)" + case Some(RangePosition(path, LineRange(start, end))) => s" ($path#L$start-$end)" + case _ => "" + } + implicit val unresolvedWarningLines: ShowLines[UnresolvedWarning] = ShowLines { a => + val withExtra = a.resolveException.failed.filter(_.extraDependencyAttributes.nonEmpty) + val buffer = mutable.ListBuffer[String]() + if (withExtra.nonEmpty) { + buffer += "\n\tNote: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes." + withExtra foreach { id => + buffer += "\t\t" + id + } + } + if (a.failedPaths.nonEmpty) { + buffer += "\n\tNote: Unresolved dependencies path:" + a.failedPaths foreach { path => + if (path.nonEmpty) { + val head = path.head + buffer += "\t\t" + head._1.toString + sourcePosStr(head._2) + path.tail foreach { + case (m, pos) => + buffer += "\t\t +- " + m.toString + sourcePosStr(pos) + } + } + } + } + buffer.toList + } +} + +final class UnresolvedWarningConfiguration private[sbt] ( + val modulePositions: Map[ModuleID, SourcePosition] +) +object UnresolvedWarningConfiguration { + def apply(): UnresolvedWarningConfiguration = apply(Map()) + def apply(modulePositions: Map[ModuleID, SourcePosition]): UnresolvedWarningConfiguration = + new UnresolvedWarningConfiguration(modulePositions) +} diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/UpdateReportExtra.scala b/core/src/main/scala/sbt/librarymanagement/UpdateReportExtra.scala similarity index 99% rename from librarymanagement/src/main/scala/sbt/librarymanagement/UpdateReportExtra.scala rename to core/src/main/scala/sbt/librarymanagement/UpdateReportExtra.scala index db97688d..a97441cf 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/UpdateReportExtra.scala +++ b/core/src/main/scala/sbt/librarymanagement/UpdateReportExtra.scala @@ -131,7 +131,7 @@ abstract class UpdateReportExtra { def allModules: Vector[ModuleID] = { val key = (m: ModuleID) => (m.organization, m.name, m.revision) configurations.flatMap(_.allModules).groupBy(key).toVector map { - case (k, v) => + case (_, v) => v reduceLeft { (agg, x) => agg.withConfigurations( (agg.configurations, x.configurations) match { diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/VersionNumber.scala b/core/src/main/scala/sbt/librarymanagement/VersionNumber.scala similarity index 98% rename from librarymanagement/src/main/scala/sbt/librarymanagement/VersionNumber.scala rename to core/src/main/scala/sbt/librarymanagement/VersionNumber.scala index 2f82a361..144b67a6 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/VersionNumber.scala +++ b/core/src/main/scala/sbt/librarymanagement/VersionNumber.scala @@ -145,7 +145,8 @@ object VersionNumber { case (v1, v2) if (v1.size >= 3) && (v2.size >= 3) => // A normal version number MUST take the form X.Y.Z (v1._1.get, v1._2.get, v1._3.get, v1.tags, v2._1.get, v2._2.get, v2._3.get, v2.tags) match { - case (x1, y1, 0, ts1, x2, y2, 0, ts2) if ts1.nonEmpty || ts2.nonEmpty => + case (x1 @ _, y1 @ _, 0, ts1, x2 @ _, y2 @ _, 0, ts2) + if ts1.nonEmpty || ts2.nonEmpty => // A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers equalsIgnoreExtra(v1, v2) case (x1, y1, _, _, x2, y2, _, _) => diff --git a/librarymanagement/src/test/scala/ConfigMacroSpec.scala b/core/src/test/scala/ConfigMacroSpec.scala similarity index 100% rename from librarymanagement/src/test/scala/ConfigMacroSpec.scala rename to core/src/test/scala/ConfigMacroSpec.scala diff --git a/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/ExternalIvyConfiguration.scala b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/ExternalIvyConfiguration.scala new file mode 100644 index 00000000..02456951 --- /dev/null +++ b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/ExternalIvyConfiguration.scala @@ -0,0 +1,66 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package sbt.librarymanagement.ivy +final class ExternalIvyConfiguration private ( + lock: Option[xsbti.GlobalLock], + log: Option[xsbti.Logger], + updateOptions: sbt.librarymanagement.ivy.UpdateOptions, + val baseDirectory: Option[java.io.File], + val uri: Option[java.net.URI], + val extraResolvers: Vector[sbt.librarymanagement.Resolver]) extends sbt.librarymanagement.ivy.IvyConfiguration(lock, log, updateOptions) with Serializable { + + private def this() = this(None, None, sbt.librarymanagement.ivy.UpdateOptions(), None, None, Vector()) + + override def equals(o: Any): Boolean = o match { + case x: ExternalIvyConfiguration => (this.lock == x.lock) && (this.log == x.log) && (this.updateOptions == x.updateOptions) && (this.baseDirectory == x.baseDirectory) && (this.uri == x.uri) && (this.extraResolvers == x.extraResolvers) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ivy.ExternalIvyConfiguration".##) + lock.##) + log.##) + updateOptions.##) + baseDirectory.##) + uri.##) + extraResolvers.##) + } + override def toString: String = { + "ExternalIvyConfiguration(" + lock + ", " + log + ", " + updateOptions + ", " + baseDirectory + ", " + uri + ", " + extraResolvers + ")" + } + protected[this] def copy(lock: Option[xsbti.GlobalLock] = lock, log: Option[xsbti.Logger] = log, updateOptions: sbt.librarymanagement.ivy.UpdateOptions = updateOptions, baseDirectory: Option[java.io.File] = baseDirectory, uri: Option[java.net.URI] = uri, extraResolvers: Vector[sbt.librarymanagement.Resolver] = extraResolvers): ExternalIvyConfiguration = { + new ExternalIvyConfiguration(lock, log, updateOptions, baseDirectory, uri, extraResolvers) + } + def withLock(lock: Option[xsbti.GlobalLock]): ExternalIvyConfiguration = { + copy(lock = lock) + } + def withLock(lock: xsbti.GlobalLock): ExternalIvyConfiguration = { + copy(lock = Option(lock)) + } + def withLog(log: Option[xsbti.Logger]): ExternalIvyConfiguration = { + copy(log = log) + } + def withLog(log: xsbti.Logger): ExternalIvyConfiguration = { + copy(log = Option(log)) + } + def withUpdateOptions(updateOptions: sbt.librarymanagement.ivy.UpdateOptions): ExternalIvyConfiguration = { + copy(updateOptions = updateOptions) + } + def withBaseDirectory(baseDirectory: Option[java.io.File]): ExternalIvyConfiguration = { + copy(baseDirectory = baseDirectory) + } + def withBaseDirectory(baseDirectory: java.io.File): ExternalIvyConfiguration = { + copy(baseDirectory = Option(baseDirectory)) + } + def withUri(uri: Option[java.net.URI]): ExternalIvyConfiguration = { + copy(uri = uri) + } + def withUri(uri: java.net.URI): ExternalIvyConfiguration = { + copy(uri = Option(uri)) + } + def withExtraResolvers(extraResolvers: Vector[sbt.librarymanagement.Resolver]): ExternalIvyConfiguration = { + copy(extraResolvers = extraResolvers) + } +} +object ExternalIvyConfiguration { + + def apply(): ExternalIvyConfiguration = new ExternalIvyConfiguration(None, None, sbt.librarymanagement.ivy.UpdateOptions(), None, None, Vector()) + def apply(lock: Option[xsbti.GlobalLock], log: Option[xsbti.Logger], updateOptions: sbt.librarymanagement.ivy.UpdateOptions, baseDirectory: Option[java.io.File], uri: Option[java.net.URI], extraResolvers: Vector[sbt.librarymanagement.Resolver]): ExternalIvyConfiguration = new ExternalIvyConfiguration(lock, log, updateOptions, baseDirectory, uri, extraResolvers) + def apply(lock: xsbti.GlobalLock, log: xsbti.Logger, updateOptions: sbt.librarymanagement.ivy.UpdateOptions, baseDirectory: java.io.File, uri: java.net.URI, extraResolvers: Vector[sbt.librarymanagement.Resolver]): ExternalIvyConfiguration = new ExternalIvyConfiguration(Option(lock), Option(log), updateOptions, Option(baseDirectory), Option(uri), extraResolvers) +} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ExternalIvyConfigurationFormats.scala b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/ExternalIvyConfigurationFormats.scala similarity index 58% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ExternalIvyConfigurationFormats.scala rename to ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/ExternalIvyConfigurationFormats.scala index 55de96c3..ae915f0e 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ExternalIvyConfigurationFormats.scala +++ b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/ExternalIvyConfigurationFormats.scala @@ -3,32 +3,32 @@ */ // DO NOT EDIT MANUALLY -package sbt.librarymanagement +package sbt.librarymanagement.ivy import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait ExternalIvyConfigurationFormats { self: sbt.internal.librarymanagement.formats.GlobalLockFormat with sbt.internal.librarymanagement.formats.LoggerFormat with sbt.internal.librarymanagement.formats.UpdateOptionsFormat with sbt.librarymanagement.ResolverFormats with sjsonnew.BasicJsonProtocol => -implicit lazy val ExternalIvyConfigurationFormat: JsonFormat[sbt.internal.librarymanagement.ExternalIvyConfiguration] = new JsonFormat[sbt.internal.librarymanagement.ExternalIvyConfiguration] { - override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.librarymanagement.ExternalIvyConfiguration = { +trait ExternalIvyConfigurationFormats { self: sbt.internal.librarymanagement.formats.GlobalLockFormat with sbt.internal.librarymanagement.formats.LoggerFormat with sbt.librarymanagement.ivy.formats.UpdateOptionsFormat with sbt.librarymanagement.ResolverFormats with sjsonnew.BasicJsonProtocol => +implicit lazy val ExternalIvyConfigurationFormat: JsonFormat[sbt.librarymanagement.ivy.ExternalIvyConfiguration] = new JsonFormat[sbt.librarymanagement.ivy.ExternalIvyConfiguration] { + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ivy.ExternalIvyConfiguration = { jsOpt match { case Some(js) => unbuilder.beginObject(js) val lock = unbuilder.readField[Option[xsbti.GlobalLock]]("lock") - val baseDirectory = unbuilder.readField[java.io.File]("baseDirectory") - val log = unbuilder.readField[xsbti.Logger]("log") - val updateOptions = unbuilder.readField[sbt.librarymanagement.UpdateOptions]("updateOptions") - val uri = unbuilder.readField[java.net.URI]("uri") + val log = unbuilder.readField[Option[xsbti.Logger]]("log") + val updateOptions = unbuilder.readField[sbt.librarymanagement.ivy.UpdateOptions]("updateOptions") + val baseDirectory = unbuilder.readField[Option[java.io.File]]("baseDirectory") + val uri = unbuilder.readField[Option[java.net.URI]]("uri") val extraResolvers = unbuilder.readField[Vector[sbt.librarymanagement.Resolver]]("extraResolvers") unbuilder.endObject() - sbt.internal.librarymanagement.ExternalIvyConfiguration(lock, baseDirectory, log, updateOptions, uri, extraResolvers) + sbt.librarymanagement.ivy.ExternalIvyConfiguration(lock, log, updateOptions, baseDirectory, uri, extraResolvers) case None => deserializationError("Expected JsObject but found None") } } - override def write[J](obj: sbt.internal.librarymanagement.ExternalIvyConfiguration, builder: Builder[J]): Unit = { + override def write[J](obj: sbt.librarymanagement.ivy.ExternalIvyConfiguration, builder: Builder[J]): Unit = { builder.beginObject() builder.addField("lock", obj.lock) - builder.addField("baseDirectory", obj.baseDirectory) builder.addField("log", obj.log) builder.addField("updateOptions", obj.updateOptions) + builder.addField("baseDirectory", obj.baseDirectory) builder.addField("uri", obj.uri) builder.addField("extraResolvers", obj.extraResolvers) builder.endObject() diff --git a/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfiguration.scala b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfiguration.scala new file mode 100644 index 00000000..0d781c43 --- /dev/null +++ b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfiguration.scala @@ -0,0 +1,104 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package sbt.librarymanagement.ivy +final class InlineIvyConfiguration private ( + lock: Option[xsbti.GlobalLock], + log: Option[xsbti.Logger], + updateOptions: sbt.librarymanagement.ivy.UpdateOptions, + val paths: Option[sbt.librarymanagement.ivy.IvyPaths], + val resolvers: Vector[sbt.librarymanagement.Resolver], + val otherResolvers: Vector[sbt.librarymanagement.Resolver], + val moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration], + val checksums: Vector[String], + val managedChecksums: Boolean, + val resolutionCacheDir: Option[java.io.File]) extends sbt.librarymanagement.ivy.IvyConfiguration(lock, log, updateOptions) with Serializable { + + private def this() = this(None, None, sbt.librarymanagement.ivy.UpdateOptions(), None, sbt.librarymanagement.Resolver.defaults, Vector.empty, Vector.empty, sbt.librarymanagement.ivy.IvyDefaults.defaultChecksums, false, None) + + override def equals(o: Any): Boolean = o match { + case x: InlineIvyConfiguration => (this.lock == x.lock) && (this.log == x.log) && (this.updateOptions == x.updateOptions) && (this.paths == x.paths) && (this.resolvers == x.resolvers) && (this.otherResolvers == x.otherResolvers) && (this.moduleConfigurations == x.moduleConfigurations) && (this.checksums == x.checksums) && (this.managedChecksums == x.managedChecksums) && (this.resolutionCacheDir == x.resolutionCacheDir) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ivy.InlineIvyConfiguration".##) + lock.##) + log.##) + updateOptions.##) + paths.##) + resolvers.##) + otherResolvers.##) + moduleConfigurations.##) + checksums.##) + managedChecksums.##) + resolutionCacheDir.##) + } + override def toString: String = { + "InlineIvyConfiguration(" + lock + ", " + log + ", " + updateOptions + ", " + paths + ", " + resolvers + ", " + otherResolvers + ", " + moduleConfigurations + ", " + checksums + ", " + managedChecksums + ", " + resolutionCacheDir + ")" + } + protected[this] def copy(lock: Option[xsbti.GlobalLock] = lock, log: Option[xsbti.Logger] = log, updateOptions: sbt.librarymanagement.ivy.UpdateOptions = updateOptions, paths: Option[sbt.librarymanagement.ivy.IvyPaths] = paths, resolvers: Vector[sbt.librarymanagement.Resolver] = resolvers, otherResolvers: Vector[sbt.librarymanagement.Resolver] = otherResolvers, moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration] = moduleConfigurations, checksums: Vector[String] = checksums, managedChecksums: Boolean = managedChecksums, resolutionCacheDir: Option[java.io.File] = resolutionCacheDir): InlineIvyConfiguration = { + new InlineIvyConfiguration(lock, log, updateOptions, paths, resolvers, otherResolvers, moduleConfigurations, checksums, managedChecksums, resolutionCacheDir) + } + def withLock(lock: Option[xsbti.GlobalLock]): InlineIvyConfiguration = { + copy(lock = lock) + } + def withLock(lock: xsbti.GlobalLock): InlineIvyConfiguration = { + copy(lock = Option(lock)) + } + def withLog(log: Option[xsbti.Logger]): InlineIvyConfiguration = { + copy(log = log) + } + def withLog(log: xsbti.Logger): InlineIvyConfiguration = { + copy(log = Option(log)) + } + def withUpdateOptions(updateOptions: sbt.librarymanagement.ivy.UpdateOptions): InlineIvyConfiguration = { + copy(updateOptions = updateOptions) + } + def withPaths(paths: Option[sbt.librarymanagement.ivy.IvyPaths]): InlineIvyConfiguration = { + copy(paths = paths) + } + def withPaths(paths: sbt.librarymanagement.ivy.IvyPaths): InlineIvyConfiguration = { + copy(paths = Option(paths)) + } + def withResolvers(resolvers: Vector[sbt.librarymanagement.Resolver]): InlineIvyConfiguration = { + copy(resolvers = resolvers) + } + def withOtherResolvers(otherResolvers: Vector[sbt.librarymanagement.Resolver]): InlineIvyConfiguration = { + copy(otherResolvers = otherResolvers) + } + def withModuleConfigurations(moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration]): InlineIvyConfiguration = { + copy(moduleConfigurations = moduleConfigurations) + } + def withChecksums(checksums: Vector[String]): InlineIvyConfiguration = { + copy(checksums = checksums) + } + def withManagedChecksums(managedChecksums: Boolean): InlineIvyConfiguration = { + copy(managedChecksums = managedChecksums) + } + def withResolutionCacheDir(resolutionCacheDir: Option[java.io.File]): InlineIvyConfiguration = { + copy(resolutionCacheDir = resolutionCacheDir) + } + def withResolutionCacheDir(resolutionCacheDir: java.io.File): InlineIvyConfiguration = { + copy(resolutionCacheDir = Option(resolutionCacheDir)) + } +} +object InlineIvyConfiguration { + /** Provided for backward compatibility. */ + def apply( + paths: sbt.librarymanagement.ivy.IvyPaths, + resolvers: Vector[sbt.librarymanagement.Resolver], + otherResolvers: Vector[sbt.librarymanagement.Resolver], + moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration], + lock: Option[xsbti.GlobalLock], + checksums: Vector[String], + managedChecksums: Boolean, + resolutionCacheDir: Option[java.io.File], + updateOptions: sbt.librarymanagement.ivy.UpdateOptions, + log: xsbti.Logger + ): InlineIvyConfiguration = { + apply() + .withLock(lock) + .withResolvers(resolvers) + .withOtherResolvers(otherResolvers) + .withModuleConfigurations(moduleConfigurations) + .withChecksums(checksums) + .withManagedChecksums(managedChecksums) + .withResolutionCacheDir(resolutionCacheDir) + .withLog(log) + } + def apply(): InlineIvyConfiguration = new InlineIvyConfiguration(None, None, sbt.librarymanagement.ivy.UpdateOptions(), None, sbt.librarymanagement.Resolver.defaults, Vector.empty, Vector.empty, sbt.librarymanagement.ivy.IvyDefaults.defaultChecksums, false, None) + def apply(lock: Option[xsbti.GlobalLock], log: Option[xsbti.Logger], updateOptions: sbt.librarymanagement.ivy.UpdateOptions, paths: Option[sbt.librarymanagement.ivy.IvyPaths], resolvers: Vector[sbt.librarymanagement.Resolver], otherResolvers: Vector[sbt.librarymanagement.Resolver], moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration], checksums: Vector[String], managedChecksums: Boolean, resolutionCacheDir: Option[java.io.File]): InlineIvyConfiguration = new InlineIvyConfiguration(lock, log, updateOptions, paths, resolvers, otherResolvers, moduleConfigurations, checksums, managedChecksums, resolutionCacheDir) + def apply(lock: xsbti.GlobalLock, log: xsbti.Logger, updateOptions: sbt.librarymanagement.ivy.UpdateOptions, paths: sbt.librarymanagement.ivy.IvyPaths, resolvers: Vector[sbt.librarymanagement.Resolver], otherResolvers: Vector[sbt.librarymanagement.Resolver], moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration], checksums: Vector[String], managedChecksums: Boolean, resolutionCacheDir: java.io.File): InlineIvyConfiguration = new InlineIvyConfiguration(Option(lock), Option(log), updateOptions, Option(paths), resolvers, otherResolvers, moduleConfigurations, checksums, managedChecksums, Option(resolutionCacheDir)) +} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/InlineIvyConfigurationFormats.scala b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfigurationFormats.scala similarity index 61% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/InlineIvyConfigurationFormats.scala rename to ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfigurationFormats.scala index 8adfd362..8c07808f 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/InlineIvyConfigurationFormats.scala +++ b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfigurationFormats.scala @@ -3,19 +3,18 @@ */ // DO NOT EDIT MANUALLY -package sbt.librarymanagement +package sbt.librarymanagement.ivy import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait InlineIvyConfigurationFormats { self: sbt.internal.librarymanagement.formats.GlobalLockFormat with sbt.internal.librarymanagement.formats.LoggerFormat with sbt.internal.librarymanagement.formats.UpdateOptionsFormat with sbt.librarymanagement.IvyPathsFormats with sbt.librarymanagement.ResolverFormats with sbt.librarymanagement.ModuleConfigurationFormats with sjsonnew.BasicJsonProtocol => -implicit lazy val InlineIvyConfigurationFormat: JsonFormat[sbt.internal.librarymanagement.InlineIvyConfiguration] = new JsonFormat[sbt.internal.librarymanagement.InlineIvyConfiguration] { - override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.librarymanagement.InlineIvyConfiguration = { +trait InlineIvyConfigurationFormats { self: sbt.internal.librarymanagement.formats.GlobalLockFormat with sbt.internal.librarymanagement.formats.LoggerFormat with sbt.librarymanagement.ivy.formats.UpdateOptionsFormat with sbt.librarymanagement.ivy.IvyPathsFormats with sbt.librarymanagement.ResolverFormats with sbt.librarymanagement.ModuleConfigurationFormats with sjsonnew.BasicJsonProtocol => +implicit lazy val InlineIvyConfigurationFormat: JsonFormat[sbt.librarymanagement.ivy.InlineIvyConfiguration] = new JsonFormat[sbt.librarymanagement.ivy.InlineIvyConfiguration] { + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ivy.InlineIvyConfiguration = { jsOpt match { case Some(js) => unbuilder.beginObject(js) val lock = unbuilder.readField[Option[xsbti.GlobalLock]]("lock") - val baseDirectory = unbuilder.readField[java.io.File]("baseDirectory") - val log = unbuilder.readField[xsbti.Logger]("log") - val updateOptions = unbuilder.readField[sbt.librarymanagement.UpdateOptions]("updateOptions") - val paths = unbuilder.readField[sbt.internal.librarymanagement.IvyPaths]("paths") + val log = unbuilder.readField[Option[xsbti.Logger]]("log") + val updateOptions = unbuilder.readField[sbt.librarymanagement.ivy.UpdateOptions]("updateOptions") + val paths = unbuilder.readField[Option[sbt.librarymanagement.ivy.IvyPaths]]("paths") val resolvers = unbuilder.readField[Vector[sbt.librarymanagement.Resolver]]("resolvers") val otherResolvers = unbuilder.readField[Vector[sbt.librarymanagement.Resolver]]("otherResolvers") val moduleConfigurations = unbuilder.readField[Vector[sbt.librarymanagement.ModuleConfiguration]]("moduleConfigurations") @@ -23,15 +22,14 @@ implicit lazy val InlineIvyConfigurationFormat: JsonFormat[sbt.internal.librarym val managedChecksums = unbuilder.readField[Boolean]("managedChecksums") val resolutionCacheDir = unbuilder.readField[Option[java.io.File]]("resolutionCacheDir") unbuilder.endObject() - sbt.internal.librarymanagement.InlineIvyConfiguration(lock, baseDirectory, log, updateOptions, paths, resolvers, otherResolvers, moduleConfigurations, checksums, managedChecksums, resolutionCacheDir) + sbt.librarymanagement.ivy.InlineIvyConfiguration(lock, log, updateOptions, paths, resolvers, otherResolvers, moduleConfigurations, checksums, managedChecksums, resolutionCacheDir) case None => deserializationError("Expected JsObject but found None") } } - override def write[J](obj: sbt.internal.librarymanagement.InlineIvyConfiguration, builder: Builder[J]): Unit = { + override def write[J](obj: sbt.librarymanagement.ivy.InlineIvyConfiguration, builder: Builder[J]): Unit = { builder.beginObject() builder.addField("lock", obj.lock) - builder.addField("baseDirectory", obj.baseDirectory) builder.addField("log", obj.log) builder.addField("updateOptions", obj.updateOptions) builder.addField("paths", obj.paths) diff --git a/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyConfiguration.scala b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyConfiguration.scala new file mode 100644 index 00000000..9ca6e9dd --- /dev/null +++ b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyConfiguration.scala @@ -0,0 +1,28 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package sbt.librarymanagement.ivy +abstract class IvyConfiguration( + val lock: Option[xsbti.GlobalLock], + val log: Option[xsbti.Logger], + val updateOptions: sbt.librarymanagement.ivy.UpdateOptions) extends Serializable { + + def this() = this(None, None, sbt.librarymanagement.ivy.UpdateOptions()) + + + override def equals(o: Any): Boolean = o match { + case x: IvyConfiguration => (this.lock == x.lock) && (this.log == x.log) && (this.updateOptions == x.updateOptions) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (17 + "sbt.librarymanagement.ivy.IvyConfiguration".##) + lock.##) + log.##) + updateOptions.##) + } + override def toString: String = { + "IvyConfiguration(" + lock + ", " + log + ", " + updateOptions + ")" + } +} +object IvyConfiguration { + +} diff --git a/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyConfigurationFormats.scala b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyConfigurationFormats.scala new file mode 100644 index 00000000..1b27eaea --- /dev/null +++ b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyConfigurationFormats.scala @@ -0,0 +1,11 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package sbt.librarymanagement.ivy + +import _root_.sjsonnew.JsonFormat +trait IvyConfigurationFormats { self: sbt.internal.librarymanagement.formats.GlobalLockFormat with sbt.internal.librarymanagement.formats.LoggerFormat with sbt.librarymanagement.ivy.formats.UpdateOptionsFormat with sbt.librarymanagement.ivy.IvyPathsFormats with sbt.librarymanagement.ResolverFormats with sbt.librarymanagement.ModuleConfigurationFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.ivy.InlineIvyConfigurationFormats with sbt.librarymanagement.ivy.ExternalIvyConfigurationFormats => +implicit lazy val IvyConfigurationFormat: JsonFormat[sbt.librarymanagement.ivy.IvyConfiguration] = flatUnionFormat2[sbt.librarymanagement.ivy.IvyConfiguration, sbt.librarymanagement.ivy.InlineIvyConfiguration, sbt.librarymanagement.ivy.ExternalIvyConfiguration]("type") +} diff --git a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/IvyPaths.scala b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyPaths.scala similarity index 90% rename from librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/IvyPaths.scala rename to ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyPaths.scala index 0a5fd35a..562419c4 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/IvyPaths.scala +++ b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyPaths.scala @@ -3,7 +3,7 @@ */ // DO NOT EDIT MANUALLY -package sbt.internal.librarymanagement +package sbt.librarymanagement.ivy final class IvyPaths private ( val baseDirectory: java.io.File, val ivyHome: Option[java.io.File]) extends Serializable { @@ -15,7 +15,7 @@ final class IvyPaths private ( case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "IvyPaths".##) + baseDirectory.##) + ivyHome.##) + 37 * (37 * (37 * (17 + "sbt.librarymanagement.ivy.IvyPaths".##) + baseDirectory.##) + ivyHome.##) } override def toString: String = { "IvyPaths(" + baseDirectory + ", " + ivyHome + ")" diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyPathsFormats.scala b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyPathsFormats.scala similarity index 67% rename from librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyPathsFormats.scala rename to ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyPathsFormats.scala index 506047e1..7c48da84 100644 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyPathsFormats.scala +++ b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyPathsFormats.scala @@ -3,23 +3,23 @@ */ // DO NOT EDIT MANUALLY -package sbt.librarymanagement +package sbt.librarymanagement.ivy import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } trait IvyPathsFormats { self: sjsonnew.BasicJsonProtocol => -implicit lazy val IvyPathsFormat: JsonFormat[sbt.internal.librarymanagement.IvyPaths] = new JsonFormat[sbt.internal.librarymanagement.IvyPaths] { - override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.librarymanagement.IvyPaths = { +implicit lazy val IvyPathsFormat: JsonFormat[sbt.librarymanagement.ivy.IvyPaths] = new JsonFormat[sbt.librarymanagement.ivy.IvyPaths] { + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ivy.IvyPaths = { jsOpt match { case Some(js) => unbuilder.beginObject(js) val baseDirectory = unbuilder.readField[java.io.File]("baseDirectory") val ivyHome = unbuilder.readField[Option[java.io.File]]("ivyHome") unbuilder.endObject() - sbt.internal.librarymanagement.IvyPaths(baseDirectory, ivyHome) + sbt.librarymanagement.ivy.IvyPaths(baseDirectory, ivyHome) case None => deserializationError("Expected JsObject but found None") } } - override def write[J](obj: sbt.internal.librarymanagement.IvyPaths, builder: Builder[J]): Unit = { + override def write[J](obj: sbt.librarymanagement.ivy.IvyPaths, builder: Builder[J]): Unit = { builder.beginObject() builder.addField("baseDirectory", obj.baseDirectory) builder.addField("ivyHome", obj.ivyHome) diff --git a/ivy/src/main/contraband/lm-ivy.json b/ivy/src/main/contraband/lm-ivy.json new file mode 100644 index 00000000..dc239f8d --- /dev/null +++ b/ivy/src/main/contraband/lm-ivy.json @@ -0,0 +1,144 @@ +{ + "codecNamespace": "sbt.librarymanagement.ivy", + "types": [ + { + "name": "IvyConfiguration", + "namespace": "sbt.librarymanagement.ivy", + "target": "Scala", + "type": "interface", + "fields": [ + { + "name": "lock", + "type": "xsbti.GlobalLock?", + "default": "None", + "since": "0.0.1" + }, + { + "name": "log", + "type": "xsbti.Logger?", + "default": "None", + "since": "0.0.1" + }, + { + "name": "updateOptions", + "type": "sbt.librarymanagement.ivy.UpdateOptions", + "default": "sbt.librarymanagement.ivy.UpdateOptions()", + "since": "0.0.1" + } + ], + "types": [ + { + "name": "InlineIvyConfiguration", + "namespace": "sbt.librarymanagement.ivy", + "target": "Scala", + "type": "record", + "fields": [ + { + "name": "paths", + "type": "sbt.librarymanagement.ivy.IvyPaths?", + "default": "None", + "since": "0.0.1" + }, + { + "name": "resolvers", + "type": "sbt.librarymanagement.Resolver*", + "default": "sbt.librarymanagement.Resolver.defaults", + "since": "0.0.1" + }, + { + "name": "otherResolvers", + "type": "sbt.librarymanagement.Resolver*", + "default": "Vector.empty", + "since": "0.0.1" + }, + { + "name": "moduleConfigurations", + "type": "sbt.librarymanagement.ModuleConfiguration*", + "default": "Vector.empty", + "since": "0.0.1" + }, + { + "name": "checksums", + "type": "String*", + "default": "sbt.librarymanagement.ivy.IvyDefaults.defaultChecksums", + "since": "0.0.1" + }, + { + "name": "managedChecksums", + "type": "Boolean", + "default": "false", + "since": "0.0.1" + }, + { + "name": "resolutionCacheDir", + "type": "java.io.File?", + "default": "None", + "since": "0.0.1" + } + ], + "extraCompanion": [ + "/** Provided for backward compatibility. */", + "def apply(", + " paths: sbt.librarymanagement.ivy.IvyPaths,", + " resolvers: Vector[sbt.librarymanagement.Resolver],", + " otherResolvers: Vector[sbt.librarymanagement.Resolver],", + " moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration],", + " lock: Option[xsbti.GlobalLock],", + " checksums: Vector[String],", + " managedChecksums: Boolean,", + " resolutionCacheDir: Option[java.io.File],", + " updateOptions: sbt.librarymanagement.ivy.UpdateOptions,", + " log: xsbti.Logger", + "): InlineIvyConfiguration = {", + " apply()", + " .withLock(lock)", + " .withResolvers(resolvers)", + " .withOtherResolvers(otherResolvers)", + " .withModuleConfigurations(moduleConfigurations)", + " .withChecksums(checksums)", + " .withManagedChecksums(managedChecksums)", + " .withResolutionCacheDir(resolutionCacheDir)", + " .withLog(log)", + "}" + ] + }, + { + "name": "ExternalIvyConfiguration", + "namespace": "sbt.librarymanagement.ivy", + "target": "Scala", + "type": "record", + "fields": [ + { + "name": "baseDirectory", + "type": "java.io.File?", + "default": "None", + "since": "0.0.1" + }, + { + "name": "uri", + "type": "java.net.URI?", + "default": "None", + "since": "0.0.1" + }, + { + "name": "extraResolvers", + "type": "sbt.librarymanagement.Resolver*", + "default": "Vector()", + "since": "0.0.1" + } + ] + } + ] + }, + { + "name": "IvyPaths", + "namespace": "sbt.librarymanagement.ivy", + "target": "Scala", + "type": "record", + "fields": [ + { "name": "baseDirectory", "type": "java.io.File" }, + { "name": "ivyHome", "type": "java.io.File?" } + ] + } + ] +} diff --git a/librarymanagement/src/main/java/sbt/internal/librarymanagement/ResolverAdapter.java b/ivy/src/main/java/internal/librarymanagement/ResolverAdapter.java similarity index 100% rename from librarymanagement/src/main/java/sbt/internal/librarymanagement/ResolverAdapter.java rename to ivy/src/main/java/internal/librarymanagement/ResolverAdapter.java diff --git a/librarymanagement/src/main/scala/org/apache/ivy/plugins/parser/m2/ReplaceMavenConfigurationMappings.scala b/ivy/src/main/scala/org/apache/ivy/plugins/parser/m2/ReplaceMavenConfigurationMappings.scala similarity index 100% rename from librarymanagement/src/main/scala/org/apache/ivy/plugins/parser/m2/ReplaceMavenConfigurationMappings.scala rename to ivy/src/main/scala/org/apache/ivy/plugins/parser/m2/ReplaceMavenConfigurationMappings.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ComponentManager.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ComponentManager.scala similarity index 98% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ComponentManager.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ComponentManager.scala index 244d86c6..a973f59e 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ComponentManager.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/ComponentManager.scala @@ -31,7 +31,7 @@ class ComponentManager( def fromGlobal = lockGlobalCache { try { update(id); getOrElse(createAndCache) } catch { - case e: NotInCache => createAndCache + case _: NotInCache => createAndCache } } def getOrElse(orElse: => Iterable[File]): Iterable[File] = { diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala similarity index 98% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala index c81bd80a..f31d223d 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala @@ -37,6 +37,7 @@ import org.apache.ivy.core.module.descriptor.{ Artifact => IArtifact } import sbt.io.IO import sbt.util.Logger import sbt.librarymanagement._ +import sbt.librarymanagement.ivy.UpdateOptions private[sbt] object ConvertResolver { import UpdateOptions.ResolverConverter @@ -225,7 +226,10 @@ private[sbt] object ConvertResolver { } case repo: ChainedResolver => IvySbt.resolverChain(repo.name, repo.resolvers, settings, log) - case repo: RawRepository => repo.resolver + case repo: RawRepository => + repo.resolver match { + case r: DependencyResolver => r + } } } diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/CustomPomParser.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/CustomPomParser.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/CustomPomParser.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/CustomPomParser.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/CustomXmlParser.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/CustomXmlParser.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/CustomXmlParser.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/CustomXmlParser.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/FakeResolver.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/FakeResolver.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/FakeResolver.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/FakeResolver.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/Ivy.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala similarity index 92% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/Ivy.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala index c0157633..86c1ef5f 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/Ivy.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala @@ -37,7 +37,10 @@ import org.apache.ivy.util.url._ import scala.xml.NodeSeq import scala.collection.mutable import sbt.util.Logger -import sbt.librarymanagement._ +import sbt.librarymanagement.{ ModuleDescriptorConfiguration => InlineConfiguration, _ } +import sbt.librarymanagement.ivy._ +import sbt.librarymanagement.syntax._ +import IvyInternalDefaults._ import Resolver.PluginPattern import ivyint.{ CachedResolutionResolveCache, @@ -48,8 +51,6 @@ import ivyint.{ } final class IvySbt(val configuration: IvyConfiguration) { self => - import configuration.baseDirectory - /* * ========== Configuration/Setup ============ * This part configures the Ivy instance by first creating the logger interface to ivy, then IvySettings, and then the Ivy instance. @@ -85,22 +86,26 @@ final class IvySbt(val configuration: IvyConfiguration) { self => private lazy val settings: IvySettings = { if (configuration.updateOptions.gigahorse) URLHandlerRegistry.setDefault(gigahorseUrlHandler) else URLHandlerRegistry.setDefault(basicUrlHandler) + val is = new IvySettings - is.setBaseDir(baseDirectory) is.setCircularDependencyStrategy( configuration.updateOptions.circularDependencyLevel.ivyStrategy ) CustomPomParser.registerDefault + val log = getLog(configuration.log) configuration match { case e: ExternalIvyConfiguration => - IvySbt.addResolvers(e.extraResolvers, is, configuration.log) - IvySbt.loadURI(is, e.uri) + val baseDirectory = getBaseDirectory(e.baseDirectory) + is.setBaseDir(baseDirectory) + IvySbt.addResolvers(e.extraResolvers, is, log) + IvySbt.loadURI(is, e.uri.getOrElse(sys.error("uri must be specified!"))) case i: InlineIvyConfiguration => + val paths = getIvyPaths(i.paths) + is.setBaseDir(paths.baseDirectory) is.setVariable("ivy.checksums", i.checksums mkString ",") is.setVariable(ConvertResolver.ManagedChecksums, i.managedChecksums.toString) - i.paths.ivyHome foreach is.setDefaultIvyUserDir - val log = configuration.log + paths.ivyHome foreach is.setDefaultIvyUserDir IvySbt.configureCache(is, i.resolutionCacheDir) IvySbt.setResolvers(is, i.resolvers, i.otherResolvers, configuration.updateOptions, log) IvySbt.setModuleConfigurations(is, i.moduleConfigurations, log) @@ -157,7 +162,7 @@ final class IvySbt(val configuration: IvyConfiguration) { self => val ivy = new IvyImplementation() ivy.setSettings(settings) ivy.bind() - val logger = new IvyLoggerInterface(configuration.log) + val logger = new IvyLoggerInterface(getLog(configuration.log)) ivy.getLoggerEngine.pushLogger(logger) ivy } @@ -194,8 +199,26 @@ final class IvySbt(val configuration: IvyConfiguration) { self => else IvySbt.cachedResolutionResolveCache.clean() } - final class Module(rawModuleSettings: ModuleSettings) { + final class Module(rawModuleSettings: ModuleSettings) + extends sbt.librarymanagement.ModuleDescriptor { self => val moduleSettings: ModuleSettings = IvySbt.substituteCross(rawModuleSettings) + + def directDependencies: Vector[ModuleID] = + moduleSettings match { + case x: InlineConfiguration => x.dependencies + case _ => Vector() + } + + def configurations = + moduleSettings match { + case ic: InlineConfiguration => ic.configurations + case _: PomConfiguration => Configurations.default ++ Configurations.defaultInternal + case _: IvyFileConfiguration => + Configurations.default ++ Configurations.defaultInternal + } + + def scalaModuleInfo: Option[ScalaModuleInfo] = moduleSettings.scalaModuleInfo + def owner = IvySbt.this def withModule[T](log: Logger)(f: (Ivy, DefaultModuleDescriptor, String) => T): T = withIvy[T](log) { ivy => @@ -213,22 +236,17 @@ final class IvySbt(val configuration: IvyConfiguration) { self => private[this] lazy val (moduleDescriptor0: DefaultModuleDescriptor, defaultConfig0: String) = { val (baseModule, baseConfiguration) = moduleSettings match { - case ic: InlineConfiguration => configureInline(ic, configuration.log) + case ic: InlineConfiguration => configureInline(ic, getLog(configuration.log)) case pc: PomConfiguration => configurePom(pc) case ifc: IvyFileConfiguration => configureIvyFile(ifc) } - val configs = - moduleSettings match { - case ic: InlineConfiguration => ic.configurations - case pc: PomConfiguration => Configurations.default ++ Configurations.defaultInternal - case ifc: IvyFileConfiguration => - Configurations.default ++ Configurations.defaultInternal - } - moduleSettings.ivyScala match { + val configs = configurations + moduleSettings.scalaModuleInfo match { case Some(is) => val svc = configs.toVector filter Configurations.underScalaVersion map { _.name } - IvyScala.checkModule(baseModule, baseConfiguration, svc, configuration.log)(is) + IvyScalaUtil.checkModule(baseModule, baseConfiguration, svc, getLog(configuration.log))( + is) case _ => // do nothing } IvySbt.addExtraNamespace(baseModule) @@ -236,7 +254,7 @@ final class IvySbt(val configuration: IvyConfiguration) { self => } private def configureInline(ic: InlineConfiguration, log: Logger) = { import ic._ - val moduleID = newConfiguredModuleID(module, moduleInfo, configurations) + val moduleID = newConfiguredModuleID(module, moduleInfo, ic.configurations) IvySbt.setConflictManager(moduleID, conflictManager, ivy.getSettings) val defaultConf = defaultConfiguration getOrElse Configuration.of( "Default", @@ -255,7 +273,7 @@ final class IvySbt(val configuration: IvyConfiguration) { self => ) IvySbt.addMainArtifact(moduleID) IvySbt.addOverrides(moduleID, overrides, ivy.getSettings.getMatcher(PatternMatcher.EXACT)) - IvySbt.addExcludes(moduleID, excludes, ivyScala) + IvySbt.addExcludes(moduleID, excludes, ic.scalaModuleInfo) val transformedDeps = IvySbt.overrideDirect(dependencies, overrides) IvySbt.addDependencies(moduleID, transformedDeps, parser) (moduleID, parser.getDefaultConf) @@ -285,7 +303,7 @@ final class IvySbt(val configuration: IvyConfiguration) { self => val dmd = IvySbt.toDefaultModuleDescriptor(md) IvySbt.addConfigurations(dmd, Configurations.defaultInternal) val defaultConf = Configurations.DefaultMavenConfiguration.name - for (is <- pc.ivyScala) if (pc.autoScalaTools) { + for (is <- pc.scalaModuleInfo) if (pc.autoScalaTools) { val confParser = new CustomXmlParser.CustomParser(settings, Some(defaultConf)) confParser.setMd(dmd) addScalaToolDependencies(dmd, confParser, is) @@ -300,7 +318,7 @@ final class IvySbt(val configuration: IvyConfiguration) { self => parser.setSource(toURL(ifc.file)) parser.parse() val dmd = IvySbt.toDefaultModuleDescriptor(parser.getModuleDescriptor()) - for (is <- ifc.ivyScala) + for (is <- ifc.scalaModuleInfo) if (ifc.autoScalaTools) addScalaToolDependencies(dmd, parser, is) (dmd, parser.getDefaultConf) @@ -308,7 +326,7 @@ final class IvySbt(val configuration: IvyConfiguration) { self => private def addScalaToolDependencies( dmd: DefaultModuleDescriptor, parser: CustomXmlParser.CustomParser, - is: IvyScala + is: ScalaModuleInfo ): Unit = { IvySbt.addConfigurations(dmd, Configurations.ScalaTool :: Nil) IvySbt.addDependencies( @@ -325,7 +343,7 @@ private[sbt] object IvySbt { val DefaultIvyConfigFilename = "ivysettings.xml" val DefaultIvyFilename = "ivy.xml" val DefaultMavenFilename = "pom.xml" - val DefaultChecksums = Vector("sha1", "md5") + val DefaultChecksums = IvyDefaults.defaultChecksums private[sbt] def cachedResolutionResolveCache: CachedResolutionResolveCache = new CachedResolutionResolveCache @@ -505,8 +523,8 @@ private[sbt] object IvySbt { } } private[this] def isProjectResolver(r: DependencyResolver): Boolean = r match { - case pr: ProjectResolver => true - case _ => false + case _: ProjectResolver => true + case _ => false } // ignore the original resolver wherever possible to avoid issues like #704 override def saveResolvers( @@ -573,7 +591,7 @@ private[sbt] object IvySbt { } private def substituteCross(m: ModuleSettings): ModuleSettings = { - m.ivyScala match { + m.scalaModuleInfo match { case None => m case Some(is) => substituteCross(m, is.scalaFullVersion, is.scalaBinaryVersion) } @@ -589,7 +607,7 @@ private[sbt] object IvySbt { val applyCross = CrossVersion(scalaFullVersion, scalaBinaryVersion) def propagateCrossVersion(moduleID: ModuleID): ModuleID = { val crossExclusions: Vector[ExclusionRule] = - moduleID.exclusions.map(CrossVersion.substituteCross(_, ic.ivyScala)) + moduleID.exclusions.map(CrossVersion.substituteCross(_, ic.scalaModuleInfo)) applyCross(moduleID) .withExclusions(crossExclusions) } @@ -723,7 +741,7 @@ private[sbt] object IvySbt { (dependencies groupBy { dep => (dep.organization, dep.name, dep.configurations) }) foreach { - case (k, vs) if vs.size > 1 => + case (_, vs) if vs.size > 1 => val v0 = vs.head (vs find { _.revision != v0.revision }) foreach { v => out += s" * ${v0.organization}:${v0.name}:(" + (vs map { _.revision }) @@ -826,7 +844,7 @@ private[sbt] object IvySbt { for (conf <- dependencyDescriptor.getModuleConfigurations) { dependencyDescriptor.addExcludeRule( conf, - IvyScala.excludeRule( + IvyScalaUtil.excludeRule( excls.organization, excls.name, excls.configurations map { _.name }, @@ -839,7 +857,7 @@ private[sbt] object IvySbt { for (conf <- dependencyDescriptor.getModuleConfigurations) { dependencyDescriptor.addIncludeRule( conf, - IvyScala.includeRule( + IvyScalaUtil.includeRule( incls.organization, incls.name, incls.configurations map { _.name }, @@ -868,24 +886,24 @@ private[sbt] object IvySbt { def addExcludes( moduleID: DefaultModuleDescriptor, excludes: Seq[ExclusionRule], - ivyScala: Option[IvyScala] - ): Unit = excludes.foreach(exclude => addExclude(moduleID, ivyScala)(exclude)) + scalaModuleInfo: Option[ScalaModuleInfo] + ): Unit = excludes.foreach(exclude => addExclude(moduleID, scalaModuleInfo)(exclude)) - def addExclude(moduleID: DefaultModuleDescriptor, ivyScala: Option[IvyScala])( + def addExclude(moduleID: DefaultModuleDescriptor, scalaModuleInfo: Option[ScalaModuleInfo])( exclude0: ExclusionRule): Unit = { // this adds _2.11 postfix - val exclude = CrossVersion.substituteCross(exclude0, ivyScala) + val exclude = CrossVersion.substituteCross(exclude0, scalaModuleInfo) val confs = if (exclude.configurations.isEmpty) moduleID.getConfigurationsNames.toList else exclude.configurations map { _.name } val excludeRule = - IvyScala.excludeRule(exclude.organization, exclude.name, confs, exclude.artifact) + IvyScalaUtil.excludeRule(exclude.organization, exclude.name, confs, exclude.artifact) moduleID.addExcludeRule(excludeRule) } def addOverrides( moduleID: DefaultModuleDescriptor, - overrides: Set[ModuleID], + overrides: Vector[ModuleID], matcher: PatternMatcher ): Unit = overrides foreach addOverride(moduleID, matcher) @@ -902,7 +920,7 @@ private[sbt] object IvySbt { * "IllegalStateException: impossible to get artifacts when data has not been loaded." * when a direct dependency is overridden with a newer version." */ - def overrideDirect(dependencies: Seq[ModuleID], overrides: Set[ModuleID]): Seq[ModuleID] = { + def overrideDirect(dependencies: Seq[ModuleID], overrides: Vector[ModuleID]): Seq[ModuleID] = { def key(id: ModuleID) = (id.organization, id.name) val overridden = overrides.map(id => (key(id), id.revision)).toMap dependencies map { dep => diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala similarity index 53% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala index acc8849a..e62d7b0c 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala @@ -4,8 +4,6 @@ package sbt.internal.librarymanagement import java.io.File -import scala.xml.{ Node => XNode, NodeSeq } -import collection.mutable import ivyint.CachedResolutionResolveEngine import org.apache.ivy.Ivy @@ -18,73 +16,14 @@ import org.apache.ivy.core.module.descriptor.{ ModuleDescriptor, DefaultModuleDescriptor } -import org.apache.ivy.core.report.ResolveReport import org.apache.ivy.core.resolve.ResolveOptions import org.apache.ivy.plugins.resolver.{ BasicResolver, DependencyResolver } +import org.apache.ivy.util.filter.{ Filter => IvyFilter } import sbt.io.{ IO, PathFinder } -import sbt.util.{ Logger, ShowLines } -import sbt.internal.util.{ SourcePosition, LinePosition, RangePosition, LineRange } -import sbt.librarymanagement._, syntax._ - -final class DeliverConfiguration( - val deliverIvyPattern: String, - val status: String, - val configurations: Option[Vector[Configuration]], - val logging: UpdateLogging -) -final class PublishConfiguration( - val ivyFile: Option[File], - val resolverName: String, - val artifacts: Map[Artifact, File], - val checksums: Vector[String], - val logging: UpdateLogging, - val overwrite: Boolean -) { - def this( - ivyFile: Option[File], - resolverName: String, - artifacts: Map[Artifact, File], - checksums: Vector[String], - logging: UpdateLogging - ) = - this(ivyFile, resolverName, artifacts, checksums, logging, false) -} - -final case class MakePomConfiguration( - file: File, - moduleInfo: ModuleInfo, - configurations: Option[Vector[Configuration]] = None, - extra: NodeSeq = NodeSeq.Empty, - process: XNode => XNode = n => n, - filterRepositories: MavenRepository => Boolean = _ => true, - allRepositories: Boolean, - includeTypes: Set[String] = Set(Artifact.DefaultType, Artifact.PomType) -) - -/** @param exclude is a map from ModuleID to classifiers that were previously tried and failed, so should now be excluded */ -final case class GetClassifiersConfiguration( - module: GetClassifiersModule, - exclude: Map[ModuleID, Set[String]], - configuration: UpdateConfiguration, - ivyScala: Option[IvyScala], - sourceArtifactTypes: Set[String], - docArtifactTypes: Set[String] -) -final case class GetClassifiersModule( - id: ModuleID, - modules: Vector[ModuleID], - configurations: Vector[Configuration], - classifiers: Vector[String] -) - -final class UnresolvedWarningConfiguration private[sbt] ( - val modulePositions: Map[ModuleID, SourcePosition] -) -object UnresolvedWarningConfiguration { - def apply(): UnresolvedWarningConfiguration = apply(Map()) - def apply(modulePositions: Map[ModuleID, SourcePosition]): UnresolvedWarningConfiguration = - new UnresolvedWarningConfiguration(modulePositions) -} +import sbt.util.Logger +import sbt.librarymanagement.{ ModuleDescriptorConfiguration => InlineConfiguration, _ }, syntax._ +import InternalDefaults._ +import UpdateClassifiersUtil._ object IvyActions { @@ -117,17 +56,17 @@ object IvyActions { } /** Creates a Maven pom from the given Ivy configuration*/ - def makePom(module: IvySbt#Module, configuration: MakePomConfiguration, log: Logger): Unit = { + def makePomFile(module: IvySbt#Module, configuration: MakePomConfiguration, log: Logger): File = { import configuration.{ allRepositories, - moduleInfo, configurations, - extra, - file, filterRepositories, process, includeTypes } + val file = configuration.file.getOrElse(sys.error("file must be specified.")) + val moduleInfo = configuration.moduleInfo.getOrElse(sys.error("moduleInfo must be specified.")) + val extra = configuration.extra.getOrElse(scala.xml.NodeSeq.Empty) module.withModule(log) { (ivy, md, default) => (new MakePom(log)).write( ivy, @@ -142,29 +81,55 @@ object IvyActions { file ) log.info("Wrote " + file.getAbsolutePath) + file } } - def deliver(module: IvySbt#Module, configuration: DeliverConfiguration, log: Logger): File = { - import configuration._ + def deliver(module: IvySbt#Module, configuration: PublishConfiguration, log: Logger): File = { + val deliverIvyPattern = configuration.deliverIvyPattern + .getOrElse(sys.error("deliverIvyPattern must be specified.")) + val status = getDeliverStatus(configuration.status) module.withModule(log) { - case (ivy, md, default) => + case (ivy, md, _) => val revID = md.getModuleRevisionId val options = DeliverOptions.newInstance(ivy.getSettings).setStatus(status) - options.setConfs(IvySbt.getConfigurations(md, configurations)) + options.setConfs(getConfigurations(md, configuration.configurations)) ivy.deliver(revID, revID.getRevision, deliverIvyPattern, options) deliveredFile(ivy, deliverIvyPattern, md) } } + + def getConfigurations( + module: ModuleDescriptor, + configurations: Option[Vector[ConfigRef]] + ): Array[String] = + configurations match { + case Some(confs) => (confs map { _.name }).toArray + case None => module.getPublicConfigurationsNames + } + def deliveredFile(ivy: Ivy, pattern: String, md: ModuleDescriptor): File = ivy.getSettings.resolveFile( IvyPatternHelper.substitute(pattern, md.getResolvedModuleRevisionId) ) def publish(module: IvySbt#Module, configuration: PublishConfiguration, log: Logger): Unit = { - import configuration._ + val resolverName = configuration.resolverName match { + case Some(x) => x + case _ => sys.error("Resolver name is not specified") + } + + // Todo. Fix publish ordering https://github.com/sbt/sbt/issues/2088#issuecomment-246208872 + val ivyFile: Option[File] = + if (configuration.publishMavenStyle) None + else { + Option(deliver(module, configuration, log)) + } + + val artifacts = Map(configuration.artifacts: _*) + val checksums = configuration.checksums module.withModule(log) { - case (ivy, md, default) => + case (ivy, md, _) => val resolver = ivy.getSettings.getResolver(resolverName) if (resolver eq null) sys.error("Undefined resolver '" + resolverName + "'") val ivyArtifact = ivyFile map { file => @@ -172,7 +137,9 @@ object IvyActions { } val cross = crossVersionMap(module.moduleSettings) val as = mapArtifacts(md, cross, artifacts) ++ ivyArtifact.toList - withChecksums(resolver, checksums) { publish(md, as, resolver, overwrite = overwrite) } + withChecksums(resolver, checksums) { + publish(md, as, resolver, overwrite = configuration.overwrite) + } } } private[this] def withChecksums[T](resolver: DependencyResolver, checksums: Vector[String])( @@ -188,7 +155,7 @@ object IvyActions { } private def crossVersionMap(moduleSettings: ModuleSettings): Option[String => String] = moduleSettings match { - case i: InlineConfiguration => CrossVersion(i.module, i.ivyScala) + case i: InlineConfiguration => CrossVersion(i.module, i.scalaModuleInfo) case _ => None } def mapArtifacts( @@ -210,8 +177,6 @@ object IvyActions { * @param module The module to be resolved. * @param configuration The update configuration. * @param uwconfig The configuration to handle unresolved warnings. - * @param logicalClock The clock necessary to cache ivy. - * @param depDir The base directory used for caching resolution. * @param log The logger. * @return The result, either an unresolved warning or an update report. Note that this * update report will or will not be successful depending on the `missingOk` option. @@ -220,8 +185,6 @@ object IvyActions { module: IvySbt#Module, configuration: UpdateConfiguration, uwconfig: UnresolvedWarningConfiguration, - logicalClock: LogicalClock, - depDir: Option[File], log: Logger ): Either[UnresolvedWarning, UpdateReport] = { module.withModule(log) { @@ -230,21 +193,27 @@ object IvyActions { val iw = IvySbt.inconsistentDuplicateWarning(moduleDescriptor) iw.foreach(log.warn(_)) + val metadataDirectory = configuration.metadataDirectory + // Create inputs, resolve and retrieve the module descriptor val inputs = ResolutionInputs(ivy, moduleDescriptor, configuration, log) val resolutionResult: Either[ResolveException, UpdateReport] = { - if (module.owner.configuration.updateOptions.cachedResolution && depDir.isDefined) { - val cache = depDir.getOrElse(sys.error("Missing directory for cached resolution.")) - cachedResolveAndRetrieve(inputs, logicalClock, cache) + if (module.owner.configuration.updateOptions.cachedResolution && metadataDirectory.isDefined) { + val cache = + metadataDirectory.getOrElse(sys.error("Missing directory for cached resolution.")) + cachedResolveAndRetrieve(inputs, cache) } else resolveAndRetrieve(inputs, defaultConf) } // Convert to unresolved warning or retrieve update report resolutionResult.fold( exception => Left(UnresolvedWarning(exception, uwconfig)), - updateReport => { - val retrieveConf = configuration.retrieve - Right(retrieveConf.map(retrieve(log, ivy, updateReport, _)).getOrElse(updateReport)) + ur0 => { + val ur = configuration.retrieveManaged match { + case Some(retrieveConf) => retrieve(log, ivy, ur0, retrieveConf) + case _ => ur0 + } + Right(ur) } ) } @@ -264,138 +233,6 @@ object IvyActions { def grouped[T](grouping: ModuleID => T)(mods: Seq[ModuleID]): Map[T, Set[String]] = mods groupBy (grouping) mapValues (_.map(_.revision).toSet) - private[sbt] def transitiveScratch( - ivySbt: IvySbt, - label: String, - config: GetClassifiersConfiguration, - uwconfig: UnresolvedWarningConfiguration, - logicalClock: LogicalClock, - depDir: Option[File], - log: Logger - ): UpdateReport = { - import config.{ configuration => c, ivyScala, module => mod } - import mod.{ id, modules => deps } - val base = restrictedCopy(id, true).withName(id.name + "$" + label) - val module = - new ivySbt.Module(InlineConfiguration(false, ivyScala, base, ModuleInfo(base.name), deps)) - val report = updateEither(module, c, uwconfig, logicalClock, depDir, log) match { - case Right(r) => r - case Left(w) => - throw w.resolveException - } - val newConfig = config.copy(module = mod.copy(modules = report.allModules)) - updateClassifiers(ivySbt, newConfig, uwconfig, logicalClock, depDir, Vector(), log) - } - - /** - * Creates explicit artifacts for each classifier in `config.module`, and then attempts to resolve them directly. This - * is for Maven compatibility, where these artifacts are not "published" in the POM, so they don't end up in the Ivy - * that sbt generates for them either.
- * Artifacts can be obtained from calling toSeq on UpdateReport.
- * In addition, retrieves specific Ivy artifacts if they have one of the requested `config.configuration.types`. - * @param config important to set `config.configuration.types` to only allow artifact types that can correspond to - * "classified" artifacts (sources and javadocs). - */ - private[sbt] def updateClassifiers( - ivySbt: IvySbt, - config: GetClassifiersConfiguration, - uwconfig: UnresolvedWarningConfiguration, - logicalClock: LogicalClock, - depDir: Option[File], - artifacts: Vector[(String, ModuleID, Artifact, File)], - log: Logger - ): UpdateReport = { - import config.{ configuration => c, module => mod, _ } - import mod.{ configurations => confs, _ } - assert(classifiers.nonEmpty, "classifiers cannot be empty") - assert(c.artifactFilter.types.nonEmpty, "UpdateConfiguration must filter on some types") - val baseModules = modules map { m => - restrictedCopy(m, true) - } - // Adding list of explicit artifacts here. - val deps = baseModules.distinct flatMap classifiedArtifacts(classifiers, exclude, artifacts) - val base = restrictedCopy(id, true).withName(id.name + classifiers.mkString("$", "_", "")) - val module = new ivySbt.Module( - InlineConfiguration(false, ivyScala, base, ModuleInfo(base.name), deps) - .withConfigurations(confs) - ) - // c.copy ensures c.types is preserved too - val upConf = c.withMissingOk(true) - updateEither(module, upConf, uwconfig, logicalClock, depDir, log) match { - case Right(r) => - // The artifacts that came from Ivy don't have their classifier set, let's set it according to - // FIXME: this is only done because IDE plugins depend on `classifier` to determine type. They - val typeClassifierMap: Map[String, String] = - ((sourceArtifactTypes.toIterable map (_ -> Artifact.SourceClassifier)) - :: (docArtifactTypes.toIterable map (_ -> Artifact.DocClassifier)) :: Nil).flatten.toMap - r.substitute { (conf, mid, artFileSeq) => - artFileSeq map { - case (art, f) => - // Deduce the classifier from the type if no classifier is present already - art.withClassifier(art.classifier orElse typeClassifierMap.get(art.`type`)) -> f - } - } - case Left(w) => - throw w.resolveException - } - } - // This version adds explicit artifact - private[sbt] def classifiedArtifacts( - classifiers: Vector[String], - exclude: Map[ModuleID, Set[String]], - artifacts: Vector[(String, ModuleID, Artifact, File)] - )(m: ModuleID): Option[ModuleID] = { - def sameModule(m1: ModuleID, m2: ModuleID): Boolean = - m1.organization == m2.organization && m1.name == m2.name && m1.revision == m2.revision - def explicitArtifacts = { - val arts = (artifacts collect { - case (_, x, art, _) if sameModule(m, x) && art.classifier.isDefined => art - }).distinct - if (arts.isEmpty) None - else Some(intransitiveModuleWithExplicitArts(m, arts)) - } - def hardcodedArtifacts = classifiedArtifacts(classifiers, exclude)(m) - explicitArtifacts orElse hardcodedArtifacts - } - private def classifiedArtifacts( - classifiers: Vector[String], - exclude: Map[ModuleID, Set[String]] - )(m: ModuleID): Option[ModuleID] = { - val excluded = exclude getOrElse (restrictedCopy(m, false), Set.empty) - val included = classifiers filterNot excluded - if (included.isEmpty) None - else { - Some( - intransitiveModuleWithExplicitArts( - module = m, - arts = classifiedArtifacts(m.name, included) - ) - ) - } - } - - /** - * Explicitly set an "include all" rule (the default) because otherwise, if we declare ANY explicitArtifacts, - * [[org.apache.ivy.core.resolve.IvyNode#getArtifacts]] (in Ivy 2.3.0-rc1) will not merge in the descriptor's - * artifacts and will only keep the explicitArtifacts. - *
- * Look for the comment saying {{{ - * // and now we filter according to include rules - * }}} - * in `IvyNode`, which iterates on `includes`, which will ordinarily be empty because higher up, in {{{ - * addAllIfNotNull(includes, usage.getDependencyIncludesSet(rootModuleConf)); - * }}} - * `usage.getDependencyIncludesSet` returns null if there are no (explicit) include rules. - */ - private def intransitiveModuleWithExplicitArts( - module: ModuleID, - arts: Vector[Artifact] - ): ModuleID = - module - .withIsTransitive(false) - .withExplicitArtifacts(arts) - .withInclusions(Vector(InclExclRule.everything)) - def addExcluded( report: UpdateReport, classifiers: Vector[String], @@ -404,10 +241,7 @@ object IvyActions { report.addMissing { id => classifiedArtifacts(id.name, classifiers filter getExcluded(id, exclude)) } - def classifiedArtifacts(name: String, classifiers: Vector[String]): Vector[Artifact] = - classifiers map { c => - Artifact.classified(name, c) - } + private[this] def getExcluded(id: ModuleID, exclude: Map[ModuleID, Set[String]]): Set[String] = exclude.getOrElse(restrictedCopy(id, false), Set.empty[String]) @@ -419,13 +253,6 @@ object IvyActions { } } groupBy (_._1) map { case (mod, pairs) => (mod, pairs.map(_._2).toSet) } - private[this] def restrictedCopy(m: ModuleID, confs: Boolean) = - ModuleID(m.organization, m.name, m.revision) - .withCrossVersion(m.crossVersion) - .withExtraAttributes(m.extraAttributes) - .withConfigurations(if (confs) m.configurations else None) - .branch(m.branchName) - /** * Represents the inputs to pass in to [[resolveAndRetrieve]] and [[cachedResolveAndRetrieve]]. * @@ -441,6 +268,15 @@ object IvyActions { log: Logger ) + implicit def toIvyFilter(f: ArtifactTypeFilter): IvyFilter = new IvyFilter { + override def accept(o: Object): Boolean = Option(o) exists { + case a: IArtifact => applyFilter(a) + } + + def applyFilter(a: IArtifact): Boolean = + (f.types contains a.getType) ^ f.inverted + } + /** * Defines the internal entrypoint of module resolution and retrieval. * @@ -462,14 +298,15 @@ object IvyActions { val ivyInstance = inputs.ivy val moduleDescriptor = inputs.module val updateConfiguration = inputs.updateConfiguration - val logging = updateConfiguration.logging val resolveOptions = new ResolveOptions val resolveId = ResolveOptions.getDefaultResolveId(moduleDescriptor) + val artifactFilter = getArtifactTypeFilter(updateConfiguration.artifactFilter) + import updateConfiguration._ resolveOptions.setResolveId(resolveId) - resolveOptions.setArtifactFilter(updateConfiguration.artifactFilter) - resolveOptions.setUseCacheOnly(updateConfiguration.offline) + resolveOptions.setArtifactFilter(artifactFilter) + resolveOptions.setUseCacheOnly(offline) resolveOptions.setLog(ivyLogLevel(logging)) - if (updateConfiguration.frozen) { + if (frozen) { resolveOptions.setTransitive(false) resolveOptions.setCheckIfChanged(false) } @@ -480,7 +317,7 @@ object IvyActions { ) val resolveReport = ivyInstance.resolve(moduleDescriptor, resolveOptions) - if (resolveReport.hasError && !inputs.updateConfiguration.missingOk) { + if (resolveReport.hasError && !missingOk) { // If strict error, collect report information and generated UnresolvedWarning val messages = resolveReport.getAllProblemMessages.toArray.map(_.toString).distinct val failedPaths = resolveReport.getUnresolvedDependencies.map { node => @@ -513,7 +350,6 @@ object IvyActions { */ private[this] def cachedResolveAndRetrieve( inputs: ResolutionInputs, - logicalClock: LogicalClock, cache: File ): Either[ResolveException, UpdateReport] = { val log = inputs.log @@ -522,16 +358,22 @@ object IvyActions { val resolver = inputs.ivy.getResolveEngine.asInstanceOf[CachedResolutionResolveEngine] val resolveOptions = new ResolveOptions val resolveId = ResolveOptions.getDefaultResolveId(descriptor) + val artifactFilter = getArtifactTypeFilter(updateConfiguration.artifactFilter) + import updateConfiguration._ resolveOptions.setResolveId(resolveId) - resolveOptions.setArtifactFilter(updateConfiguration.artifactFilter) - resolveOptions.setUseCacheOnly(updateConfiguration.offline) - resolveOptions.setLog(ivyLogLevel(updateConfiguration.logging)) - if (updateConfiguration.frozen) { + resolveOptions.setArtifactFilter(artifactFilter) + resolveOptions.setUseCacheOnly(offline) + resolveOptions.setLog(ivyLogLevel(logging)) + if (frozen) { resolveOptions.setTransitive(false) resolveOptions.setCheckIfChanged(false) } - val acceptError = updateConfiguration.missingOk - resolver.customResolve(descriptor, acceptError, logicalClock, resolveOptions, cache, log) + resolver.customResolve(descriptor, + missingOk, + updateConfiguration.logicalClock, + resolveOptions, + cache, + log) } private def retrieve( @@ -541,15 +383,15 @@ object IvyActions { config: RetrieveConfiguration ): UpdateReport = { val copyChecksums = ivy.getVariable(ConvertResolver.ManagedChecksums).toBoolean - val toRetrieve: Option[Set[ConfigRef]] = config.configurationsToRetrieve - val base = config.retrieveDirectory - val pattern = config.outputPattern + val toRetrieve: Option[Vector[ConfigRef]] = config.configurationsToRetrieve + val base = getRetrieveDirectory(config.retrieveDirectory) + val pattern = getRetrievePattern(config.outputPattern) val existingFiles = PathFinder(base).allPaths.get filterNot { _.isDirectory } val toCopy = new collection.mutable.HashSet[(File, File)] val retReport = report retrieve { (conf: ConfigRef, mid, art, cached) => toRetrieve match { case None => performRetrieve(conf, mid, art, base, pattern, cached, copyChecksums, toCopy) - case Some(refs) if refs(conf) => + case Some(refs) if refs contains conf => performRetrieve(conf, mid, art, base, pattern, cached, copyChecksums, toCopy) case _ => cached } @@ -656,83 +498,10 @@ object IvyActions { } } private[this] def checkFilesPresent(artifacts: Seq[(IArtifact, File)]): Unit = { - val missing = artifacts filter { case (a, file) => !file.exists } + val missing = artifacts filter { case (_, file) => !file.exists } if (missing.nonEmpty) sys.error( "Missing files for publishing:\n\t" + missing.map(_._2.getAbsolutePath).mkString("\n\t") ) } } - -private[sbt] final class ResolveException( - val messages: Seq[String], - val failed: Seq[ModuleID], - val failedPaths: Map[ModuleID, Seq[ModuleID]] -) extends RuntimeException(messages.mkString("\n")) { - def this(messages: Seq[String], failed: Seq[ModuleID]) = - this(messages, failed, Map(failed map { m => - m -> Nil - }: _*)) -} - -/** - * Represents unresolved dependency warning, which displays reconstructed dependency tree - * along with source position of each node. - */ -final class UnresolvedWarning private[sbt] ( - val resolveException: ResolveException, - val failedPaths: Seq[Seq[(ModuleID, Option[SourcePosition])]] -) -object UnresolvedWarning { - private[sbt] def apply( - err: ResolveException, - config: UnresolvedWarningConfiguration - ): UnresolvedWarning = { - def modulePosition(m0: ModuleID): Option[SourcePosition] = - config.modulePositions.find { - case (m, p) => - (m.organization == m0.organization) && - (m0.name startsWith m.name) && - (m.revision == m0.revision) - } map { - case (m, p) => p - } - val failedPaths = err.failed map { x: ModuleID => - err.failedPaths(x).toList.reverse map { id => - (id, modulePosition(id)) - } - } - new UnresolvedWarning(err, failedPaths) - } - - private[sbt] def sourcePosStr(posOpt: Option[SourcePosition]): String = - posOpt match { - case Some(LinePosition(path, start)) => s" ($path#L$start)" - case Some(RangePosition(path, LineRange(start, end))) => s" ($path#L$start-$end)" - case _ => "" - } - implicit val unresolvedWarningLines: ShowLines[UnresolvedWarning] = ShowLines { a => - val withExtra = a.resolveException.failed.filter(_.extraDependencyAttributes.nonEmpty) - val buffer = mutable.ListBuffer[String]() - if (withExtra.nonEmpty) { - buffer += "\n\tNote: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes." - withExtra foreach { id => - buffer += "\t\t" + id - } - } - if (a.failedPaths.nonEmpty) { - buffer += "\n\tNote: Unresolved dependencies path:" - a.failedPaths foreach { path => - if (path.nonEmpty) { - val head = path.head - buffer += "\t\t" + head._1.toString + sourcePosStr(head._2) - path.tail foreach { - case (m, pos) => - buffer += "\t\t +- " + m.toString + sourcePosStr(pos) - } - } - } - } - buffer.toList - } -} diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyCache.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyCache.scala similarity index 95% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyCache.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/IvyCache.scala index 9a0044ac..c17aa283 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyCache.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyCache.scala @@ -17,9 +17,10 @@ import org.apache.ivy.plugins.resolver.util.ResolvedResource import org.apache.ivy.util.FileUtil import sbt.io.Path import sbt.librarymanagement._ +import sbt.librarymanagement.ivy.{ InlineIvyConfiguration, IvyPaths } import sbt.util.Logger -import scalajson.ast.unsafe._ +import sjsonnew.shaded.scalajson.ast.unsafe._ import scala.collection.mutable import jawn.{ SupportParser, MutableFacade } @@ -103,18 +104,11 @@ class IvyCache(val ivyHome: Option[File]) { private def basicLocalIvy(lock: Option[xsbti.GlobalLock], log: Logger) = { val local = Resolver.defaultLocal val paths = IvyPaths(new File("."), ivyHome) - val conf = new InlineIvyConfiguration( - paths, - Vector(local), - Vector.empty, - Vector.empty, - lock, - IvySbt.DefaultChecksums, - false, - None, - UpdateOptions(), - log - ) + val conf = InlineIvyConfiguration() + .withPaths(paths) + .withResolvers(Vector(local)) + .withLock(lock) + .withLog(log) (new IvySbt(conf), local) } diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/IvyInternalDefaults.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyInternalDefaults.scala new file mode 100644 index 00000000..e2d558ba --- /dev/null +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyInternalDefaults.scala @@ -0,0 +1,28 @@ +package sbt +package internal.librarymanagement + +import java.io.File +import sbt.librarymanagement.ivy._ +import sbt.io.syntax._ +import xsbti.{ Logger => XLogger } +import sbt.util.Logger + +/** + * This is a list of functions with default values. + */ +object IvyInternalDefaults { + def defaultBaseDirectory: File = + (new File(".")).getAbsoluteFile / "lib_managed" + + def getBaseDirectory(opt: Option[File]): File = + opt.getOrElse(defaultBaseDirectory) + + def getLog(opt: Option[XLogger]): XLogger = + opt.getOrElse(Logger.Null) + + def defaultIvyPaths: IvyPaths = + IvyPaths(defaultBaseDirectory, None) + + def getIvyPaths(opt: Option[IvyPaths]): IvyPaths = + opt.getOrElse(defaultIvyPaths) +} diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyLogger.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyLogger.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyLogger.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/IvyLogger.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/IvyScalaExtra.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyScalaUtil.scala similarity index 82% rename from librarymanagement/src/main/scala/sbt/librarymanagement/IvyScalaExtra.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/IvyScalaUtil.scala index 9d18c9da..ed21d56a 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/IvyScalaExtra.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyScalaUtil.scala @@ -1,68 +1,28 @@ /* sbt -- Simple Build Tool * Copyright 2008, 2009, 2010 Mark Harrah */ -package sbt.librarymanagement +package sbt.internal.librarymanagement import java.util.Collections.emptyMap import scala.collection.mutable.HashSet -import org.apache.ivy.core.module.descriptor._ +import org.apache.ivy.core.module.descriptor.{ Configuration => _, _ } import org.apache.ivy.core.module.id.{ ArtifactId, ModuleId, ModuleRevisionId } import org.apache.ivy.plugins.matcher.ExactPatternMatcher import org.apache.ivy.plugins.namespace.NamespaceTransformer import sbt.util.Logger +import sbt.librarymanagement.ScalaArtifacts._ +import sbt.librarymanagement.{ ScalaModuleInfo, CrossVersion, Configuration } -object ScalaArtifacts { - val Organization = "org.scala-lang" - val LibraryID = "scala-library" - val CompilerID = "scala-compiler" - val ReflectID = "scala-reflect" - val ActorsID = "scala-actors" - val ScalapID = "scalap" - val Artifacts = Vector(LibraryID, CompilerID, ReflectID, ActorsID, ScalapID) - val DottyIDPrefix = "dotty" +object IvyScalaUtil { - def dottyID(binaryVersion: String): String = s"${DottyIDPrefix}_${binaryVersion}" - - def libraryDependency(version: String): ModuleID = ModuleID(Organization, LibraryID, version) - - private[sbt] def toolDependencies( - org: String, - version: String, - isDotty: Boolean = false - ): Seq[ModuleID] = - if (isDotty) - Seq( - ModuleID(org, DottyIDPrefix, version) - .withConfigurations(Some(Configurations.ScalaTool.name + "->default(compile)")) - .withCrossVersion(CrossVersion.binary) - ) - else - Seq( - scalaToolDependency(org, ScalaArtifacts.CompilerID, version), - scalaToolDependency(org, ScalaArtifacts.LibraryID, version) - ) - - private[this] def scalaToolDependency(org: String, id: String, version: String): ModuleID = - ModuleID(org, id, version).withConfigurations( - Some(Configurations.ScalaTool.name + "->default,optional(default)") - ) -} -object SbtArtifacts { - val Organization = "org.scala-sbt" -} - -import ScalaArtifacts._ - -private[sbt] abstract class IvyScalaFunctions { - - /** Performs checks/adds filters on Scala dependencies (if enabled in IvyScala). */ + /** Performs checks/adds filters on Scala dependencies (if enabled in ScalaModuleInfo). */ def checkModule( module: DefaultModuleDescriptor, conf: String, scalaVersionConfigs: Vector[String], log: Logger - )(check: IvyScala): Unit = { + )(check: ScalaModuleInfo): Unit = { if (check.checkExplicit) checkDependencies( module, @@ -98,7 +58,7 @@ private[sbt] abstract class IvyScalaFunctions { def dependeeQualifies: Boolean = dd.getParentRevisionId == null || ( dd.getParentRevisionId.getName match { - case name @ (CompilerID | LibraryID | ReflectID | ActorsID | ScalapID) => + case _ @(CompilerID | LibraryID | ReflectID | ActorsID | ScalapID) => false case _ => true diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyUtil.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyUtil.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyUtil.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/IvyUtil.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/MakePom.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala similarity index 99% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/MakePom.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala index 3e30bf85..3ec739e4 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/MakePom.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala @@ -10,6 +10,7 @@ package sbt.internal.librarymanagement import java.io.File import sbt.util.Logger import sbt.librarymanagement._ +import Resolver._ import mavenint.PomExtraDependencyAttributes // Node needs to be renamed to XNode because the task subproject contains a Node type that will shadow @@ -259,7 +260,7 @@ class MakePom(val log: Logger) { types match { case Nil => Artifact.PomType case xs if xs.contains(Artifact.DefaultType) => Artifact.DefaultType - case x :: xs => x + case x :: (xs @ _) => x } } val IgnoreTypes: Set[String] = Set(Artifact.SourceType, Artifact.DocType, Artifact.PomType) diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ProjectResolver.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ProjectResolver.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ProjectResolver.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ProjectResolver.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ResolutionCache.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ResolutionCache.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ResolutionCache.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ResolutionCache.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala similarity index 99% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala index e6985e94..4cebabdc 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala @@ -158,7 +158,7 @@ private[sbt] class CachedResolutionResolveCache { def extractOverrides(md0: ModuleDescriptor): Vector[IvyOverride] = { import scala.collection.JavaConverters._ md0.getAllDependencyDescriptorMediators.getAllRules.asScala.toSeq.toVector sortBy { - case (k, v) => + case (k, _) => k.toString } collect { case (k: MapMatcher, v: OverrideDependencyDescriptorMediator) => @@ -209,7 +209,7 @@ private[sbt] class CachedResolutionResolveCache { else None) match { case Some(path) => log.debug(s"parsing ${path.getAbsolutePath.toString}") - val ur = JsonUtil.parseUpdateReport(md, path, cachedDescriptor, log) + val ur = JsonUtil.parseUpdateReport(path, cachedDescriptor, log) if (ur.allFiles forall { _.exists }) { updateReportCache(md.getModuleRevisionId) = Right(ur) Some(Right(ur)) @@ -299,7 +299,7 @@ private[sbt] class CachedResolutionResolveCache { if (projectReportCache contains (mrid -> logicalClock)) projectReportCache((mrid, logicalClock)) else { - val oldKeys = projectReportCache.keys filter { case (x, clk) => clk != logicalClock } + val oldKeys = projectReportCache.keys filter { case (_, clk) => clk != logicalClock } projectReportCache --= oldKeys projectReportCache.getOrElseUpdate((mrid, logicalClock), f) } @@ -645,7 +645,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine { OrganizationArtifactReport(oar.organization, oar.name, mrs) } allModules2(k) = oars - case (k, v) => // do nothing + case (_, _) => // do nothing } breakLoops(rest) @@ -757,7 +757,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine { val allCallers = xs flatMap { _.callers } // Caller info is often repeated across the subprojects. We only need ModuleID info for later, so xs.head is ok. val distinctByModuleId = allCallers.groupBy({ _.caller }).toVector map { - case (k, xs) => xs.head + case (_, xs) => xs.head } val allArtifacts = (xs flatMap { _.artifacts }).distinct xs.head diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/CustomMavenResolver.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/CustomMavenResolver.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/CustomMavenResolver.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/CustomMavenResolver.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/ErrorMessageAuthenticator.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/ErrorMessageAuthenticator.scala similarity index 93% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/ErrorMessageAuthenticator.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/ErrorMessageAuthenticator.scala index 9a19ac6c..78e1154d 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/ErrorMessageAuthenticator.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/ErrorMessageAuthenticator.scala @@ -40,8 +40,8 @@ object ErrorMessageAuthenticator { } try Option(ivyOriginalField.get(ivy).asInstanceOf[Authenticator]) match { - case Some(alreadyThere: ErrorMessageAuthenticator) => // We're already installed, no need to do the work again. - case originalOpt => installIntoIvyImpl(originalOpt) + case Some(_: ErrorMessageAuthenticator) => // We're already installed, no need to do the work again. + case originalOpt => installIntoIvyImpl(originalOpt) } catch { case t: Throwable => Message.debug( @@ -57,7 +57,7 @@ object ErrorMessageAuthenticator { def doInstall(original: Option[Authenticator]): Unit = try Authenticator.setDefault(new ErrorMessageAuthenticator(original)) catch { - case e: SecurityException if !securityWarningLogged => + case _: SecurityException if !securityWarningLogged => securityWarningLogged = true Message.warn( "Not enough permissions to set the ErrorMessageAuthenticator. " @@ -69,7 +69,7 @@ object ErrorMessageAuthenticator { // obtain it. If that doesn't work, assume there is no original authenticator def doInstallIfIvy(original: Option[Authenticator]): Unit = original match { - case Some(installed: ErrorMessageAuthenticator) => // Ignore, we're already installed + case Some(_: ErrorMessageAuthenticator) => // Ignore, we're already installed case Some(ivy: IvyAuthenticator) => installIntoIvy(ivy); () case original => doInstall(original) diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/GigahorseUrlHandler.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/GigahorseUrlHandler.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/GigahorseUrlHandler.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/GigahorseUrlHandler.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/IvyCredentialsLookup.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/IvyCredentialsLookup.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/IvyCredentialsLookup.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/IvyCredentialsLookup.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/MergeDescriptors.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/MergeDescriptors.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/MergeDescriptors.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/MergeDescriptors.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/ParallelResolveEngine.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/ParallelResolveEngine.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/ParallelResolveEngine.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/ParallelResolveEngine.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtChainResolver.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtChainResolver.scala similarity index 99% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtChainResolver.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtChainResolver.scala index ad624505..d9f72ac1 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtChainResolver.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtChainResolver.scala @@ -21,6 +21,7 @@ import org.apache.ivy.plugins.resolver.util.{ HasLatestStrategy, ResolvedResourc import org.apache.ivy.util.{ Message, StringUtils => IvyStringUtils } import sbt.util.Logger import sbt.librarymanagement._ +import sbt.librarymanagement.ivy.UpdateOptions import scala.util.control.NonFatal diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtDefaultDependencyDescriptor.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtDefaultDependencyDescriptor.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtDefaultDependencyDescriptor.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtDefaultDependencyDescriptor.scala diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala similarity index 100% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala rename to ivy/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/CircularDependencyLevel.scala b/ivy/src/main/scala/sbt/librarymanagement/ivy/CircularDependencyLevel.scala similarity index 98% rename from librarymanagement/src/main/scala/sbt/librarymanagement/CircularDependencyLevel.scala rename to ivy/src/main/scala/sbt/librarymanagement/ivy/CircularDependencyLevel.scala index 4f1b5320..defba16b 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/CircularDependencyLevel.scala +++ b/ivy/src/main/scala/sbt/librarymanagement/ivy/CircularDependencyLevel.scala @@ -1,4 +1,5 @@ package sbt.librarymanagement +package ivy import org.apache.ivy.plugins.circular.{ CircularDependencyStrategy, diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/Credentials.scala b/ivy/src/main/scala/sbt/librarymanagement/ivy/Credentials.scala similarity index 99% rename from librarymanagement/src/main/scala/sbt/librarymanagement/Credentials.scala rename to ivy/src/main/scala/sbt/librarymanagement/ivy/Credentials.scala index 4044dfd3..26ccc57f 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/Credentials.scala +++ b/ivy/src/main/scala/sbt/librarymanagement/ivy/Credentials.scala @@ -2,6 +2,7 @@ * Copyright 2009 Mark Harrah */ package sbt.librarymanagement +package ivy import java.io.File import org.apache.ivy.util.url.CredentialsStore diff --git a/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyDefaults.scala b/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyDefaults.scala new file mode 100644 index 00000000..70028721 --- /dev/null +++ b/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyDefaults.scala @@ -0,0 +1,9 @@ +package sbt +package librarymanagement.ivy + +/** + * This is a list of functions with default values. + */ +object IvyDefaults { + val defaultChecksums: Vector[String] = Vector("sha1", "md5") +} diff --git a/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyDependencyResolution.scala b/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyDependencyResolution.scala new file mode 100644 index 00000000..fd0fd259 --- /dev/null +++ b/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyDependencyResolution.scala @@ -0,0 +1,31 @@ +package sbt +package librarymanagement +package ivy + +import sbt.internal.librarymanagement._ +import sbt.util.Logger + +class IvyDependencyResolution private[sbt] (val ivySbt: IvySbt) + extends DependencyResolutionInterface { + type Module = ivySbt.Module + + override def moduleDescriptor(moduleSetting: ModuleDescriptorConfiguration): ModuleDescriptor = { + new Module(moduleSetting) + } + + override def update(module: ModuleDescriptor, + configuration: UpdateConfiguration, + uwconfig: UnresolvedWarningConfiguration, + log: Logger): Either[UnresolvedWarning, UpdateReport] = + IvyActions.updateEither(toModule(module), configuration, uwconfig, log) + + private[sbt] def toModule(module: ModuleDescriptor): Module = + module match { + case m: Module => m + } +} + +object IvyDependencyResolution { + def apply(ivyConfiguration: IvyConfiguration): DependencyResolution = + DependencyResolution(new IvyDependencyResolution(new IvySbt(ivyConfiguration))) +} diff --git a/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyLibraryManagementCodec.scala b/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyLibraryManagementCodec.scala new file mode 100644 index 00000000..68bbee4d --- /dev/null +++ b/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyLibraryManagementCodec.scala @@ -0,0 +1,17 @@ +package sbt.librarymanagement +package ivy + +trait IvyLibraryManagementCodec + extends sjsonnew.BasicJsonProtocol + with LibraryManagementCodec + with sbt.internal.librarymanagement.formats.GlobalLockFormat + with sbt.internal.librarymanagement.formats.LoggerFormat + with sbt.librarymanagement.ivy.formats.UpdateOptionsFormat + with IvyPathsFormats + with ResolverFormats + with ModuleConfigurationFormats + with InlineIvyConfigurationFormats + with ExternalIvyConfigurationFormats + with IvyConfigurationFormats + +object IvyLibraryManagementCodec extends IvyLibraryManagementCodec diff --git a/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyPublisher.scala b/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyPublisher.scala new file mode 100644 index 00000000..cc92e8bf --- /dev/null +++ b/ivy/src/main/scala/sbt/librarymanagement/ivy/IvyPublisher.scala @@ -0,0 +1,35 @@ +package sbt +package librarymanagement +package ivy + +import sbt.internal.librarymanagement._ +import sbt.util.Logger +import java.io.File + +class IvyPublisher private[sbt] (val ivySbt: IvySbt) extends PublisherInterface { + type Module = ivySbt.Module + + override def moduleDescriptor(moduleSetting: ModuleDescriptorConfiguration): ModuleDescriptor = { + new Module(moduleSetting) + } + + override def makePomFile(module: ModuleDescriptor, + configuration: MakePomConfiguration, + log: Logger): File = + IvyActions.makePomFile(toModule(module), configuration, log) + + override def publish(module: ModuleDescriptor, + configuration: PublishConfiguration, + log: Logger): Unit = + IvyActions.publish(toModule(module), configuration, log) + + private[sbt] def toModule(module: ModuleDescriptor): Module = + module match { + case m: Module => m + } +} + +object IvyPublisher { + def apply(ivyConfiguration: IvyConfiguration): Publisher = + Publisher(new IvyPublisher(new IvySbt(ivyConfiguration))) +} diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/UpdateOptions.scala b/ivy/src/main/scala/sbt/librarymanagement/ivy/UpdateOptions.scala similarity index 99% rename from librarymanagement/src/main/scala/sbt/librarymanagement/UpdateOptions.scala rename to ivy/src/main/scala/sbt/librarymanagement/ivy/UpdateOptions.scala index bafbc3e4..f09436e6 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/UpdateOptions.scala +++ b/ivy/src/main/scala/sbt/librarymanagement/ivy/UpdateOptions.scala @@ -1,4 +1,5 @@ package sbt.librarymanagement +package ivy import org.apache.ivy.plugins.resolver.DependencyResolver import org.apache.ivy.core.settings.IvySettings diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/UpdateOptionsFormat.scala b/ivy/src/main/scala/sbt/librarymanagement/ivy/formats/UpdateOptionsFormat.scala similarity index 97% rename from librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/UpdateOptionsFormat.scala rename to ivy/src/main/scala/sbt/librarymanagement/ivy/formats/UpdateOptionsFormat.scala index c948a12c..db0e8378 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/UpdateOptionsFormat.scala +++ b/ivy/src/main/scala/sbt/librarymanagement/ivy/formats/UpdateOptionsFormat.scala @@ -1,4 +1,4 @@ -package sbt.internal.librarymanagement +package sbt.librarymanagement.ivy package formats import sjsonnew._ diff --git a/librarymanagement/src/test/resources/artifact1.jar b/ivy/src/test/resources/artifact1.jar similarity index 100% rename from librarymanagement/src/test/resources/artifact1.jar rename to ivy/src/test/resources/artifact1.jar diff --git a/librarymanagement/src/test/resources/artifact2.txt b/ivy/src/test/resources/artifact2.txt similarity index 100% rename from librarymanagement/src/test/resources/artifact2.txt rename to ivy/src/test/resources/artifact2.txt diff --git a/librarymanagement/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/ivys/ivy.xml b/ivy/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/ivys/ivy.xml similarity index 100% rename from librarymanagement/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/ivys/ivy.xml rename to ivy/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/ivys/ivy.xml diff --git a/librarymanagement/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/jars/libmodule.jar b/ivy/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/jars/libmodule.jar similarity index 100% rename from librarymanagement/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/jars/libmodule.jar rename to ivy/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/jars/libmodule.jar diff --git a/librarymanagement/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/srcs/libmodule-source.jar b/ivy/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/srcs/libmodule-source.jar similarity index 100% rename from librarymanagement/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/srcs/libmodule-source.jar rename to ivy/src/test/resources/test-ivy-repo/com.test/module-with-srcs/0.1.00/srcs/libmodule-source.jar diff --git a/librarymanagement/src/test/resources/test-maven-repo/com/test/test-artifact/1.0.0-SNAPSHOT/test-artifact-1.0.0-SNAPSHOT.jar b/ivy/src/test/resources/test-maven-repo/com/test/test-artifact/1.0.0-SNAPSHOT/test-artifact-1.0.0-SNAPSHOT.jar similarity index 100% rename from librarymanagement/src/test/resources/test-maven-repo/com/test/test-artifact/1.0.0-SNAPSHOT/test-artifact-1.0.0-SNAPSHOT.jar rename to ivy/src/test/resources/test-maven-repo/com/test/test-artifact/1.0.0-SNAPSHOT/test-artifact-1.0.0-SNAPSHOT.jar diff --git a/librarymanagement/src/test/resources/test-maven-repo/com/test/test-artifact/1.0.0-SNAPSHOT/test-artifact-1.0.0-SNAPSHOT.pom b/ivy/src/test/resources/test-maven-repo/com/test/test-artifact/1.0.0-SNAPSHOT/test-artifact-1.0.0-SNAPSHOT.pom similarity index 100% rename from librarymanagement/src/test/resources/test-maven-repo/com/test/test-artifact/1.0.0-SNAPSHOT/test-artifact-1.0.0-SNAPSHOT.pom rename to ivy/src/test/resources/test-maven-repo/com/test/test-artifact/1.0.0-SNAPSHOT/test-artifact-1.0.0-SNAPSHOT.pom diff --git a/librarymanagement/src/test/scala/BaseIvySpecification.scala b/ivy/src/test/scala/BaseIvySpecification.scala similarity index 55% rename from librarymanagement/src/test/scala/BaseIvySpecification.scala rename to ivy/src/test/scala/BaseIvySpecification.scala index 5fa82c30..4dd23afe 100644 --- a/librarymanagement/src/test/scala/BaseIvySpecification.scala +++ b/ivy/src/test/scala/BaseIvySpecification.scala @@ -6,6 +6,7 @@ import java.io.File import cross.CrossVersionUtil import sbt.internal.util.ConsoleLogger import sbt.librarymanagement._ +import sbt.librarymanagement.ivy._ import Configurations._ trait BaseIvySpecification extends UnitSpec { @@ -17,6 +18,8 @@ trait BaseIvySpecification extends UnitSpec { ModuleID("com.example", "foo", "0.1.0").withConfigurations(Some("compile")) lazy val log = ConsoleLogger() + def lmEngine(uo: UpdateOptions = UpdateOptions()): DependencyResolution = + IvyDependencyResolution(mkIvyConfiguration(uo)) def configurations = Vector(Compile, Test, Runtime) def module(moduleId: ModuleID, @@ -24,8 +27,8 @@ trait BaseIvySpecification extends UnitSpec { scalaFullVersion: Option[String], uo: UpdateOptions = UpdateOptions(), overrideScalaVersion: Boolean = true): IvySbt#Module = { - val ivyScala = scalaFullVersion map { fv => - IvyScala( + val scalaModuleInfo = scalaFullVersion map { fv => + ScalaModuleInfo( scalaFullVersion = fv, scalaBinaryVersion = CrossVersionUtil.binaryScalaVersion(fv), configurations = Vector.empty, @@ -35,60 +38,49 @@ trait BaseIvySpecification extends UnitSpec { ) } - val moduleSetting: ModuleSettings = InlineConfiguration( - false, - ivyScala, - module = moduleId, - moduleInfo = ModuleInfo("foo"), - dependencies = deps - ).withConfigurations(configurations) + val moduleSetting: ModuleSettings = ModuleDescriptorConfiguration(moduleId, ModuleInfo("foo")) + .withDependencies(deps) + .withConfigurations(configurations) + .withScalaModuleInfo(scalaModuleInfo) val ivySbt = new IvySbt(mkIvyConfiguration(uo)) new ivySbt.Module(moduleSetting) } - def resolvers: Vector[Resolver] = Vector(DefaultMavenRepository) + def resolvers: Vector[Resolver] = Vector(Resolver.mavenCentral) def chainResolver = ChainedResolver("sbt-chain", resolvers) def mkIvyConfiguration(uo: UpdateOptions): IvyConfiguration = { - val paths = IvyPaths(currentBase, Some(currentTarget)) - val other = Vector.empty - val check = Vector.empty - val managedChecksums = false val moduleConfs = Vector(ModuleConfiguration("*", chainResolver)) val resCacheDir = currentTarget / "resolution-cache" - new InlineIvyConfiguration(paths, - resolvers, - other, - moduleConfs, - None, - check, - managedChecksums, - Some(resCacheDir), - uo, - log) + InlineIvyConfiguration() + .withPaths(IvyPaths(currentBase, Some(currentTarget))) + .withResolvers(resolvers) + .withModuleConfigurations(moduleConfs) + .withChecksums(Vector.empty) + .withResolutionCacheDir(resCacheDir) + .withLog(log) + .withUpdateOptions(uo) } - def makeUpdateConfiguration(offline: Boolean): UpdateConfiguration = { - val retrieveConfig = - RetrieveConfiguration(currentManaged, Resolver.defaultRetrievePattern).withSync(false) - UpdateConfiguration(Some(retrieveConfig), - false, - UpdateLogging.Full, - ArtifactTypeFilter.forbid(Set("src", "doc")), - offline, - false) + def makeUpdateConfiguration(offline: Boolean, + metadataDirectory: Option[File]): UpdateConfiguration = { + val retrieveConfig = RetrieveConfiguration() + .withRetrieveDirectory(currentManaged) + .withOutputPattern(Resolver.defaultRetrievePattern) + .withSync(false) + + UpdateConfiguration() + .withRetrieveManaged(retrieveConfig) + .withLogging(UpdateLogging.Full) + .withOffline(offline) + .withMetadataDirectory(metadataDirectory) } def ivyUpdateEither(module: IvySbt#Module): Either[UnresolvedWarning, UpdateReport] = { // IO.delete(currentTarget) - val config = makeUpdateConfiguration(false) - IvyActions.updateEither(module, - config, - UnresolvedWarningConfiguration(), - LogicalClock.unknown, - Some(currentDependency), - log) + val config = makeUpdateConfiguration(false, Some(currentDependency)) + IvyActions.updateEither(module, config, UnresolvedWarningConfiguration(), log) } def cleanIvyCache(): Unit = IO.delete(currentTarget / "cache") @@ -105,14 +97,11 @@ trait BaseIvySpecification extends UnitSpec { def mkPublishConfiguration(resolver: Resolver, artifacts: Map[Artifact, File]): PublishConfiguration = { - new PublishConfiguration( - ivyFile = None, - resolverName = resolver.name, - artifacts = artifacts, - checksums = Vector.empty, - logging = UpdateLogging.Full, - overwrite = true - ) + PublishConfiguration() + .withResolverName(resolver.name) + .withArtifacts(artifacts.toVector) + .withChecksums(Vector.empty) + .withOverwrite(true) } def ivyPublish(module: IvySbt#Module, config: PublishConfiguration) = { diff --git a/librarymanagement/src/test/scala/CachedResolutionSpec.scala b/ivy/src/test/scala/CachedResolutionSpec.scala similarity index 98% rename from librarymanagement/src/test/scala/CachedResolutionSpec.scala rename to ivy/src/test/scala/CachedResolutionSpec.scala index f00787fd..ebab8028 100644 --- a/librarymanagement/src/test/scala/CachedResolutionSpec.scala +++ b/ivy/src/test/scala/CachedResolutionSpec.scala @@ -2,6 +2,7 @@ package sbt.internal.librarymanagement import sbt.util.ShowLines import sbt.librarymanagement._ +import sbt.librarymanagement.ivy.UpdateOptions class CachedResolutionSpec extends BaseIvySpecification { import ShowLines._ diff --git a/librarymanagement/src/test/scala/ComponentManagerTest.scala b/ivy/src/test/scala/ComponentManagerTest.scala similarity index 100% rename from librarymanagement/src/test/scala/ComponentManagerTest.scala rename to ivy/src/test/scala/ComponentManagerTest.scala diff --git a/librarymanagement/src/test/scala/CrossVersionTest.scala b/ivy/src/test/scala/CrossVersionTest.scala similarity index 100% rename from librarymanagement/src/test/scala/CrossVersionTest.scala rename to ivy/src/test/scala/CrossVersionTest.scala diff --git a/librarymanagement/src/test/scala/CustomPomParserTest.scala b/ivy/src/test/scala/CustomPomParserTest.scala similarity index 71% rename from librarymanagement/src/test/scala/CustomPomParserTest.scala rename to ivy/src/test/scala/CustomPomParserTest.scala index 488f683a..97d5c54c 100644 --- a/librarymanagement/src/test/scala/CustomPomParserTest.scala +++ b/ivy/src/test/scala/CustomPomParserTest.scala @@ -5,6 +5,7 @@ import org.apache.ivy.core.module.descriptor.{ Artifact => IvyArtifact } import org.apache.ivy.core.module.id.ModuleRevisionId import org.apache.ivy.core.resolve.ResolveOptions import sbt.librarymanagement._ +import sbt.librarymanagement.ivy.{ InlineIvyConfiguration, IvyPaths } import sbt.io.IO.withTemporaryDirectory import sbt.internal.util.ConsoleLogger @@ -15,16 +16,10 @@ class CustomPomParserTest extends UnitSpec { val repoUrl = getClass.getResource("/test-maven-repo") val local = MavenRepository("Test Repo", repoUrl.toExternalForm) val paths = IvyPaths(new File("."), Some(cacheDir)) - val conf = new InlineIvyConfiguration(paths, - Vector(local), - Vector.empty, - Vector.empty, - None, - Vector("sha1", "md5"), - false, - None, - UpdateOptions(), - log) + val conf = InlineIvyConfiguration() + .withPaths(paths) + .withResolvers(Vector(local)) + .withLog(log) val ivySbt = new IvySbt(conf) val resolveOpts = new ResolveOptions().setConfs(Array("default")) val mrid = ModuleRevisionId.newInstance("com.test", "test-artifact", "1.0.0-SNAPSHOT") diff --git a/librarymanagement/src/test/scala/DMSerializationSpec.scala b/ivy/src/test/scala/DMSerializationSpec.scala similarity index 98% rename from librarymanagement/src/test/scala/DMSerializationSpec.scala rename to ivy/src/test/scala/DMSerializationSpec.scala index d38c8fcd..937fa353 100644 --- a/librarymanagement/src/test/scala/DMSerializationSpec.scala +++ b/ivy/src/test/scala/DMSerializationSpec.scala @@ -4,7 +4,7 @@ import java.net.URL import java.io.File import sbt.internal._, librarymanagement._ -import scalajson.ast.unsafe._ +import sjsonnew.shaded.scalajson.ast.unsafe._ import sjsonnew._, support.scalajson.unsafe._ import org.scalatest.Assertion diff --git a/librarymanagement/src/test/scala/EvictionWarningSpec.scala b/ivy/src/test/scala/EvictionWarningSpec.scala similarity index 100% rename from librarymanagement/src/test/scala/EvictionWarningSpec.scala rename to ivy/src/test/scala/EvictionWarningSpec.scala diff --git a/librarymanagement/src/test/scala/FrozenModeSpec.scala b/ivy/src/test/scala/FrozenModeSpec.scala similarity index 84% rename from librarymanagement/src/test/scala/FrozenModeSpec.scala rename to ivy/src/test/scala/FrozenModeSpec.scala index e84abfe9..cd9a3079 100644 --- a/librarymanagement/src/test/scala/FrozenModeSpec.scala +++ b/ivy/src/test/scala/FrozenModeSpec.scala @@ -1,13 +1,13 @@ package sbt.librarymanagement +import sbt.librarymanagement.ivy.UpdateOptions import sbt.internal.librarymanagement._ -import sbt.internal.librarymanagement.impl.DependencyBuilders +import sbt.librarymanagement.syntax._ -class FrozenModeSpec extends BaseIvySpecification with DependencyBuilders { +class FrozenModeSpec extends BaseIvySpecification { private final val targetDir = Some(currentDependency) - private final val onlineConf = makeUpdateConfiguration(false) - private final val frozenConf = makeUpdateConfiguration(false).withFrozen(true) - private final val noClock = LogicalClock.unknown + private final val onlineConf = makeUpdateConfiguration(false, targetDir) + private final val frozenConf = makeUpdateConfiguration(false, targetDir).withFrozen(true) private final val warningConf = UnresolvedWarningConfiguration() private final val normalOptions = UpdateOptions() @@ -29,7 +29,7 @@ class FrozenModeSpec extends BaseIvySpecification with DependencyBuilders { it should "fail when artifacts are missing in the cache" in { cleanIvyCache() def update(module: IvySbt#Module, conf: UpdateConfiguration) = - IvyActions.updateEither(module, conf, warningConf, noClock, targetDir, log) + IvyActions.updateEither(module, conf, warningConf, log) val toResolve = module(defaultModuleId, stoml, None, normalOptions) val onlineResolution = update(toResolve, onlineConf) diff --git a/librarymanagement/src/test/scala/InclExclSpec.scala b/ivy/src/test/scala/InclExclSpec.scala similarity index 84% rename from librarymanagement/src/test/scala/InclExclSpec.scala rename to ivy/src/test/scala/InclExclSpec.scala index c3a86755..62856f0c 100644 --- a/librarymanagement/src/test/scala/InclExclSpec.scala +++ b/ivy/src/test/scala/InclExclSpec.scala @@ -2,9 +2,10 @@ package sbt.librarymanagement import org.scalatest.Assertion import sbt.internal.librarymanagement.BaseIvySpecification -import sbt.internal.librarymanagement.impl.{ DependencyBuilders, GroupArtifactID } +import sbt.librarymanagement.syntax._ +import DependencyBuilders.OrganizationArtifactName -class InclExclSpec extends BaseIvySpecification with DependencyBuilders { +class InclExclSpec extends BaseIvySpecification { def createLiftDep(toExclude: ExclusionRule): ModuleID = ("net.liftweb" %% "lift-mapper" % "2.6-M4" % "compile").excludeAll(toExclude) @@ -41,13 +42,13 @@ class InclExclSpec extends BaseIvySpecification with DependencyBuilders { } it should "exclude any version of lift-json with explicit Scala version" in { - val excluded: GroupArtifactID = "net.liftweb" % "lift-json_2.10" + val excluded: OrganizationArtifactName = "net.liftweb" % "lift-json_2.10" val report = getIvyReport(createLiftDep(excluded), scala210) testLiftJsonIsMissing(report) } it should "exclude any version of cross-built lift-json" in { - val excluded: GroupArtifactID = "net.liftweb" %% "lift-json" + val excluded: OrganizationArtifactName = "net.liftweb" %% "lift-json" val report = getIvyReport(createLiftDep(excluded), scala210) testLiftJsonIsMissing(report) } @@ -60,7 +61,7 @@ class InclExclSpec extends BaseIvySpecification with DependencyBuilders { } it should "exclude any version of lift-json when it's full cross version" in { - val excluded = new GroupArtifactID("net.liftweb", "lift-json", CrossVersion.full) + val excluded = new OrganizationArtifactName("net.liftweb", "lift-json", CrossVersion.full) val report = getIvyReport(createMetaDep(excluded), scala2122) testScalahostIsMissing(report) } diff --git a/librarymanagement/src/test/scala/InconsistentDuplicateSpec.scala b/ivy/src/test/scala/InconsistentDuplicateSpec.scala similarity index 100% rename from librarymanagement/src/test/scala/InconsistentDuplicateSpec.scala rename to ivy/src/test/scala/InconsistentDuplicateSpec.scala diff --git a/librarymanagement/src/test/scala/MakePomSpec.scala b/ivy/src/test/scala/MakePomSpec.scala similarity index 100% rename from librarymanagement/src/test/scala/MakePomSpec.scala rename to ivy/src/test/scala/MakePomSpec.scala diff --git a/librarymanagement/src/test/scala/MergeDescriptorSpec.scala b/ivy/src/test/scala/MergeDescriptorSpec.scala similarity index 92% rename from librarymanagement/src/test/scala/MergeDescriptorSpec.scala rename to ivy/src/test/scala/MergeDescriptorSpec.scala index b435027b..ded1a9f1 100644 --- a/librarymanagement/src/test/scala/MergeDescriptorSpec.scala +++ b/ivy/src/test/scala/MergeDescriptorSpec.scala @@ -2,6 +2,7 @@ package sbt.internal.librarymanagement import org.apache.ivy.core.module.descriptor.DependencyArtifactDescriptor import sbt.librarymanagement._ +import sbt.librarymanagement.ivy.UpdateOptions import sbt.internal.librarymanagement.ivyint._ class MergeDescriptorSpec extends BaseIvySpecification { @@ -14,11 +15,11 @@ class MergeDescriptorSpec extends BaseIvySpecification { UpdateOptions() ) m.withModule(log) { - case (ivy, md, _) => + case (_, md, _) => val deps = md.getDependencies assert(deps.size == 1) deps.headOption.getOrElse(sys.error("Dependencies not found")) match { - case dd @ MergedDescriptors(dd0, dd1) => + case dd @ MergedDescriptors(_, _) => val arts = dd.getAllDependencyArtifacts val a0: DependencyArtifactDescriptor = arts.toList(0) val a1: DependencyArtifactDescriptor = arts.toList(1) diff --git a/librarymanagement/src/test/scala/ModuleIdTest.scala b/ivy/src/test/scala/ModuleIdTest.scala similarity index 100% rename from librarymanagement/src/test/scala/ModuleIdTest.scala rename to ivy/src/test/scala/ModuleIdTest.scala diff --git a/librarymanagement/src/test/scala/ModuleResolversTest.scala b/ivy/src/test/scala/ModuleResolversTest.scala similarity index 92% rename from librarymanagement/src/test/scala/ModuleResolversTest.scala rename to ivy/src/test/scala/ModuleResolversTest.scala index dd35c89e..dea739b0 100644 --- a/librarymanagement/src/test/scala/ModuleResolversTest.scala +++ b/ivy/src/test/scala/ModuleResolversTest.scala @@ -1,9 +1,11 @@ package sbt.librarymanagement +import sbt.librarymanagement.ivy.UpdateOptions import sbt.internal.librarymanagement.BaseIvySpecification -import sbt.internal.librarymanagement.impl.DependencyBuilders +import sbt.librarymanagement.syntax._ +import Resolver._ -class ModuleResolversTest extends BaseIvySpecification with DependencyBuilders { +class ModuleResolversTest extends BaseIvySpecification { override final val resolvers = Vector( DefaultMavenRepository, JavaNet2Repository, diff --git a/librarymanagement/src/test/scala/OfflineModeSpec.scala b/ivy/src/test/scala/OfflineModeSpec.scala similarity index 88% rename from librarymanagement/src/test/scala/OfflineModeSpec.scala rename to ivy/src/test/scala/OfflineModeSpec.scala index f4747a7f..5bf20732 100644 --- a/librarymanagement/src/test/scala/OfflineModeSpec.scala +++ b/ivy/src/test/scala/OfflineModeSpec.scala @@ -1,18 +1,17 @@ package sbt.librarymanagement +import sbt.librarymanagement.ivy.UpdateOptions import org.scalatest.Assertion import sbt.internal.librarymanagement._ -import sbt.internal.librarymanagement.impl.DependencyBuilders import sbt.io.IO -class OfflineModeSpec extends BaseIvySpecification with DependencyBuilders { +class OfflineModeSpec extends BaseIvySpecification { private final def targetDir = Some(currentDependency) - private final def onlineConf = makeUpdateConfiguration(false) - private final def offlineConf = makeUpdateConfiguration(true) + private final def onlineConf = makeUpdateConfiguration(false, targetDir) + private final def offlineConf = makeUpdateConfiguration(true, targetDir) private final def warningConf = UnresolvedWarningConfiguration() private final def normalOptions = UpdateOptions() private final def cachedOptions = UpdateOptions().withCachedResolution(true) - private final def noClock = LogicalClock.unknown def avro177 = ModuleID("org.apache.avro", "avro", "1.7.7") def dataAvro1940 = ModuleID("com.linkedin.pegasus", "data-avro", "1.9.40") @@ -34,7 +33,7 @@ class OfflineModeSpec extends BaseIvySpecification with DependencyBuilders { cleanCachedResolutionCache(toResolve) val onlineResolution = - IvyActions.updateEither(toResolve, onlineConf, warningConf, noClock, targetDir, log) + IvyActions.updateEither(toResolve, onlineConf, warningConf, log) assert(onlineResolution.isRight) assert(onlineResolution.right.exists(report => report.stats.resolveTime > 0)) @@ -43,7 +42,7 @@ class OfflineModeSpec extends BaseIvySpecification with DependencyBuilders { val estimatedCachedTime = originalResolveTime * 0.3 val offlineResolution = - IvyActions.updateEither(toResolve, offlineConf, warningConf, noClock, targetDir, log) + IvyActions.updateEither(toResolve, offlineConf, warningConf, log) assert(offlineResolution.isRight, s"Offline resolution has failed with $offlineResolution.") val resolveTime = offlineResolution.right.get.stats.resolveTime @@ -65,7 +64,7 @@ class OfflineModeSpec extends BaseIvySpecification with DependencyBuilders { val toResolve = module(defaultModuleId, dependencies, None, updateOptions) if (updateOptions.cachedResolution) cleanCachedResolutionCache(toResolve) val failedOfflineResolution = - IvyActions.updateEither(toResolve, offlineConf, warningConf, noClock, targetDir, log) + IvyActions.updateEither(toResolve, offlineConf, warningConf, log) assert(failedOfflineResolution.isLeft) } diff --git a/librarymanagement/src/test/scala/ResolverTest.scala b/ivy/src/test/scala/ResolverTest.scala similarity index 100% rename from librarymanagement/src/test/scala/ResolverTest.scala rename to ivy/src/test/scala/ResolverTest.scala diff --git a/librarymanagement/src/test/scala/ScalaOverrideTest.scala b/ivy/src/test/scala/ScalaOverrideTest.scala similarity index 98% rename from librarymanagement/src/test/scala/ScalaOverrideTest.scala rename to ivy/src/test/scala/ScalaOverrideTest.scala index bb872438..57ee011c 100644 --- a/librarymanagement/src/test/scala/ScalaOverrideTest.scala +++ b/ivy/src/test/scala/ScalaOverrideTest.scala @@ -5,7 +5,7 @@ import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor import sbt.internal.librarymanagement.UnitSpec -import IvyScala.OverrideScalaMediator +import sbt.internal.librarymanagement.IvyScalaUtil.OverrideScalaMediator import ScalaArtifacts._ class ScalaOverrideTest extends UnitSpec { diff --git a/librarymanagement/src/test/scala/UpdateOptionsSpec.scala b/ivy/src/test/scala/UpdateOptionsSpec.scala similarity index 95% rename from librarymanagement/src/test/scala/UpdateOptionsSpec.scala rename to ivy/src/test/scala/UpdateOptionsSpec.scala index eaf61fe2..831d2934 100644 --- a/librarymanagement/src/test/scala/UpdateOptionsSpec.scala +++ b/ivy/src/test/scala/UpdateOptionsSpec.scala @@ -1,4 +1,4 @@ -package sbt.librarymanagement +package sbt.librarymanagement.ivy import sbt.internal.librarymanagement.UnitSpec diff --git a/librarymanagement/src/test/scala/VersionNumberSpec.scala b/ivy/src/test/scala/VersionNumberSpec.scala similarity index 98% rename from librarymanagement/src/test/scala/VersionNumberSpec.scala rename to ivy/src/test/scala/VersionNumberSpec.scala index 5a1c27a7..4c1b8497 100644 --- a/librarymanagement/src/test/scala/VersionNumberSpec.scala +++ b/ivy/src/test/scala/VersionNumberSpec.scala @@ -131,8 +131,8 @@ class VersionNumberSpec extends UnitSpec { } def beParsedAsError(s: String): Unit = s match { - case VersionNumber(ns1, ts1, es1) => sys.error(s) - case _ => () + case VersionNumber(_, _, _) => sys.error(s) + case _ => () } def beSemVerCompatWith(v1: String, v2: String) = VersionNumber.SemVer.isCompatible(VersionNumber(v1), VersionNumber(v2)) shouldBe true diff --git a/librarymanagement/src/test/scala/sbt/internal/librarymanagement/FakeResolverSpecification.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/FakeResolverSpecification.scala similarity index 95% rename from librarymanagement/src/test/scala/sbt/internal/librarymanagement/FakeResolverSpecification.scala rename to ivy/src/test/scala/sbt/internal/librarymanagement/FakeResolverSpecification.scala index 07962f60..fdb5cc41 100644 --- a/librarymanagement/src/test/scala/sbt/internal/librarymanagement/FakeResolverSpecification.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/FakeResolverSpecification.scala @@ -4,7 +4,7 @@ package librarymanagement import java.io.File -import sbt.librarymanagement.{ ModuleID, RawRepository, Resolver, UpdateReport } +import sbt.librarymanagement.{ ModuleID, RawRepository, Resolver, UpdateReport, ResolveException } class FakeResolverSpecification extends BaseIvySpecification { import FakeResolver._ @@ -67,7 +67,8 @@ class FakeResolverSpecification extends BaseIvySpecification { ) private def fakeResolver = new FakeResolver("FakeResolver", new File("tmp"), modules) - override def resolvers: Vector[Resolver] = Vector(new RawRepository(fakeResolver)) + override def resolvers: Vector[Resolver] = + Vector(new RawRepository(fakeResolver, fakeResolver.getName)) private def getModule(myModule: ModuleID): IvySbt#Module = module(defaultModuleId, Vector(myModule), None) private def getAllFiles(report: UpdateReport) = diff --git a/librarymanagement/src/test/scala/sbt/internal/librarymanagement/IvyRepoSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/IvyRepoSpec.scala similarity index 75% rename from librarymanagement/src/test/scala/sbt/internal/librarymanagement/IvyRepoSpec.scala rename to ivy/src/test/scala/sbt/internal/librarymanagement/IvyRepoSpec.scala index 30965e81..2117e8c8 100644 --- a/librarymanagement/src/test/scala/sbt/internal/librarymanagement/IvyRepoSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/IvyRepoSpec.scala @@ -1,10 +1,11 @@ package sbt.internal.librarymanagement import org.scalatest.Inside -import sbt.internal.librarymanagement.impl.DependencyBuilders import sbt.librarymanagement._ +import sbt.librarymanagement.syntax._ +import InternalDefaults._ -class IvyRepoSpec extends BaseIvySpecification with DependencyBuilders { +class IvyRepoSpec extends BaseIvySpecification { val ourModuleID = ModuleID("com.example", "foo", "0.1.0").withConfigurations(Some("compile")) @@ -43,12 +44,12 @@ class IvyRepoSpec extends BaseIvySpecification with DependencyBuilders { val m = makeModuleForDepWithSources - // the "default" configuration used in updateEither. - val c = makeUpdateConfiguration(false) + // the "default" configuration used in `update`. + val c = makeUpdateConfiguration(false, None) - val ivyScala = m.moduleSettings.ivyScala - val srcTypes = Set("src") - val docTypes = Set("javadoc") + val scalaModuleInfo = m.moduleSettings.scalaModuleInfo + val srcTypes = Vector("src") + val docTypes = Vector("javadoc") // These will be the default classifiers that SBT should try, in case a dependency is Maven. // In this case though, they will be tried and should fail gracefully - only the val attemptedClassifiers = Vector("sources", "javadoc") @@ -61,25 +62,24 @@ class IvyRepoSpec extends BaseIvySpecification with DependencyBuilders { val externalModules = Vector(dep) // Note: need to extract ourModuleID so we can plug it in here, can't fish it back out of the IvySbt#Module (`m`) GetClassifiersModule(ourModuleID, + scalaModuleInfo, externalModules, Vector(Configurations.Compile), attemptedClassifiers) } + val artifactFilter = getArtifactTypeFilter(c.artifactFilter) val gcm = GetClassifiersConfiguration(clMod, - Map.empty, - c.withArtifactFilter(c.artifactFilter.invert), - ivyScala, + Vector.empty, + c.withArtifactFilter(artifactFilter.invert), srcTypes, docTypes) - val report2 = IvyActions.updateClassifiers(m.owner, - gcm, - UnresolvedWarningConfiguration(), - LogicalClock.unknown, - None, - Vector(), - log) + val report2 = + lmEngine() + .updateClassifiers(gcm, UnresolvedWarningConfiguration(), Vector(), log) + .right + .get import Inside._ inside(report2.configuration(ConfigRef("compile")).map(_.modules)) { diff --git a/librarymanagement/src/test/scala/sbt/internal/librarymanagement/ManagedChecksumsSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/ManagedChecksumsSpec.scala similarity index 63% rename from librarymanagement/src/test/scala/sbt/internal/librarymanagement/ManagedChecksumsSpec.scala rename to ivy/src/test/scala/sbt/internal/librarymanagement/ManagedChecksumsSpec.scala index 493d600e..fab7016d 100644 --- a/librarymanagement/src/test/scala/sbt/internal/librarymanagement/ManagedChecksumsSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/ManagedChecksumsSpec.scala @@ -3,25 +3,14 @@ package sbt.librarymanagement import java.io.File import org.apache.ivy.util.Message -import org.scalatest.Assertion -import sbt.internal.librarymanagement.{ - BaseIvySpecification, - InlineIvyConfiguration, - IvyActions, - IvyConfiguration, - IvyPaths, - IvySbt, - LogicalClock, - UnresolvedWarningConfiguration -} -import sbt.internal.librarymanagement.impl.DependencyBuilders +import sbt.internal.librarymanagement.{ BaseIvySpecification, IvyActions } +import sbt.librarymanagement.ivy._ import sbt.io.IO -class ManagedChecksumsSpec extends BaseIvySpecification with DependencyBuilders { +class ManagedChecksumsSpec extends BaseIvySpecification { private final def targetDir = Some(currentDependency) - private final def onlineConf = makeUpdateConfiguration(false) + private final def onlineConf = makeUpdateConfiguration(false, targetDir) private final def warningConf = UnresolvedWarningConfiguration() - private final def noClock = LogicalClock.unknown private final val Checksum = "sha1" def avro177 = ModuleID("org.apache.avro", "avro", "1.7.7") @@ -32,21 +21,17 @@ class ManagedChecksumsSpec extends BaseIvySpecification with DependencyBuilders import sbt.io.syntax._ override def mkIvyConfiguration(uo: UpdateOptions): IvyConfiguration = { - val paths = IvyPaths(currentBase, Some(currentTarget)) - val other = Vector.empty - val check = Vector(Checksum) val moduleConfs = Vector(ModuleConfiguration("*", chainResolver)) val resCacheDir = currentTarget / "resolution-cache" - new InlineIvyConfiguration(paths, - resolvers, - other, - moduleConfs, - None, - check, - managedChecksums = true, - Some(resCacheDir), - uo, - log) + InlineIvyConfiguration() + .withPaths(IvyPaths(currentBase, Some(currentTarget))) + .withResolvers(resolvers) + .withModuleConfigurations(moduleConfs) + .withChecksums(Vector(Checksum)) + .withResolutionCacheDir(resCacheDir) + .withLog(log) + .withUpdateOptions(uo) + .withManagedChecksums(true) } def cleanAll(): Unit = { @@ -66,7 +51,7 @@ class ManagedChecksumsSpec extends BaseIvySpecification with DependencyBuilders cleanAll() val updateOptions = UpdateOptions() val toResolve = module(defaultModuleId, dependencies, None, updateOptions) - val res = IvyActions.updateEither(toResolve, onlineConf, warningConf, noClock, targetDir, log) + val res = IvyActions.updateEither(toResolve, onlineConf, warningConf, log) assert(res.isRight, s"Resolution with managed checksums failed! $res") val updateReport = res.right.get val allModuleReports = updateReport.configurations.flatMap(_.modules) diff --git a/librarymanagement/src/test/scala/sbt/internal/librarymanagement/TestLogger.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/TestLogger.scala similarity index 100% rename from librarymanagement/src/test/scala/sbt/internal/librarymanagement/TestLogger.scala rename to ivy/src/test/scala/sbt/internal/librarymanagement/TestLogger.scala diff --git a/librarymanagement/src/test/scala/sbt/internal/librarymanagement/UnitSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/UnitSpec.scala similarity index 100% rename from librarymanagement/src/test/scala/sbt/internal/librarymanagement/UnitSpec.scala rename to ivy/src/test/scala/sbt/internal/librarymanagement/UnitSpec.scala diff --git a/librarymanagement/src/test/scala/sbt/internal/librarymanagement/VersionRangeSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/VersionRangeSpec.scala similarity index 100% rename from librarymanagement/src/test/scala/sbt/internal/librarymanagement/VersionRangeSpec.scala rename to ivy/src/test/scala/sbt/internal/librarymanagement/VersionRangeSpec.scala diff --git a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/ExternalIvyConfiguration.scala b/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/ExternalIvyConfiguration.scala deleted file mode 100644 index b99ec923..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/ExternalIvyConfiguration.scala +++ /dev/null @@ -1,56 +0,0 @@ -/** - * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. - */ - -// DO NOT EDIT MANUALLY -package sbt.internal.librarymanagement -final class ExternalIvyConfiguration private ( - lock: Option[xsbti.GlobalLock], - baseDirectory: java.io.File, - log: xsbti.Logger, - updateOptions: sbt.librarymanagement.UpdateOptions, - val uri: java.net.URI, - val extraResolvers: Vector[sbt.librarymanagement.Resolver]) extends sbt.internal.librarymanagement.IvyConfiguration(lock, baseDirectory, log, updateOptions) with Serializable { - - - - override def equals(o: Any): Boolean = o match { - case x: ExternalIvyConfiguration => (this.lock == x.lock) && (this.baseDirectory == x.baseDirectory) && (this.log == x.log) && (this.updateOptions == x.updateOptions) && (this.uri == x.uri) && (this.extraResolvers == x.extraResolvers) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "ExternalIvyConfiguration".##) + lock.##) + baseDirectory.##) + log.##) + updateOptions.##) + uri.##) + extraResolvers.##) - } - override def toString: String = { - "ExternalIvyConfiguration(" + lock + ", " + baseDirectory + ", " + log + ", " + updateOptions + ", " + uri + ", " + extraResolvers + ")" - } - protected[this] def copy(lock: Option[xsbti.GlobalLock] = lock, baseDirectory: java.io.File = baseDirectory, log: xsbti.Logger = log, updateOptions: sbt.librarymanagement.UpdateOptions = updateOptions, uri: java.net.URI = uri, extraResolvers: Vector[sbt.librarymanagement.Resolver] = extraResolvers): ExternalIvyConfiguration = { - new ExternalIvyConfiguration(lock, baseDirectory, log, updateOptions, uri, extraResolvers) - } - def withLock(lock: Option[xsbti.GlobalLock]): ExternalIvyConfiguration = { - copy(lock = lock) - } - def withLock(lock: xsbti.GlobalLock): ExternalIvyConfiguration = { - copy(lock = Option(lock)) - } - def withBaseDirectory(baseDirectory: java.io.File): ExternalIvyConfiguration = { - copy(baseDirectory = baseDirectory) - } - def withLog(log: xsbti.Logger): ExternalIvyConfiguration = { - copy(log = log) - } - def withUpdateOptions(updateOptions: sbt.librarymanagement.UpdateOptions): ExternalIvyConfiguration = { - copy(updateOptions = updateOptions) - } - def withUri(uri: java.net.URI): ExternalIvyConfiguration = { - copy(uri = uri) - } - def withExtraResolvers(extraResolvers: Vector[sbt.librarymanagement.Resolver]): ExternalIvyConfiguration = { - copy(extraResolvers = extraResolvers) - } -} -object ExternalIvyConfiguration { - - def apply(lock: Option[xsbti.GlobalLock], baseDirectory: java.io.File, log: xsbti.Logger, updateOptions: sbt.librarymanagement.UpdateOptions, uri: java.net.URI, extraResolvers: Vector[sbt.librarymanagement.Resolver]): ExternalIvyConfiguration = new ExternalIvyConfiguration(lock, baseDirectory, log, updateOptions, uri, extraResolvers) - def apply(lock: xsbti.GlobalLock, baseDirectory: java.io.File, log: xsbti.Logger, updateOptions: sbt.librarymanagement.UpdateOptions, uri: java.net.URI, extraResolvers: Vector[sbt.librarymanagement.Resolver]): ExternalIvyConfiguration = new ExternalIvyConfiguration(Option(lock), baseDirectory, log, updateOptions, uri, extraResolvers) -} diff --git a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/InlineConfiguration.scala b/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/InlineConfiguration.scala deleted file mode 100644 index 5ddc4a15..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/InlineConfiguration.scala +++ /dev/null @@ -1,78 +0,0 @@ -/** - * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. - */ - -// DO NOT EDIT MANUALLY -package sbt.internal.librarymanagement -final class InlineConfiguration private ( - validate: Boolean, - ivyScala: Option[sbt.librarymanagement.IvyScala], - val module: sbt.librarymanagement.ModuleID, - val moduleInfo: sbt.librarymanagement.ModuleInfo, - val dependencies: Vector[sbt.librarymanagement.ModuleID], - val overrides: Set[sbt.librarymanagement.ModuleID], - val excludes: Vector[sbt.librarymanagement.InclExclRule], - val ivyXML: scala.xml.NodeSeq, - val configurations: Vector[sbt.librarymanagement.Configuration], - val defaultConfiguration: Option[sbt.librarymanagement.Configuration], - val conflictManager: sbt.librarymanagement.ConflictManager) extends sbt.librarymanagement.ModuleSettings(validate, ivyScala) with Serializable { - - private def this(validate: Boolean, ivyScala: Option[sbt.librarymanagement.IvyScala], module: sbt.librarymanagement.ModuleID, moduleInfo: sbt.librarymanagement.ModuleInfo, dependencies: Vector[sbt.librarymanagement.ModuleID]) = this(validate, ivyScala, module, moduleInfo, dependencies, Set.empty, Vector.empty, scala.xml.NodeSeq.Empty, Vector.empty, None, sbt.librarymanagement.ConflictManager.default) - - override def equals(o: Any): Boolean = o match { - case x: InlineConfiguration => (this.validate == x.validate) && (this.ivyScala == x.ivyScala) && (this.module == x.module) && (this.moduleInfo == x.moduleInfo) && (this.dependencies == x.dependencies) && (this.overrides == x.overrides) && (this.excludes == x.excludes) && (this.ivyXML == x.ivyXML) && (this.configurations == x.configurations) && (this.defaultConfiguration == x.defaultConfiguration) && (this.conflictManager == x.conflictManager) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "InlineConfiguration".##) + validate.##) + ivyScala.##) + module.##) + moduleInfo.##) + dependencies.##) + overrides.##) + excludes.##) + ivyXML.##) + configurations.##) + defaultConfiguration.##) + conflictManager.##) - } - override def toString: String = { - "InlineConfiguration(" + validate + ", " + ivyScala + ", " + module + ", " + moduleInfo + ", " + dependencies + ", " + overrides + ", " + excludes + ", " + ivyXML + ", " + configurations + ", " + defaultConfiguration + ", " + conflictManager + ")" - } - protected[this] def copy(validate: Boolean = validate, ivyScala: Option[sbt.librarymanagement.IvyScala] = ivyScala, module: sbt.librarymanagement.ModuleID = module, moduleInfo: sbt.librarymanagement.ModuleInfo = moduleInfo, dependencies: Vector[sbt.librarymanagement.ModuleID] = dependencies, overrides: Set[sbt.librarymanagement.ModuleID] = overrides, excludes: Vector[sbt.librarymanagement.InclExclRule] = excludes, ivyXML: scala.xml.NodeSeq = ivyXML, configurations: Vector[sbt.librarymanagement.Configuration] = configurations, defaultConfiguration: Option[sbt.librarymanagement.Configuration] = defaultConfiguration, conflictManager: sbt.librarymanagement.ConflictManager = conflictManager): InlineConfiguration = { - new InlineConfiguration(validate, ivyScala, module, moduleInfo, dependencies, overrides, excludes, ivyXML, configurations, defaultConfiguration, conflictManager) - } - def withValidate(validate: Boolean): InlineConfiguration = { - copy(validate = validate) - } - def withIvyScala(ivyScala: Option[sbt.librarymanagement.IvyScala]): InlineConfiguration = { - copy(ivyScala = ivyScala) - } - def withIvyScala(ivyScala: sbt.librarymanagement.IvyScala): InlineConfiguration = { - copy(ivyScala = Option(ivyScala)) - } - def withModule(module: sbt.librarymanagement.ModuleID): InlineConfiguration = { - copy(module = module) - } - def withModuleInfo(moduleInfo: sbt.librarymanagement.ModuleInfo): InlineConfiguration = { - copy(moduleInfo = moduleInfo) - } - def withDependencies(dependencies: Vector[sbt.librarymanagement.ModuleID]): InlineConfiguration = { - copy(dependencies = dependencies) - } - def withOverrides(overrides: Set[sbt.librarymanagement.ModuleID]): InlineConfiguration = { - copy(overrides = overrides) - } - def withExcludes(excludes: Vector[sbt.librarymanagement.InclExclRule]): InlineConfiguration = { - copy(excludes = excludes) - } - def withIvyXML(ivyXML: scala.xml.NodeSeq): InlineConfiguration = { - copy(ivyXML = ivyXML) - } - def withConfigurations(configurations: Vector[sbt.librarymanagement.Configuration]): InlineConfiguration = { - copy(configurations = configurations) - } - def withDefaultConfiguration(defaultConfiguration: Option[sbt.librarymanagement.Configuration]): InlineConfiguration = { - copy(defaultConfiguration = defaultConfiguration) - } - def withConflictManager(conflictManager: sbt.librarymanagement.ConflictManager): InlineConfiguration = { - copy(conflictManager = conflictManager) - } -} -object InlineConfiguration extends sbt.internal.librarymanagement.InlineConfigurationFunctions { - - def apply(validate: Boolean, ivyScala: Option[sbt.librarymanagement.IvyScala], module: sbt.librarymanagement.ModuleID, moduleInfo: sbt.librarymanagement.ModuleInfo, dependencies: Vector[sbt.librarymanagement.ModuleID]): InlineConfiguration = new InlineConfiguration(validate, ivyScala, module, moduleInfo, dependencies, Set.empty, Vector.empty, scala.xml.NodeSeq.Empty, Vector.empty, None, sbt.librarymanagement.ConflictManager.default) - def apply(validate: Boolean, ivyScala: sbt.librarymanagement.IvyScala, module: sbt.librarymanagement.ModuleID, moduleInfo: sbt.librarymanagement.ModuleInfo, dependencies: Vector[sbt.librarymanagement.ModuleID]): InlineConfiguration = new InlineConfiguration(validate, Option(ivyScala), module, moduleInfo, dependencies, Set.empty, Vector.empty, scala.xml.NodeSeq.Empty, Vector.empty, None, sbt.librarymanagement.ConflictManager.default) - def apply(validate: Boolean, ivyScala: Option[sbt.librarymanagement.IvyScala], module: sbt.librarymanagement.ModuleID, moduleInfo: sbt.librarymanagement.ModuleInfo, dependencies: Vector[sbt.librarymanagement.ModuleID], overrides: Set[sbt.librarymanagement.ModuleID], excludes: Vector[sbt.librarymanagement.InclExclRule], ivyXML: scala.xml.NodeSeq, configurations: Vector[sbt.librarymanagement.Configuration], defaultConfiguration: Option[sbt.librarymanagement.Configuration], conflictManager: sbt.librarymanagement.ConflictManager): InlineConfiguration = new InlineConfiguration(validate, ivyScala, module, moduleInfo, dependencies, overrides, excludes, ivyXML, configurations, defaultConfiguration, conflictManager) - def apply(validate: Boolean, ivyScala: sbt.librarymanagement.IvyScala, module: sbt.librarymanagement.ModuleID, moduleInfo: sbt.librarymanagement.ModuleInfo, dependencies: Vector[sbt.librarymanagement.ModuleID], overrides: Set[sbt.librarymanagement.ModuleID], excludes: Vector[sbt.librarymanagement.InclExclRule], ivyXML: scala.xml.NodeSeq, configurations: Vector[sbt.librarymanagement.Configuration], defaultConfiguration: Option[sbt.librarymanagement.Configuration], conflictManager: sbt.librarymanagement.ConflictManager): InlineConfiguration = new InlineConfiguration(validate, Option(ivyScala), module, moduleInfo, dependencies, overrides, excludes, ivyXML, configurations, defaultConfiguration, conflictManager) -} diff --git a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/InlineIvyConfiguration.scala b/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/InlineIvyConfiguration.scala deleted file mode 100644 index 0cd006bf..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/InlineIvyConfiguration.scala +++ /dev/null @@ -1,92 +0,0 @@ -/** - * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. - */ - -// DO NOT EDIT MANUALLY -package sbt.internal.librarymanagement -final class InlineIvyConfiguration private ( - lock: Option[xsbti.GlobalLock], - baseDirectory: java.io.File, - log: xsbti.Logger, - updateOptions: sbt.librarymanagement.UpdateOptions, - val paths: sbt.internal.librarymanagement.IvyPaths, - val resolvers: Vector[sbt.librarymanagement.Resolver], - val otherResolvers: Vector[sbt.librarymanagement.Resolver], - val moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration], - val checksums: Vector[String], - val managedChecksums: Boolean, - val resolutionCacheDir: Option[java.io.File]) extends sbt.internal.librarymanagement.IvyConfiguration(lock, baseDirectory, log, updateOptions) with Serializable { - def this( - paths: sbt.internal.librarymanagement.IvyPaths, - resolvers: Vector[sbt.librarymanagement.Resolver], - otherResolvers: Vector[sbt.librarymanagement.Resolver], - moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration], - lock: Option[xsbti.GlobalLock], - checksums: Vector[String], - managedChecksums: Boolean, - resolutionCacheDir: Option[java.io.File], - updateOptions: sbt.librarymanagement.UpdateOptions, - log: xsbti.Logger - ) = - this(lock, paths.baseDirectory, log, updateOptions, paths, resolvers, otherResolvers, - moduleConfigurations, checksums, managedChecksums, resolutionCacheDir) - - - override def equals(o: Any): Boolean = o match { - case x: InlineIvyConfiguration => (this.lock == x.lock) && (this.baseDirectory == x.baseDirectory) && (this.log == x.log) && (this.updateOptions == x.updateOptions) && (this.paths == x.paths) && (this.resolvers == x.resolvers) && (this.otherResolvers == x.otherResolvers) && (this.moduleConfigurations == x.moduleConfigurations) && (this.checksums == x.checksums) && (this.managedChecksums == x.managedChecksums) && (this.resolutionCacheDir == x.resolutionCacheDir) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "InlineIvyConfiguration".##) + lock.##) + baseDirectory.##) + log.##) + updateOptions.##) + paths.##) + resolvers.##) + otherResolvers.##) + moduleConfigurations.##) + checksums.##) + managedChecksums.##) + resolutionCacheDir.##) - } - override def toString: String = { - "InlineIvyConfiguration(" + lock + ", " + baseDirectory + ", " + log + ", " + updateOptions + ", " + paths + ", " + resolvers + ", " + otherResolvers + ", " + moduleConfigurations + ", " + checksums + ", " + managedChecksums + ", " + resolutionCacheDir + ")" - } - protected[this] def copy(lock: Option[xsbti.GlobalLock] = lock, baseDirectory: java.io.File = baseDirectory, log: xsbti.Logger = log, updateOptions: sbt.librarymanagement.UpdateOptions = updateOptions, paths: sbt.internal.librarymanagement.IvyPaths = paths, resolvers: Vector[sbt.librarymanagement.Resolver] = resolvers, otherResolvers: Vector[sbt.librarymanagement.Resolver] = otherResolvers, moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration] = moduleConfigurations, checksums: Vector[String] = checksums, managedChecksums: Boolean = managedChecksums, resolutionCacheDir: Option[java.io.File] = resolutionCacheDir): InlineIvyConfiguration = { - new InlineIvyConfiguration(lock, baseDirectory, log, updateOptions, paths, resolvers, otherResolvers, moduleConfigurations, checksums, managedChecksums, resolutionCacheDir) - } - def withLock(lock: Option[xsbti.GlobalLock]): InlineIvyConfiguration = { - copy(lock = lock) - } - def withLock(lock: xsbti.GlobalLock): InlineIvyConfiguration = { - copy(lock = Option(lock)) - } - def withBaseDirectory(baseDirectory: java.io.File): InlineIvyConfiguration = { - copy(baseDirectory = baseDirectory) - } - def withLog(log: xsbti.Logger): InlineIvyConfiguration = { - copy(log = log) - } - def withUpdateOptions(updateOptions: sbt.librarymanagement.UpdateOptions): InlineIvyConfiguration = { - copy(updateOptions = updateOptions) - } - def withPaths(paths: sbt.internal.librarymanagement.IvyPaths): InlineIvyConfiguration = { - copy(paths = paths) - } - def withResolvers(resolvers: Vector[sbt.librarymanagement.Resolver]): InlineIvyConfiguration = { - copy(resolvers = resolvers) - } - def withOtherResolvers(otherResolvers: Vector[sbt.librarymanagement.Resolver]): InlineIvyConfiguration = { - copy(otherResolvers = otherResolvers) - } - def withModuleConfigurations(moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration]): InlineIvyConfiguration = { - copy(moduleConfigurations = moduleConfigurations) - } - def withChecksums(checksums: Vector[String]): InlineIvyConfiguration = { - copy(checksums = checksums) - } - def withManagedChecksums(managedChecksums: Boolean): InlineIvyConfiguration = { - copy(managedChecksums = managedChecksums) - } - def withResolutionCacheDir(resolutionCacheDir: Option[java.io.File]): InlineIvyConfiguration = { - copy(resolutionCacheDir = resolutionCacheDir) - } - def withResolutionCacheDir(resolutionCacheDir: java.io.File): InlineIvyConfiguration = { - copy(resolutionCacheDir = Option(resolutionCacheDir)) - } -} -object InlineIvyConfiguration { - - def apply(lock: Option[xsbti.GlobalLock], baseDirectory: java.io.File, log: xsbti.Logger, updateOptions: sbt.librarymanagement.UpdateOptions, paths: sbt.internal.librarymanagement.IvyPaths, resolvers: Vector[sbt.librarymanagement.Resolver], otherResolvers: Vector[sbt.librarymanagement.Resolver], moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration], checksums: Vector[String], managedChecksums: Boolean, resolutionCacheDir: Option[java.io.File]): InlineIvyConfiguration = new InlineIvyConfiguration(lock, baseDirectory, log, updateOptions, paths, resolvers, otherResolvers, moduleConfigurations, checksums, managedChecksums, resolutionCacheDir) - def apply(lock: xsbti.GlobalLock, baseDirectory: java.io.File, log: xsbti.Logger, updateOptions: sbt.librarymanagement.UpdateOptions, paths: sbt.internal.librarymanagement.IvyPaths, resolvers: Vector[sbt.librarymanagement.Resolver], otherResolvers: Vector[sbt.librarymanagement.Resolver], moduleConfigurations: Vector[sbt.librarymanagement.ModuleConfiguration], checksums: Vector[String], managedChecksums: Boolean, resolutionCacheDir: java.io.File): InlineIvyConfiguration = new InlineIvyConfiguration(Option(lock), baseDirectory, log, updateOptions, paths, resolvers, otherResolvers, moduleConfigurations, checksums, managedChecksums, Option(resolutionCacheDir)) -} diff --git a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/IvyConfiguration.scala b/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/IvyConfiguration.scala deleted file mode 100644 index a50adcb0..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/IvyConfiguration.scala +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. - */ - -// DO NOT EDIT MANUALLY -package sbt.internal.librarymanagement -abstract class IvyConfiguration( - val lock: Option[xsbti.GlobalLock], - val baseDirectory: java.io.File, - val log: xsbti.Logger, - val updateOptions: sbt.librarymanagement.UpdateOptions) extends Serializable { - - - - - override def equals(o: Any): Boolean = o match { - case x: IvyConfiguration => (this.lock == x.lock) && (this.baseDirectory == x.baseDirectory) && (this.log == x.log) && (this.updateOptions == x.updateOptions) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (17 + "IvyConfiguration".##) + lock.##) + baseDirectory.##) + log.##) + updateOptions.##) - } - override def toString: String = { - "IvyConfiguration(" + lock + ", " + baseDirectory + ", " + log + ", " + updateOptions + ")" - } -} -object IvyConfiguration { - -} diff --git a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/RetrieveConfiguration.scala b/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/RetrieveConfiguration.scala deleted file mode 100644 index 0a6551f3..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/internal/librarymanagement/RetrieveConfiguration.scala +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. - */ - -// DO NOT EDIT MANUALLY -package sbt.internal.librarymanagement -final class RetrieveConfiguration private ( - val retrieveDirectory: java.io.File, - val outputPattern: String, - val sync: Boolean, - val configurationsToRetrieve: Option[Set[sbt.librarymanagement.ConfigRef]]) extends Serializable { - - private def this(retrieveDirectory: java.io.File, outputPattern: String) = this(retrieveDirectory, outputPattern, false, None) - - override def equals(o: Any): Boolean = o match { - case x: RetrieveConfiguration => (this.retrieveDirectory == x.retrieveDirectory) && (this.outputPattern == x.outputPattern) && (this.sync == x.sync) && (this.configurationsToRetrieve == x.configurationsToRetrieve) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (17 + "RetrieveConfiguration".##) + retrieveDirectory.##) + outputPattern.##) + sync.##) + configurationsToRetrieve.##) - } - override def toString: String = { - "RetrieveConfiguration(" + retrieveDirectory + ", " + outputPattern + ", " + sync + ", " + configurationsToRetrieve + ")" - } - protected[this] def copy(retrieveDirectory: java.io.File = retrieveDirectory, outputPattern: String = outputPattern, sync: Boolean = sync, configurationsToRetrieve: Option[Set[sbt.librarymanagement.ConfigRef]] = configurationsToRetrieve): RetrieveConfiguration = { - new RetrieveConfiguration(retrieveDirectory, outputPattern, sync, configurationsToRetrieve) - } - def withRetrieveDirectory(retrieveDirectory: java.io.File): RetrieveConfiguration = { - copy(retrieveDirectory = retrieveDirectory) - } - def withOutputPattern(outputPattern: String): RetrieveConfiguration = { - copy(outputPattern = outputPattern) - } - def withSync(sync: Boolean): RetrieveConfiguration = { - copy(sync = sync) - } - def withConfigurationsToRetrieve(configurationsToRetrieve: Option[Set[sbt.librarymanagement.ConfigRef]]): RetrieveConfiguration = { - copy(configurationsToRetrieve = configurationsToRetrieve) - } -} -object RetrieveConfiguration { - - def apply(retrieveDirectory: java.io.File, outputPattern: String): RetrieveConfiguration = new RetrieveConfiguration(retrieveDirectory, outputPattern, false, None) - def apply(retrieveDirectory: java.io.File, outputPattern: String, sync: Boolean, configurationsToRetrieve: Option[Set[sbt.librarymanagement.ConfigRef]]): RetrieveConfiguration = new RetrieveConfiguration(retrieveDirectory, outputPattern, sync, configurationsToRetrieve) -} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Configuration.scala b/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Configuration.scala deleted file mode 100644 index a4ab026d..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/Configuration.scala +++ /dev/null @@ -1,50 +0,0 @@ -/** - * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. - */ - -// DO NOT EDIT MANUALLY -package sbt.librarymanagement -/** Represents an Ivy configuration. */ -final class Configuration private ( - val name: String, - val description: String, - val isPublic: Boolean, - val extendsConfigs: Vector[sbt.librarymanagement.Configuration], - val transitive: Boolean) extends sbt.librarymanagement.ConfigurationExtra with Serializable { - - private def this(name: String) = this(name, "", true, Vector.empty, true) - - override def equals(o: Any): Boolean = o match { - case x: Configuration => (this.name == x.name) && (this.description == x.description) && (this.isPublic == x.isPublic) && (this.extendsConfigs == x.extendsConfigs) && (this.transitive == x.transitive) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (17 + "Configuration".##) + name.##) + description.##) + isPublic.##) + extendsConfigs.##) + transitive.##) - } - override def toString: String = { - name - } - protected[this] def copy(name: String = name, description: String = description, isPublic: Boolean = isPublic, extendsConfigs: Vector[sbt.librarymanagement.Configuration] = extendsConfigs, transitive: Boolean = transitive): Configuration = { - new Configuration(name, description, isPublic, extendsConfigs, transitive) - } - def withName(name: String): Configuration = { - copy(name = name) - } - def withDescription(description: String): Configuration = { - copy(description = description) - } - def withIsPublic(isPublic: Boolean): Configuration = { - copy(isPublic = isPublic) - } - def withExtendsConfigs(extendsConfigs: Vector[sbt.librarymanagement.Configuration]): Configuration = { - copy(extendsConfigs = extendsConfigs) - } - def withTransitive(transitive: Boolean): Configuration = { - copy(transitive = transitive) - } -} -object Configuration { - - def apply(name: String): Configuration = new Configuration(name, "", true, Vector.empty, true) - def apply(name: String, description: String, isPublic: Boolean, extendsConfigs: Vector[sbt.librarymanagement.Configuration], transitive: Boolean): Configuration = new Configuration(name, description, isPublic, extendsConfigs, transitive) -} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigurationFormats.scala b/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigurationFormats.scala deleted file mode 100644 index 70e4b21f..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ConfigurationFormats.scala +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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 ConfigurationFormats { self: sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol => -implicit lazy val ConfigurationFormat: JsonFormat[sbt.librarymanagement.Configuration] = new JsonFormat[sbt.librarymanagement.Configuration] { - override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.Configuration = { - jsOpt match { - case Some(js) => - unbuilder.beginObject(js) - val name = unbuilder.readField[String]("name") - val description = unbuilder.readField[String]("description") - val isPublic = unbuilder.readField[Boolean]("isPublic") - val extendsConfigs = unbuilder.readField[Vector[sbt.librarymanagement.Configuration]]("extendsConfigs") - val transitive = unbuilder.readField[Boolean]("transitive") - unbuilder.endObject() - sbt.librarymanagement.Configuration(name, description, isPublic, extendsConfigs, transitive) - case None => - deserializationError("Expected JsObject but found None") - } - } - override def write[J](obj: sbt.librarymanagement.Configuration, builder: Builder[J]): Unit = { - builder.beginObject() - builder.addField("name", obj.name) - builder.addField("description", obj.description) - builder.addField("isPublic", obj.isPublic) - builder.addField("extendsConfigs", obj.extendsConfigs) - builder.addField("transitive", obj.transitive) - builder.endObject() - } -} -} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyConfigurationFormats.scala b/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyConfigurationFormats.scala deleted file mode 100644 index 405edbba..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyConfigurationFormats.scala +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. - */ - -// DO NOT EDIT MANUALLY -package sbt.librarymanagement - -import _root_.sjsonnew.JsonFormat -trait IvyConfigurationFormats { self: sbt.internal.librarymanagement.formats.GlobalLockFormat with sbt.internal.librarymanagement.formats.LoggerFormat with sbt.internal.librarymanagement.formats.UpdateOptionsFormat with sbt.librarymanagement.IvyPathsFormats with sbt.librarymanagement.ResolverFormats with sbt.librarymanagement.ModuleConfigurationFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.InlineIvyConfigurationFormats with sbt.librarymanagement.ExternalIvyConfigurationFormats => -implicit lazy val IvyConfigurationFormat: JsonFormat[sbt.internal.librarymanagement.IvyConfiguration] = flatUnionFormat2[sbt.internal.librarymanagement.IvyConfiguration, sbt.internal.librarymanagement.InlineIvyConfiguration, sbt.internal.librarymanagement.ExternalIvyConfiguration]("type") -} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfiguration.scala b/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfiguration.scala deleted file mode 100644 index 2939baaa..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfiguration.scala +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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, - ivyScala: Option[sbt.librarymanagement.IvyScala], - val file: java.io.File, - val autoScalaTools: Boolean) extends sbt.librarymanagement.ModuleSettings(validate, ivyScala) with Serializable { - - - - override def equals(o: Any): Boolean = o match { - case x: IvyFileConfiguration => (this.validate == x.validate) && (this.ivyScala == x.ivyScala) && (this.file == x.file) && (this.autoScalaTools == x.autoScalaTools) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (17 + "IvyFileConfiguration".##) + validate.##) + ivyScala.##) + file.##) + autoScalaTools.##) - } - override def toString: String = { - "IvyFileConfiguration(" + validate + ", " + ivyScala + ", " + file + ", " + autoScalaTools + ")" - } - protected[this] def copy(validate: Boolean = validate, ivyScala: Option[sbt.librarymanagement.IvyScala] = ivyScala, file: java.io.File = file, autoScalaTools: Boolean = autoScalaTools): IvyFileConfiguration = { - new IvyFileConfiguration(validate, ivyScala, file, autoScalaTools) - } - def withValidate(validate: Boolean): IvyFileConfiguration = { - copy(validate = validate) - } - def withIvyScala(ivyScala: Option[sbt.librarymanagement.IvyScala]): IvyFileConfiguration = { - copy(ivyScala = ivyScala) - } - def withIvyScala(ivyScala: sbt.librarymanagement.IvyScala): IvyFileConfiguration = { - copy(ivyScala = Option(ivyScala)) - } - def withFile(file: java.io.File): IvyFileConfiguration = { - copy(file = file) - } - def withAutoScalaTools(autoScalaTools: Boolean): IvyFileConfiguration = { - copy(autoScalaTools = autoScalaTools) - } -} -object IvyFileConfiguration { - - def apply(validate: Boolean, ivyScala: Option[sbt.librarymanagement.IvyScala], file: java.io.File, autoScalaTools: Boolean): IvyFileConfiguration = new IvyFileConfiguration(validate, ivyScala, file, autoScalaTools) - def apply(validate: Boolean, ivyScala: sbt.librarymanagement.IvyScala, file: java.io.File, autoScalaTools: Boolean): IvyFileConfiguration = new IvyFileConfiguration(validate, Option(ivyScala), file, autoScalaTools) -} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleSettingsFormats.scala b/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleSettingsFormats.scala deleted file mode 100644 index 66ae6c37..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/ModuleSettingsFormats.scala +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. - */ - -// DO NOT EDIT MANUALLY -package sbt.librarymanagement - -import _root_.sjsonnew.JsonFormat -trait ModuleSettingsFormats { self: sbt.librarymanagement.IvyScalaFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.IvyFileConfigurationFormats with sbt.librarymanagement.PomConfigurationFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ModuleInfoFormats with sbt.librarymanagement.InclExclRuleFormats with sbt.internal.librarymanagement.formats.NodeSeqFormat with sbt.librarymanagement.ConfigurationFormats with sbt.librarymanagement.ConflictManagerFormats with sbt.librarymanagement.InlineConfigurationFormats => -implicit lazy val ModuleSettingsFormat: JsonFormat[sbt.librarymanagement.ModuleSettings] = flatUnionFormat3[sbt.librarymanagement.ModuleSettings, sbt.librarymanagement.IvyFileConfiguration, sbt.librarymanagement.PomConfiguration, sbt.internal.librarymanagement.InlineConfiguration]("type") -} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PomConfiguration.scala b/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PomConfiguration.scala deleted file mode 100644 index ff9b1613..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/PomConfiguration.scala +++ /dev/null @@ -1,48 +0,0 @@ -/** - * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. - */ - -// DO NOT EDIT MANUALLY -package sbt.librarymanagement -final class PomConfiguration private ( - validate: Boolean, - ivyScala: Option[sbt.librarymanagement.IvyScala], - val file: java.io.File, - val autoScalaTools: Boolean) extends sbt.librarymanagement.ModuleSettings(validate, ivyScala) with Serializable { - - - - override def equals(o: Any): Boolean = o match { - case x: PomConfiguration => (this.validate == x.validate) && (this.ivyScala == x.ivyScala) && (this.file == x.file) && (this.autoScalaTools == x.autoScalaTools) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (17 + "PomConfiguration".##) + validate.##) + ivyScala.##) + file.##) + autoScalaTools.##) - } - override def toString: String = { - "PomConfiguration(" + validate + ", " + ivyScala + ", " + file + ", " + autoScalaTools + ")" - } - protected[this] def copy(validate: Boolean = validate, ivyScala: Option[sbt.librarymanagement.IvyScala] = ivyScala, file: java.io.File = file, autoScalaTools: Boolean = autoScalaTools): PomConfiguration = { - new PomConfiguration(validate, ivyScala, file, autoScalaTools) - } - def withValidate(validate: Boolean): PomConfiguration = { - copy(validate = validate) - } - def withIvyScala(ivyScala: Option[sbt.librarymanagement.IvyScala]): PomConfiguration = { - copy(ivyScala = ivyScala) - } - def withIvyScala(ivyScala: sbt.librarymanagement.IvyScala): PomConfiguration = { - copy(ivyScala = Option(ivyScala)) - } - def withFile(file: java.io.File): PomConfiguration = { - copy(file = file) - } - def withAutoScalaTools(autoScalaTools: Boolean): PomConfiguration = { - copy(autoScalaTools = autoScalaTools) - } -} -object PomConfiguration { - - def apply(validate: Boolean, ivyScala: Option[sbt.librarymanagement.IvyScala], file: java.io.File, autoScalaTools: Boolean): PomConfiguration = new PomConfiguration(validate, ivyScala, file, autoScalaTools) - def apply(validate: Boolean, ivyScala: sbt.librarymanagement.IvyScala, file: java.io.File, autoScalaTools: Boolean): PomConfiguration = new PomConfiguration(validate, Option(ivyScala), file, autoScalaTools) -} diff --git a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateConfiguration.scala b/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateConfiguration.scala deleted file mode 100644 index de5773ee..00000000 --- a/librarymanagement/src/main/contraband-scala/sbt/librarymanagement/UpdateConfiguration.scala +++ /dev/null @@ -1,56 +0,0 @@ -/** - * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. - */ - -// DO NOT EDIT MANUALLY -package sbt.librarymanagement -final class UpdateConfiguration private ( - val retrieve: Option[sbt.internal.librarymanagement.RetrieveConfiguration], - val missingOk: Boolean, - val logging: sbt.librarymanagement.UpdateLogging, - val artifactFilter: sbt.librarymanagement.ArtifactTypeFilter, - val offline: Boolean, - val frozen: Boolean) extends Serializable { - - - - override def equals(o: Any): Boolean = o match { - case x: UpdateConfiguration => (this.retrieve == x.retrieve) && (this.missingOk == x.missingOk) && (this.logging == x.logging) && (this.artifactFilter == x.artifactFilter) && (this.offline == x.offline) && (this.frozen == x.frozen) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "UpdateConfiguration".##) + retrieve.##) + missingOk.##) + logging.##) + artifactFilter.##) + offline.##) + frozen.##) - } - override def toString: String = { - "UpdateConfiguration(" + retrieve + ", " + missingOk + ", " + logging + ", " + artifactFilter + ", " + offline + ", " + frozen + ")" - } - protected[this] def copy(retrieve: Option[sbt.internal.librarymanagement.RetrieveConfiguration] = retrieve, missingOk: Boolean = missingOk, logging: sbt.librarymanagement.UpdateLogging = logging, artifactFilter: sbt.librarymanagement.ArtifactTypeFilter = artifactFilter, offline: Boolean = offline, frozen: Boolean = frozen): UpdateConfiguration = { - new UpdateConfiguration(retrieve, missingOk, logging, artifactFilter, offline, frozen) - } - def withRetrieve(retrieve: Option[sbt.internal.librarymanagement.RetrieveConfiguration]): UpdateConfiguration = { - copy(retrieve = retrieve) - } - def withRetrieve(retrieve: sbt.internal.librarymanagement.RetrieveConfiguration): UpdateConfiguration = { - copy(retrieve = Option(retrieve)) - } - def withMissingOk(missingOk: Boolean): UpdateConfiguration = { - copy(missingOk = missingOk) - } - def withLogging(logging: sbt.librarymanagement.UpdateLogging): UpdateConfiguration = { - copy(logging = logging) - } - def withArtifactFilter(artifactFilter: sbt.librarymanagement.ArtifactTypeFilter): UpdateConfiguration = { - copy(artifactFilter = artifactFilter) - } - def withOffline(offline: Boolean): UpdateConfiguration = { - copy(offline = offline) - } - def withFrozen(frozen: Boolean): UpdateConfiguration = { - copy(frozen = frozen) - } -} -object UpdateConfiguration { - - def apply(retrieve: Option[sbt.internal.librarymanagement.RetrieveConfiguration], missingOk: Boolean, logging: sbt.librarymanagement.UpdateLogging, artifactFilter: sbt.librarymanagement.ArtifactTypeFilter, offline: Boolean, frozen: Boolean): UpdateConfiguration = new UpdateConfiguration(retrieve, missingOk, logging, artifactFilter, offline, frozen) - def apply(retrieve: sbt.internal.librarymanagement.RetrieveConfiguration, missingOk: Boolean, logging: sbt.librarymanagement.UpdateLogging, artifactFilter: sbt.librarymanagement.ArtifactTypeFilter, offline: Boolean, frozen: Boolean): UpdateConfiguration = new UpdateConfiguration(Option(retrieve), missingOk, logging, artifactFilter, offline, frozen) -} diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/DependencyResolverFormat.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/DependencyResolverFormat.scala deleted file mode 100644 index e365b961..00000000 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/formats/DependencyResolverFormat.scala +++ /dev/null @@ -1,8 +0,0 @@ -package sbt.internal.librarymanagement.formats - -import sjsonnew._ -import org.apache.ivy.plugins.resolver.DependencyResolver - -trait DependencyResolverFormat { self: BasicJsonProtocol => - implicit lazy val DependencyResolverFormat: JsonFormat[DependencyResolver] = ??? -} diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/impl/DependencyBuilders.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/impl/DependencyBuilders.scala deleted file mode 100755 index a37a4f38..00000000 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/impl/DependencyBuilders.scala +++ /dev/null @@ -1,58 +0,0 @@ -/* sbt -- Simple Build Tool - * Copyright 2009,2010 Mark Harrah - */ -package sbt.internal.librarymanagement -package impl - -import StringUtilities.nonEmpty -import sbt.librarymanagement._ - -trait DependencyBuilders { - final implicit def toGroupID(groupID: String): GroupID = { - nonEmpty(groupID, "Group ID") - new GroupID(groupID) - } - final implicit def toRepositoryName(name: String): RepositoryName = { - nonEmpty(name, "Repository name") - new RepositoryName(name) - } - final implicit def moduleIDConfigurable(m: ModuleID): ModuleIDConfigurable = { - require(m.configurations.isEmpty, "Configurations already specified for module " + m) - new ModuleIDConfigurable(m) - } -} - -final class GroupID private[sbt] (private[sbt] val groupID: String) { - def %(artifactID: String) = groupArtifact(artifactID, Disabled()) - def %%(artifactID: String): GroupArtifactID = groupArtifact(artifactID, CrossVersion.binary) - - private def groupArtifact(artifactID: String, cross: CrossVersion) = { - nonEmpty(artifactID, "Artifact ID") - new GroupArtifactID(groupID, artifactID, cross) - } -} -final class GroupArtifactID private[sbt] ( - private[sbt] val groupID: String, - private[sbt] val artifactID: String, - private[sbt] val crossVersion: CrossVersion -) { - def %(revision: String): ModuleID = { - nonEmpty(revision, "Revision") - ModuleID(groupID, artifactID, revision).cross(crossVersion) - } -} -final class ModuleIDConfigurable private[sbt] (moduleID: ModuleID) { - def %(configuration: Configuration): ModuleID = %(configuration.name) - - def %(configurations: String): ModuleID = { - nonEmpty(configurations, "Configurations") - val c = configurations - moduleID.withConfigurations(configurations = Some(c)) - } -} -final class RepositoryName private[sbt] (name: String) { - def at(location: String) = { - nonEmpty(location, "Repository location") - MavenRepository(name, location) - } -} diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/DefaultLibraryManagement.scala b/librarymanagement/src/main/scala/sbt/librarymanagement/DefaultLibraryManagement.scala deleted file mode 100644 index 49af3cb7..00000000 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/DefaultLibraryManagement.scala +++ /dev/null @@ -1,105 +0,0 @@ -package sbt -package librarymanagement - -import java.io.File -import sbt.internal.librarymanagement._ -import sbt.util.Logger -import sbt.io.Hash - -class DefaultLibraryManagement(ivyConfiguration: IvyConfiguration, log: Logger) - extends LibraryManagement { - private[sbt] val ivySbt: IvySbt = new IvySbt(ivyConfiguration) - private val sbtOrgTemp = JsonUtil.sbtOrgTemp - private val modulePrefixTemp = "temp-module-" - - type Module = ivySbt.Module - - /** - * Returns a dummy module that depends on `moduleID`. - * Note: Sbt's implementation of Ivy requires us to do this, because only the dependencies - * of the specified module will be downloaded. - */ - def getModule(moduleId: ModuleID): Module = getModule(moduleId, None) - - def getModule(moduleId: ModuleID, ivyScala: Option[IvyScala]): ivySbt.Module = { - val sha1 = Hash.toHex(Hash(moduleId.name)) - val dummyID = ModuleID(sbtOrgTemp, modulePrefixTemp + sha1, moduleId.revision) - .withConfigurations(moduleId.configurations) - getModule(dummyID, Vector(moduleId), UpdateOptions(), ivyScala) - } - - def getModule( - moduleId: ModuleID, - deps: Vector[ModuleID], - uo: UpdateOptions = UpdateOptions(), - ivyScala: Option[IvyScala] - ): ivySbt.Module = { - val moduleSetting = InlineConfiguration( - validate = false, - ivyScala = ivyScala, - module = moduleId, - moduleInfo = ModuleInfo(moduleId.name), - dependencies = deps - ).withConfigurations(Vector(Configurations.Component)) - new ivySbt.Module(moduleSetting) - } - - private def dependenciesNames(module: ivySbt.Module): String = - module.moduleSettings match { - // `module` is a dummy module, we will only fetch its dependencies. - case ic: InlineConfiguration => - ic.dependencies map { - case mID: ModuleID => - import mID._ - s"$organization % $name % $revision" - } mkString ", " - case _ => - s"unknown" - } - - def update(module: ivySbt.Module, retrieveDirectory: File)( - predicate: File => Boolean - ): Option[Seq[File]] = { - val specialArtifactTypes = Artifact.DefaultSourceTypes union Artifact.DefaultDocTypes - val artifactFilter = ArtifactTypeFilter.forbid(specialArtifactTypes) - val retrieveConfiguration = - RetrieveConfiguration(retrieveDirectory, Resolver.defaultRetrievePattern).withSync(false) - val updateConfiguration = UpdateConfiguration( - Some(retrieveConfiguration), - true, - UpdateLogging.DownloadOnly, - artifactFilter, - false, - false - ) - - log.debug(s"Attempting to fetch ${dependenciesNames(module)}. This operation may fail.") - IvyActions.updateEither( - module, - updateConfiguration, - UnresolvedWarningConfiguration(), - LogicalClock.unknown, - None, - log - ) match { - case Left(unresolvedWarning) => - log.debug(s"Couldn't retrieve module ${dependenciesNames(module)}.") - None - - case Right(updateReport) => - val allFiles = - for { - conf <- updateReport.configurations - m <- conf.modules - (_, f) <- m.artifacts - } yield f - - log.debug(s"Files retrieved for ${dependenciesNames(module)}:") - log.debug(allFiles mkString ", ") - allFiles filter predicate match { - case Seq() => None - case files => Some(files) - } - } - } -} diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/LibraryManagement.scala b/librarymanagement/src/main/scala/sbt/librarymanagement/LibraryManagement.scala deleted file mode 100644 index ce86cc0b..00000000 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/LibraryManagement.scala +++ /dev/null @@ -1,8 +0,0 @@ -package sbt.librarymanagement - -// Interface for library management - -trait LibraryManagement { - type Module - def getModule(moduleId: ModuleID): Module -} diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/LibraryManagementSyntax.scala b/librarymanagement/src/main/scala/sbt/librarymanagement/LibraryManagementSyntax.scala deleted file mode 100644 index e6c43d87..00000000 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/LibraryManagementSyntax.scala +++ /dev/null @@ -1,7 +0,0 @@ -package sbt.librarymanagement - -trait LibraryManagementSyntax { - implicit def richUpdateReport(ur: UpdateReport): RichUpdateReport = new RichUpdateReport(ur) -} - -object syntax extends LibraryManagementSyntax diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/package.scala b/librarymanagement/src/main/scala/sbt/librarymanagement/package.scala deleted file mode 100644 index a1892b2f..00000000 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/package.scala +++ /dev/null @@ -1,9 +0,0 @@ -package sbt - -package object librarymanagement extends ResolversSyntax { - type ExclusionRule = InclExclRule - val ExclusionRule = InclExclRule - - type InclusionRule = InclExclRule - val InclusionRule = InclExclRule -} diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown new file mode 100644 index 00000000..2225348b --- /dev/null +++ b/notes/1.0.0.markdown @@ -0,0 +1,5 @@ +- 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` diff --git a/project/DatatypeConfig.scala b/project/DatatypeConfig.scala index cc95f3ff..3e729cd4 100644 --- a/project/DatatypeConfig.scala +++ b/project/DatatypeConfig.scala @@ -34,8 +34,12 @@ object DatatypeConfig { "sbt.internal.librarymanagement.formats.LoggerFormat" :: Nil } - case "sbt.librarymanagement.UpdateOptions" => { _ => - "sbt.internal.librarymanagement.formats.UpdateOptionsFormat" :: Nil + case "sbt.librarymanagement.ivy.UpdateOptions" => { _ => + "sbt.librarymanagement.ivy.formats.UpdateOptionsFormat" :: Nil + } + + case "sbt.librarymanagement.LogicalClock" => { _ => + "sbt.internal.librarymanagement.formats.LogicalClockFormats" :: Nil } // TODO: These are handled by BasicJsonProtocol, and sbt-datatype should handle them by default, imo diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 264d23e1..57048034 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -6,8 +6,8 @@ object Dependencies { val scala211 = "2.11.11" val scala212 = "2.12.2" - private val ioVersion = "1.0.0-M12" - private val utilVersion = "1.0.0-M26" + private val ioVersion = "1.0.0-M13" + private val utilVersion = "1.0.0-M27" private val sbtIO = "org.scala-sbt" %% "io" % ioVersion diff --git a/project/plugins.sbt b/project/plugins.sbt index ae33ece3..e5b186e6 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.3") -addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M7") +addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M9") addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.4.0") addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.3")