-
Notifications
You must be signed in to change notification settings - Fork 932
fix: filter depreciation warning in run/build-android commands
#1977
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: filter depreciation warning in run/build-android commands
#1977
Conversation
run/build-android commandsrun/build-android commands
|
|
||
| export const filterGradlewOutput = (output: string) => { | ||
| const regex = new RegExp( | ||
| /package="([^"]+)" found in source AndroidManifest\.xml:(.*?)Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated\.(.*?)Please instead set the namespace \(or testNamespace\) in the module's build\.gradle file, as described here: https:\/\/developer\.android\.com\/studio\/build\/configure-app-module#set-namespace(.*?\n)*This migration can be done automatically using the AGP Upgrade Assistant, please refer to https:\/\/developer\.android\.com\/studio\/build\/agp-upgrade-assistant for more information\./gms, |
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.
This is a single line, we can match only a part of it. The wording may change between versions—not sure if it happened ever though
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.
Hm, I'm not sure what do you mean, because if we only check the first sentence "package="com.swmansion.gesturehandler.react" found in source AndroidManifest.xml:", how would we replace other part of this warning?
cortinico
left a comment
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.
I have to admit that I'm not a great fan of this approach, but I understand if we end up using it as we have not many other options.
A couple of things to consider first:
-
The Manifest Merger source code actually has a flag to turn this logging off. I'm unsure if we can toggle it easily via AGP though:
https://github.com/jrodbx/agp-sources/blob/0839a8e5ead11df9e8489a5aa4edda7e9d9cf984/7.3.1/com.android.tools.build/manifest-merger/com/android/manifmerger/ManifestMerger2.java#L198-L214 -
It should be possible inside RNGP to use Artifact's API to manipulate the Manifest. That should allow us to remove those extra
package=directives so that by the time the Manifest hits the Manifest Merger, they're removed.
|
Yeah, we treat this as a band-aid. Will you explore these solutions—which sound way better—on your own, or you need some kind of help? |
Happy to receive a PR or collaborate on those. Option n.2 sounds the most feasible for me. |
|
@cortinico I can help with this topic and fixing this 👍 |
|
Moving to draft as we explore alternatives. |
|
@cortinico would you like to somehow move this forward? |
For the sake of 0.73, I'll explore a different alternative so we probably won't need this right now |
|
Let's close it then. |
Summary:
Recently there was created discussion about removing
packageproperty from library'sAndroidManifest.xml, and usenamespaceinbuild.gradle. But it turned out that it breaks compatibility and if you wish to retain the highest compatibility it's better to don't remove thepackageproperty fromAndroidManifest.xml, and keep both these fields. And that's totally fine, but if we havepackageproperty and we're on RN version > 71 we'll see the warning about deprecation (that you should specify namespace viabuild.gradle).In this PR I added filtering deprecation warning from gradlew commands output.
TODO:
Test Plan:
AndroidManifest.xmlpackageproperty, e.g.yarn add react-native-pager-viewYou shouldn't see warning regarding that setting
packageproperty inAndroidManifest.xmlis deprecated.