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

[config][dev-launcher] Fix compatibility with SDK 44 #15562

Merged
merged 2 commits into from
Dec 15, 2021

Conversation

lukmccall
Copy link
Contributor

@lukmccall lukmccall commented Dec 14, 2021

Why

A follow-up to #15541 (review).

How

The regex which wraps activity delegates caused an infinity loop. I replaced that with a different approach - I'm not longed using regex.
Also, the init block on iOS is different.

Test Plan

  • run expo prebuild in a project with SDK 44 beta.

Note: needs #15541 to work

@expo-bot expo-bot added the bot: passed checks ExpoBot has nothing to complain about label Dec 14, 2021
Copy link
Contributor

@esamelson esamelson left a comment

Choose a reason for hiding this comment

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

🎉

@esamelson esamelson force-pushed the @lukmccall/dev-launcher/fix-config-plugin branch from 05bdedb to e7a90b3 Compare December 15, 2021 01:18
@esamelson esamelson merged commit 8e1a8cc into master Dec 15, 2021
@esamelson esamelson deleted the @lukmccall/dev-launcher/fix-config-plugin branch December 15, 2021 01:18
lukmccall pushed a commit that referenced this pull request Dec 15, 2021
Co-authored-by: Łukasz Kosmaty <lukasz.kosmaty@swmansion.com># Why

when testing #15562 on the sdk-44 branch I found there were still a few issues -- (1) some expo-modules stuff would be inadvertently removed from AppDelegate, even though the project would build, and (2) tests were failing.

# How

(commit 1) added the correct logic for SDK 44's `initializeReactNativeApp` function (these regexes are getting so messy, we can't move to expo module initialization soon enough 😅 ), and added tests with a corresponding SDK 44 AppDelegate.m.
(commit 2) fixed wrong string constant that was causing failures for SDK 43 and below
(commit 3) fixed tests on the Android side that were logging warnings. @lukmccall is it correct to say that this config plugin cannot handle projects where `createReactActivityDelegate` isn't already overridden in MainActivity? I modified the tests as such, but if that isn't the case, [this warning](https://github.com/expo/expo/blob/4ca5ff72ef3abcc30cb7936eaf9c4b97fed9a5ad/packages/expo-dev-launcher/plugin/src/withDevLauncher.ts#L205-L209) needs to be changed.

# Test Plan

All tests pass. Manually tested in a blank SDK 44 app; cherry picked these commits onto sdk-44 and then used patch-package to patch entire the expo-dev-launcher package to match sdk-44 HEAD. Ran expo prebuild, saw no errors, eyeballed the code changes, and tested the following scenarios:

✅ project builds on iOS and Android
✅ iOS: can open app served by `expo start --dev-client`
✅ iOS: can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ Android: can open app served by `expo start --dev-client`
✅ Android: can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ expo install expo-updates@0.11.2, expo prebuild --clean, project builds
✅ iOS (with expo-updates integration): can open app served by `expo start --dev-client`
✅ iOS (with expo-updates integration): can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ iOS (with expo-updates integration): can open published app
✅ Android (with expo-updates integration): can open app served by `expo start --dev-client`
✅ Android (with expo-updates integration): can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ Android (with expo-updates integration): can open published app
lukmccall pushed a commit that referenced this pull request Dec 15, 2021
Co-authored-by: Łukasz Kosmaty <lukasz.kosmaty@swmansion.com># Why

when testing #15562 on the sdk-44 branch I found there were still a few issues -- (1) some expo-modules stuff would be inadvertently removed from AppDelegate, even though the project would build, and (2) tests were failing.

# How

(commit 1) added the correct logic for SDK 44's `initializeReactNativeApp` function (these regexes are getting so messy, we can't move to expo module initialization soon enough 😅 ), and added tests with a corresponding SDK 44 AppDelegate.m.
(commit 2) fixed wrong string constant that was causing failures for SDK 43 and below
(commit 3) fixed tests on the Android side that were logging warnings. @lukmccall is it correct to say that this config plugin cannot handle projects where `createReactActivityDelegate` isn't already overridden in MainActivity? I modified the tests as such, but if that isn't the case, [this warning](https://github.com/expo/expo/blob/4ca5ff72ef3abcc30cb7936eaf9c4b97fed9a5ad/packages/expo-dev-launcher/plugin/src/withDevLauncher.ts#L205-L209) needs to be changed.

# Test Plan

All tests pass. Manually tested in a blank SDK 44 app; cherry picked these commits onto sdk-44 and then used patch-package to patch entire the expo-dev-launcher package to match sdk-44 HEAD. Ran expo prebuild, saw no errors, eyeballed the code changes, and tested the following scenarios:

✅ project builds on iOS and Android
✅ iOS: can open app served by `expo start --dev-client`
✅ iOS: can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ Android: can open app served by `expo start --dev-client`
✅ Android: can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ expo install expo-updates@0.11.2, expo prebuild --clean, project builds
✅ iOS (with expo-updates integration): can open app served by `expo start --dev-client`
✅ iOS (with expo-updates integration): can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ iOS (with expo-updates integration): can open published app
✅ Android (with expo-updates integration): can open app served by `expo start --dev-client`
✅ Android (with expo-updates integration): can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ Android (with expo-updates integration): can open published app
DominickVale pushed a commit to DominickVale/expo that referenced this pull request Dec 15, 2021
DominickVale pushed a commit to DominickVale/expo that referenced this pull request Dec 15, 2021
Co-authored-by: Łukasz Kosmaty <lukasz.kosmaty@swmansion.com># Why

when testing expo#15562 on the sdk-44 branch I found there were still a few issues -- (1) some expo-modules stuff would be inadvertently removed from AppDelegate, even though the project would build, and (2) tests were failing.

# How

(commit 1) added the correct logic for SDK 44's `initializeReactNativeApp` function (these regexes are getting so messy, we can't move to expo module initialization soon enough 😅 ), and added tests with a corresponding SDK 44 AppDelegate.m.
(commit 2) fixed wrong string constant that was causing failures for SDK 43 and below
(commit 3) fixed tests on the Android side that were logging warnings. @lukmccall is it correct to say that this config plugin cannot handle projects where `createReactActivityDelegate` isn't already overridden in MainActivity? I modified the tests as such, but if that isn't the case, [this warning](https://github.com/expo/expo/blob/4ca5ff72ef3abcc30cb7936eaf9c4b97fed9a5ad/packages/expo-dev-launcher/plugin/src/withDevLauncher.ts#L205-L209) needs to be changed.

# Test Plan

All tests pass. Manually tested in a blank SDK 44 app; cherry picked these commits onto sdk-44 and then used patch-package to patch entire the expo-dev-launcher package to match sdk-44 HEAD. Ran expo prebuild, saw no errors, eyeballed the code changes, and tested the following scenarios:

✅ project builds on iOS and Android
✅ iOS: can open app served by `expo start --dev-client`
✅ iOS: can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ Android: can open app served by `expo start --dev-client`
✅ Android: can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ expo install expo-updates@0.11.2, expo prebuild --clean, project builds
✅ iOS (with expo-updates integration): can open app served by `expo start --dev-client`
✅ iOS (with expo-updates integration): can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ iOS (with expo-updates integration): can open published app
✅ Android (with expo-updates integration): can open app served by `expo start --dev-client`
✅ Android (with expo-updates integration): can open app served by `expo start --dev-client --force-manifest-type=expo-updates`
✅ Android (with expo-updates integration): can open published app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants