Skip to content

static hermes + systraces + UIManager Constants opts + so loading opts #74

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

Draft
wants to merge 1 commit into
base: 0.78.2-discord-1
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ internal object NdkConfiguratorUtils {
if (hermesEnabled) {
excludes.add("**/libjsc.so")
excludes.add("**/libjsctooling.so")
includes.add("**/libhermes.so")
includes.add("**/libhermesvm.so")
includes.add("**/libhermestooling.so")
} else {
excludes.add("**/libhermes.so")
excludes.add("**/libhermesvm.so")
excludes.add("**/libhermestooling.so")
includes.add("**/libjsc.so")
includes.add("**/libjsctooling.so")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ class NdkConfiguratorUtilsTest {
assertThat(excludes).containsExactly("**/libjsc.so", "**/libjsctooling.so")
assertThat(includes).doesNotContain("**/libjsc.so", "**/libjsctooling.so")

assertThat(includes).containsExactly("**/libhermes.so", "**/libhermestooling.so")
assertThat(excludes).doesNotContain("**/libhermes.so", "**/libhermestooling.so")
assertThat(includes).containsExactly("**/libhermesvm.so", "**/libhermestooling.so")
assertThat(excludes).doesNotContain("**/libhermesvm.so", "**/libhermestooling.so")
}

@Test
fun getPackagingOptionsForVariant_withHermesDisabled() {
val (excludes, includes) = getPackagingOptionsForVariant(hermesEnabled = false)

assertThat(excludes).containsExactly("**/libhermes.so", "**/libhermestooling.so")
assertThat(includes).doesNotContain("**/libhermes.so", "**/libhermestooling.so")
assertThat(excludes).containsExactly("**/libhermesvm.so", "**/libhermestooling.so")
assertThat(includes).doesNotContain("**/libhermesvm.so", "**/libhermestooling.so")

assertThat(includes).containsExactly("**/libjsc.so", "**/libjsctooling.so")
assertThat(excludes).doesNotContain("**/libjsc.so", "**/libjsctooling.so")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import type {TurboModule} from './RCTExport';

import invariant from 'invariant';
import * as Systrace from '../Performance/Systrace';


const NativeModules = require('../BatchedBridge/NativeModules');

Expand Down Expand Up @@ -43,7 +45,12 @@ export function get<T: TurboModule>(name: string): ?T {
}

export function getEnforcing<T: TurboModule>(name: string): T {
Systrace.beginEvent(
'TurboModuleRegistry.getEnforcing',
{name},
);
const module = requireModule<T>(name);
Systrace.endEvent();
invariant(
module != null,
`TurboModuleRegistry.getEnforcing(...): '${name}' could not be found. ` +
Expand Down
11 changes: 6 additions & 5 deletions packages/react-native/ReactAndroid/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ val packageReactNdkLibsForBuck by
// Shared libraries (.so) are copied from the merged_native_libs folder instead
from("$buildDir/intermediates/merged_native_libs/debug/out/lib/")
exclude("**/libjsc.so")
exclude("**/libhermes.so")
exclude("**/libhermesvm.so")
into("src/main/jni/prebuilt/lib")
}

Expand All @@ -474,7 +474,7 @@ val packageReactNdkDebugLibsForDiscord by
// Shared libraries (.so) are copied from the merged_native_libs folder instead
from("$buildDir/intermediates/merged_native_libs/debug/out/lib/")
exclude("**/libjsc.so")
exclude("**/libhermes.so")
exclude("**/libhermesvm.so")
into("src/main/jni/prebuilt/lib/debug")
}

Expand All @@ -485,7 +485,7 @@ val packageReactNdkReleaseLibsForDiscord by
// Shared libraries (.so) are copied from the merged_native_libs folder instead
from("$buildDir/intermediates/merged_native_libs/release/out/lib/")
exclude("**/libjsc.so")
exclude("**/libhermes.so")
exclude("**/libhermesvm.so")
into("src/main/jni/prebuilt/lib/release")
}

Expand Down Expand Up @@ -561,7 +561,7 @@ android {
buildConfigField("boolean", "IS_INTERNAL_BUILD", "false")
buildConfigField("int", "EXOPACKAGE_FLAGS", "0")
buildConfigField("boolean", "UNSTABLE_ENABLE_FUSEBOX_RELEASE", "false")
buildConfigField("boolean", "ENABLE_PERFETTO", "false")
buildConfigField("boolean", "ENABLE_PERFETTO", "true")

resValue("integer", "react_native_dev_server_port", reactNativeDevServerPort())

Expand Down Expand Up @@ -650,7 +650,7 @@ android {
// we produce. The reason behind this is that we want to allow users to pick the
// JS engine by specifying a dependency on either `hermes-engine` or `android-jsc`
// that will include the necessary .so files to load.
jniLibs.excludes.add("**/libhermes.so")
jniLibs.excludes.add("**/libhermesvm.so")
jniLibs.excludes.add("**/libjsc.so")
}

Expand Down Expand Up @@ -683,6 +683,7 @@ android {
tasks.withType<KotlinCompile>().configureEach { exclude("com/facebook/annotationprocessors/**") }

dependencies {
implementation("com.tencent:mmkv-static:1.2.14")
api(libs.androidx.appcompat)
api(libs.androidx.appcompat.resources)
api(libs.androidx.autofill)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <fbjni/fbjni.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
#include <rncore.h>
#include <reactperflogger/ReactPerfettoLogger.h>
#include <android/log.h>

#ifdef REACT_NATIVE_APP_CODEGEN_HEADER
#include REACT_NATIVE_APP_CODEGEN_HEADER
Expand Down Expand Up @@ -114,6 +116,7 @@ std::shared_ptr<TurboModule> javaModuleProvider(
} // namespace facebook::react

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
initializePerfetto();
return facebook::jni::initialize(vm, [] {
facebook::react::DefaultTurboModuleManagerDelegate::cxxModuleProvider =
&facebook::react::cxxModuleProvider;
Expand Down
Loading
Loading