Fix: race condition in android copy vs bundle phases #29128
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.
Summary
We ran into an issue where our
index.android.bundle
was not included in our generated.aab
file (strangely, it was only happening on CI builds). I enabled--info
level logging on the gradle command on our CI and noticed that> Task :app:copyPlaystoreReleaseBundledJs NO-SOURCE
was there with the info that the source file didn't exist. This led me to believe that thecopyXXXBundledJs
task andbundleXXXJsAndAssets
tasks were not executing in the proper order.Strangely, this issue only started to occur for us after updating a dependency on Android, but I suspect it's always been a race condition and we've just gotten lucky.
This change ensures that the
bundleJsAndAssets
task runs before thecopyBundledJs
task.I've tested locally with our code and also on our CI and both are finally working 💪
Changelog
[Android] [Fixed] - Ensure gradle task order (
bundleJsAndAssets
occurs beforecopyBundledJs
)Test Plan
./gradlew clean && ./gradlew cleanBuildCache && ./gradle bundleFlavourRelease
The generated bundle now includes
index.android.bundle
(of course this is difficult to test, because the issue only happens on some machines/setups/when the stars align, apparently).