-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move libreact_newarchdefaults.so inside libreactnative.so
Summary: This is a more complex library as I had to introduce a `ReactNativeSoLoader` to handle the internal/oss scenarios. Changelog: [Internal] [Changed] - Move libreact_newarchdefaults.so inside libreactnative.so Differential Revision: D55796933
- Loading branch information
1 parent
1cad4f8
commit 5a2ed4a
Showing
10 changed files
with
77 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 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 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
32 changes: 32 additions & 0 deletions
32
.../react-native/ReactAndroid/src/main/java/com/facebook/react/common/ReactNativeSoLoader.kt
This file contains 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,32 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.facebook.react.common | ||
|
||
import com.facebook.react.BuildConfig | ||
import com.facebook.soloader.SoLoader | ||
|
||
public object ReactNativeSoLoader { | ||
|
||
private var isReactNativeSoLoaded = false | ||
|
||
private fun shouldLoadOnlyReactNativeSo(): Boolean = BuildConfig.IS_INTERNAL_BUILD.not() | ||
|
||
@JvmStatic | ||
public fun loadLibrary(shortName: String?): Boolean = | ||
if (shouldLoadOnlyReactNativeSo()) { | ||
if (!isReactNativeSoLoaded) { | ||
// We don't need to use SoLoader at all at this point as we're handling the | ||
// merging of the .so libraries manually. | ||
System.loadLibrary("reactnative") | ||
isReactNativeSoLoaded = true | ||
} | ||
true | ||
} else { | ||
SoLoader.loadLibrary(shortName) | ||
} | ||
} |
This file contains 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 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 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 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,14 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include <fbjni/fbjni.h> | ||
|
||
namespace facebook { | ||
namespace react { | ||
JNIEXPORT void OnLoad_react_newarchdefaults(); | ||
} | ||
} // namespace facebook |
This file contains 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 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