Skip to content

Commit

Permalink
Fix baseline-exact-dependencies with new GCV (#1487)
Browse files Browse the repository at this point in the history
Fix `com.palantir.baseline-exact-dependencies` to work with GCV 1.26.0+.
  • Loading branch information
dansanduleac authored Sep 2, 2020
1 parent db7ac4c commit cc5217a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-1487.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: Fix `com.palantir.baseline-exact-dependencies` to work with GCV 1.26.0+.
links:
- https://github.com/palantir/gradle-baseline/pull/1487
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,13 @@ private static void configureSourceSet(
});

explicitCompile.withDependencies(deps -> {
// Mirror the transitive constraints form compileClasspath in order to pick up GCV locks.
// We should really do this with an addAllLater but that would require Gradle 6, or a hacky workaround.
explicitCompile.getDependencyConstraints().addAll(compileClasspath.getAllDependencyConstraints());
// Pick up GCV locks. We're making an internal assumption that this configuration exists,
// but we can rely on this since we control GCV.
// Alternatively, we could tell GCV to lock this configuration, at the cost of a slightly more
// expensive 'unifiedClasspath' resolution during lock computation.
if (project.getRootProject().getPluginManager().hasPlugin("com.palantir.versions-lock")) {
explicitCompile.extendsFrom(project.getConfigurations().getByName("lockConstraints"));
}
// Inherit the excludes from compileClasspath too (that get aggregated from all its super-configurations).
compileClasspath.getExcludeRules().forEach(rule -> explicitCompile.exclude(excludeRuleAsMap(rule)));
});
Expand Down

0 comments on commit cc5217a

Please sign in to comment.