Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix baseline-exact-dependencies with new GCV #1487

Merged
merged 3 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels quite weird to have this direct knowledge of GCV here? Will this still work with old GCV?

}
// Inherit the excludes from compileClasspath too (that get aggregated from all its super-configurations).
compileClasspath.getExcludeRules().forEach(rule -> explicitCompile.exclude(excludeRuleAsMap(rule)));
});
Expand Down