-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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 variable expansion in ReactNative-application.cmake #35306
Fix variable expansion in ReactNative-application.cmake #35306
Conversation
Base commit: 0376aa4 |
Base commit: 0376aa4 |
PR build artifact for bf22691 is ready. |
PR build artifact for bf22691 is ready. |
@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Hi, while adjusting [react-native-screens](https://github.com/software-mansion/react-native-screens) to `0.71.0-rc.0` I encountered the same problems as reported [here](reactwg/react-native-releases#41 (reply in thread)) by WoLewicki. Basically inside `CMake`'s `foreach` loop iterator variable is not being expanded to the actual value: ```cmake foreach(autolinked_library ${AUTOLINKED_LIBRARIES}) target_link_libraries(autolinked_library common_flags) // <-- here we are literally linking to "autolinked_library". endforeach() ``` ## Changelog [Android] [Fixed] - Fix Android autolinking failing because of not expanded variable Pull Request resolved: #35306 Reviewed By: christophpurrer, cipolleschi Differential Revision: D41220408 Pulled By: rshest fbshipit-source-id: 12ce993f0c5227ca7d3c2cc272fe3739126930b3
## Description It seems that autolinking got complete overhaul in 0.71.0 as `android/app/src/main/jni` directory was deleted -> thus it works differently for sure now. Still need to dive into it. **FabricTestExample** * [x] Android * [x] iOS **TestsExample** * #1679 **FabricExample** * #1680 **TODO**: Consider whether to use `com.facebook.react:react-native:+` or `com.facebook.react:react-native` (without `+`) in `android/build.gradle` of the library. AFAIK the former takes highest available version from defined repositories (should be `node_modules`?), the latter uses version injected by React Native Gradle Plugin (but I believe it works since React Native 0.71.0 or 0.70.0 (need to check) -- so version check might be necessary). Decided to leave: ```gradle implementation 'com.facebook.react:react-native:+' ``` in library's `android/build.gradle` due to following reasons: * [Android's readme in RN repo](https://github.com/facebook/react-native/blob/e108e9ebf1e6c52b6eeffeb6c41f842ad95baa0d/android/README.md) * [Road to 0.71.0 post](reactwg/react-native-releases#41 (reply in thread)) Blocked by: * ~facebook/react-native#35306 * ~software-mansion/react-native-reanimated#3745 * ~software-mansion/react-native-gesture-handler#2313 (decided to fix version on commit) * ~`react-native-safe-area-context` - lacks support for RN71~ (created patch) * ~`@react-native-community/cli-platform-android` requires this patch: kkafar/RNS-tester@9edaaa9. The patch is already merged, but it is not shipped with `react-native` yet.~ **NOTE**: Example application will handled in separate PR, as there are problems with detox (it does not support 0.71 yet) and we run CI on that app. ## Changes * Updated examples * Updated library's build code ## Test code and steps to reproduce Run example applications ## Checklist - [ ] Ensured that CI passes
Summary: Hi, while adjusting [react-native-screens](https://github.com/software-mansion/react-native-screens) to `0.71.0-rc.0` I encountered the same problems as reported [here](reactwg/react-native-releases#41 (reply in thread)) by WoLewicki. Basically inside `CMake`'s `foreach` loop iterator variable is not being expanded to the actual value: ```cmake foreach(autolinked_library ${AUTOLINKED_LIBRARIES}) target_link_libraries(autolinked_library common_flags) // <-- here we are literally linking to "autolinked_library". endforeach() ``` ## Changelog [Android] [Fixed] - Fix Android autolinking failing because of not expanded variable Pull Request resolved: facebook#35306 Reviewed By: christophpurrer, cipolleschi Differential Revision: D41220408 Pulled By: rshest fbshipit-source-id: 12ce993f0c5227ca7d3c2cc272fe3739126930b3
## Description It seems that autolinking got complete overhaul in 0.71.0 as `android/app/src/main/jni` directory was deleted -> thus it works differently for sure now. Still need to dive into it. **FabricTestExample** * [x] Android * [x] iOS **TestsExample** * software-mansion/react-native-screens#1679 **FabricExample** * software-mansion/react-native-screens#1680 **TODO**: Consider whether to use `com.facebook.react:react-native:+` or `com.facebook.react:react-native` (without `+`) in `android/build.gradle` of the library. AFAIK the former takes highest available version from defined repositories (should be `node_modules`?), the latter uses version injected by React Native Gradle Plugin (but I believe it works since React Native 0.71.0 or 0.70.0 (need to check) -- so version check might be necessary). Decided to leave: ```gradle implementation 'com.facebook.react:react-native:+' ``` in library's `android/build.gradle` due to following reasons: * [Android's readme in RN repo](https://github.com/facebook/react-native/blob/e108e9ebf1e6c52b6eeffeb6c41f842ad95baa0d/android/README.md) * [Road to 0.71.0 post](reactwg/react-native-releases#41 (reply in thread)) Blocked by: * ~facebook/react-native#35306 * ~software-mansion/react-native-reanimated#3745 * ~software-mansion/react-native-gesture-handler#2313 (decided to fix version on commit) * ~`react-native-safe-area-context` - lacks support for RN71~ (created patch) * ~`@react-native-community/cli-platform-android` requires this patch: kkafar/RNS-tester@9edaaa9. The patch is already merged, but it is not shipped with `react-native` yet.~ **NOTE**: Example application will handled in separate PR, as there are problems with detox (it does not support 0.71 yet) and we run CI on that app. ## Changes * Updated examples * Updated library's build code ## Test code and steps to reproduce Run example applications ## Checklist - [ ] Ensured that CI passes
Summary
Hi, while adjusting react-native-screens to
0.71.0-rc.0
I encountered the same problems as reported here by @WoLewicki.Basically inside
CMake
'sforeach
loop iterator variable is not being expanded to the actual value:Changelog
[Android] [Fixed] - Fix Android autolinking failing because of not expanded variable
Test Plan