-
Notifications
You must be signed in to change notification settings - Fork 308
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
init.gradle: Ignore BOM dependencies when comparing dependency trees #6092
init.gradle: Ignore BOM dependencies when comparing dependency trees #6092
Conversation
@mpbecker and @pirvudoru, could help confirming whether this fixes your issues described here and here, respectively? |
@@ -251,7 +251,7 @@ class AbstractDependencyTreePlugin<T> implements Plugin<T> { | |||
/** | |||
* Return true if the provided DependencyResult represents an imported Maven BOM. | |||
*/ | |||
private boolean isBom(DependencyResult dependencyResult) { | |||
private static boolean isBom(DependencyResult dependencyResult) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Unrelated change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, expanding the diffs shows that it's not unrelated as isBom
is called from the static dependencyTreeEquals
now.
@@ -394,7 +394,8 @@ class AbstractDependencyTreePlugin<T> implements Plugin<T> { | |||
|
|||
def resultDependencies = dependencyResult instanceof ResolvedDependencyResult ? | |||
dependencyResult.selected.dependencies : [] as Set<DependencyResult> | |||
if (dependency.dependencies.size() != resultDependencies.size()) { | |||
// Ignore the BOM dependencies for calculating the count since they are skipped by `fetchDependency`. | |||
if (dependency.dependencies.size() != resultDependencies.findAll { !isBom(it) }.size()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Could we use count { !isBom(it) }
here?
When comparing dependency trees, the count of sub dependencies should not include BOM dependencies, since they are skipped by the `fetchDependency` function. This solves a bug where an Android project shipping 'androidx.appcompat:appcompat:1.5.1' would hang indefinitely. This is because, for instance, 'kotlinx-coroutines-android:1.6.1' depends on 'kotlinx-coroutines-core:1.6.1, kotlin-stdlib-jdk8:1.6.0 and kotlinx-coroutines-bom:1.6.1'. Since no ORT dependency is created for 'kotlinx-coroutines-bom' because it's a BOM file, it should also not be taken in account when comparing dependency trees. Otherwise, comparison would always fail, leading to a cache miss and overgrowth of the latter. Signed-off-by: Nicolas Nobelis <[email protected]>
ecef86a
to
4f570f9
Compare
When comparing dependency trees, the count of sub dependencies should not include BOM dependencies, since they are skipped by the
fetchDependency
function.This solves a bug where an Android project shipping 'androidx.appcompat:appcompat:1.5.1' would hang indefinitely. This is because, for instance, 'kotlinx-coroutines-android:1.6.1' depends on 'kotlinx-coroutines-core:1.6.1, kotlin-stdlib-jdk8:1.6.0 and kotlinx-coroutines-bom:1.6.1'. Since no ORT dependency is created for 'kotlinx-coroutines-bom' because it's a BOM file, it should also not be taken in account when comparing dependency trees. Otherwise, comparison would always fail, leading to a cache miss and overgrowth of the latter.
Signed-off-by: Nicolas Nobelis [email protected]