-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix platform constraint processing to avoid accidental exclude
Previously, a constraint in a platform that applied to a transitive dependency of the platform would prevent subsequent processing of that dependency. This resulted in the dependency being unintentionally excluded. This commit updates the configuring of exclusions to only track a dependency is seen when it's an actual dependency and not a constraint. Closes gh-368
- Loading branch information
1 parent
aa1f91d
commit 786f0f2
Showing
5 changed files
with
140 additions
and
1 deletion.
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
24 changes: 24 additions & 0 deletions
24
.../platformConstrainingATransitiveDependencyDoesNotAccidentallyExcludeThatDependency.gradle
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,24 @@ | ||
plugins { | ||
id "java" | ||
id "io.spring.dependency-management" | ||
} | ||
|
||
repositories { | ||
maven { | ||
url file("maven-repo") | ||
} | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation(platform("test:platform-with-constrained-transitive-dependency:1.0")) | ||
} | ||
|
||
tasks.register("resolve") { | ||
doFirst { | ||
def files = project.configurations.compileClasspath.resolve() | ||
def output = new File("${buildDir}/resolved.txt") | ||
output.parentFile.mkdirs() | ||
files.collect { it.name }.each { output << "${it}\n" } | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
...ined-transitive-dependency/1.0/platform-with-constrained-transitive-dependency-1.0.module
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,76 @@ | ||
{ | ||
"formatVersion": "1.1", | ||
"component": { | ||
"group": "test", | ||
"module": "platform-with-constrained-transitive-dependency", | ||
"version": "1.0", | ||
"attributes": { | ||
"org.gradle.status": "release" | ||
} | ||
}, | ||
"createdBy": { | ||
"gradle": { | ||
"version": "8.4" | ||
} | ||
}, | ||
"variants": [ | ||
{ | ||
"name": "apiElements", | ||
"attributes": { | ||
"org.gradle.category": "platform", | ||
"org.gradle.usage": "java-api" | ||
}, | ||
"dependencies": [ | ||
{ | ||
"group": "com.squareup.okhttp3", | ||
"module": "okhttp", | ||
"version": { | ||
"requires": "4.11.0" | ||
} | ||
} | ||
], | ||
"dependencyConstraints": [ | ||
{ | ||
"group": "com.squareup.okio", | ||
"module": "okio", | ||
"version": { | ||
"requires": "3.6.0", | ||
"prefers": "latest.release", | ||
"rejects": [ | ||
"3.2.0" | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "runtimeElements", | ||
"attributes": { | ||
"org.gradle.category": "platform", | ||
"org.gradle.usage": "java-runtime" | ||
}, | ||
"dependencies": [ | ||
{ | ||
"group": "com.squareup.okhttp3", | ||
"module": "okhttp", | ||
"version": { | ||
"requires": "4.11.0" | ||
} | ||
} | ||
], | ||
"dependencyConstraints": [ | ||
{ | ||
"group": "com.squareup.okio", | ||
"module": "okio", | ||
"version": { | ||
"requires": "3.6.0", | ||
"prefers": "latest.release", | ||
"rejects": [ | ||
"3.2.0" | ||
] | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
31 changes: 31 additions & 0 deletions
31
...trained-transitive-dependency/1.0/platform-with-constrained-transitive-dependency-1.0.pom
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,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<!-- This module was also published with a richer model, Gradle metadata, --> | ||
<!-- which should be used instead. Do not delete the following line which --> | ||
<!-- is to indicate to Gradle or any Gradle module metadata file consumer --> | ||
<!-- that they should prefer consuming it instead. --> | ||
<!-- do_not_remove: published-with-gradle-metadata --> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>test</groupId> | ||
<artifactId>platform-with-constrained-transitive-dependency</artifactId> | ||
<version>1.0</version> | ||
<packaging>pom</packaging> | ||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.squareup.okio</groupId> | ||
<artifactId>okio</artifactId> | ||
<version>3.6.0</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.squareup.okhttp3</groupId> | ||
<artifactId>okhttp</artifactId> | ||
<version>4.11.0</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |