-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix UpdateReport to be compatible with dependency-graph (#156)
Fixes coursier/coursier#1375 Ref sbt/sbt#4706 / sbt/sbt#4688 Ref sbt/sbt-dependency-graph#178 Currently the UpdateReport returned by Coursier is missing callers from the direct dependencies. This is evident from the fact that `thisModule`'s information is not passed. Another missing information in the UpdateReport is ModuleReport that originates from subproject dependencies (aka inter-project dependencies). These two missing info result in broken rendering for sbt-dependency-graph. This commit attemps to fix them by passing them through to SbtUpdateReport. See the scripted test for confirmation.
- Loading branch information
1 parent
de3b4f0
commit dc5b9ec
Showing
8 changed files
with
119 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
modules/sbt-coursier/src/sbt-test/shared-1/caller/build.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
lazy val check = taskKey[Unit]("") | ||
|
||
scalaVersion in ThisBuild := "2.12.8" | ||
organization in ThisBuild := "com.example" | ||
|
||
lazy val app = (project in file("app")) | ||
.dependsOn(util) | ||
.settings( | ||
name := "app", | ||
libraryDependencies += "com.chuusai" %% "shapeless" % "2.3.3", | ||
check := { | ||
val ur = update.value | ||
val cr = ur.configuration(Compile).get | ||
// configuration report must include a module report for subproject dependency | ||
val coreReport = cr.modules.find(m => | ||
m.module.name == "core_2.12" | ||
).getOrElse(sys.error("report for core is missing")) | ||
assert(coreReport.callers.exists(c => c.caller.name == "util_2.12"), | ||
s"caller on core is missing util: ${coreReport.callers}") | ||
|
||
// configuration report must include a module report for library dependency | ||
val shapelessReport = cr.modules.find(m => | ||
m.module.name == "shapeless_2.12" | ||
).getOrElse(sys.error("report for shapeless is missing")) | ||
assert(shapelessReport.callers.exists(c => c.caller.name == "app_2.12"), | ||
s"caller on shapeless is missing self module (app): ${shapelessReport.callers}") | ||
} | ||
) | ||
|
||
lazy val util = (project in file("util")) | ||
.dependsOn(core) | ||
.settings( | ||
name := "util" | ||
) | ||
|
||
lazy val core = (project in file("core")) | ||
.settings( | ||
name := "core" | ||
) |
13 changes: 13 additions & 0 deletions
13
modules/sbt-coursier/src/sbt-test/shared-1/caller/project/plugins.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
addSbtPlugin { | ||
|
||
val name = sys.props.getOrElse( | ||
"plugin.name", | ||
sys.error("plugin.name Java property not set") | ||
) | ||
val version = sys.props.getOrElse( | ||
"plugin.version", | ||
sys.error("plugin.version Java property not set") | ||
) | ||
|
||
"io.get-coursier" % name % version | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
> check |