-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Update ReactAndroid to use the AGP NDK Apis #32443
Conversation
This pull request was exported from Phabricator. Differential Revision: D31683721 |
|
Base commit: 3dff1fa |
This pull request was exported from Phabricator. Differential Revision: D31683721 |
Summary: Pull Request resolved: facebook#32443 This diff removes all the custom Gradle machinery to build the native code and delegates to AGP the triggering of the `ndk-build` command. This means that the native build will be now invoked with the `:ReactAndroid:externalNativeBuild<Variant>` task. An important thing to notice is that that task will always run, and will delegate to Make the compilation avoidance. If you invoke the task twice, the second time it will be significantly faster. On my machine this takes ~6/7 mins the first time, and 30 seconds the second time. There are some gotchas that are worth noting: * The native build will run on every build now. Given the complexity of our native build graph, even with an up-to-date build, Make will still take ~30 seconds on my machine to analyse all the targets and mention that there is no work to be done. I believe this could be impactful for local development experience. The mitigation I found was to apply an `abiFilter` to build only the ABI of the target device (e.g. arm64 for a real device and so on). This reduces the native build to ~10 seconds. * All the change to the `react-native-gradle-plugin` source will cause the Gradle tasks to be considered invalid. Therefore they will re-extract the header files inside the folders that are used by Make to compile, triggering a near-full rebuild. This can be a bit painful when building locally, if you plan to edit react-native-gradle-plugin and relaunch rn-tester (seems to be like an edge case scenario but worth pointing out). The mitigation here would be to invoke the tasks like ``` gw :packages:rn-tester:android:app:installHermesDebug -x prepareBoost -x prepareLibevent -x prepareGlog \ -x prepareJSC -x extractNativeDependencies -x generateCodegenArtifactsFromSchema \ -x generateCodegenSchemaFromJavaScript ``` Changelog: [Internal] [Changed] - Refactor Extract Headers and JNI from AARs to an internal task Reviewed By: ShikaSD Differential Revision: D31683721 fbshipit-source-id: 83f963dda66f8c4356e05b6f19a98aa54a7ba995
dce0d74
to
4288392
Compare
PR build artifact for 4288392 is ready. |
This pull request was exported from Phabricator. Differential Revision: D31683721 |
Summary: Pull Request resolved: facebook#32443 This diff removes all the custom Gradle machinery to build the native code and delegates to AGP the triggering of the `ndk-build` command. This means that the native build will be now invoked with the `:ReactAndroid:externalNativeBuild<Variant>` task. An important thing to notice is that that task will always run, and will delegate to Make the compilation avoidance. If you invoke the task twice, the second time it will be significantly faster. On my machine this takes ~6/7 mins the first time, and 30 seconds the second time. There are some gotchas that are worth noting: * The native build will run on every build now. Given the complexity of our native build graph, even with an up-to-date build, Make will still take ~30 seconds on my machine to analyse all the targets and mention that there is no work to be done. I believe this could be impactful for local development experience. The mitigation I found was to apply an `abiFilter` to build only the ABI of the target device (e.g. arm64 for a real device and so on). This reduces the native build to ~10 seconds. * All the change to the `react-native-gradle-plugin` source will cause the Gradle tasks to be considered invalid. Therefore they will re-extract the header files inside the folders that are used by Make to compile, triggering a near-full rebuild. This can be a bit painful when building locally, if you plan to edit react-native-gradle-plugin and relaunch rn-tester (seems to be like an edge case scenario but worth pointing out). The mitigation here would be to invoke the tasks like ``` gw :packages:rn-tester:android:app:installHermesDebug -x prepareBoost -x prepareLibevent -x prepareGlog \ -x prepareJSC -x extractNativeDependencies -x generateCodegenArtifactsFromSchema \ -x generateCodegenSchemaFromJavaScript ``` Changelog: [Internal] [Changed] - Refactor Extract Headers and JNI from AARs to an internal task Reviewed By: ShikaSD Differential Revision: D31683721 fbshipit-source-id: ee8d31a14b779aed43a1ccb4b9b9a119af309574
4288392
to
1675356
Compare
PR build artifact for 1675356 is ready. |
This pull request was exported from Phabricator. Differential Revision: D31683721 |
Summary: While working updating the codeden Makefile template for Android, I've removed the `libreact_debug` and `libreact_render_debug` dependencies as they were unused in a simple turbomodule. Turns out that `:ReactAndroid` is depending on having those dependencies. Moving the build file to use AGP APIs, triggers this scenario and is making `ReactAndroid` failing to build (see the build status for facebook#32443). I'm updating the codegen Makefile template to reintrodce the two libraries + I've update the prebuilt makefile (used in the playbook) to include `react_debug` prebuilts as they were missing. Changelog: [Internal] [Changed] - Re-add libreact_debug to codegen makefile and add prebuilts for them Differential Revision: D31900675 fbshipit-source-id: 6ace1c2bd27c93773f587fa604f8a27e8c26b1f8
Summary: Pull Request resolved: facebook#32443 This diff removes all the custom Gradle machinery to build the native code and delegates to AGP the triggering of the `ndk-build` command. This means that the native build will be now invoked with the `:ReactAndroid:externalNativeBuild<Variant>` task. An important thing to notice is that that task will always run, and will delegate to Make the compilation avoidance. If you invoke the task twice, the second time it will be significantly faster. On my machine this takes ~6/7 mins the first time, and 30 seconds the second time. There are some gotchas that are worth noting: * The native build will run on every build now. Given the complexity of our native build graph, even with an up-to-date build, Make will still take ~30 seconds on my machine to analyse all the targets and mention that there is no work to be done. I believe this could be impactful for local development experience. The mitigation I found was to apply an `abiFilter` to build only the ABI of the target device (e.g. arm64 for a real device and so on). This reduces the native build to ~10 seconds. * All the change to the `react-native-gradle-plugin` source will cause the Gradle tasks to be considered invalid. Therefore they will re-extract the header files inside the folders that are used by Make to compile, triggering a near-full rebuild. This can be a bit painful when building locally, if you plan to edit react-native-gradle-plugin and relaunch rn-tester (seems to be like an edge case scenario but worth pointing out). The mitigation here would be to invoke the tasks like ``` gw :packages:rn-tester:android:app:installHermesDebug -x prepareBoost -x prepareLibevent -x prepareGlog \ -x prepareJSC -x extractNativeDependencies -x generateCodegenArtifactsFromSchema \ -x generateCodegenSchemaFromJavaScript ``` Changelog: [Internal] [Changed] - Refactor Extract Headers and JNI from AARs to an internal task Reviewed By: ShikaSD Differential Revision: D31683721 fbshipit-source-id: 0736891c8197b424d3db30ea593d6bc61fd69ffd
1675356
to
af60c49
Compare
PR build artifact for af60c49 is ready. |
This pull request was exported from Phabricator. Differential Revision: D31683721 |
Summary: While working updating the codeden Makefile template for Android, I've removed the `libreact_debug` and `libreact_render_debug` dependencies as they were unused in a simple turbomodule. Turns out that `:ReactAndroid` is depending on having those dependencies. Moving the build file to use AGP APIs, triggers this scenario and is making `ReactAndroid` failing to build (see the build status for facebook#32443). I'm updating the codegen Makefile template to reintrodce the two libraries + I've update the prebuilt makefile (used in the playbook) to include `react_debug` prebuilts as they were missing. Changelog: [Internal] [Changed] - Re-add libreact_debug to codegen makefile and add prebuilts for them Differential Revision: D31900675 fbshipit-source-id: cfdfe1293d45cdc2539c933fb2410cc64a444c4d
Summary: Pull Request resolved: facebook#32443 This diff removes all the custom Gradle machinery to build the native code and delegates to AGP the triggering of the `ndk-build` command. This means that the native build will be now invoked with the `:ReactAndroid:externalNativeBuild<Variant>` task. An important thing to notice is that that task will always run, and will delegate to Make the compilation avoidance. If you invoke the task twice, the second time it will be significantly faster. On my machine this takes ~6/7 mins the first time, and 30 seconds the second time. There are some gotchas that are worth noting: * The native build will run on every build now. Given the complexity of our native build graph, even with an up-to-date build, Make will still take ~30 seconds on my machine to analyse all the targets and mention that there is no work to be done. I believe this could be impactful for local development experience. The mitigation I found was to apply an `abiFilter` to build only the ABI of the target device (e.g. arm64 for a real device and so on). This reduces the native build to ~10 seconds. * All the change to the `react-native-gradle-plugin` source will cause the Gradle tasks to be considered invalid. Therefore they will re-extract the header files inside the folders that are used by Make to compile, triggering a near-full rebuild. This can be a bit painful when building locally, if you plan to edit react-native-gradle-plugin and relaunch rn-tester (seems to be like an edge case scenario but worth pointing out). The mitigation here would be to invoke the tasks like ``` gw :packages:rn-tester:android:app:installHermesDebug -x prepareBoost -x prepareLibevent -x prepareGlog \ -x prepareJSC -x extractNativeDependencies -x generateCodegenArtifactsFromSchema \ -x generateCodegenSchemaFromJavaScript ``` Changelog: [Internal] [Changed] - Refactor Extract Headers and JNI from AARs to an internal task Reviewed By: ShikaSD Differential Revision: D31683721 fbshipit-source-id: 56b42d8127bce178697aefdb9da1ec467a622057
af60c49
to
b96a530
Compare
PR build artifact for b96a530 is ready. |
This pull request was exported from Phabricator. Differential Revision: D31683721 |
Summary: While working updating the codeden Makefile template for Android, I've removed the `libreact_debug` and `libreact_render_debug` dependencies as they were unused in a simple turbomodule. Turns out that `:ReactAndroid` is depending on having those dependencies. Moving the build file to use AGP APIs, triggers this scenario and is making `ReactAndroid` failing to build (see the build status for facebook#32443). I'm updating the codegen Makefile template to reintrodce the two libraries + I've update the prebuilt makefile (used in the playbook) to include `react_debug` prebuilts as they were missing. Changelog: [Internal] [Changed] - Re-add libreact_debug to codegen makefile and add prebuilts for them Differential Revision: D31900675 fbshipit-source-id: a52b1609bf85aa3ac9800669708fa07d091ac195
Summary: Pull Request resolved: facebook#32443 This diff removes all the custom Gradle machinery to build the native code and delegates to AGP the triggering of the `ndk-build` command. This means that the native build will be now invoked with the `:ReactAndroid:externalNativeBuild<Variant>` task. An important thing to notice is that that task will always run, and will delegate to Make the compilation avoidance. If you invoke the task twice, the second time it will be significantly faster. On my machine this takes ~6/7 mins the first time, and 30 seconds the second time. There are some gotchas that are worth noting: * The native build will run on every build now. Given the complexity of our native build graph, even with an up-to-date build, Make will still take ~30 seconds on my machine to analyse all the targets and mention that there is no work to be done. I believe this could be impactful for local development experience. The mitigation I found was to apply an `abiFilter` to build only the ABI of the target device (e.g. arm64 for a real device and so on). This reduces the native build to ~10 seconds. * All the change to the `react-native-gradle-plugin` source will cause the Gradle tasks to be considered invalid. Therefore they will re-extract the header files inside the folders that are used by Make to compile, triggering a near-full rebuild. This can be a bit painful when building locally, if you plan to edit react-native-gradle-plugin and relaunch rn-tester (seems to be like an edge case scenario but worth pointing out). The mitigation here would be to invoke the tasks like ``` gw :packages:rn-tester:android:app:installHermesDebug -x prepareBoost -x prepareLibevent -x prepareGlog \ -x prepareJSC -x extractNativeDependencies -x generateCodegenArtifactsFromSchema \ -x generateCodegenSchemaFromJavaScript ``` Changelog: [Internal] [Changed] - Refactor Extract Headers and JNI from AARs to an internal task Reviewed By: ShikaSD Differential Revision: D31683721 fbshipit-source-id: adefc9b28ce6454c6cadaef9369d4965854a46de
b96a530
to
315313f
Compare
PR build artifact for 315313f is ready. |
Base commit: 3dff1fa |
Summary: While working updating the codeden Makefile template for Android, I've removed the `libreact_debug` and `libreact_render_debug` dependencies as they were unused in a simple turbomodule. Turns out that `:ReactAndroid` is depending on having those dependencies. Moving the build file to use AGP APIs, triggers this scenario and is making `ReactAndroid` failing to build (see the build status for #32443). I'm updating the codegen Makefile template to reintrodce the two libraries + I've update the prebuilt makefile (used in the playbook) to include `react_debug` prebuilts as they were missing. Changelog: [Internal] [Changed] - Re-add libreact_debug to codegen makefile and add prebuilts for them Reviewed By: ShikaSD Differential Revision: D31900675 fbshipit-source-id: ff188c0498a0dca4a951a548a580ca8dd0674782
This pull request was exported from Phabricator. Differential Revision: D31683721 |
Summary: Pull Request resolved: facebook#32443 This diff removes all the custom Gradle machinery to build the native code and delegates to AGP the triggering of the `ndk-build` command. This means that the native build will be now invoked with the `:ReactAndroid:externalNativeBuild<Variant>` task. An important thing to notice is that that task will always run, and will delegate to Make the compilation avoidance. If you invoke the task twice, the second time it will be significantly faster. On my machine this takes ~6/7 mins the first time, and 30 seconds the second time. There are some gotchas that are worth noting: * The native build will run on every build now. Given the complexity of our native build graph, even with an up-to-date build, Make will still take ~30 seconds on my machine to analyse all the targets and mention that there is no work to be done. I believe this could be impactful for local development experience. The mitigation I found was to apply an `abiFilter` to build only the ABI of the target device (e.g. arm64 for a real device and so on). This reduces the native build to ~10 seconds. * All the change to the `react-native-gradle-plugin` source will cause the Gradle tasks to be considered invalid. Therefore they will re-extract the header files inside the folders that are used by Make to compile, triggering a near-full rebuild. This can be a bit painful when building locally, if you plan to edit react-native-gradle-plugin and relaunch rn-tester (seems to be like an edge case scenario but worth pointing out). The mitigation here would be to invoke the tasks like ``` gw :packages:rn-tester:android:app:installHermesDebug -x prepareBoost -x prepareLibevent -x prepareGlog \ -x prepareJSC -x extractNativeDependencies -x generateCodegenArtifactsFromSchema \ -x generateCodegenSchemaFromJavaScript ``` Changelog: [Internal] [Changed] - Refactor Extract Headers and JNI from AARs to an internal task Reviewed By: ShikaSD Differential Revision: D31683721 fbshipit-source-id: ff2415b4b1d835b2486458b75b5f5dff2340870a
315313f
to
b409ebe
Compare
Summary: Pull Request resolved: facebook#32443 This diff removes all the custom Gradle machinery to build the native code and delegates to AGP the triggering of the `ndk-build` command. This means that the native build will be now invoked with the `:ReactAndroid:externalNativeBuild<Variant>` task. An important thing to notice is that that task will always run, and will delegate to Make the compilation avoidance. If you invoke the task twice, the second time it will be significantly faster. On my machine this takes ~6/7 mins the first time, and 30 seconds the second time. There are some gotchas that are worth noting: * The native build will run on every build now. Given the complexity of our native build graph, even with an up-to-date build, Make will still take ~30 seconds on my machine to analyse all the targets and mention that there is no work to be done. I believe this could be impactful for local development experience. The mitigation I found was to apply an `abiFilter` to build only the ABI of the target device (e.g. arm64 for a real device and so on). This reduces the native build to ~10 seconds. * All the change to the `react-native-gradle-plugin` source will cause the Gradle tasks to be considered invalid. Therefore they will re-extract the header files inside the folders that are used by Make to compile, triggering a near-full rebuild. This can be a bit painful when building locally, if you plan to edit react-native-gradle-plugin and relaunch rn-tester (seems to be like an edge case scenario but worth pointing out). The mitigation here would be to invoke the tasks like ``` gw :packages:rn-tester:android:app:installHermesDebug -x prepareBoost -x prepareLibevent -x prepareGlog \ -x prepareJSC -x extractNativeDependencies -x generateCodegenArtifactsFromSchema \ -x generateCodegenSchemaFromJavaScript ``` Changelog: [Internal] [Changed] - Refactor Extract Headers and JNI from AARs to an internal task Reviewed By: ShikaSD Differential Revision: D31683721 fbshipit-source-id: 2364fb678a04428f9c9280ddbd4ff6f15ecfbc84
This pull request was exported from Phabricator. Differential Revision: D31683721 |
b409ebe
to
5c57396
Compare
PR build artifact for 5c57396 is ready. |
This pull request has been merged in b0711f1. |
Summary:
This diff removes all the custom Gradle machinery to build the native code and delegates to AGP
the triggering of the
ndk-build
command. This means that the native build will be now invokedwith the
:ReactAndroid:externalNativeBuild<Variant>
task.An important thing to notice is that that task will always run, and will delegate to Make the
compilation avoidance. If you invoke the task twice, the second time it will be significantly faster.
On my machine this takes ~6/7 mins the first time, and 30 seconds the second time.
There are some gotchas that are worth noting:
even with an up-to-date build, Make will still take ~30 seconds on my machine to analyse all the
targets and mention that there is no work to be done. I believe this could be impactful for local
development experience. The mitigation I found was to apply an
abiFilter
to build only the ABIof the target device (e.g. arm64 for a real device and so on).
This reduces the native build to ~10 seconds.
react-native-gradle-plugin
source will cause the Gradle tasks to beconsidered invalid. Therefore they will re-extract the header files inside the folders that are
used by Make to compile, triggering a near-full rebuild. This can be a bit painful when building
locally, if you plan to edit react-native-gradle-plugin and relaunch
rn-tester (seems to be like an edge case scenario but worth pointing out). The mitigation here
would be to invoke the tasks like
Changelog:
[Internal] [Changed] - Refactor Extract Headers and JNI from AARs to an internal task
Reviewed By: ShikaSD
Differential Revision: D31683721