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

fix: android artifacts in a release package #30470

Closed

Conversation

grabbou
Copy link
Contributor

@grabbou grabbou commented Nov 25, 2020

Summary

Android artefacts in a release package are missing, as a result, users are not able to run 0.64.0-rc.0 on Android. Locally, everything works.

After several hours of testing, we found out that running ./gradlew ReactAndroid:installArchives will "sometimes" fix it and I have managed to verify both locally and on the CI, that running Gradle without cache is broken, but when running Gradle once again (right after corrupted build completed, but there is cache already) fixes the issue.

Seems to be Gradle related.

In this PR, I am adding a validation to publish-npm.js script to make sure this kind of errors never happen again in the future. We also attempt to rebuild Android once, hoping that it will pass the validation.

Here's the truncated output of the script:

BUILD SUCCESSFUL in 8m 9s
41 actionable tasks: 41 executed
Artifacts are corrupted. Rebuilding with Gradle once again to fix it

BUILD SUCCESSFUL in 6s
43 actionable tasks: 12 executed, 31 up-to-date
Artifacts validated, continuing.

Test Plan

Run the newly added code via node and you should see the script re-running installArchives and creating correct artifact. You can use this gist contents to just paste into publish-npm.js.

Remember to update the version in package.json to 0.64.0-rc.0 and run:

rm -rf android
rm -rf .gradle
rm -rf ReactAndroid/build

before doing anything, to make sure you start fresh.

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Callstack Partner: Callstack Partner labels Nov 25, 2020
Copy link
Contributor

@alloy alloy left a comment

Choose a reason for hiding this comment

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

Great sleuthing, @grabbou 🕵️

scripts/publish-npm.js Outdated Show resolved Hide resolved
scripts/publish-npm.js Outdated Show resolved Hide resolved
scripts/publish-npm.js Outdated Show resolved Hide resolved
grabbou and others added 3 commits November 25, 2020 11:31
Co-authored-by: Eloy Durán <eloy.de.enige@gmail.com>
Co-authored-by: Eloy Durán <eloy.de.enige@gmail.com>
@grabbou
Copy link
Contributor Author

grabbou commented Nov 25, 2020

Shipped 0.64.0-rc.1 with that script included, and everything works. Here's the output! https://app.circleci.com/pipelines/github/facebook/react-native/7266/workflows/58b22daf-d6db-41e2-a4bd-51ffad4e650c/jobs/178795

android/com/facebook/react/react-native/0.64.0-rc.1/react-native-0.64.0-rc.1.aar is missing contents. Rebuilding with Gradle again in an effort to try to fix it.

Ready to be merged.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@cortinico
Copy link
Contributor

Thanks for sending the PR. I'm closing this as the logic is completely rewritten now.

@cortinico cortinico closed this Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Callstack Partner: Callstack Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants