Skip to content

Commit

Permalink
Add support for custom protocol with coursier
Browse files Browse the repository at this point in the history
  • Loading branch information
MasseGuillaume committed May 16, 2022
1 parent 3a9a384 commit 5ffc6bc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions main/src/main/scala/sbt/Defaults.scala
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ object Defaults extends BuildCommon {
csrLogger := LMCoursier.coursierLoggerTask.value,
csrMavenProfiles :== Set.empty,
csrReconciliations :== LMCoursier.relaxedForAllModules,
csrProtocolHandlerDependencies :== Nil,
)

/** Core non-plugin settings for sbt builds. These *must* be on every build or the sbt engine will fail to run at all. */
Expand Down
1 change: 1 addition & 0 deletions main/src/main/scala/sbt/Keys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ object Keys {
val csrExtraCredentials = taskKey[Seq[lmcoursier.credentials.Credentials]]("")
val csrPublications = taskKey[Seq[(lmcoursier.definitions.Configuration, lmcoursier.definitions.Publication)]]("")
val csrReconciliations = settingKey[Seq[(ModuleMatchers, Reconciliation)]]("Strategy to reconcile version conflicts.")
val csrProtocolHandlerDependencies = settingKey[Seq[ModuleID]]("Dependency to fetch to be able to load custom protocols.")

val internalConfigurationMap = settingKey[Configuration => Configuration]("Maps configurations to the actual configuration used to define the classpath.").withRank(CSetting)
val classpathConfiguration = taskKey[Configuration]("The configuration used to define the classpath.").withRank(CTask)
Expand Down
22 changes: 15 additions & 7 deletions main/src/main/scala/sbt/coursierint/LMCoursier.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ object LMCoursier {
ivyHome: Option[File],
strict: Option[CStrict],
depsOverrides: Seq[ModuleID],
log: Logger
log: Logger,
protocolHandlerDependencies: Seq[ModuleID]
): CoursierConfiguration =
coursierConfiguration(
rs,
Expand All @@ -117,7 +118,8 @@ object LMCoursier {
strict,
depsOverrides,
None,
log
log,
protocolHandlerDependencies
)

def coursierConfiguration(
Expand All @@ -142,7 +144,8 @@ object LMCoursier {
strict: Option[CStrict],
depsOverrides: Seq[ModuleID],
updateConfig: Option[UpdateConfiguration],
log: Logger
log: Logger,
protocolHandlerDependencies: Seq[ModuleID],
): CoursierConfiguration = {
val coursierExcludeDeps = Inputs
.exclusions(
Expand Down Expand Up @@ -195,6 +198,7 @@ object LMCoursier {
.withStrict(strict)
.withForceVersions(userForceVersions.toVector)
.withMissingOk(missingOk)
.withProtocolHandlerDependencies(protocolHandlerDependencies)
}

def coursierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
Expand All @@ -221,7 +225,8 @@ object LMCoursier {
CoursierInputsTasks.strictTask.value,
dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log
streams.value.log,
csrProtocolHandlerDependencies.value,
)
}

Expand Down Expand Up @@ -249,7 +254,8 @@ object LMCoursier {
CoursierInputsTasks.strictTask.value,
dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log
streams.value.log,
csrProtocolHandlerDependencies.value
)
}

Expand Down Expand Up @@ -277,7 +283,8 @@ object LMCoursier {
CoursierInputsTasks.strictTask.value,
dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log
streams.value.log,
csrProtocolHandlerDependencies.value,
)
}

Expand Down Expand Up @@ -305,7 +312,8 @@ object LMCoursier {
CoursierInputsTasks.strictTask.value,
dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log
streams.value.log,
csrProtocolHandlerDependencies.value,
)
}

Expand Down

0 comments on commit 5ffc6bc

Please sign in to comment.