This repository has been archived by the owner on Apr 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix tree generation on projects with cached resolution
Before 7992dc9, a custom, non-cached-resolution-aware update task was used to generate the report that the tree is based on, effectively ignoring the cached resolution flag at the project level. Starting 7992dc9, this plugin, when run with sbt 0.13.8 or sbt 1.2.5+, relies on cached-resolution-backed reports for projects that have the engine enabled via `updateOptions`. Other 1.x releases are not directly impacted as sbt had a buggy implementation of the feature anyway, see sbt/sbt#3761. Cached resolution has the side effect of generating an ivy report with artificial module descriptors which makes it hard to reconstruct the tree without inlining sbt internals (see below), so this effectively ignores it *for the purpose of the tree generation*, even if the project enabled it for the regular report. ModuleId( org.scala-sbt.temp, temp-resolve-e2a956132f02c038285b41b374c02f5838076f37, 1.0 ) https://github.com/sbt/librarymanagement/blob/984de6f/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala#L137
- Loading branch information
1 parent
625f87a
commit 31d9355
Showing
5 changed files
with
43 additions
and
7 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
17 changes: 17 additions & 0 deletions
17
src/sbt-test/sbt-dependency-graph/cachedResolution/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,17 @@ | ||
scalaVersion := "2.12.9" | ||
|
||
libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.28" | ||
updateOptions := updateOptions.value.withCachedResolution(true) | ||
|
||
TaskKey[Unit]("check") := { | ||
val report = (ivyReport in Test).value | ||
val graph = (asciiTree in Test).value | ||
|
||
def sanitize(str: String): String = str.split('\n').drop(1).mkString("\n") | ||
val expectedGraph = | ||
"""default:cachedresolution_2.12:0.1.0-SNAPSHOT | ||
| +-org.slf4j:slf4j-api:1.7.28 | ||
| """.stripMargin | ||
require(sanitize(graph) == sanitize(expectedGraph), "Graph for report %s was '\n%s' but should have been '\n%s'" format (report, sanitize(graph), sanitize(expectedGraph))) | ||
() | ||
} |
1 change: 1 addition & 0 deletions
1
src/sbt-test/sbt-dependency-graph/cachedResolution/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 @@ | ||
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % sys.props("project.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 |