Fix regression in Android unlink command #21043
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
Commit 4dfdec9 introduced a regression in the
unlinkcommand for Android projects: native modules previously linked with the now-deprecatedcompileconfiguration will not be detected anymore and by extension will not be unlinked.unlinkshould be aware of both new and deprecated options to ensure functionality also in existing projects that previously linked modules with the old convention.This PR fixes the regression by:
makeDeprecatedNativeModuleis added so to have the deprecated patch line that could be present in the Gradle build file.isInstalledto check, for a given package name, for bothcompile(using the function introduced in step 1) andimplementationdependency records inbuild.gradle.unregisterNativeModulewill proceed to revoke both possible patch lines frombuild.gradle.This PR together with commit 4dfdec9 provide the following behaviour:
linkwill continue to work as intended usingimplementation. This works without issues even with older packages that still usecompileinternally for their own dependencies.linkwill detect previously linked packages withcompileand will not proceed with a new linkage. Instead, it will log thatPlatform 'android' module X is already linked.unlinkwill detect dependencies with bothcompileandimplementationand proceed to unlink as expected.Test Plan:
compileand the described behaviour listed above was matched.Related PRs:
Release Notes:
[CLI] [BUGFIX] [local-cli/link] - Fixed regression in Android
unlink.