diff --git a/build.sbt b/build.sbt index b098b8441..6a7b19e99 100644 --- a/build.sbt +++ b/build.sbt @@ -18,6 +18,7 @@ inThisBuild(List( val coursierVersion0 = "1.1.0-M14-5" lazy val `lm-coursier` = project + // .enablePlugins(ContrabandPlugin) .in(file("modules/lm-coursier")) .settings( shared, diff --git a/modules/lm-coursier/src/main/contraband/authentication.json b/modules/lm-coursier/src/main/contraband/authentication.json new file mode 100644 index 000000000..9f77a0ccb --- /dev/null +++ b/modules/lm-coursier/src/main/contraband/authentication.json @@ -0,0 +1,33 @@ +{ + "types": [ + { + "name": "Authentication", + "namespace": "lmcoursier.definitions", + "target": "Scala", + "parents": [], + "type": "record", + "fields": [ + { + "name": "user", + "type": "String" + }, + { + "name": "password", + "type": "String" + }, + { + "name": "optional", + "type": "Boolean", + "default": "false", + "since": "1.0.0" + }, + { + "name": "realmOpt", + "type": "Option[String]", + "default": "None", + "since": "1.0.0" + } + ] + } + ] +} diff --git a/modules/lm-coursier/src/main/contraband/datetime.json b/modules/lm-coursier/src/main/contraband/datetime.json new file mode 100644 index 000000000..464bdf293 --- /dev/null +++ b/modules/lm-coursier/src/main/contraband/datetime.json @@ -0,0 +1,37 @@ +{ + "types": [ + { + "name": "DateTime", + "namespace": "lmcoursier.definitions", + "target": "Scala", + "parents": [], + "type": "record", + "fields": [ + { + "name": "year", + "type": "Int" + }, + { + "name": "month", + "type": "Int" + }, + { + "name": "day", + "type": "Int" + }, + { + "name": "hour", + "type": "Int" + }, + { + "name": "minute", + "type": "Int" + }, + { + "name": "second", + "type": "Int" + } + ] + } + ] +} diff --git a/modules/lm-coursier/src/main/contraband/dependency.json b/modules/lm-coursier/src/main/contraband/dependency.json new file mode 100644 index 000000000..d30591513 --- /dev/null +++ b/modules/lm-coursier/src/main/contraband/dependency.json @@ -0,0 +1,41 @@ +{ + "types": [ + { + "name": "Dependency", + "namespace": "lmcoursier.definitions", + "target": "Scala", + "parents": [], + "type": "record", + "fields": [ + { + "name": "module", + "type": "Module" + }, + { + "name": "version", + "type": "String" + }, + { + "name": "configuration", + "type": "Configuration" + }, + { + "name": "exclusions", + "type": "Set[(Organization, ModuleName)]" + }, + { + "name": "attributes", + "type": "Attributes" + }, + { + "name": "optional", + "type": "Boolean" + }, + { + "name": "transitive", + "type": "Boolean" + } + ] + } + ] +} diff --git a/modules/lm-coursier/src/main/contraband/developer.json b/modules/lm-coursier/src/main/contraband/developer.json new file mode 100644 index 000000000..e4d98806a --- /dev/null +++ b/modules/lm-coursier/src/main/contraband/developer.json @@ -0,0 +1,25 @@ +{ + "types": [ + { + "name": "Developer", + "namespace": "lmcoursier.definitions", + "target": "Scala", + "parents": [], + "type": "record", + "fields": [ + { + "name": "id", + "type": "String" + }, + { + "name": "name", + "type": "String" + }, + { + "name": "url", + "type": "String" + } + ] + } + ] +} diff --git a/modules/lm-coursier/src/main/contraband/fallback-dependency.json b/modules/lm-coursier/src/main/contraband/fallback-dependency.json new file mode 100644 index 000000000..4f50f58d6 --- /dev/null +++ b/modules/lm-coursier/src/main/contraband/fallback-dependency.json @@ -0,0 +1,29 @@ +{ + "types": [ + { + "name": "FallbackDependency", + "namespace": "lmcoursier", + "target": "Scala", + "parents": [], + "type": "record", + "fields": [ + { + "name": "module", + "type": "lmcoursier.definitions.Module" + }, + { + "name": "version", + "type": "String" + }, + { + "name": "url", + "type": "java.net.URL" + }, + { + "name": "changing", + "type": "Boolean" + } + ] + } + ] +} diff --git a/modules/lm-coursier/src/main/contraband/info.json b/modules/lm-coursier/src/main/contraband/info.json new file mode 100644 index 000000000..b4fabf126 --- /dev/null +++ b/modules/lm-coursier/src/main/contraband/info.json @@ -0,0 +1,33 @@ +{ + "types": [ + { + "name": "Info", + "namespace": "lmcoursier.definitions", + "target": "Scala", + "parents": [], + "type": "record", + "fields": [ + { + "name": "description", + "type": "String" + }, + { + "name": "homePage", + "type": "String" + }, + { + "name": "licenses", + "type": "Seq[(String, Option[String])]" + }, + { + "name": "developers", + "type": "Seq[Developer]" + }, + { + "name": "publication", + "type": "Option[DateTime]" + } + ] + } + ] +} diff --git a/modules/lm-coursier/src/main/contraband/module.json b/modules/lm-coursier/src/main/contraband/module.json new file mode 100644 index 000000000..cc3de0b21 --- /dev/null +++ b/modules/lm-coursier/src/main/contraband/module.json @@ -0,0 +1,25 @@ +{ + "types": [ + { + "name": "Module", + "namespace": "lmcoursier.definitions", + "target": "Scala", + "parents": [], + "type": "record", + "fields": [ + { + "name": "organization", + "type": "Organization" + }, + { + "name": "name", + "type": "ModuleName" + }, + { + "name": "attributes", + "type": "Map[String, String]" + } + ] + } + ] +} diff --git a/modules/lm-coursier/src/main/contraband/project.json b/modules/lm-coursier/src/main/contraband/project.json new file mode 100644 index 000000000..014c1e946 --- /dev/null +++ b/modules/lm-coursier/src/main/contraband/project.json @@ -0,0 +1,45 @@ +{ + "types": [ + { + "name": "Project", + "namespace": "lmcoursier.definitions", + "target": "Scala", + "parents": [], + "type": "record", + "fields": [ + { + "name": "module", + "type": "Module" + }, + { + "name": "version", + "type": "String" + }, + { + "name": "dependencies", + "type": "Seq[(Configuration, Dependency)]" + }, + { + "name": "configurations", + "type": "Map[Configuration, Seq[Configuration]]" + }, + { + "name": "properties", + "type": "Seq[(String, String)]" + }, + { + "name": "packagingOpt", + "type": "Option[Type]" + }, + { + "name": "publications", + "type": "Seq[(Configuration, Publication)]" + }, + { + "name": "info", + "type": "Info" + } + ] + } + ] +} diff --git a/modules/lm-coursier/src/main/contraband/publication.json b/modules/lm-coursier/src/main/contraband/publication.json new file mode 100644 index 000000000..98a191052 --- /dev/null +++ b/modules/lm-coursier/src/main/contraband/publication.json @@ -0,0 +1,29 @@ +{ + "types": [ + { + "name": "Publication", + "namespace": "lmcoursier.definitions", + "target": "Scala", + "parents": [], + "type": "record", + "fields": [ + { + "name": "name", + "type": "String" + }, + { + "name": "type", + "type": "Type" + }, + { + "name": "ext", + "type": "Extension" + }, + { + "name": "classifier", + "type": "Classifier" + } + ] + } + ] +} diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/CoursierDependencyResolution.scala b/modules/lm-coursier/src/main/scala/lmcoursier/CoursierDependencyResolution.scala index 0e0541df3..d8b955345 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/CoursierDependencyResolution.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/CoursierDependencyResolution.scala @@ -106,9 +106,7 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen } .map { case (config, dep) => - val dep0 = dep.copy( - exclusions = dep.exclusions ++ excludeDependencies - ) + val dep0 = dep.withExclusions(dep.exclusions ++ excludeDependencies) (ToCoursier.configuration(config), ToCoursier.dependency(dep0)) } diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/FallbackDependency.scala b/modules/lm-coursier/src/main/scala/lmcoursier/FallbackDependency.scala index 8247c7f59..b3c3e2d3f 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/FallbackDependency.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/FallbackDependency.scala @@ -1,13 +1,44 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY package lmcoursier - -import java.net.URL - -import lmcoursier.definitions.Module - -// FIXME Handle that via the contraband thing? -final case class FallbackDependency( - module: Module, - version: String, - url: URL, - changing: Boolean -) +final class FallbackDependency private ( + val module: lmcoursier.definitions.Module, + val version: String, + val url: java.net.URL, + val changing: Boolean) extends Serializable { + + + + override def equals(o: Any): Boolean = o match { + case x: FallbackDependency => (this.module == x.module) && (this.version == x.version) && (this.url == x.url) && (this.changing == x.changing) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (17 + "lmcoursier.FallbackDependency".##) + module.##) + version.##) + url.##) + changing.##) + } + override def toString: String = { + "FallbackDependency(" + module + ", " + version + ", " + url + ", " + changing + ")" + } + private[this] def copy(module: lmcoursier.definitions.Module = module, version: String = version, url: java.net.URL = url, changing: Boolean = changing): FallbackDependency = { + new FallbackDependency(module, version, url, changing) + } + def withModule(module: lmcoursier.definitions.Module): FallbackDependency = { + copy(module = module) + } + def withVersion(version: String): FallbackDependency = { + copy(version = version) + } + def withUrl(url: java.net.URL): FallbackDependency = { + copy(url = url) + } + def withChanging(changing: Boolean): FallbackDependency = { + copy(changing = changing) + } +} +object FallbackDependency { + + def apply(module: lmcoursier.definitions.Module, version: String, url: java.net.URL, changing: Boolean): FallbackDependency = new FallbackDependency(module, version, url, changing) +} diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/FromSbt.scala b/modules/lm-coursier/src/main/scala/lmcoursier/FromSbt.scala index 554d6b15d..d5a061d07 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/FromSbt.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/FromSbt.scala @@ -101,7 +101,12 @@ object FromSbt { for { (from, to) <- allMappings attr <- attributes - } yield from -> dep.copy(configuration = to, attributes = attr) + } yield { + val dep0 = dep + .withConfiguration(to) + .withAttributes(attr) + from -> dep0 + } } def fallbackDependencies( diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Authentication.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Authentication.scala index a03103abd..0aa6a3256 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Authentication.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Authentication.scala @@ -1,11 +1,45 @@ -package lmcoursier.definitions +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ -final case class Authentication( - user: String, - password: String, - optional: Boolean = false, - realmOpt: Option[String] = None -) { - override def toString: String = - s"Authentication($user, *******, $optional, $realmOpt)" +// DO NOT EDIT MANUALLY +package lmcoursier.definitions +final class Authentication private ( + val user: String, + val password: String, + val optional: Boolean, + val realmOpt: Option[String]) extends Serializable { + + private def this(user: String, password: String) = this(user, password, false, None) + + override def equals(o: Any): Boolean = o match { + case x: Authentication => (this.user == x.user) && (this.password == x.password) && (this.optional == x.optional) && (this.realmOpt == x.realmOpt) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (17 + "lmcoursier.definitions.Authentication".##) + user.##) + password.##) + optional.##) + realmOpt.##) + } + override def toString: String = { + "Authentication(" + user + ", " + password + ", " + optional + ", " + realmOpt + ")" + } + private[this] def copy(user: String = user, password: String = password, optional: Boolean = optional, realmOpt: Option[String] = realmOpt): Authentication = { + new Authentication(user, password, optional, realmOpt) + } + def withUser(user: String): Authentication = { + copy(user = user) + } + def withPassword(password: String): Authentication = { + copy(password = password) + } + def withOptional(optional: Boolean): Authentication = { + copy(optional = optional) + } + def withRealmOpt(realmOpt: Option[String]): Authentication = { + copy(realmOpt = realmOpt) + } +} +object Authentication { + + def apply(user: String, password: String): Authentication = new Authentication(user, password) + def apply(user: String, password: String, optional: Boolean, realmOpt: Option[String]): Authentication = new Authentication(user, password, optional, realmOpt) } diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Classifier.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Classifier.scala deleted file mode 100644 index d3720859a..000000000 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Classifier.scala +++ /dev/null @@ -1,3 +0,0 @@ -package lmcoursier.definitions - -final case class Classifier(value: String) extends AnyVal diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Configuration.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Configuration.scala deleted file mode 100644 index 378605c85..000000000 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Configuration.scala +++ /dev/null @@ -1,3 +0,0 @@ -package lmcoursier.definitions - -final case class Configuration(value: String) extends AnyVal diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/DateTime.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/DateTime.scala new file mode 100644 index 000000000..9ed52f54e --- /dev/null +++ b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/DateTime.scala @@ -0,0 +1,52 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package lmcoursier.definitions +final class DateTime private ( + val year: Int, + val month: Int, + val day: Int, + val hour: Int, + val minute: Int, + val second: Int) extends Serializable { + + + + override def equals(o: Any): Boolean = o match { + case x: DateTime => (this.year == x.year) && (this.month == x.month) && (this.day == x.day) && (this.hour == x.hour) && (this.minute == x.minute) && (this.second == x.second) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "lmcoursier.definitions.DateTime".##) + year.##) + month.##) + day.##) + hour.##) + minute.##) + second.##) + } + override def toString: String = { + "DateTime(" + year + ", " + month + ", " + day + ", " + hour + ", " + minute + ", " + second + ")" + } + private[this] def copy(year: Int = year, month: Int = month, day: Int = day, hour: Int = hour, minute: Int = minute, second: Int = second): DateTime = { + new DateTime(year, month, day, hour, minute, second) + } + def withYear(year: Int): DateTime = { + copy(year = year) + } + def withMonth(month: Int): DateTime = { + copy(month = month) + } + def withDay(day: Int): DateTime = { + copy(day = day) + } + def withHour(hour: Int): DateTime = { + copy(hour = hour) + } + def withMinute(minute: Int): DateTime = { + copy(minute = minute) + } + def withSecond(second: Int): DateTime = { + copy(second = second) + } +} +object DateTime { + + def apply(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int): DateTime = new DateTime(year, month, day, hour, minute, second) +} diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Definitions.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Definitions.scala new file mode 100644 index 000000000..f60cbe505 --- /dev/null +++ b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Definitions.scala @@ -0,0 +1,13 @@ +package lmcoursier.definitions + +final case class Classifier(value: String) extends AnyVal + +final case class Configuration(value: String) extends AnyVal + +final case class Extension(value: String) extends AnyVal + +final case class ModuleName(value: String) extends AnyVal + +final case class Organization(value: String) extends AnyVal + +final case class Type(value: String) extends AnyVal diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Dependency.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Dependency.scala index 21a35b6dd..864fae3a2 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Dependency.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Dependency.scala @@ -1,14 +1,56 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY package lmcoursier.definitions - -final case class Dependency( - module: Module, - version: String, - configuration: Configuration, - exclusions: Set[(Organization, ModuleName)], - - // Maven-specific - attributes: Attributes, - optional: Boolean, - - transitive: Boolean -) +final class Dependency private ( + val module: Module, + val version: String, + val configuration: Configuration, + val exclusions: Set[(Organization, ModuleName)], + val attributes: Attributes, + val optional: Boolean, + val transitive: Boolean) extends Serializable { + + + + override def equals(o: Any): Boolean = o match { + case x: Dependency => (this.module == x.module) && (this.version == x.version) && (this.configuration == x.configuration) && (this.exclusions == x.exclusions) && (this.attributes == x.attributes) && (this.optional == x.optional) && (this.transitive == x.transitive) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "lmcoursier.definitions.Dependency".##) + module.##) + version.##) + configuration.##) + exclusions.##) + attributes.##) + optional.##) + transitive.##) + } + override def toString: String = { + "Dependency(" + module + ", " + version + ", " + configuration + ", " + exclusions + ", " + attributes + ", " + optional + ", " + transitive + ")" + } + private[this] def copy(module: Module = module, version: String = version, configuration: Configuration = configuration, exclusions: Set[(Organization, ModuleName)] = exclusions, attributes: Attributes = attributes, optional: Boolean = optional, transitive: Boolean = transitive): Dependency = { + new Dependency(module, version, configuration, exclusions, attributes, optional, transitive) + } + def withModule(module: Module): Dependency = { + copy(module = module) + } + def withVersion(version: String): Dependency = { + copy(version = version) + } + def withConfiguration(configuration: Configuration): Dependency = { + copy(configuration = configuration) + } + def withExclusions(exclusions: Set[(Organization, ModuleName)]): Dependency = { + copy(exclusions = exclusions) + } + def withAttributes(attributes: Attributes): Dependency = { + copy(attributes = attributes) + } + def withOptional(optional: Boolean): Dependency = { + copy(optional = optional) + } + def withTransitive(transitive: Boolean): Dependency = { + copy(transitive = transitive) + } +} +object Dependency { + + def apply(module: Module, version: String, configuration: Configuration, exclusions: Set[(Organization, ModuleName)], attributes: Attributes, optional: Boolean, transitive: Boolean): Dependency = new Dependency(module, version, configuration, exclusions, attributes, optional, transitive) +} diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Developer.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Developer.scala new file mode 100644 index 000000000..7aeaea870 --- /dev/null +++ b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Developer.scala @@ -0,0 +1,40 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY +package lmcoursier.definitions +final class Developer private ( + val id: String, + val name: String, + val url: String) extends Serializable { + + + + override def equals(o: Any): Boolean = o match { + case x: Developer => (this.id == x.id) && (this.name == x.name) && (this.url == x.url) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (17 + "lmcoursier.definitions.Developer".##) + id.##) + name.##) + url.##) + } + override def toString: String = { + "Developer(" + id + ", " + name + ", " + url + ")" + } + private[this] def copy(id: String = id, name: String = name, url: String = url): Developer = { + new Developer(id, name, url) + } + def withId(id: String): Developer = { + copy(id = id) + } + def withName(name: String): Developer = { + copy(name = name) + } + def withUrl(url: String): Developer = { + copy(url = url) + } +} +object Developer { + + def apply(id: String, name: String, url: String): Developer = new Developer(id, name, url) +} diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Extension.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Extension.scala deleted file mode 100644 index 1730c5810..000000000 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Extension.scala +++ /dev/null @@ -1,3 +0,0 @@ -package lmcoursier.definitions - -final case class Extension(value: String) extends AnyVal diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Info.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Info.scala index a6d2897d0..94bdabb37 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Info.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Info.scala @@ -1,26 +1,48 @@ +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ + +// DO NOT EDIT MANUALLY package lmcoursier.definitions - -final case class Info( - description: String, - homePage: String, - licenses: Seq[(String, Option[String])], - developers: Seq[Info.Developer], - publication: Option[Info.DateTime] -) - -object Info { - final case class Developer( - id: String, - name: String, - url: String - ) - - final case class DateTime( - year: Int, - month: Int, - day: Int, - hour: Int, - minute: Int, - second: Int - ) +final class Info private ( + val description: String, + val homePage: String, + val licenses: Seq[(String, Option[String])], + val developers: Seq[Developer], + val publication: Option[DateTime]) extends Serializable { + + + + override def equals(o: Any): Boolean = o match { + case x: Info => (this.description == x.description) && (this.homePage == x.homePage) && (this.licenses == x.licenses) && (this.developers == x.developers) && (this.publication == x.publication) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (37 * (17 + "lmcoursier.definitions.Info".##) + description.##) + homePage.##) + licenses.##) + developers.##) + publication.##) + } + override def toString: String = { + "Info(" + description + ", " + homePage + ", " + licenses + ", " + developers + ", " + publication + ")" + } + private[this] def copy(description: String = description, homePage: String = homePage, licenses: Seq[(String, Option[String])] = licenses, developers: Seq[Developer] = developers, publication: Option[DateTime] = publication): Info = { + new Info(description, homePage, licenses, developers, publication) + } + def withDescription(description: String): Info = { + copy(description = description) + } + def withHomePage(homePage: String): Info = { + copy(homePage = homePage) + } + def withLicenses(licenses: Seq[(String, Option[String])]): Info = { + copy(licenses = licenses) + } + def withDevelopers(developers: Seq[Developer]): Info = { + copy(developers = developers) + } + def withPublication(publication: Option[DateTime]): Info = { + copy(publication = publication) + } +} +object Info { + + def apply(description: String, homePage: String, licenses: Seq[(String, Option[String])], developers: Seq[Developer], publication: Option[DateTime]): Info = new Info(description, homePage, licenses, developers, publication) } diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Module.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Module.scala index 09ec6b6ea..a843f9a0a 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Module.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Module.scala @@ -1,7 +1,40 @@ -package lmcoursier.definitions +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ -final case class Module( - organization: Organization, - name: ModuleName, - attributes: Map[String, String] -) +// DO NOT EDIT MANUALLY +package lmcoursier.definitions +final class Module private ( + val organization: Organization, + val name: ModuleName, + val attributes: Map[String, String]) extends Serializable { + + + + override def equals(o: Any): Boolean = o match { + case x: Module => (this.organization == x.organization) && (this.name == x.name) && (this.attributes == x.attributes) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (17 + "lmcoursier.definitions.Module".##) + organization.##) + name.##) + attributes.##) + } + override def toString: String = { + "Module(" + organization + ", " + name + ", " + attributes + ")" + } + private[this] def copy(organization: Organization = organization, name: ModuleName = name, attributes: Map[String, String] = attributes): Module = { + new Module(organization, name, attributes) + } + def withOrganization(organization: Organization): Module = { + copy(organization = organization) + } + def withName(name: ModuleName): Module = { + copy(name = name) + } + def withAttributes(attributes: Map[String, String]): Module = { + copy(attributes = attributes) + } +} +object Module { + + def apply(organization: Organization, name: ModuleName, attributes: Map[String, String]): Module = new Module(organization, name, attributes) +} diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/ModuleName.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/ModuleName.scala deleted file mode 100644 index c29d972cf..000000000 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/ModuleName.scala +++ /dev/null @@ -1,3 +0,0 @@ -package lmcoursier.definitions - -final case class ModuleName(value: String) extends AnyVal diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Organization.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Organization.scala deleted file mode 100644 index 9ef788eb7..000000000 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Organization.scala +++ /dev/null @@ -1,3 +0,0 @@ -package lmcoursier.definitions - -final case class Organization(value: String) extends AnyVal diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Project.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Project.scala index 68af2a012..e2f466167 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Project.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Project.scala @@ -1,12 +1,60 @@ -package lmcoursier.definitions +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ -final case class Project( - module: Module, - version: String, - dependencies: Seq[(Configuration, Dependency)], - configurations: Map[Configuration, Seq[Configuration]], - properties: Seq[(String, String)], - packagingOpt: Option[Type], - publications: Seq[(Configuration, Publication)], - info: Info -) +// DO NOT EDIT MANUALLY +package lmcoursier.definitions +final class Project private ( + val module: Module, + val version: String, + val dependencies: Seq[(Configuration, Dependency)], + val configurations: Map[Configuration, Seq[Configuration]], + val properties: Seq[(String, String)], + val packagingOpt: Option[Type], + val publications: Seq[(Configuration, Publication)], + val info: Info) extends Serializable { + + + + override def equals(o: Any): Boolean = o match { + case x: Project => (this.module == x.module) && (this.version == x.version) && (this.dependencies == x.dependencies) && (this.configurations == x.configurations) && (this.properties == x.properties) && (this.packagingOpt == x.packagingOpt) && (this.publications == x.publications) && (this.info == x.info) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "lmcoursier.definitions.Project".##) + module.##) + version.##) + dependencies.##) + configurations.##) + properties.##) + packagingOpt.##) + publications.##) + info.##) + } + override def toString: String = { + "Project(" + module + ", " + version + ", " + dependencies + ", " + configurations + ", " + properties + ", " + packagingOpt + ", " + publications + ", " + info + ")" + } + private[this] def copy(module: Module = module, version: String = version, dependencies: Seq[(Configuration, Dependency)] = dependencies, configurations: Map[Configuration, Seq[Configuration]] = configurations, properties: Seq[(String, String)] = properties, packagingOpt: Option[Type] = packagingOpt, publications: Seq[(Configuration, Publication)] = publications, info: Info = info): Project = { + new Project(module, version, dependencies, configurations, properties, packagingOpt, publications, info) + } + def withModule(module: Module): Project = { + copy(module = module) + } + def withVersion(version: String): Project = { + copy(version = version) + } + def withDependencies(dependencies: Seq[(Configuration, Dependency)]): Project = { + copy(dependencies = dependencies) + } + def withConfigurations(configurations: Map[Configuration, Seq[Configuration]]): Project = { + copy(configurations = configurations) + } + def withProperties(properties: Seq[(String, String)]): Project = { + copy(properties = properties) + } + def withPackagingOpt(packagingOpt: Option[Type]): Project = { + copy(packagingOpt = packagingOpt) + } + def withPublications(publications: Seq[(Configuration, Publication)]): Project = { + copy(publications = publications) + } + def withInfo(info: Info): Project = { + copy(info = info) + } +} +object Project { + + def apply(module: Module, version: String, dependencies: Seq[(Configuration, Dependency)], configurations: Map[Configuration, Seq[Configuration]], properties: Seq[(String, String)], packagingOpt: Option[Type], publications: Seq[(Configuration, Publication)], info: Info): Project = new Project(module, version, dependencies, configurations, properties, packagingOpt, publications, info) +} diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Publication.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Publication.scala index 0f1b938f8..e2ea83913 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Publication.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Publication.scala @@ -1,8 +1,44 @@ -package lmcoursier.definitions +/** + * This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]]. + */ -final case class Publication( - name: String, - `type`: Type, - ext: Extension, - classifier: Classifier -) +// DO NOT EDIT MANUALLY +package lmcoursier.definitions +final class Publication private ( + val name: String, + val `type`: Type, + val ext: Extension, + val classifier: Classifier) extends Serializable { + + + + override def equals(o: Any): Boolean = o match { + case x: Publication => (this.name == x.name) && (this.`type` == x.`type`) && (this.ext == x.ext) && (this.classifier == x.classifier) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (37 * (37 * (37 * (17 + "lmcoursier.definitions.Publication".##) + name.##) + `type`.##) + ext.##) + classifier.##) + } + override def toString: String = { + "Publication(" + name + ", " + `type` + ", " + ext + ", " + classifier + ")" + } + private[this] def copy(name: String = name, `type`: Type = `type`, ext: Extension = ext, classifier: Classifier = classifier): Publication = { + new Publication(name, `type`, ext, classifier) + } + def withName(name: String): Publication = { + copy(name = name) + } + def withType(`type`: Type): Publication = { + copy(`type` = `type`) + } + def withExt(ext: Extension): Publication = { + copy(ext = ext) + } + def withClassifier(classifier: Classifier): Publication = { + copy(classifier = classifier) + } +} +object Publication { + + def apply(name: String, `type`: Type, ext: Extension, classifier: Classifier): Publication = new Publication(name, `type`, ext, classifier) +} diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Type.scala b/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Type.scala deleted file mode 100644 index 1e6d8e8a8..000000000 --- a/modules/lm-coursier/src/main/scala/lmcoursier/definitions/Type.scala +++ /dev/null @@ -1,3 +0,0 @@ -package lmcoursier.definitions - -final case class Type(value: String) extends AnyVal diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/internal/ResolutionParams.scala b/modules/lm-coursier/src/main/scala/lmcoursier/internal/ResolutionParams.scala index 281b18edf..96e50d46e 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/internal/ResolutionParams.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/internal/ResolutionParams.scala @@ -31,10 +31,11 @@ final case class ResolutionParams( if (fallbackDependencies.isEmpty) Nil else { - val map = fallbackDependencies.map { - case FallbackDependency(mod, ver, url, changing) => - (ToCoursier.module(mod), ver) -> ((url, changing)) - }.toMap + val map = fallbackDependencies + .map { dep => + (ToCoursier.module(dep.module), dep.version) -> ((dep.url, dep.changing)) + } + .toMap Seq( InMemoryRepository(map) diff --git a/modules/sbt-coursier-shared/src/main/scala/coursier/sbtcoursiershared/InputsTasks.scala b/modules/sbt-coursier-shared/src/main/scala/coursier/sbtcoursiershared/InputsTasks.scala index e0744df52..8dbe901c9 100644 --- a/modules/sbt-coursier-shared/src/main/scala/coursier/sbtcoursiershared/InputsTasks.scala +++ b/modules/sbt-coursier-shared/src/main/scala/coursier/sbtcoursiershared/InputsTasks.scala @@ -47,10 +47,11 @@ object InputsTasks { sbv ) - proj.copy( - dependencies = proj.dependencies.map { + proj.withDependencies( + proj.dependencies.map { case (config, dep) => - (config, dep.copy(exclusions = dep.exclusions ++ exclusions0)) + val dep0 = dep.withExclusions(dep.exclusions ++ exclusions0) + (config, dep0) } ) } diff --git a/modules/sbt-coursier-shared/src/main/scala/coursier/sbtcoursiershared/IvyXml.scala b/modules/sbt-coursier-shared/src/main/scala/coursier/sbtcoursiershared/IvyXml.scala index 901369d6f..5b9d614dd 100644 --- a/modules/sbt-coursier-shared/src/main/scala/coursier/sbtcoursiershared/IvyXml.scala +++ b/modules/sbt-coursier-shared/src/main/scala/coursier/sbtcoursiershared/IvyXml.scala @@ -72,8 +72,8 @@ object IvyXml { .collect { case (conf, dep) if conf.value == shadedConfig.value => dep } } - val project: Project = project0.copy( - dependencies = project0.dependencies.collect { + val project = project0.withDependencies( + project0.dependencies.collect { case p @ (_, dep) if !filterOutDependencies(dep) => p } ) @@ -169,7 +169,7 @@ object IvyXml { val currentProject = { val proj = coursierProject.value val publications = coursierPublications.value - proj.copy(publications = publications) + proj.withPublications(publications) } writeFiles(currentProject, shadedConfigOpt, sbt.Keys.ivySbt.value, sbt.Keys.streams.value.log) } diff --git a/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/DisplayTasks.scala b/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/DisplayTasks.scala index 29bd26a59..788d73f77 100644 --- a/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/DisplayTasks.scala +++ b/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/DisplayTasks.scala @@ -32,7 +32,7 @@ object DisplayTasks { Def.task { val proj = coursierProject.value val publications = coursierPublications.value - proj.copy(publications = publications) + proj.withPublications(publications) } val resolutionsTask = diff --git a/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/ResolutionTasks.scala b/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/ResolutionTasks.scala index 799858bc8..c6da8ae35 100644 --- a/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/ResolutionTasks.scala +++ b/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/ResolutionTasks.scala @@ -39,7 +39,7 @@ object ResolutionTasks { Def.task { val baseConfigGraphs = coursierConfigGraphs.value val publications = coursierPublications.value - (ToCoursier.project(coursierProject.value.copy(publications = publications)), coursierFallbackDependencies.value, baseConfigGraphs) + (ToCoursier.project(coursierProject.value.withPublications(publications)), coursierFallbackDependencies.value, baseConfigGraphs) } val resolversTask = diff --git a/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/SbtCoursierFromSbt.scala b/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/SbtCoursierFromSbt.scala index e9768f57a..b98ed21d7 100644 --- a/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/SbtCoursierFromSbt.scala +++ b/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/SbtCoursierFromSbt.scala @@ -24,8 +24,8 @@ object SbtCoursierFromSbt { // this is a loose attempt at fixing that cm.configurations match { case Seq(cfg) => - p.copy( - dependencies = p.dependencies.map { + p.withDependencies( + p.dependencies.map { case (_, d) => (Configuration(cfg.name), d) } ) diff --git a/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/UpdateTasks.scala b/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/UpdateTasks.scala index bd8aa98d9..bb6407c92 100644 --- a/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/UpdateTasks.scala +++ b/modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/UpdateTasks.scala @@ -29,7 +29,7 @@ object UpdateTasks { Def.task { val proj = coursierProject.value val publications = coursierPublications.value - proj.copy(publications = publications) + proj.withPublications(publications) } val resTask = diff --git a/project/plugins.sbt b/project/plugins.sbt index 23e1b8f36..b3f49e806 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,6 +5,7 @@ plugins_( "com.typesafe" % "sbt-mima-plugin" % "0.3.0", "com.jsuereth" % "sbt-pgp" % "1.1.2", "io.get-coursier" % "sbt-shading" % sbtCoursierVersion + // "org.scala-sbt" % "sbt-contraband" % "0.4.3" ) libs ++= Seq(