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

Make sourcemaps script compatible with flavors #530

Conversation

louiszawadzki
Copy link
Contributor

What does this PR do?

Make sourcemaps script compatible with builds using flavors for RN >=0.71 (cf #528).

Since RN 0.71, the path are no longer defined in the react.gradle file but in the react-native-gradle-plugin. In the plugin, the targetPath is variant.name and no longer variant.dirName.

Additional Notes

There is a other possibility for when RN >= 0.71 to get the sourcemaps and bundle path as attributes of the bundle task.
Even if this could potentially be more stable in the long run, I feel it could make the script more complex and in the end harder to maintain.
The proposed fix is a bit simpler and has less potential to break on other versions of RN.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@louiszawadzki louiszawadzki requested a review from a team as a code owner September 19, 2023 12:09
def bundleAssetName = project.extensions.react.bundleAssetName.get() ?: "index.android.bundle"
def targetName = variant.name.capitalize()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

targetName is the same for all cases, but I prefer to have it defined in here to have a more consistent scope in each if condition.
But I'm not against moving it to the top of the getReactConfig function if that makes more sense.

@louiszawadzki louiszawadzki merged commit 6655f6d into develop Sep 19, 2023
3 checks passed
@louiszawadzki louiszawadzki deleted the louiszawadzki/support-flavors-in-gradle-sourcemaps-upload branch September 19, 2023 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants