Skip to content
This repository was archived by the owner on Apr 8, 2021. It is now read-only.

Commit ddd90b8

Browse files
committed
Broken attempt so far: in ignoreMissingUpdate, don't download jar files, fixes #130
1 parent 49ad75a commit ddd90b8

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/main/scala-sbt-0.13/sbt/dependencygraph/DependencyGraphSbtCompat.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@ object DependencyGraphSbtCompat {
1111
def withMissingOk(missingOk: Boolean): UpdateConfiguration =
1212
updateConfig.copy(missingOk = missingOk)
1313
}
14+
15+
implicit class RichInlineConfiguration(val i: InlineConfiguration) extends AnyVal {
16+
def withDependencies(newDependencies: Vector[ModuleID]): InlineConfiguration =
17+
i.copy(dependencies = newDependencies)
18+
}
1419
}
1520
}

src/main/scala/net/virtualvoid/sbt/graph/DependencyGraphKeys.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ trait DependencyGraphKeys {
9595
val ivyReport = TaskKey[File](
9696
"ivy-report",
9797
"A task which returns the location of the ivy report file for a given configuration (default `compile`).")
98-
val ignoreMissingUpdate = Keys.update in ivyReport
9998
val filterScalaLibrary = SettingKey[Boolean](
10099
"filter-scala-library",
101100
"Specifies if scala dependency should be filtered in dependency-* output")
@@ -104,6 +103,7 @@ trait DependencyGraphKeys {
104103
"dependency-license-info",
105104
"Aggregates and shows information about the licenses of dependencies")
106105

106+
val ignoreMissingUpdate = TaskKey[UpdateReport]("dependencyUpdate", "Specialized update task for sbt-dependency-graph")
107107
// internal
108108
private[graph] val moduleGraphStore = TaskKey[ModuleGraph]("module-graph-store", "The stored module-graph from the last run")
109109
val whatDependsOn = InputKey[String]("what-depends-on", "Shows information about what depends on the given module")

src/main/scala/net/virtualvoid/sbt/graph/DependencyGraphSettings.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,18 @@ object DependencyGraphSettings {
3737

3838
def baseSettings = Seq(
3939
ivyReportFunction := ivyReportFunctionTask.value,
40-
updateConfiguration in ignoreMissingUpdate := updateConfiguration.value.withMissingOk(true),
4140

41+
// create our own version of `update` that will
42+
// * not fail on missing artifacts
43+
// * not actually download any jar files but only poms
44+
updateConfiguration in ignoreMissingUpdate := updateConfiguration.value.withMissingOk(true),
45+
moduleSettings in ignoreMissingUpdate := {
46+
moduleSettings.value match {
47+
case i: InlineConfiguration i.withDependencies(i.dependencies.map(_.pomOnly()).toVector)
48+
case x x
49+
}
50+
},
51+
ivyModule in ignoreMissingUpdate := { val is = ivySbt.value; new is.Module((moduleSettings in ignoreMissingUpdate).value) },
4252
ignoreMissingUpdate :=
4353
// inTask will make sure the new definition will pick up `updateConfiguration in ignoreMissingUpdate`
4454
SbtAccess.inTask(ignoreMissingUpdate, Classpaths.updateTask).value,

0 commit comments

Comments
 (0)