-
Notifications
You must be signed in to change notification settings - Fork 99
fix(android): build fixes for 0.81 #2507
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...oid/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.microsoft.reacttestapp.compat | ||
|
|
||
| import android.app.Application | ||
| import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint | ||
| import com.facebook.react.defaults.DefaultReactNativeHost | ||
| import com.facebook.soloader.SoLoader | ||
| import com.microsoft.reacttestapp.BuildConfig | ||
|
|
||
| abstract class ReactNativeHostCompat(application: Application) : | ||
| DefaultReactNativeHost(application) { | ||
|
|
||
| companion object { | ||
| init { | ||
| DefaultNewArchitectureEntryPoint.load() | ||
| SoLoader.loadLibrary("reacttestapp_appmodules") | ||
| } | ||
| } | ||
|
|
||
| override val isNewArchEnabled: Boolean = BuildConfig.REACTAPP_USE_FABRIC | ||
| } |
34 changes: 34 additions & 0 deletions
34
android/app/src/new-arch-0.81/java/com/microsoft/reacttestapp/fabric/ComponentsRegistry.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package com.microsoft.reacttestapp.fabric | ||
|
|
||
| import com.facebook.jni.HybridData | ||
| import com.facebook.proguard.annotations.DoNotStrip | ||
| import com.facebook.react.fabric.ComponentFactory | ||
| import com.facebook.soloader.SoLoader | ||
|
|
||
| /** | ||
| * The corresponding C++ implementation is in `android/app/src/main/jni/ComponentsRegistry.cpp` | ||
| */ | ||
| @DoNotStrip | ||
| class ComponentsRegistry @DoNotStrip private constructor(componentFactory: ComponentFactory) { | ||
|
|
||
| companion object { | ||
| @DoNotStrip | ||
| fun register(componentFactory: ComponentFactory): ComponentsRegistry = | ||
| ComponentsRegistry(componentFactory) | ||
|
|
||
| init { | ||
| SoLoader.loadLibrary("fabricjni") | ||
| SoLoader.loadLibrary("reacttestapp_appmodules") | ||
| } | ||
| } | ||
|
|
||
| @DoNotStrip | ||
| private val mHybridData: HybridData | ||
|
|
||
| @DoNotStrip | ||
| private external fun initHybrid(componentFactory: ComponentFactory): HybridData | ||
|
|
||
| init { | ||
| mHybridData = initHybrid(componentFactory) | ||
| } | ||
| } |
37 changes: 37 additions & 0 deletions
37
...c/new-arch-0.81/java/com/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package com.microsoft.reacttestapp.turbomodule | ||
|
|
||
| import com.facebook.jni.HybridData | ||
| import com.facebook.react.ReactPackage | ||
| import com.facebook.react.ReactPackageTurboModuleManagerDelegate | ||
| import com.facebook.react.bridge.ReactApplicationContext | ||
|
|
||
| /** | ||
| * These type aliases are here to prevent `@react-native-community/cli` from | ||
| * marking them as native modules to autolink. | ||
| * | ||
| * See also `matchClassName` in | ||
| * https://github.com/react-native-community/cli/blob/8.x/packages/platform-android/src/config/findPackageClassName.ts#L25 | ||
| */ | ||
| typealias PackagesList = List<ReactPackage> | ||
| typealias ReactTurboModuleManagerDelegate = ReactPackageTurboModuleManagerDelegate | ||
| typealias ReactTurboModuleManagerDelegateBuilder = ReactPackageTurboModuleManagerDelegate.Builder | ||
|
|
||
| /** | ||
| * The corresponding C++ implementation is in `android/app/src/main/jni/TurboModuleManagerDelegate.cpp` | ||
| */ | ||
| class TurboModuleManagerDelegate protected constructor( | ||
| reactApplicationContext: ReactApplicationContext, | ||
| packages: PackagesList | ||
| ) : ReactTurboModuleManagerDelegate(reactApplicationContext, packages) { | ||
|
|
||
| external override fun initHybrid(): HybridData | ||
|
|
||
| external fun canCreateTurboModule(moduleName: String?): Boolean | ||
|
|
||
| class Builder : ReactTurboModuleManagerDelegateBuilder() { | ||
| override fun build( | ||
| context: ReactApplicationContext, | ||
| packages: PackagesList | ||
| ): TurboModuleManagerDelegate = TurboModuleManagerDelegate(context, packages) | ||
| } | ||
| } |
1 change: 1 addition & 0 deletions
1
android/app/src/old-arch/java/com/microsoft/reacttestapp/compat/ReactNativeHostCompat.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| package com.microsoft.reacttestapp.compat | ||
|
|
||
| @Suppress("DEPRECATION") | ||
| typealias ReactNativeHostCompat = com.facebook.react.ReactNativeHost |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, however we backported
rncore.hto make this non breaking