Skip to content

Commit

Permalink
Commit generated sources
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault committed Feb 14, 2019
1 parent 23320e6 commit 572b38e
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 3 deletions.
11 changes: 8 additions & 3 deletions build.sbt
Expand Up @@ -311,18 +311,23 @@ lazy val coursier = crossProject("coursier")(JSPlatform, JVMPlatform)
.settings(
shared,
dontPublishScalaJsIn("2.11"),
inConfig(Compile) {
inConfig(Compile)(Seq(
// commit generated sources in git, mostly for pants
// from https://github.com/sbt/librarymanagement/blob/6d35f329b6b6be8da467eefc399ba9fa6f6725c0/build.sbt#L108-L110
managedSourceDirectories in Compile += baseDirectory.value / "src" / "main" / "contraband-scala",
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
// from https://github.com/sbt/contraband/blob/63901346c0c92711a874c7189897e9fcd5cd003f/plugin/src/main/scala/ContrabandPlugin.scala#L60-L77,
// adjusting the source directory, and calling the former generateContrabands task
// This allows to process contraband files from jvm/src/main/contraband (former task) *and* the ones
// from shared/src/main/contraband (this task).
generateContrabands := {
val jvmSpecific = generateContrabands.value
val extraSourceDir = (baseDirectory.value / "..").getCanonicalFile / "shared" / "src" / "main" / "contraband"
val extraManagedSourceDir = (baseDirectory.value / "..").getCanonicalFile / "shared" / "src" / "main" / "contraband-scala"
val shared = sbt.contraband.Generate(extraSourceDir,
!(skipGeneration in generateContrabands).value,
!(skipGeneration in generateJsonCodecs).value,
(sourceManaged in generateContrabands).value,
extraManagedSourceDir,
(contrabandJavaLazy in generateContrabands).value,
(contrabandJavaOption in generateContrabands).value,
(contrabandScalaArray in generateContrabands).value,
Expand All @@ -338,7 +343,7 @@ lazy val coursier = crossProject("coursier")(JSPlatform, JVMPlatform)

jvmSpecific ++ shared
}
},
)),
publishGeneratedSources,
utest,
libs += Deps.scalaAsync % Test
Expand Down
@@ -0,0 +1,65 @@
/**
* This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]].
*/

// DO NOT EDIT MANUALLY
package coursier.params
final class CacheParams private (
val cacheLocation: java.io.File,
val cachePolicies: Seq[coursier.cache.CachePolicy],
val ttl: Option[scala.concurrent.duration.Duration],
val parallel: Int,
val checksum: Seq[Option[String]],
val retryCount: Int,
val cacheLocalArtifacts: Boolean,
val followHttpToHttpsRedirections: Boolean) extends coursier.params.CacheParamsHelpers with Serializable {

private def this() = this(coursier.cache.CacheDefaults.location, coursier.cache.CachePolicy.default, coursier.cache.CacheDefaults.ttl, coursier.cache.CacheDefaults.concurrentDownloadCount, coursier.cache.CacheDefaults.checksums, 1, false, true)

override def equals(o: Any): Boolean = o match {
case x: CacheParams => (this.cacheLocation == x.cacheLocation) && (this.cachePolicies == x.cachePolicies) && (this.ttl == x.ttl) && (this.parallel == x.parallel) && (this.checksum == x.checksum) && (this.retryCount == x.retryCount) && (this.cacheLocalArtifacts == x.cacheLocalArtifacts) && (this.followHttpToHttpsRedirections == x.followHttpToHttpsRedirections)
case _ => false
}
override def hashCode: Int = {
37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "coursier.params.CacheParams".##) + cacheLocation.##) + cachePolicies.##) + ttl.##) + parallel.##) + checksum.##) + retryCount.##) + cacheLocalArtifacts.##) + followHttpToHttpsRedirections.##)
}
override def toString: String = {
"CacheParams(" + cacheLocation + ", " + cachePolicies + ", " + ttl + ", " + parallel + ", " + checksum + ", " + retryCount + ", " + cacheLocalArtifacts + ", " + followHttpToHttpsRedirections + ")"
}
private[this] def copy(cacheLocation: java.io.File = cacheLocation, cachePolicies: Seq[coursier.cache.CachePolicy] = cachePolicies, ttl: Option[scala.concurrent.duration.Duration] = ttl, parallel: Int = parallel, checksum: Seq[Option[String]] = checksum, retryCount: Int = retryCount, cacheLocalArtifacts: Boolean = cacheLocalArtifacts, followHttpToHttpsRedirections: Boolean = followHttpToHttpsRedirections): CacheParams = {
new CacheParams(cacheLocation, cachePolicies, ttl, parallel, checksum, retryCount, cacheLocalArtifacts, followHttpToHttpsRedirections)
}
def withCacheLocation(cacheLocation: java.io.File): CacheParams = {
copy(cacheLocation = cacheLocation)
}
def withCachePolicies(cachePolicies: Seq[coursier.cache.CachePolicy]): CacheParams = {
copy(cachePolicies = cachePolicies)
}
def withTtl(ttl: Option[scala.concurrent.duration.Duration]): CacheParams = {
copy(ttl = ttl)
}
def withTtl(ttl: scala.concurrent.duration.Duration): CacheParams = {
copy(ttl = Option(ttl))
}
def withParallel(parallel: Int): CacheParams = {
copy(parallel = parallel)
}
def withChecksum(checksum: Seq[Option[String]]): CacheParams = {
copy(checksum = checksum)
}
def withRetryCount(retryCount: Int): CacheParams = {
copy(retryCount = retryCount)
}
def withCacheLocalArtifacts(cacheLocalArtifacts: Boolean): CacheParams = {
copy(cacheLocalArtifacts = cacheLocalArtifacts)
}
def withFollowHttpToHttpsRedirections(followHttpToHttpsRedirections: Boolean): CacheParams = {
copy(followHttpToHttpsRedirections = followHttpToHttpsRedirections)
}
}
object CacheParams {

def apply(): CacheParams = new CacheParams()
def apply(cacheLocation: java.io.File, cachePolicies: Seq[coursier.cache.CachePolicy], ttl: Option[scala.concurrent.duration.Duration], parallel: Int, checksum: Seq[Option[String]], retryCount: Int, cacheLocalArtifacts: Boolean, followHttpToHttpsRedirections: Boolean): CacheParams = new CacheParams(cacheLocation, cachePolicies, ttl, parallel, checksum, retryCount, cacheLocalArtifacts, followHttpToHttpsRedirections)
def apply(cacheLocation: java.io.File, cachePolicies: Seq[coursier.cache.CachePolicy], ttl: scala.concurrent.duration.Duration, parallel: Int, checksum: Seq[Option[String]], retryCount: Int, cacheLocalArtifacts: Boolean, followHttpToHttpsRedirections: Boolean): CacheParams = new CacheParams(cacheLocation, cachePolicies, Option(ttl), parallel, checksum, retryCount, cacheLocalArtifacts, followHttpToHttpsRedirections)
}
@@ -0,0 +1,61 @@
/**
* This code is generated using [[http://www.scala-sbt.org/contraband/ sbt-contraband]].
*/

// DO NOT EDIT MANUALLY
package coursier.params
final class ResolutionParams private (
val keepOptionalDependencies: Boolean,
val maxIterations: Int,
val forceVersion: Map[coursier.core.Module, String],
val forcedProperties: Map[String, String],
val profiles: Set[String],
val scalaVersion: String,
val forceScalaVersion: Boolean,
val typelevel: Boolean) extends Serializable {

private def this() = this(false, 200, Map.empty, Map.empty, Set.empty, coursier.internal.Defaults.scalaVersion, false, false)

override def equals(o: Any): Boolean = o match {
case x: ResolutionParams => (this.keepOptionalDependencies == x.keepOptionalDependencies) && (this.maxIterations == x.maxIterations) && (this.forceVersion == x.forceVersion) && (this.forcedProperties == x.forcedProperties) && (this.profiles == x.profiles) && (this.scalaVersion == x.scalaVersion) && (this.forceScalaVersion == x.forceScalaVersion) && (this.typelevel == x.typelevel)
case _ => false
}
override def hashCode: Int = {
37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "coursier.params.ResolutionParams".##) + keepOptionalDependencies.##) + maxIterations.##) + forceVersion.##) + forcedProperties.##) + profiles.##) + scalaVersion.##) + forceScalaVersion.##) + typelevel.##)
}
override def toString: String = {
"ResolutionParams(" + keepOptionalDependencies + ", " + maxIterations + ", " + forceVersion + ", " + forcedProperties + ", " + profiles + ", " + scalaVersion + ", " + forceScalaVersion + ", " + typelevel + ")"
}
private[this] def copy(keepOptionalDependencies: Boolean = keepOptionalDependencies, maxIterations: Int = maxIterations, forceVersion: Map[coursier.core.Module, String] = forceVersion, forcedProperties: Map[String, String] = forcedProperties, profiles: Set[String] = profiles, scalaVersion: String = scalaVersion, forceScalaVersion: Boolean = forceScalaVersion, typelevel: Boolean = typelevel): ResolutionParams = {
new ResolutionParams(keepOptionalDependencies, maxIterations, forceVersion, forcedProperties, profiles, scalaVersion, forceScalaVersion, typelevel)
}
def withKeepOptionalDependencies(keepOptionalDependencies: Boolean): ResolutionParams = {
copy(keepOptionalDependencies = keepOptionalDependencies)
}
def withMaxIterations(maxIterations: Int): ResolutionParams = {
copy(maxIterations = maxIterations)
}
def withForceVersion(forceVersion: Map[coursier.core.Module, String]): ResolutionParams = {
copy(forceVersion = forceVersion)
}
def withForcedProperties(forcedProperties: Map[String, String]): ResolutionParams = {
copy(forcedProperties = forcedProperties)
}
def withProfiles(profiles: Set[String]): ResolutionParams = {
copy(profiles = profiles)
}
def withScalaVersion(scalaVersion: String): ResolutionParams = {
copy(scalaVersion = scalaVersion)
}
def withForceScalaVersion(forceScalaVersion: Boolean): ResolutionParams = {
copy(forceScalaVersion = forceScalaVersion)
}
def withTypelevel(typelevel: Boolean): ResolutionParams = {
copy(typelevel = typelevel)
}
}
object ResolutionParams {

def apply(): ResolutionParams = new ResolutionParams()
def apply(keepOptionalDependencies: Boolean, maxIterations: Int, forceVersion: Map[coursier.core.Module, String], forcedProperties: Map[String, String], profiles: Set[String], scalaVersion: String, forceScalaVersion: Boolean, typelevel: Boolean): ResolutionParams = new ResolutionParams(keepOptionalDependencies, maxIterations, forceVersion, forcedProperties, profiles, scalaVersion, forceScalaVersion, typelevel)
}

0 comments on commit 572b38e

Please sign in to comment.