mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
59
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fafef8365 | ||
|
|
646945c2f2 | ||
|
|
da9136f587 | ||
|
|
ffe52b75a3 | ||
|
|
a2a73739d8 | ||
|
|
046ff8e58b | ||
|
|
fb114da8a4 | ||
|
|
191ddc1ec7 | ||
|
|
aaa7ba4ab3 | ||
|
|
2689d4d372 | ||
|
|
d35ddb5e59 | ||
|
|
8e514a8a10 | ||
|
|
e28784d4b6 | ||
|
|
28275a0f7b | ||
|
|
bcf76e8bb0 | ||
|
|
c2d96d3a5b | ||
|
|
c557311ed8 | ||
|
|
3f74a87027 | ||
|
|
9793542555 | ||
|
|
b899e18d1c | ||
|
|
aec35b8960 | ||
|
|
3c79d7c18d | ||
|
|
7f051c5470 | ||
|
|
8bdb34732b | ||
|
|
4583fbe052 | ||
|
|
fbef891573 | ||
|
|
bda6acf3b0 | ||
|
|
474f455a75 | ||
|
|
2ad87cdc50 | ||
|
|
5d41129ce1 | ||
|
|
776fca1e7c | ||
|
|
3d1d81cddc | ||
|
|
62b8a7b4ef | ||
|
|
70d5c97ab4 | ||
|
|
0ef21bf8ad | ||
|
|
b23c558a20 | ||
|
|
89fd398342 | ||
|
|
9f2389f074 | ||
|
|
6da351a5ed | ||
|
|
2ad845ccb2 | ||
|
|
e04bbf0497 | ||
|
|
78f089906c | ||
|
|
8480386d50 | ||
|
|
9910981d3a | ||
|
|
d1a1020a4a | ||
|
|
fb84932e48 | ||
|
|
3f848e7a54 | ||
|
|
df748ba083 | ||
|
|
defefb19e3 | ||
|
|
ba51aeaa90 | ||
|
|
24657ad5c4 | ||
|
|
b7b83cda0a | ||
|
|
9301badec1 | ||
|
|
14718b20c6 | ||
|
|
e7d89fa53a | ||
|
|
8197399e43 | ||
|
|
4a48364639 | ||
|
|
e3adf47214 | ||
|
|
59cc1738d7 |
@@ -76,7 +76,6 @@ module.system.haste.module_ref_prefix=m#
|
||||
react.runtime=automatic
|
||||
|
||||
experimental.error_code_migration=new
|
||||
suppress_type=$FlowFixMe
|
||||
|
||||
ban_spread_key_props=true
|
||||
|
||||
|
||||
@@ -71,17 +71,17 @@ runs:
|
||||
mv build_"$SLICE" "$FINAL_PATH"
|
||||
|
||||
# check whether everything is there
|
||||
if [[ -d "$FINAL_PATH/API/hermes/hermes.framework" ]]; then
|
||||
echo "Successfully built hermes.framework for $SLICE in $FLAVOR"
|
||||
if [[ -d "$FINAL_PATH/lib/hermesvm.framework" ]]; then
|
||||
echo "Successfully built hermesvm.framework for $SLICE in $FLAVOR"
|
||||
else
|
||||
echo "Failed to built hermes.framework for $SLICE in $FLAVOR"
|
||||
echo "Failed to built hermesvm.framework for $SLICE in $FLAVOR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d "$FINAL_PATH/API/hermes/hermes.framework.dSYM" ]]; then
|
||||
echo "Successfully built hermes.framework.dSYM for $SLICE in $FLAVOR"
|
||||
if [[ -d "$FINAL_PATH/lib/hermesvm.framework.dSYM" ]]; then
|
||||
echo "Successfully built hermesvm.framework.dSYM for $SLICE in $FLAVOR"
|
||||
else
|
||||
echo "Failed to built hermes.framework.dSYM for $SLICE in $FLAVOR"
|
||||
echo "Failed to built hermesvm.framework.dSYM for $SLICE in $FLAVOR"
|
||||
echo "Please try again"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -186,7 +186,7 @@ runs:
|
||||
|
||||
cd ./packages/react-native/sdks/hermes || exit 1
|
||||
|
||||
DSYM_FILE_PATH=API/hermes/hermes.framework.dSYM
|
||||
DSYM_FILE_PATH=lib/hermesvm.framework.dSYM
|
||||
cp -r build_macosx/$DSYM_FILE_PATH "$WORKING_DIR/macosx/"
|
||||
cp -r build_catalyst/$DSYM_FILE_PATH "$WORKING_DIR/catalyst/"
|
||||
cp -r build_iphoneos/$DSYM_FILE_PATH "$WORKING_DIR/iphoneos/"
|
||||
@@ -197,10 +197,10 @@ runs:
|
||||
cp -r build_xrsimulator/$DSYM_FILE_PATH "$WORKING_DIR/xrsimulator/"
|
||||
|
||||
DEST_DIR="/tmp/hermes/dSYM/$FLAVOR"
|
||||
tar -C "$WORKING_DIR" -czvf "hermes.framework.dSYM" .
|
||||
tar -C "$WORKING_DIR" -czvf "hermesvm.framework.dSYM" .
|
||||
|
||||
mkdir -p "$DEST_DIR"
|
||||
mv "hermes.framework.dSYM" "$DEST_DIR"
|
||||
mv "hermesvm.framework.dSYM" "$DEST_DIR"
|
||||
- name: Upload hermes dSYM artifacts
|
||||
uses: actions/upload-artifact@v4.3.4
|
||||
with:
|
||||
|
||||
@@ -99,8 +99,8 @@ runs:
|
||||
mkdir -p ./packages/react-native/ReactAndroid/external-artifacts/artifacts/
|
||||
cp ${{ inputs.hermes-ws-dir }}/hermes-runtime-darwin/hermes-ios-Debug.tar.gz ./packages/react-native/ReactAndroid/external-artifacts/artifacts/hermes-ios-debug.tar.gz
|
||||
cp ${{ inputs.hermes-ws-dir }}/hermes-runtime-darwin/hermes-ios-Release.tar.gz ./packages/react-native/ReactAndroid/external-artifacts/artifacts/hermes-ios-release.tar.gz
|
||||
cp ${{ inputs.hermes-ws-dir }}/dSYM/Debug/hermes.framework.dSYM ./packages/react-native/ReactAndroid/external-artifacts/artifacts/hermes-framework-dSYM-debug.tar.gz
|
||||
cp ${{ inputs.hermes-ws-dir }}/dSYM/Release/hermes.framework.dSYM ./packages/react-native/ReactAndroid/external-artifacts/artifacts/hermes-framework-dSYM-release.tar.gz
|
||||
cp ${{ inputs.hermes-ws-dir }}/dSYM/Debug/hermesvm.framework.dSYM ./packages/react-native/ReactAndroid/external-artifacts/artifacts/hermes-framework-dSYM-debug.tar.gz
|
||||
cp ${{ inputs.hermes-ws-dir }}/dSYM/Release/hermesvm.framework.dSYM ./packages/react-native/ReactAndroid/external-artifacts/artifacts/hermes-framework-dSYM-release.tar.gz
|
||||
- name: Download ReactNativeDependencies
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
|
||||
@@ -246,6 +246,11 @@ jobs:
|
||||
- name: Print ReactCore folder
|
||||
shell: bash
|
||||
run: ls -lR /tmp/ReactCore
|
||||
- name: Configure git
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global user.email "react-native-bot@meta.com"
|
||||
git config --global user.name "React Native Bot"
|
||||
- name: Prepare artifacts
|
||||
run: |
|
||||
REACT_NATIVE_PKG=$(find /tmp/react-native-tmp -type f -name "*.tgz")
|
||||
|
||||
+28
-12
@@ -26,10 +26,12 @@ fun getListReactAndroidProperty(name: String) = reactAndroidProperties.getProper
|
||||
|
||||
apiValidation {
|
||||
ignoredPackages.addAll(
|
||||
getListReactAndroidProperty("binaryCompatibilityValidator.ignoredPackages"))
|
||||
getListReactAndroidProperty("binaryCompatibilityValidator.ignoredPackages")
|
||||
)
|
||||
ignoredClasses.addAll(getListReactAndroidProperty("binaryCompatibilityValidator.ignoredClasses"))
|
||||
nonPublicMarkers.addAll(
|
||||
getListReactAndroidProperty("binaryCompatibilityValidator.nonPublicMarkers"))
|
||||
getListReactAndroidProperty("binaryCompatibilityValidator.nonPublicMarkers")
|
||||
)
|
||||
validationDisabled =
|
||||
reactAndroidProperties
|
||||
.getProperty("binaryCompatibilityValidator.validationDisabled")
|
||||
@@ -37,8 +39,9 @@ apiValidation {
|
||||
}
|
||||
|
||||
version =
|
||||
if (project.hasProperty("isSnapshot") &&
|
||||
(project.property("isSnapshot") as? String).toBoolean()) {
|
||||
if (
|
||||
project.hasProperty("isSnapshot") && (project.property("isSnapshot") as? String).toBoolean()
|
||||
) {
|
||||
"${reactAndroidProperties.getProperty("VERSION_NAME")}-SNAPSHOT"
|
||||
} else {
|
||||
reactAndroidProperties.getProperty("VERSION_NAME")
|
||||
@@ -66,8 +69,10 @@ tasks.register("clean", Delete::class.java) {
|
||||
description = "Remove all the build files and intermediate build outputs"
|
||||
dependsOn(gradle.includedBuild("gradle-plugin").task(":clean"))
|
||||
subprojects.forEach {
|
||||
if (it.project.plugins.hasPlugin("com.android.library") ||
|
||||
it.project.plugins.hasPlugin("com.android.application")) {
|
||||
if (
|
||||
it.project.plugins.hasPlugin("com.android.library") ||
|
||||
it.project.plugins.hasPlugin("com.android.application")
|
||||
) {
|
||||
dependsOn(it.tasks.named("clean"))
|
||||
}
|
||||
}
|
||||
@@ -77,10 +82,13 @@ tasks.register("clean", Delete::class.java) {
|
||||
delete(rootProject.file("./packages/react-native/sdks/download/"))
|
||||
delete(rootProject.file("./packages/react-native/sdks/hermes/"))
|
||||
delete(
|
||||
rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/arm64-v8a/"))
|
||||
rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/arm64-v8a/")
|
||||
)
|
||||
delete(
|
||||
rootProject.file(
|
||||
"./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/"))
|
||||
"./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/"
|
||||
)
|
||||
)
|
||||
delete(rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/x86/"))
|
||||
delete(rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/x86_64/"))
|
||||
delete(rootProject.file("./packages/react-native-codegen/lib"))
|
||||
@@ -98,7 +106,8 @@ tasks.register("publishAllToMavenTempLocal") {
|
||||
dependsOn(":packages:react-native:ReactAndroid:publishAllPublicationsToMavenTempLocalRepository")
|
||||
// We don't publish the external-artifacts to Maven Local as ci is using it via workspace.
|
||||
dependsOn(
|
||||
":packages:react-native:ReactAndroid:hermes-engine:publishAllPublicationsToMavenTempLocalRepository")
|
||||
":packages:react-native:ReactAndroid:hermes-engine:publishAllPublicationsToMavenTempLocalRepository"
|
||||
)
|
||||
}
|
||||
|
||||
tasks.register("publishAndroidToSonatype") {
|
||||
@@ -120,7 +129,8 @@ if (project.findProperty("react.internal.useHermesNightly")?.toString()?.toBoole
|
||||
That's fine for local development, but you should not commit this change.
|
||||
********************************************************************************
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
allprojects {
|
||||
configurations.all {
|
||||
resolutionStrategy.dependencySubstitution {
|
||||
@@ -152,10 +162,12 @@ allprojects {
|
||||
"**/build/**",
|
||||
"**/hermes-engine/**",
|
||||
"**/internal/featureflags/**",
|
||||
"**/systeminfo/ReactNativeVersion.kt")
|
||||
"**/systeminfo/ReactNativeVersion.kt",
|
||||
)
|
||||
listOf(
|
||||
com.ncorti.ktfmt.gradle.tasks.KtfmtCheckTask::class,
|
||||
com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask::class)
|
||||
com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask::class,
|
||||
)
|
||||
.forEach { tasks.withType(it) { exclude(excludePatterns) } }
|
||||
|
||||
// Disable the problematic ktfmt script tasks due to symbolic link issues in subprojects
|
||||
@@ -165,3 +177,7 @@ allprojects {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We intentionally disable the `ktfmtCheck` tasks as the formatting is primarly handled inside
|
||||
// fbsource
|
||||
allprojects { tasks.withType<com.ncorti.ktfmt.gradle.tasks.KtfmtCheckTask>() { enabled = false } }
|
||||
|
||||
+5
-5
@@ -63,7 +63,7 @@
|
||||
"@typescript-eslint/parser": "^8.36.0",
|
||||
"ansi-styles": "^4.2.1",
|
||||
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
|
||||
"babel-plugin-syntax-hermes-parser": "0.31.2",
|
||||
"babel-plugin-syntax-hermes-parser": "0.32.0",
|
||||
"babel-plugin-transform-define": "^2.1.4",
|
||||
"babel-plugin-transform-flow-enums": "^0.0.2",
|
||||
"clang-format": "^1.8.0",
|
||||
@@ -81,11 +81,11 @@
|
||||
"eslint-plugin-react-native": "^4.0.0",
|
||||
"eslint-plugin-redundant-undefined": "^0.4.0",
|
||||
"eslint-plugin-relay": "^1.8.3",
|
||||
"flow-api-translator": "0.31.2",
|
||||
"flow-api-translator": "0.32.0",
|
||||
"flow-bin": "^0.279.0",
|
||||
"glob": "^7.1.1",
|
||||
"hermes-eslint": "0.31.2",
|
||||
"hermes-transform": "0.31.2",
|
||||
"hermes-eslint": "0.32.0",
|
||||
"hermes-transform": "0.32.0",
|
||||
"ini": "^5.0.0",
|
||||
"inquirer": "^7.1.0",
|
||||
"jest": "^29.7.0",
|
||||
@@ -102,7 +102,7 @@
|
||||
"node-fetch": "^2.2.0",
|
||||
"nullthrows": "^1.1.1",
|
||||
"prettier": "3.6.2",
|
||||
"prettier-plugin-hermes-parser": "0.31.1",
|
||||
"prettier-plugin-hermes-parser": "0.32.0",
|
||||
"react": "19.1.1",
|
||||
"react-test-renderer": "19.1.1",
|
||||
"rimraf": "^3.0.2",
|
||||
|
||||
@@ -81,10 +81,147 @@ export {Commands};
|
||||
export default (codegenNativeComponent<ModuleProps>('Module'): NativeType);
|
||||
`;
|
||||
|
||||
const COMMANDS_WITH_COVERAGE_INVALID = `
|
||||
// @flow
|
||||
|
||||
const codegenNativeComponent = require('codegenNativeComponent');
|
||||
import type {NativeComponentType} from 'codegenNativeComponent';
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
|
||||
type ModuleProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
|}>;
|
||||
|
||||
type NativeType = NativeComponentType<ModuleProps>;
|
||||
|
||||
// Coverage instrumentation of invalid Commands export - should still fail
|
||||
export const Commands = (cov_1234567890().s[0]++, {
|
||||
hotspotUpdate: () => {},
|
||||
scrollTo: () => {},
|
||||
});
|
||||
|
||||
export default (codegenNativeComponent<ModuleProps>('Module'): NativeType);
|
||||
`;
|
||||
|
||||
const COMMANDS_WITH_COVERAGE_WRONG_FUNCTION = `
|
||||
// @flow
|
||||
|
||||
const codegenNativeComponent = require('codegenNativeComponent');
|
||||
import type {NativeComponentType} from 'codegenNativeComponent';
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
|
||||
type ModuleProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
|}>;
|
||||
|
||||
type NativeType = NativeComponentType<ModuleProps>;
|
||||
|
||||
// Coverage instrumentation of wrong function call - should fail
|
||||
export const Commands = (cov_abcdef123().s[0]++, someOtherFunction({
|
||||
supportedCommands: ['pause', 'play'],
|
||||
}));
|
||||
|
||||
export default (codegenNativeComponent<ModuleProps>('Module'): NativeType);
|
||||
`;
|
||||
|
||||
const COMMANDS_WITH_COMPLEX_COVERAGE_INVALID = `
|
||||
// @flow
|
||||
|
||||
const codegenNativeComponent = require('codegenNativeComponent');
|
||||
import type {NativeComponentType} from 'codegenNativeComponent';
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
|
||||
type ModuleProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
|}>;
|
||||
|
||||
type NativeType = NativeComponentType<ModuleProps>;
|
||||
|
||||
// Complex coverage instrumentation with invalid nested structure - should fail
|
||||
export const Commands = (
|
||||
cov_xyz789().f[1]++,
|
||||
cov_xyz789().s[2]++,
|
||||
{
|
||||
pause: (ref) => {},
|
||||
play: (ref) => {},
|
||||
}
|
||||
);
|
||||
|
||||
export default (codegenNativeComponent<ModuleProps>('Module'): NativeType);
|
||||
`;
|
||||
|
||||
const COMMANDS_WITH_COVERAGE_WRONG_NAME = `
|
||||
// @flow
|
||||
|
||||
const codegenNativeCommands = require('codegenNativeCommands');
|
||||
const codegenNativeComponent = require('codegenNativeComponent');
|
||||
import type {NativeComponentType} from 'codegenNativeComponent';
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
|
||||
type ModuleProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
|}>;
|
||||
|
||||
type NativeType = NativeComponentType<ModuleProps>;
|
||||
|
||||
interface NativeCommands {
|
||||
+pause: (viewRef: React.ElementRef<NativeType>) => void;
|
||||
+play: (viewRef: React.ElementRef<NativeType>) => void;
|
||||
}
|
||||
|
||||
// Coverage instrumentation with correct function but wrong export name - should fail
|
||||
export const WrongName = (cov_wrong123().s[0]++, codegenNativeCommands<NativeCommands>({
|
||||
supportedCommands: ['pause', 'play'],
|
||||
}));
|
||||
|
||||
export default (codegenNativeComponent<ModuleProps>('Module'): NativeType);
|
||||
`;
|
||||
|
||||
const COMMANDS_WITH_COVERAGE_TYPE_CAST_INVALID = `
|
||||
// @flow
|
||||
|
||||
const codegenNativeComponent = require('codegenNativeComponent');
|
||||
import type {NativeComponentType} from 'codegenNativeComponent';
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
|
||||
type ModuleProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
|}>;
|
||||
|
||||
type NativeType = NativeComponentType<ModuleProps>;
|
||||
|
||||
interface NativeCommands {
|
||||
+pause: (viewRef: React.ElementRef<NativeType>) => void;
|
||||
+play: (viewRef: React.ElementRef<NativeType>) => void;
|
||||
}
|
||||
|
||||
// Coverage instrumentation with type cast but wrong function - should fail
|
||||
export const Commands: NativeCommands = (cov_cast123().s[0]++, invalidFunction({
|
||||
supportedCommands: ['pause', 'play'],
|
||||
}));
|
||||
|
||||
export default (codegenNativeComponent<ModuleProps>('Module'): NativeType);
|
||||
`;
|
||||
|
||||
module.exports = {
|
||||
'CommandsExportedWithDifferentNameNativeComponent.js':
|
||||
COMMANDS_EXPORTED_WITH_DIFFERENT_NAME,
|
||||
'CommandsExportedWithShorthandNativeComponent.js':
|
||||
COMMANDS_EXPORTED_WITH_SHORTHAND,
|
||||
'OtherCommandsExportNativeComponent.js': OTHER_COMMANDS_EXPORT,
|
||||
'CommandsWithCoverageInvalidNativeComponent.js':
|
||||
COMMANDS_WITH_COVERAGE_INVALID,
|
||||
'CommandsWithCoverageWrongFunctionNativeComponent.js':
|
||||
COMMANDS_WITH_COVERAGE_WRONG_FUNCTION,
|
||||
'CommandsWithComplexCoverageInvalidNativeComponent.js':
|
||||
COMMANDS_WITH_COMPLEX_COVERAGE_INVALID,
|
||||
'CommandsWithCoverageWrongNameNativeComponent.js':
|
||||
COMMANDS_WITH_COVERAGE_WRONG_NAME,
|
||||
'CommandsWithCoverageTypeCastInvalidNativeComponent.js':
|
||||
COMMANDS_WITH_COVERAGE_TYPE_CAST_INVALID,
|
||||
};
|
||||
|
||||
@@ -59,6 +59,92 @@ export default codegenNativeComponent<ModuleProps>('Module', {
|
||||
});
|
||||
`;
|
||||
|
||||
// Coverage instrumentation test cases - should be recognized as valid
|
||||
const COMMANDS_WITH_SIMPLE_COVERAGE = `
|
||||
// @flow
|
||||
|
||||
const codegenNativeCommands = require('codegenNativeCommands');
|
||||
const codegenNativeComponent = require('codegenNativeComponent');
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
import type {NativeComponentType} from 'codegenNativeComponent';
|
||||
|
||||
type ModuleProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
|}>;
|
||||
|
||||
type NativeType = NativeComponentType<ModuleProps>;
|
||||
|
||||
interface NativeCommands {
|
||||
+pause: (viewRef: React.ElementRef<NativeType>) => void;
|
||||
+play: (viewRef: React.ElementRef<NativeType>) => void;
|
||||
}
|
||||
|
||||
export const Commands = (cov_1234567890.s[0]++, codegenNativeCommands<NativeCommands>({
|
||||
supportedCommands: ['pause', 'play'],
|
||||
}));
|
||||
|
||||
export default codegenNativeComponent<ModuleProps>('Module');
|
||||
`;
|
||||
|
||||
const COMMANDS_WITH_COMPLEX_COVERAGE = `
|
||||
// @flow
|
||||
|
||||
const codegenNativeCommands = require('codegenNativeCommands');
|
||||
const codegenNativeComponent = require('codegenNativeComponent');
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
import type {NativeComponentType} from 'codegenNativeComponent';
|
||||
|
||||
type ModuleProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
|}>;
|
||||
|
||||
type NativeType = NativeComponentType<ModuleProps>;
|
||||
|
||||
interface NativeCommands {
|
||||
+seek: (viewRef: React.ElementRef<NativeType>, position: number) => void;
|
||||
+stop: (viewRef: React.ElementRef<NativeType>) => void;
|
||||
}
|
||||
|
||||
export const Commands = (
|
||||
cov_abcdef123().f[2]++,
|
||||
cov_abcdef123().s[5]++,
|
||||
codegenNativeCommands<NativeCommands>({
|
||||
supportedCommands: ['seek', 'stop'],
|
||||
})
|
||||
);
|
||||
|
||||
export default codegenNativeComponent<ModuleProps>('Module');
|
||||
`;
|
||||
|
||||
const COMMANDS_WITH_TYPE_CAST_COVERAGE = `
|
||||
// @flow
|
||||
|
||||
const codegenNativeCommands = require('codegenNativeCommands');
|
||||
const codegenNativeComponent = require('codegenNativeComponent');
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
import type {NativeComponentType} from 'codegenNativeComponent';
|
||||
|
||||
type ModuleProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
|}>;
|
||||
|
||||
type NativeType = NativeComponentType<ModuleProps>;
|
||||
|
||||
interface NativeCommands {
|
||||
+mute: (viewRef: React.ElementRef<NativeType>) => void;
|
||||
+unmute: (viewRef: React.ElementRef<NativeType>) => void;
|
||||
}
|
||||
|
||||
export const Commands: NativeCommands = (cov_xyz789().s[1]++, codegenNativeCommands<NativeCommands>({
|
||||
supportedCommands: ['mute', 'unmute'],
|
||||
}));
|
||||
|
||||
export default codegenNativeComponent<ModuleProps>('Module');
|
||||
`;
|
||||
|
||||
const FULL_NATIVE_COMPONENT_WITH_TYPE_EXPORT = `
|
||||
// @flow
|
||||
|
||||
@@ -107,4 +193,9 @@ module.exports = {
|
||||
'NotANativeComponent.js': NOT_A_NATIVE_COMPONENT,
|
||||
'FullNativeComponent.js': FULL_NATIVE_COMPONENT,
|
||||
'FullTypedNativeComponent.js': FULL_NATIVE_COMPONENT_WITH_TYPE_EXPORT,
|
||||
'CommandsWithSimpleCoverageNativeComponent.js': COMMANDS_WITH_SIMPLE_COVERAGE,
|
||||
'CommandsWithComplexCoverageNativeComponent.js':
|
||||
COMMANDS_WITH_COMPLEX_COVERAGE,
|
||||
'CommandsWithTypeCastCoverageNativeComponent.js':
|
||||
COMMANDS_WITH_TYPE_CAST_COVERAGE,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,77 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Babel plugin inline view configs can inline config for CommandsWithComplexCoverageNativeComponent.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
const codegenNativeCommands = require('codegenNativeCommands');
|
||||
const codegenNativeComponent = require('codegenNativeComponent');
|
||||
import type { ViewProps } from 'ViewPropTypes';
|
||||
import type { NativeComponentType } from 'codegenNativeComponent';
|
||||
type ModuleProps = $ReadOnly<{|
|
||||
...ViewProps
|
||||
|}>;
|
||||
type NativeType = NativeComponentType<ModuleProps>;
|
||||
interface NativeCommands {
|
||||
+seek: (viewRef: React.ElementRef<NativeType>, position: number) => void,
|
||||
+stop: (viewRef: React.ElementRef<NativeType>) => void,
|
||||
}
|
||||
const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');
|
||||
let nativeComponentName = 'Module';
|
||||
export const __INTERNAL_VIEW_CONFIG = {
|
||||
uiViewClassName: \\"Module\\",
|
||||
validAttributes: {}
|
||||
};
|
||||
export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);"
|
||||
`;
|
||||
|
||||
exports[`Babel plugin inline view configs can inline config for CommandsWithSimpleCoverageNativeComponent.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
const codegenNativeCommands = require('codegenNativeCommands');
|
||||
const codegenNativeComponent = require('codegenNativeComponent');
|
||||
import type { ViewProps } from 'ViewPropTypes';
|
||||
import type { NativeComponentType } from 'codegenNativeComponent';
|
||||
type ModuleProps = $ReadOnly<{|
|
||||
...ViewProps
|
||||
|}>;
|
||||
type NativeType = NativeComponentType<ModuleProps>;
|
||||
interface NativeCommands {
|
||||
+pause: (viewRef: React.ElementRef<NativeType>) => void,
|
||||
+play: (viewRef: React.ElementRef<NativeType>) => void,
|
||||
}
|
||||
const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');
|
||||
let nativeComponentName = 'Module';
|
||||
export const __INTERNAL_VIEW_CONFIG = {
|
||||
uiViewClassName: \\"Module\\",
|
||||
validAttributes: {}
|
||||
};
|
||||
export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);"
|
||||
`;
|
||||
|
||||
exports[`Babel plugin inline view configs can inline config for CommandsWithTypeCastCoverageNativeComponent.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
const codegenNativeCommands = require('codegenNativeCommands');
|
||||
const codegenNativeComponent = require('codegenNativeComponent');
|
||||
import type { ViewProps } from 'ViewPropTypes';
|
||||
import type { NativeComponentType } from 'codegenNativeComponent';
|
||||
type ModuleProps = $ReadOnly<{|
|
||||
...ViewProps
|
||||
|}>;
|
||||
type NativeType = NativeComponentType<ModuleProps>;
|
||||
interface NativeCommands {
|
||||
+mute: (viewRef: React.ElementRef<NativeType>) => void,
|
||||
+unmute: (viewRef: React.ElementRef<NativeType>) => void,
|
||||
}
|
||||
const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');
|
||||
let nativeComponentName = 'Module';
|
||||
export const __INTERNAL_VIEW_CONFIG = {
|
||||
uiViewClassName: \\"Module\\",
|
||||
validAttributes: {}
|
||||
};
|
||||
export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);"
|
||||
`;
|
||||
|
||||
exports[`Babel plugin inline view configs can inline config for FullNativeComponent.js 1`] = `
|
||||
"// @flow
|
||||
|
||||
@@ -153,6 +225,61 @@ exports[`Babel plugin inline view configs fails on inline config for CommandsExp
|
||||
24 |"
|
||||
`;
|
||||
|
||||
exports[`Babel plugin inline view configs fails on inline config for CommandsWithComplexCoverageInvalidNativeComponent.js 1`] = `
|
||||
"/CommandsWithComplexCoverageInvalidNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands.
|
||||
14 |
|
||||
15 | // Complex coverage instrumentation with invalid nested structure - should fail
|
||||
> 16 | export const Commands = (
|
||||
| ^
|
||||
17 | cov_xyz789().f[1]++,
|
||||
18 | cov_xyz789().s[2]++,
|
||||
19 | {"
|
||||
`;
|
||||
|
||||
exports[`Babel plugin inline view configs fails on inline config for CommandsWithCoverageInvalidNativeComponent.js 1`] = `
|
||||
"/CommandsWithCoverageInvalidNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands.
|
||||
14 |
|
||||
15 | // Coverage instrumentation of invalid Commands export - should still fail
|
||||
> 16 | export const Commands = (cov_1234567890().s[0]++, {
|
||||
| ^
|
||||
17 | hotspotUpdate: () => {},
|
||||
18 | scrollTo: () => {},
|
||||
19 | });"
|
||||
`;
|
||||
|
||||
exports[`Babel plugin inline view configs fails on inline config for CommandsWithCoverageTypeCastInvalidNativeComponent.js 1`] = `
|
||||
"/CommandsWithCoverageTypeCastInvalidNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands.
|
||||
19 |
|
||||
20 | // Coverage instrumentation with type cast but wrong function - should fail
|
||||
> 21 | export const Commands: NativeCommands = (cov_cast123().s[0]++, invalidFunction({
|
||||
| ^
|
||||
22 | supportedCommands: ['pause', 'play'],
|
||||
23 | }));
|
||||
24 |"
|
||||
`;
|
||||
|
||||
exports[`Babel plugin inline view configs fails on inline config for CommandsWithCoverageWrongFunctionNativeComponent.js 1`] = `
|
||||
"/CommandsWithCoverageWrongFunctionNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands.
|
||||
14 |
|
||||
15 | // Coverage instrumentation of wrong function call - should fail
|
||||
> 16 | export const Commands = (cov_abcdef123().s[0]++, someOtherFunction({
|
||||
| ^
|
||||
17 | supportedCommands: ['pause', 'play'],
|
||||
18 | }));
|
||||
19 |"
|
||||
`;
|
||||
|
||||
exports[`Babel plugin inline view configs fails on inline config for CommandsWithCoverageWrongNameNativeComponent.js 1`] = `
|
||||
"/CommandsWithCoverageWrongNameNativeComponent.js: Native commands must be exported with the name 'Commands'
|
||||
20 |
|
||||
21 | // Coverage instrumentation with correct function but wrong export name - should fail
|
||||
> 22 | export const WrongName = (cov_wrong123().s[0]++, codegenNativeCommands<NativeCommands>({
|
||||
| ^
|
||||
23 | supportedCommands: ['pause', 'play'],
|
||||
24 | }));
|
||||
25 |"
|
||||
`;
|
||||
|
||||
exports[`Babel plugin inline view configs fails on inline config for OtherCommandsExportNativeComponent.js 1`] = `
|
||||
"/OtherCommandsExportNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands.
|
||||
17 | }
|
||||
|
||||
@@ -102,6 +102,58 @@ function isCodegenDeclaration(declaration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function isCodegenNativeCommandsDeclaration(declaration) {
|
||||
if (!declaration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handle direct calls: codegenNativeCommands()
|
||||
if (
|
||||
declaration.type === 'CallExpression' &&
|
||||
declaration.callee &&
|
||||
declaration.callee.type === 'Identifier' &&
|
||||
declaration.callee.name === 'codegenNativeCommands'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle coverage instrumentation: (cov_xxx().s[0]++, codegenNativeCommands())
|
||||
if (declaration.type === 'SequenceExpression' && declaration.expressions) {
|
||||
// Get the last expression in the sequence (the actual function call)
|
||||
const lastExpression =
|
||||
declaration.expressions[declaration.expressions.length - 1];
|
||||
// Recursively check if the last expression is a valid codegenNativeCommands call
|
||||
return isCodegenNativeCommandsDeclaration(lastExpression);
|
||||
}
|
||||
|
||||
// Handle Flow type casts: (codegenNativeCommands(): NativeCommands)
|
||||
if (
|
||||
(declaration.type === 'TypeCastExpression' ||
|
||||
declaration.type === 'AsExpression') &&
|
||||
declaration.expression &&
|
||||
declaration.expression.type === 'CallExpression' &&
|
||||
declaration.expression.callee &&
|
||||
declaration.expression.callee.type === 'Identifier' &&
|
||||
declaration.expression.callee.name === 'codegenNativeCommands'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle TypeScript assertions: codegenNativeCommands() as NativeCommands
|
||||
if (
|
||||
declaration.type === 'TSAsExpression' &&
|
||||
declaration.expression &&
|
||||
declaration.expression.type === 'CallExpression' &&
|
||||
declaration.expression.callee &&
|
||||
declaration.expression.callee.type === 'Identifier' &&
|
||||
declaration.expression.callee.name === 'codegenNativeCommands'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = function ({parse, types: t}) {
|
||||
return {
|
||||
pre(state) {
|
||||
@@ -125,12 +177,12 @@ module.exports = function ({parse, types: t}) {
|
||||
const firstDeclaration = path.node.declaration.declarations[0];
|
||||
|
||||
if (firstDeclaration.type === 'VariableDeclarator') {
|
||||
if (
|
||||
firstDeclaration.init &&
|
||||
firstDeclaration.init.type === 'CallExpression' &&
|
||||
firstDeclaration.init.callee.type === 'Identifier' &&
|
||||
firstDeclaration.init.callee.name === 'codegenNativeCommands'
|
||||
) {
|
||||
// Check if this is a valid codegenNativeCommands call, handling type annotations
|
||||
const isValidCommandsExport = isCodegenNativeCommandsDeclaration(
|
||||
firstDeclaration.init,
|
||||
);
|
||||
|
||||
if (isValidCommandsExport) {
|
||||
if (
|
||||
firstDeclaration.id.type === 'Identifier' &&
|
||||
firstDeclaration.id.name !== 'Commands'
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
"bugs": "https://github.com/facebook/react-native/issues",
|
||||
"main": "index.js",
|
||||
"devDependencies": {
|
||||
"babel-plugin-syntax-hermes-parser": "0.31.2",
|
||||
"hermes-eslint": "0.31.2"
|
||||
"babel-plugin-syntax-hermes-parser": "0.32.0",
|
||||
"hermes-eslint": "0.32.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 20.19.4"
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
"source-map-support": "0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-plugin-syntax-hermes-parser": "0.31.2",
|
||||
"hermes-eslint": "0.31.2"
|
||||
"babel-plugin-syntax-hermes-parser": "0.32.0",
|
||||
"hermes-eslint": "0.32.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 20.19.4"
|
||||
|
||||
@@ -45,3 +45,7 @@ tasks.named("ktfmtFormat") {
|
||||
":shared:ktfmtFormat",
|
||||
)
|
||||
}
|
||||
|
||||
// We intentionally disable the `ktfmtCheck` tasks as the formatting is primarly handled inside
|
||||
// fbsource
|
||||
allprojects { tasks.withType<com.ncorti.ktfmt.gradle.tasks.KtfmtCheckTask>() { enabled = false } }
|
||||
|
||||
@@ -68,7 +68,8 @@ tasks.withType<KotlinCompile>().configureEach {
|
||||
// See comment above on JDK 11 support
|
||||
jvmTarget.set(JvmTarget.JVM_11)
|
||||
allWarningsAsErrors.set(
|
||||
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false)
|
||||
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -208,7 +208,8 @@ abstract class ReactExtension @Inject constructor(val project: Project) {
|
||||
} else {
|
||||
buildTypes.forEach { buildType ->
|
||||
result.add(
|
||||
(dependencyConfiguration ?: "${buildType}Implementation") to ":$nameCleansed")
|
||||
(dependencyConfiguration ?: "${buildType}Implementation") to ":$nameCleansed"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-3
@@ -112,7 +112,8 @@ class ReactPlugin : Plugin<Project> {
|
||||
********************************************************************************
|
||||
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
exitProcess(1)
|
||||
}
|
||||
}
|
||||
@@ -186,7 +187,8 @@ class ReactPlugin : Plugin<Project> {
|
||||
// We want to exclude the build directory, to don't pick them up for execution
|
||||
// avoidance.
|
||||
tree.exclude("**/build/**/*")
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
val needsCodegenFromPackageJson = project.needsCodegenFromPackageJson(rootExtension.root)
|
||||
it.onlyIf { (isLibrary || needsCodegenFromPackageJson) && !includesGeneratedCode }
|
||||
@@ -303,7 +305,8 @@ class ReactPlugin : Plugin<Project> {
|
||||
project.extensions.getByType(ApplicationAndroidComponentsExtension::class.java).apply {
|
||||
onVariants(selector().all()) { variant ->
|
||||
variant.sources.java?.addStaticSourceDirectory(
|
||||
generatedAutolinkingJavaDir.get().asFile.absolutePath)
|
||||
generatedAutolinkingJavaDir.get().asFile.absolutePath
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-5
@@ -59,10 +59,12 @@ class ReactRootProjectPlugin : Plugin<Project> {
|
||||
}
|
||||
|
||||
private fun checkLegacyArchProperty(project: Project) {
|
||||
if ((project.hasProperty(PropertyUtils.NEW_ARCH_ENABLED) &&
|
||||
!project.property(PropertyUtils.NEW_ARCH_ENABLED).toString().toBoolean()) ||
|
||||
(project.hasProperty(PropertyUtils.SCOPED_NEW_ARCH_ENABLED) &&
|
||||
!project.property(PropertyUtils.SCOPED_NEW_ARCH_ENABLED).toString().toBoolean())) {
|
||||
if (
|
||||
(project.hasProperty(PropertyUtils.NEW_ARCH_ENABLED) &&
|
||||
!project.property(PropertyUtils.NEW_ARCH_ENABLED).toString().toBoolean()) ||
|
||||
(project.hasProperty(PropertyUtils.SCOPED_NEW_ARCH_ENABLED) &&
|
||||
!project.property(PropertyUtils.SCOPED_NEW_ARCH_ENABLED).toString().toBoolean())
|
||||
) {
|
||||
project.logger.error(
|
||||
"""
|
||||
********************************************************************************
|
||||
@@ -77,7 +79,8 @@ class ReactRootProjectPlugin : Plugin<Project> {
|
||||
********************************************************************************
|
||||
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -54,9 +54,11 @@ internal fun Project.configureReactTasks(variant: Variant, config: ReactExtensio
|
||||
|
||||
configureNewArchPackagingOptions(project, config, variant)
|
||||
configureJsEnginePackagingOptions(config, variant, isHermesEnabledInThisVariant, useThirdPartyJSC)
|
||||
if (!isHermesEnabledInThisVariant &&
|
||||
!useThirdPartyJSC &&
|
||||
rootProject.name != "react-native-github") {
|
||||
if (
|
||||
!isHermesEnabledInThisVariant &&
|
||||
!useThirdPartyJSC &&
|
||||
rootProject.name != "react-native-github"
|
||||
) {
|
||||
showJSCRemovalMessage(project)
|
||||
}
|
||||
|
||||
|
||||
+6
-3
@@ -39,12 +39,15 @@ abstract class PrivateReactExtension @Inject constructor(project: Project) {
|
||||
// - We're inside a user project, so inside the ./android folder. Default should be
|
||||
// ../
|
||||
// User can always override this default by setting a `root =` inside the template.
|
||||
if (project.rootProject.name == "react-native-github" ||
|
||||
project.rootProject.name == "react-native-build-from-source") {
|
||||
if (
|
||||
project.rootProject.name == "react-native-github" ||
|
||||
project.rootProject.name == "react-native-build-from-source"
|
||||
) {
|
||||
project.rootProject.layout.projectDirectory.dir("../../")
|
||||
} else {
|
||||
project.rootProject.layout.projectDirectory.dir("../")
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
val reactNativeDir: DirectoryProperty =
|
||||
objects.directoryProperty().convention(root.dir("node_modules/react-native"))
|
||||
|
||||
+72
-72
@@ -165,88 +165,88 @@ abstract class GenerateAutolinkingNewArchitecturesFileTask : DefaultTask() {
|
||||
// language=cmake
|
||||
val CMAKE_TEMPLATE =
|
||||
"""
|
||||
# This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin)
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||
|
||||
# We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so
|
||||
# or link against a old prefab target (this is needed for React Native 0.76 on).
|
||||
set(REACTNATIVE_MERGED_SO true)
|
||||
|
||||
{{ libraryIncludes }}
|
||||
|
||||
set(AUTOLINKED_LIBRARIES
|
||||
{{ libraryModules }}
|
||||
)
|
||||
"""
|
||||
# This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin)
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||
|
||||
# We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so
|
||||
# or link against a old prefab target (this is needed for React Native 0.76 on).
|
||||
set(REACTNATIVE_MERGED_SO true)
|
||||
|
||||
{{ libraryIncludes }}
|
||||
|
||||
set(AUTOLINKED_LIBRARIES
|
||||
{{ libraryModules }}
|
||||
)
|
||||
"""
|
||||
.trimIndent()
|
||||
|
||||
// language=cpp
|
||||
val CPP_TEMPLATE =
|
||||
"""
|
||||
/**
|
||||
* This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "autolinking.h"
|
||||
{{ autolinkingCppIncludes }}
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
std::shared_ptr<TurboModule> autolinking_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) {
|
||||
{{ autolinkingCppTurboModuleJavaProviders }}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<TurboModule> autolinking_cxxModuleProvider(const std::string moduleName, const std::shared_ptr<CallInvoker>& jsInvoker) {
|
||||
{{ autolinkingCppTurboModuleCxxProviders }}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void autolinking_registerProviders(std::shared_ptr<ComponentDescriptorProviderRegistry const> providerRegistry) {
|
||||
{{ autolinkingCppComponentDescriptors }}
|
||||
return;
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
"""
|
||||
/**
|
||||
* This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "autolinking.h"
|
||||
{{ autolinkingCppIncludes }}
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
std::shared_ptr<TurboModule> autolinking_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) {
|
||||
{{ autolinkingCppTurboModuleJavaProviders }}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<TurboModule> autolinking_cxxModuleProvider(const std::string moduleName, const std::shared_ptr<CallInvoker>& jsInvoker) {
|
||||
{{ autolinkingCppTurboModuleCxxProviders }}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void autolinking_registerProviders(std::shared_ptr<ComponentDescriptorProviderRegistry const> providerRegistry) {
|
||||
{{ autolinkingCppComponentDescriptors }}
|
||||
return;
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
"""
|
||||
.trimIndent()
|
||||
|
||||
// language=cpp
|
||||
val hTemplate =
|
||||
"""
|
||||
/**
|
||||
* This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ReactCommon/CallInvoker.h>
|
||||
#include <ReactCommon/JavaTurboModule.h>
|
||||
#include <ReactCommon/TurboModule.h>
|
||||
#include <jsi/jsi.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
std::shared_ptr<TurboModule> autolinking_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms);
|
||||
std::shared_ptr<TurboModule> autolinking_cxxModuleProvider(const std::string moduleName, const std::shared_ptr<CallInvoker>& jsInvoker);
|
||||
void autolinking_registerProviders(std::shared_ptr<ComponentDescriptorProviderRegistry const> providerRegistry);
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
"""
|
||||
/**
|
||||
* This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ReactCommon/CallInvoker.h>
|
||||
#include <ReactCommon/JavaTurboModule.h>
|
||||
#include <ReactCommon/TurboModule.h>
|
||||
#include <jsi/jsi.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
std::shared_ptr<TurboModule> autolinking_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms);
|
||||
std::shared_ptr<TurboModule> autolinking_cxxModuleProvider(const std::string moduleName, const std::shared_ptr<CallInvoker>& jsInvoker);
|
||||
void autolinking_registerProviders(std::shared_ptr<ComponentDescriptorProviderRegistry const> providerRegistry);
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
"""
|
||||
.trimIndent()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -82,6 +82,7 @@ abstract class GenerateCodegenArtifactsTask : Exec() {
|
||||
libraryName,
|
||||
"--javaPackageName",
|
||||
codegenJavaPackageName,
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -69,6 +69,7 @@ abstract class GenerateCodegenSchemaTask : Exec() {
|
||||
"NativeSampleTurboModule",
|
||||
generatedSchemaFile.get().asFile.cliPath(workingDir),
|
||||
jsRootDir.asFile.get().cliPath(workingDir),
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+46
-44
@@ -32,17 +32,19 @@ abstract class GenerateEntryPointTask : DefaultTask() {
|
||||
JsonUtils.fromAutolinkingConfigJson(autolinkInputFile.get().asFile)
|
||||
?: error(
|
||||
"""
|
||||
RNGP - Autolinking: Could not parse autolinking config file:
|
||||
${autolinkInputFile.get().asFile.absolutePath}
|
||||
|
||||
The file is either missing or not containing valid JSON so the build won't succeed.
|
||||
"""
|
||||
.trimIndent())
|
||||
RNGP - Autolinking: Could not parse autolinking config file:
|
||||
${autolinkInputFile.get().asFile.absolutePath}
|
||||
|
||||
The file is either missing or not containing valid JSON so the build won't succeed.
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val packageName =
|
||||
model.project?.android?.packageName
|
||||
?: error(
|
||||
"RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field.")
|
||||
"RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field."
|
||||
)
|
||||
val generatedFileContents = composeFileContent(packageName)
|
||||
|
||||
val outputDir = generatedOutputDirectory.get().asFile
|
||||
@@ -62,45 +64,45 @@ abstract class GenerateEntryPointTask : DefaultTask() {
|
||||
// language=java
|
||||
val generatedFileContentsTemplate =
|
||||
"""
|
||||
package com.facebook.react;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
|
||||
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
|
||||
import com.facebook.react.views.view.WindowUtilKt;
|
||||
import com.facebook.react.soloader.OpenSourceMergedSoMapping;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* This class is the entry point for loading React Native using the configuration
|
||||
* that the users specifies in their .gradle files.
|
||||
*
|
||||
* The `loadReactNative(this)` method invocation should be called inside the
|
||||
* application onCreate otherwise the app won't load correctly.
|
||||
*/
|
||||
public class ReactNativeApplicationEntryPoint {
|
||||
public static void loadReactNative(Context context) {
|
||||
try {
|
||||
SoLoader.init(context, OpenSourceMergedSoMapping.INSTANCE);
|
||||
} catch (IOException error) {
|
||||
throw new RuntimeException(error);
|
||||
}
|
||||
|
||||
if ({{packageName}}.BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
||||
DefaultNewArchitectureEntryPoint.load();
|
||||
}
|
||||
|
||||
if ({{packageName}}.BuildConfig.IS_EDGE_TO_EDGE_ENABLED) {
|
||||
WindowUtilKt.setEdgeToEdgeFeatureFlagOn();
|
||||
package com.facebook.react;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
|
||||
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
|
||||
import com.facebook.react.views.view.WindowUtilKt;
|
||||
import com.facebook.react.soloader.OpenSourceMergedSoMapping;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* This class is the entry point for loading React Native using the configuration
|
||||
* that the users specifies in their .gradle files.
|
||||
*
|
||||
* The `loadReactNative(this)` method invocation should be called inside the
|
||||
* application onCreate otherwise the app won't load correctly.
|
||||
*/
|
||||
public class ReactNativeApplicationEntryPoint {
|
||||
public static void loadReactNative(Context context) {
|
||||
try {
|
||||
SoLoader.init(context, OpenSourceMergedSoMapping.INSTANCE);
|
||||
} catch (IOException error) {
|
||||
throw new RuntimeException(error);
|
||||
}
|
||||
|
||||
if ({{packageName}}.BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
||||
DefaultNewArchitectureEntryPoint.load();
|
||||
}
|
||||
|
||||
if ({{packageName}}.BuildConfig.IS_EDGE_TO_EDGE_ENABLED) {
|
||||
WindowUtilKt.setEdgeToEdgeFeatureFlagOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
"""
|
||||
.trimIndent()
|
||||
}
|
||||
}
|
||||
|
||||
+72
-70
@@ -34,17 +34,19 @@ abstract class GeneratePackageListTask : DefaultTask() {
|
||||
JsonUtils.fromAutolinkingConfigJson(autolinkInputFile.get().asFile)
|
||||
?: error(
|
||||
"""
|
||||
RNGP - Autolinking: Could not parse autolinking config file:
|
||||
${autolinkInputFile.get().asFile.absolutePath}
|
||||
|
||||
The file is either missing or not containing valid JSON so the build won't succeed.
|
||||
"""
|
||||
.trimIndent())
|
||||
RNGP - Autolinking: Could not parse autolinking config file:
|
||||
${autolinkInputFile.get().asFile.absolutePath}
|
||||
|
||||
The file is either missing or not containing valid JSON so the build won't succeed.
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val packageName =
|
||||
model.project?.android?.packageName
|
||||
?: error(
|
||||
"RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field.")
|
||||
"RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field."
|
||||
)
|
||||
|
||||
val androidPackages = filterAndroidPackages(model)
|
||||
val packageImports = composePackageImports(packageName, androidPackages)
|
||||
@@ -134,69 +136,69 @@ abstract class GeneratePackageListTask : DefaultTask() {
|
||||
// language=java
|
||||
val generatedFileContentsTemplate =
|
||||
"""
|
||||
package com.facebook.react;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.shell.MainPackageConfig;
|
||||
import com.facebook.react.shell.MainReactPackage;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
|
||||
{{ packageImports }}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class PackageList {
|
||||
private Application application;
|
||||
private ReactNativeHost reactNativeHost;
|
||||
private MainPackageConfig mConfig;
|
||||
|
||||
public PackageList(ReactNativeHost reactNativeHost) {
|
||||
this(reactNativeHost, null);
|
||||
}
|
||||
|
||||
public PackageList(Application application) {
|
||||
this(application, null);
|
||||
}
|
||||
|
||||
public PackageList(ReactNativeHost reactNativeHost, MainPackageConfig config) {
|
||||
this.reactNativeHost = reactNativeHost;
|
||||
mConfig = config;
|
||||
}
|
||||
|
||||
public PackageList(Application application, MainPackageConfig config) {
|
||||
this.reactNativeHost = null;
|
||||
this.application = application;
|
||||
mConfig = config;
|
||||
}
|
||||
|
||||
private ReactNativeHost getReactNativeHost() {
|
||||
return this.reactNativeHost;
|
||||
}
|
||||
|
||||
private Resources getResources() {
|
||||
return this.getApplication().getResources();
|
||||
}
|
||||
|
||||
private Application getApplication() {
|
||||
if (this.reactNativeHost == null) return this.application;
|
||||
return this.reactNativeHost.getApplication();
|
||||
}
|
||||
|
||||
private Context getApplicationContext() {
|
||||
return this.getApplication().getApplicationContext();
|
||||
}
|
||||
|
||||
public ArrayList<ReactPackage> getPackages() {
|
||||
return new ArrayList<>(Arrays.<ReactPackage>asList(
|
||||
new MainReactPackage(mConfig){{ packageClassInstances }}
|
||||
));
|
||||
}
|
||||
}
|
||||
"""
|
||||
package com.facebook.react;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.shell.MainPackageConfig;
|
||||
import com.facebook.react.shell.MainReactPackage;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
|
||||
{{ packageImports }}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class PackageList {
|
||||
private Application application;
|
||||
private ReactNativeHost reactNativeHost;
|
||||
private MainPackageConfig mConfig;
|
||||
|
||||
public PackageList(ReactNativeHost reactNativeHost) {
|
||||
this(reactNativeHost, null);
|
||||
}
|
||||
|
||||
public PackageList(Application application) {
|
||||
this(application, null);
|
||||
}
|
||||
|
||||
public PackageList(ReactNativeHost reactNativeHost, MainPackageConfig config) {
|
||||
this.reactNativeHost = reactNativeHost;
|
||||
mConfig = config;
|
||||
}
|
||||
|
||||
public PackageList(Application application, MainPackageConfig config) {
|
||||
this.reactNativeHost = null;
|
||||
this.application = application;
|
||||
mConfig = config;
|
||||
}
|
||||
|
||||
private ReactNativeHost getReactNativeHost() {
|
||||
return this.reactNativeHost;
|
||||
}
|
||||
|
||||
private Resources getResources() {
|
||||
return this.getApplication().getResources();
|
||||
}
|
||||
|
||||
private Application getApplication() {
|
||||
if (this.reactNativeHost == null) return this.application;
|
||||
return this.reactNativeHost.getApplication();
|
||||
}
|
||||
|
||||
private Context getApplicationContext() {
|
||||
return this.getApplication().getApplicationContext();
|
||||
}
|
||||
|
||||
public ArrayList<ReactPackage> getPackages() {
|
||||
return new ArrayList<>(Arrays.<ReactPackage>asList(
|
||||
new MainReactPackage(mConfig){{ packageClassInstances }}
|
||||
));
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -54,7 +54,8 @@ abstract class BuildCodegenCLITask : Exec() {
|
||||
windowsAwareBashCommandLine(
|
||||
codegenDir.asFile.get().canonicalPath.unixifyPath().plus(BUILD_SCRIPT_PATH),
|
||||
bashWindowsHome = bashWindowsHome.orNull,
|
||||
))
|
||||
)
|
||||
)
|
||||
super.exec()
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -29,8 +29,10 @@ abstract class CustomExecTask : Exec() {
|
||||
@get:Input @get:Optional abstract val onlyIfProvidedPathDoesNotExists: Property<String>
|
||||
|
||||
override fun exec() {
|
||||
if (onlyIfProvidedPathDoesNotExists.isPresent &&
|
||||
File(onlyIfProvidedPathDoesNotExists.get()).exists()) {
|
||||
if (
|
||||
onlyIfProvidedPathDoesNotExists.isPresent &&
|
||||
File(onlyIfProvidedPathDoesNotExists.get()).exists()
|
||||
) {
|
||||
return
|
||||
}
|
||||
if (standardOutputFile.isPresent) {
|
||||
|
||||
+2
-1
@@ -64,7 +64,8 @@ abstract class PrepareGflagsTask : DefaultTask() {
|
||||
.replace(Regex("@GFLAGS_NAMESPACE@"), "gflags")
|
||||
.replace(
|
||||
Regex(
|
||||
"@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@"),
|
||||
"@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@"
|
||||
),
|
||||
"1",
|
||||
)
|
||||
.replace(Regex("@([A-Z0-9_]+)@"), "1")
|
||||
|
||||
+2
-1
@@ -61,7 +61,8 @@ abstract class PrepareGlogTask : DefaultTask() {
|
||||
"ac_cv___attribute___noreturn" to "__attribute__ ((noreturn))",
|
||||
"ac_cv___attribute___printf_4_5" to
|
||||
"__attribute__((__format__ (__printf__, 4, 5)))",
|
||||
)),
|
||||
)
|
||||
),
|
||||
ReplaceTokens::class.java,
|
||||
)
|
||||
matchedFile.path = (matchedFile.name.removeSuffix(".in"))
|
||||
|
||||
+9
-8
@@ -39,7 +39,8 @@ internal object BackwardCompatUtils {
|
||||
|
||||
********************************************************************************
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,14 +56,14 @@ internal object BackwardCompatUtils {
|
||||
val message =
|
||||
"""
|
||||
|
||||
=============== JavaScriptCore is being moved ===============
|
||||
JavaScriptCore has been extracted from react-native core
|
||||
and will be removed in a future release. It can now be
|
||||
installed from `@react-native-community/javascriptcore`
|
||||
See: https://github.com/react-native-community/javascriptcore
|
||||
=============================================================
|
||||
=============== JavaScriptCore is being moved ===============
|
||||
JavaScriptCore has been extracted from react-native core
|
||||
and will be removed in a future release. It can now be
|
||||
installed from `@react-native-community/javascriptcore`
|
||||
See: https://github.com/react-native-community/javascriptcore
|
||||
=============================================================
|
||||
|
||||
"""
|
||||
"""
|
||||
.trimIndent()
|
||||
project.logger.warn(message)
|
||||
hasShownJSCRemovalMessage = true
|
||||
|
||||
+10
-5
@@ -33,7 +33,8 @@ internal object DependencyUtils {
|
||||
val exclusiveEnterpriseRepository = project.rootProject.exclusiveEnterpriseRepository()
|
||||
if (exclusiveEnterpriseRepository != null) {
|
||||
project.logger.lifecycle(
|
||||
"Replacing ALL Maven Repositories with: $exclusiveEnterpriseRepository")
|
||||
"Replacing ALL Maven Repositories with: $exclusiveEnterpriseRepository"
|
||||
)
|
||||
}
|
||||
|
||||
project.rootProject.allprojects { eachProject ->
|
||||
@@ -135,26 +136,30 @@ internal object DependencyUtils {
|
||||
"com.facebook.react:react-native",
|
||||
"${groupString}:react-android:${versionString}",
|
||||
"The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210.",
|
||||
))
|
||||
)
|
||||
)
|
||||
dependencySubstitution.add(
|
||||
Triple(
|
||||
"com.facebook.react:hermes-engine",
|
||||
"${groupString}:hermes-android:${versionString}",
|
||||
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210.",
|
||||
))
|
||||
)
|
||||
)
|
||||
if (groupString != DEFAULT_INTERNAL_PUBLISHING_GROUP) {
|
||||
dependencySubstitution.add(
|
||||
Triple(
|
||||
"com.facebook.react:react-android",
|
||||
"${groupString}:react-android:${versionString}",
|
||||
"The react-android dependency was modified to use the correct Maven group.",
|
||||
))
|
||||
)
|
||||
)
|
||||
dependencySubstitution.add(
|
||||
Triple(
|
||||
"com.facebook.react:hermes-android",
|
||||
"${groupString}:hermes-android:${versionString}",
|
||||
"The hermes-android dependency was modified to use the correct Maven group.",
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
return dependencySubstitution
|
||||
}
|
||||
|
||||
+7
-5
@@ -45,7 +45,8 @@ internal object NdkConfiguratorUtils {
|
||||
}
|
||||
if (cmakeArgs.none { it.startsWith("-DREACT_ANDROID_DIR") }) {
|
||||
cmakeArgs.add(
|
||||
"-DREACT_ANDROID_DIR=${extension.reactNativeDir.file("ReactAndroid").get().asFile}")
|
||||
"-DREACT_ANDROID_DIR=${extension.reactNativeDir.file("ReactAndroid").get().asFile}"
|
||||
)
|
||||
}
|
||||
if (cmakeArgs.none { it.startsWith("-DANDROID_STL") }) {
|
||||
cmakeArgs.add("-DANDROID_STL=c++_shared")
|
||||
@@ -86,7 +87,8 @@ internal object NdkConfiguratorUtils {
|
||||
"**/libjsi.so",
|
||||
// AGP will give priority of libc++_shared coming from App modules.
|
||||
"**/libc++_shared.so",
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,17 +120,17 @@ internal object NdkConfiguratorUtils {
|
||||
hermesEnabled -> {
|
||||
excludes.add("**/libjsc.so")
|
||||
excludes.add("**/libjsctooling.so")
|
||||
includes.add("**/libhermes.so")
|
||||
includes.add("**/libhermesvm.so")
|
||||
includes.add("**/libhermestooling.so")
|
||||
}
|
||||
useThirdPartyJSC -> {
|
||||
excludes.add("**/libhermes.so")
|
||||
excludes.add("**/libhermesvm.so")
|
||||
excludes.add("**/libhermestooling.so")
|
||||
excludes.add("**/libjsctooling.so")
|
||||
includes.add("**/libjsc.so")
|
||||
}
|
||||
else -> {
|
||||
excludes.add("**/libhermes.so")
|
||||
excludes.add("**/libhermesvm.so")
|
||||
excludes.add("**/libhermestooling.so")
|
||||
includes.add("**/libjsc.so")
|
||||
includes.add("**/libjsctooling.so")
|
||||
|
||||
+11
-8
@@ -105,13 +105,14 @@ private fun detectCliFile(reactNativeRoot: File, preconfiguredCliFile: File?): F
|
||||
|
||||
error(
|
||||
"""
|
||||
Couldn't determine CLI location!
|
||||
Couldn't determine CLI location!
|
||||
|
||||
Please set `react { cliFile = file(...) }` inside your
|
||||
build.gradle to the path of the react-native cli.js file.
|
||||
This file typically resides in `node_modules/react-native/cli.js`
|
||||
"""
|
||||
.trimIndent())
|
||||
Please set `react { cliFile = file(...) }` inside your
|
||||
build.gradle to the path of the react-native cli.js file.
|
||||
This file typically resides in `node_modules/react-native/cli.js`
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,7 +161,8 @@ internal fun detectOSAwareHermesCommand(projectRoot: File, hermesCommand: String
|
||||
error(
|
||||
"Couldn't determine Hermesc location. " +
|
||||
"Please set `react.hermesCommand` to the path of the hermesc binary file. " +
|
||||
"node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc")
|
||||
"node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +188,8 @@ internal fun getHermesOSBin(): String {
|
||||
if (Os.isLinuxAmd64()) return "linux64-bin"
|
||||
error(
|
||||
"OS not recognized. Please set project.react.hermesCommand " +
|
||||
"to the path of a working Hermes compiler.")
|
||||
"to the path of a working Hermes compiler."
|
||||
)
|
||||
}
|
||||
|
||||
internal fun projectPathToLibraryName(projectPath: String): String =
|
||||
|
||||
+129
-122
@@ -23,11 +23,12 @@ class ReactExtensionTest {
|
||||
val validJsonFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0"
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0"
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val deps = getGradleDependenciesToApply(validJsonFile)
|
||||
assertThat(deps).isEmpty()
|
||||
@@ -38,23 +39,24 @@ class ReactExtensionTest {
|
||||
val validJsonFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react"
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val deps = getGradleDependenciesToApply(validJsonFile)
|
||||
assertThat(deps).containsExactly("implementation" to ":react-native_oss-library-example")
|
||||
@@ -65,24 +67,25 @@ class ReactExtensionTest {
|
||||
val validJsonFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react",
|
||||
"dependencyConfiguration": "compileOnly"
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react",
|
||||
"dependencyConfiguration": "compileOnly"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val deps = getGradleDependenciesToApply(validJsonFile)
|
||||
assertThat(deps).containsExactly("compileOnly" to ":react-native_oss-library-example")
|
||||
@@ -93,24 +96,25 @@ class ReactExtensionTest {
|
||||
val validJsonFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react",
|
||||
"buildTypes": ["debug", "release"]
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react",
|
||||
"buildTypes": ["debug", "release"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val deps = getGradleDependenciesToApply(validJsonFile)
|
||||
assertThat(deps)
|
||||
@@ -125,33 +129,34 @@ class ReactExtensionTest {
|
||||
val validJsonFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react"
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react"
|
||||
}
|
||||
}
|
||||
},
|
||||
"@react-native/another-library-for-testing": {
|
||||
"root": "./node_modules/@react-native/another-library-for-testing",
|
||||
"name": "@react-native/another-library-for-testing",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@react-native/another-library-for-testing": {
|
||||
"root": "./node_modules/@react-native/another-library-for-testing",
|
||||
"name": "@react-native/another-library-for-testing",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val deps = getGradleDependenciesToApply(validJsonFile)
|
||||
assertThat(deps)
|
||||
@@ -166,26 +171,27 @@ class ReactExtensionTest {
|
||||
val validJsonFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"ios": {
|
||||
"podspecPath": "./node_modules/@react-native/oss-library-example/oss-library-example.podspec",
|
||||
"version": "0.0.0",
|
||||
"configurations": [],
|
||||
"scriptPhases": []
|
||||
},
|
||||
"android": null
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"ios": {
|
||||
"podspecPath": "./node_modules/@react-native/oss-library-example/oss-library-example.podspec",
|
||||
"version": "0.0.0",
|
||||
"configurations": [],
|
||||
"scriptPhases": []
|
||||
},
|
||||
"android": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val deps = getGradleDependenciesToApply(validJsonFile)
|
||||
assertThat(deps).isEmpty()
|
||||
@@ -196,34 +202,35 @@ class ReactExtensionTest {
|
||||
val validJsonFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/android-example",
|
||||
"name": "@react-native/android-example",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react"
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/android-example",
|
||||
"name": "@react-native/android-example",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react"
|
||||
}
|
||||
}
|
||||
},
|
||||
"@react-native/another-library-for-testing": {
|
||||
"root": "./node_modules/@react-native/cxx-testing",
|
||||
"name": "@react-native/cxx-testing",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react",
|
||||
"isPureCxxDependency": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@react-native/another-library-for-testing": {
|
||||
"root": "./node_modules/@react-native/cxx-testing",
|
||||
"name": "@react-native/cxx-testing",
|
||||
"platforms": {
|
||||
"android": {
|
||||
"sourceDir": "src/main/java",
|
||||
"packageImportPath": "com.facebook.react",
|
||||
"isPureCxxDependency": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val deps = getGradleDependenciesToApply(validJsonFile)
|
||||
assertThat(deps).containsExactly("implementation" to ":react-native_android-example")
|
||||
|
||||
+2
-1
@@ -41,7 +41,8 @@ class ModelAutolinkingDependenciesJsonTest {
|
||||
"@this*is~a(more)complicated/example!of~weird)packages",
|
||||
null,
|
||||
)
|
||||
.nameCleansed)
|
||||
.nameCleansed
|
||||
)
|
||||
.isEqualTo("this_is_a_more_complicated_example_of_weird_packages")
|
||||
}
|
||||
}
|
||||
|
||||
+16
-8
@@ -72,9 +72,11 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
|
||||
name = "a-dependency",
|
||||
platforms =
|
||||
ModelAutolinkingDependenciesPlatformJson(android = null),
|
||||
)),
|
||||
)
|
||||
),
|
||||
project = null,
|
||||
))
|
||||
)
|
||||
)
|
||||
assertThat(result).isEmpty()
|
||||
}
|
||||
|
||||
@@ -101,9 +103,11 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
|
||||
name = "a-dependency",
|
||||
platforms =
|
||||
ModelAutolinkingDependenciesPlatformJson(android = android),
|
||||
)),
|
||||
)
|
||||
),
|
||||
project = null,
|
||||
))
|
||||
)
|
||||
)
|
||||
assertThat(result).containsExactly(android)
|
||||
}
|
||||
|
||||
@@ -130,7 +134,8 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
|
||||
|
||||
)
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -160,7 +165,8 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
|
||||
another_cxxModule
|
||||
)
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -204,7 +210,8 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -260,7 +267,8 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-2
@@ -148,7 +148,8 @@ class GenerateCodegenArtifactsTaskTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
val task =
|
||||
@@ -177,7 +178,8 @@ class GenerateCodegenArtifactsTaskTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
val task =
|
||||
|
||||
+2
-1
@@ -86,6 +86,7 @@ class GenerateEntryPointTaskTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+20
-10
@@ -64,7 +64,8 @@ class GeneratePackageListTaskTest {
|
||||
// @react-native/another-package
|
||||
import com.facebook.react.anotherPackage;
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -88,7 +89,8 @@ class GeneratePackageListTaskTest {
|
||||
new APackage(),
|
||||
new AnotherPackage()
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -147,9 +149,11 @@ class GeneratePackageListTaskTest {
|
||||
name = "a-dependency",
|
||||
platforms =
|
||||
ModelAutolinkingDependenciesPlatformJson(android = null),
|
||||
)),
|
||||
)
|
||||
),
|
||||
project = null,
|
||||
))
|
||||
)
|
||||
)
|
||||
assertThat(result)
|
||||
.isEqualTo(emptyMap<String, ModelAutolinkingDependenciesPlatformAndroidJson>())
|
||||
}
|
||||
@@ -177,9 +181,11 @@ class GeneratePackageListTaskTest {
|
||||
name = "a-dependency",
|
||||
platforms =
|
||||
ModelAutolinkingDependenciesPlatformJson(android = android),
|
||||
)),
|
||||
)
|
||||
),
|
||||
project = null,
|
||||
))
|
||||
)
|
||||
)
|
||||
assertThat(result.entries.size).isEqualTo(1)
|
||||
assertThat(result["a-dependency"]).isEqualTo(android)
|
||||
}
|
||||
@@ -208,9 +214,11 @@ class GeneratePackageListTaskTest {
|
||||
name = "a-pure-cxx-dependency",
|
||||
platforms =
|
||||
ModelAutolinkingDependenciesPlatformJson(android = android),
|
||||
)),
|
||||
)
|
||||
),
|
||||
project = null,
|
||||
))
|
||||
)
|
||||
)
|
||||
assertThat(result)
|
||||
.isEqualTo(emptyMap<String, ModelAutolinkingDependenciesPlatformAndroidJson>())
|
||||
}
|
||||
@@ -289,7 +297,8 @@ class GeneratePackageListTaskTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -371,7 +380,8 @@ class GeneratePackageListTaskTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
private val testDependencies =
|
||||
|
||||
+2
-1
@@ -26,7 +26,8 @@ class PrepareBoostTaskTest {
|
||||
assertThatThrownBy { task.taskAction() }
|
||||
.isInstanceOf(IllegalStateException::class.java)
|
||||
.hasMessage(
|
||||
"Cannot query the value of task ':PrepareBoostTask' property 'boostVersion' because it has no value available.")
|
||||
"Cannot query the value of task ':PrepareBoostTask' property 'boostVersion' because it has no value available."
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-1
@@ -125,7 +125,8 @@ typedef unsigned __int64 uint64;
|
||||
#endif
|
||||
|
||||
} // namespace GFLAGS_NAMESPACE
|
||||
""")
|
||||
"""
|
||||
)
|
||||
}
|
||||
File(gflagspath, "gflags-1.0.0/src/config.h.in").apply {
|
||||
parentFile.mkdirs()
|
||||
|
||||
+13
-8
@@ -55,7 +55,8 @@ class PreparePrefabHeadersTaskTest {
|
||||
createTestTask<PreparePrefabHeadersTask>(project = project) {
|
||||
it.outputDir.set(outputDir)
|
||||
it.input.set(
|
||||
listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix)))
|
||||
listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix))
|
||||
)
|
||||
}
|
||||
|
||||
task.taskAction()
|
||||
@@ -76,7 +77,8 @@ class PreparePrefabHeadersTaskTest {
|
||||
createTestTask<PreparePrefabHeadersTask>(project = project) {
|
||||
it.outputDir.set(outputDir)
|
||||
it.input.set(
|
||||
listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix)))
|
||||
listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix))
|
||||
)
|
||||
}
|
||||
|
||||
task.taskAction()
|
||||
@@ -102,7 +104,8 @@ class PreparePrefabHeadersTaskTest {
|
||||
"sample_library",
|
||||
listOf("input/component1/" to "", "input/component2/" to ""),
|
||||
),
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
task.taskAction()
|
||||
@@ -125,7 +128,8 @@ class PreparePrefabHeadersTaskTest {
|
||||
listOf(
|
||||
PrefabPreprocessingEntry("libraryone", "input/lib1/" to ""),
|
||||
PrefabPreprocessingEntry("librarytwo", "input/lib2/" to ""),
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
task.taskAction()
|
||||
@@ -155,7 +159,8 @@ class PreparePrefabHeadersTaskTest {
|
||||
"librarytwo",
|
||||
listOf("input/lib2/" to "", "input/shared/" to "shared/"),
|
||||
),
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
task.taskAction()
|
||||
@@ -181,9 +186,9 @@ class PreparePrefabHeadersTaskTest {
|
||||
|
||||
val project = createProject(projectDir = tempFolder.root)
|
||||
val task =
|
||||
createTestTask<PreparePrefabHeadersTask>(project = project) {
|
||||
it.outputDir.set(outputDir)
|
||||
it.input.set(listOf(PrefabPreprocessingEntry("sample_library", "boost/" to "")))
|
||||
createTestTask<PreparePrefabHeadersTask>(project = project) { task ->
|
||||
task.outputDir.set(outputDir)
|
||||
task.input.set(listOf(PrefabPreprocessingEntry("sample_library", "boost/" to "")))
|
||||
}
|
||||
|
||||
task.taskAction()
|
||||
|
||||
+4
-2
@@ -37,7 +37,8 @@ class AgpConfiguratorUtilsTest {
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
</manifest>
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
val actual = getPackageNameFromManifest(manifest)
|
||||
@@ -55,7 +56,8 @@ class AgpConfiguratorUtilsTest {
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.facebook.react" >
|
||||
</manifest>
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
val actual = getPackageNameFromManifest(manifest)
|
||||
|
||||
+46
-23
@@ -40,7 +40,8 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
project.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == localMavenURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNotNull()
|
||||
}
|
||||
|
||||
@@ -54,7 +55,8 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
project.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNotNull()
|
||||
}
|
||||
|
||||
@@ -68,7 +70,8 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
project.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNotNull()
|
||||
}
|
||||
|
||||
@@ -82,7 +85,8 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
project.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNotNull()
|
||||
}
|
||||
|
||||
@@ -96,7 +100,8 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
project.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNotNull()
|
||||
}
|
||||
|
||||
@@ -116,7 +121,8 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
project.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNotNull()
|
||||
}
|
||||
|
||||
@@ -131,7 +137,8 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
project.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNull()
|
||||
|
||||
// We test both with scoped and unscoped property
|
||||
@@ -143,7 +150,8 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
project.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNull()
|
||||
}
|
||||
|
||||
@@ -158,7 +166,8 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
project.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNotNull()
|
||||
|
||||
// We test both with scoped and unscoped property
|
||||
@@ -170,7 +179,8 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
project.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNotNull()
|
||||
}
|
||||
|
||||
@@ -226,12 +236,14 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
appProject.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNotNull()
|
||||
assertThat(
|
||||
libProject.repositories.firstOrNull {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isNotNull()
|
||||
}
|
||||
|
||||
@@ -254,7 +266,8 @@ class DependencyUtilsTest {
|
||||
assertThat(
|
||||
libProject.repositories.count {
|
||||
it is MavenArtifactRepository && it.url == repositoryURI
|
||||
})
|
||||
}
|
||||
)
|
||||
.isEqualTo(2)
|
||||
}
|
||||
|
||||
@@ -332,13 +345,15 @@ class DependencyUtilsTest {
|
||||
assertThat("com.facebook.react:react-android:0.42.0")
|
||||
.isEqualTo(dependencySubstitutions[0].second)
|
||||
assertThat(
|
||||
"The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210.")
|
||||
"The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210."
|
||||
)
|
||||
.isEqualTo(dependencySubstitutions[0].third)
|
||||
assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first)
|
||||
assertThat("com.facebook.react:hermes-android:0.42.0")
|
||||
.isEqualTo(dependencySubstitutions[1].second)
|
||||
assertThat(
|
||||
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210.")
|
||||
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210."
|
||||
)
|
||||
.isEqualTo(dependencySubstitutions[1].third)
|
||||
}
|
||||
|
||||
@@ -349,12 +364,14 @@ class DependencyUtilsTest {
|
||||
assertThat("com.facebook.react:react-native").isEqualTo(dependencySubstitutions[0].first)
|
||||
assertThat("io.github.test:react-android:0.42.0").isEqualTo(dependencySubstitutions[0].second)
|
||||
assertThat(
|
||||
"The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210.")
|
||||
"The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210."
|
||||
)
|
||||
.isEqualTo(dependencySubstitutions[0].third)
|
||||
assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first)
|
||||
assertThat("io.github.test:hermes-android:0.42.0").isEqualTo(dependencySubstitutions[1].second)
|
||||
assertThat(
|
||||
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210.")
|
||||
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210."
|
||||
)
|
||||
.isEqualTo(dependencySubstitutions[1].third)
|
||||
assertThat("com.facebook.react:react-android").isEqualTo(dependencySubstitutions[2].first)
|
||||
assertThat("io.github.test:react-android:0.42.0").isEqualTo(dependencySubstitutions[2].second)
|
||||
@@ -375,7 +392,8 @@ class DependencyUtilsTest {
|
||||
VERSION_NAME=1000.0.0
|
||||
ANOTHER_PROPERTY=true
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
val versionString = readVersionAndGroupStrings(propertiesFile).first
|
||||
@@ -392,7 +410,8 @@ class DependencyUtilsTest {
|
||||
VERSION_NAME=0.0.0-20221101-2019-cfe811ab1
|
||||
ANOTHER_PROPERTY=true
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
val versionString = readVersionAndGroupStrings(propertiesFile).first
|
||||
@@ -408,7 +427,8 @@ class DependencyUtilsTest {
|
||||
"""
|
||||
ANOTHER_PROPERTY=true
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
val versionString = readVersionAndGroupStrings(propertiesFile).first
|
||||
@@ -424,7 +444,8 @@ class DependencyUtilsTest {
|
||||
VERSION_NAME=
|
||||
ANOTHER_PROPERTY=true
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
val versionString = readVersionAndGroupStrings(propertiesFile).first
|
||||
@@ -440,7 +461,8 @@ class DependencyUtilsTest {
|
||||
react.internal.publishingGroup=io.github.test
|
||||
ANOTHER_PROPERTY=true
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
val groupString = readVersionAndGroupStrings(propertiesFile).second
|
||||
@@ -456,7 +478,8 @@ class DependencyUtilsTest {
|
||||
"""
|
||||
ANOTHER_PROPERTY=true
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
val groupString = readVersionAndGroupStrings(propertiesFile).second
|
||||
|
||||
+7
-7
@@ -24,8 +24,8 @@ 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
|
||||
@@ -39,8 +39,8 @@ 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
|
||||
@@ -51,8 +51,8 @@ class NdkConfiguratorUtilsTest {
|
||||
useThirdPartyJSC = 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")
|
||||
@@ -68,6 +68,6 @@ class NdkConfiguratorUtilsTest {
|
||||
|
||||
assertThat(includes).containsExactly("**/libjsc.so")
|
||||
assertThat(excludes)
|
||||
.containsExactly("**/libhermes.so", "**/libhermestooling.so", "**/libjsctooling.so")
|
||||
.containsExactly("**/libhermesvm.so", "**/libhermestooling.so", "**/libjsctooling.so")
|
||||
}
|
||||
}
|
||||
|
||||
+10
-5
@@ -147,7 +147,8 @@ class PathUtilsTest {
|
||||
tempFolder.newFolder("node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/")
|
||||
val expected =
|
||||
tempFolder.newFile(
|
||||
"node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc")
|
||||
"node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc"
|
||||
)
|
||||
|
||||
assertThat(detectOSAwareHermesCommand(tempFolder.root, "")).isEqualTo(expected.toString())
|
||||
}
|
||||
@@ -189,7 +190,8 @@ class PathUtilsTest {
|
||||
tempFolder.newFolder("node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/")
|
||||
val expected =
|
||||
tempFolder.newFile(
|
||||
"node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc")
|
||||
"node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc"
|
||||
)
|
||||
tempFolder.newFolder("node_modules/react-native/sdks/hermesc/osx-bin/")
|
||||
tempFolder.newFile("node_modules/react-native/sdks/hermesc/osx-bin/hermesc")
|
||||
|
||||
@@ -203,7 +205,8 @@ class PathUtilsTest {
|
||||
File(
|
||||
tempFolder.root,
|
||||
"node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc",
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -214,7 +217,8 @@ class PathUtilsTest {
|
||||
File(
|
||||
tempFolder.root,
|
||||
"node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc.exe",
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -311,7 +315,8 @@ class PathUtilsTest {
|
||||
"codegenConfig": {}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
val project = ProjectBuilder.builder().withProjectDir(moduleFolder).build()
|
||||
project.plugins.apply("com.android.library")
|
||||
|
||||
+4
-2
@@ -128,7 +128,8 @@ class ProjectUtilsTest {
|
||||
"codegenConfig": {}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
extension.root.set(tempFolder.root)
|
||||
assertThat(project.needsCodegenFromPackageJson(extension.root)).isTrue()
|
||||
@@ -146,7 +147,8 @@ class ProjectUtilsTest {
|
||||
"name": "a-library"
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
extension.root.set(tempFolder.root)
|
||||
assertThat(project.needsCodegenFromPackageJson(extension.root)).isFalse()
|
||||
|
||||
@@ -58,7 +58,8 @@ tasks.withType<KotlinCompile>().configureEach {
|
||||
// See comment above on JDK 11 support
|
||||
jvmTarget.set(JvmTarget.JVM_11)
|
||||
allWarningsAsErrors.set(
|
||||
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false)
|
||||
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -158,9 +158,8 @@ abstract class ReactSettingsExtension @Inject constructor(val settings: Settings
|
||||
logger.error(message)
|
||||
if (cacheJsonConfig.length() != 0L) {
|
||||
logger.error(
|
||||
cacheJsonConfig
|
||||
.readText()
|
||||
.substring(0, min(1024, cacheJsonConfig.length().toInt())))
|
||||
cacheJsonConfig.readText().substring(0, min(1024, cacheJsonConfig.length().toInt()))
|
||||
)
|
||||
}
|
||||
cacheJsonConfig.delete()
|
||||
throw GradleException(message)
|
||||
|
||||
+103
-93
@@ -29,11 +29,12 @@ class ReactSettingsExtensionTest {
|
||||
val validFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"value": "¯\\_(ツ)_/¯"
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
{
|
||||
"value": "¯\\_(ツ)_/¯"
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
assertThat(computeSha256(validFile))
|
||||
.isEqualTo("838aa9a72a16fdd55b0d49b510a82e264a30f59333b5fdd97c7798a29146f6a8")
|
||||
}
|
||||
@@ -43,11 +44,12 @@ class ReactSettingsExtensionTest {
|
||||
val validJsonFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0"
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0"
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val map = getLibrariesToAutolink(validJsonFile)
|
||||
assertThat(map.keys).isEmpty()
|
||||
@@ -58,41 +60,42 @@ class ReactSettingsExtensionTest {
|
||||
val validJsonFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"ios": {
|
||||
"podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec",
|
||||
"version": "0.0.1",
|
||||
"configurations": [],
|
||||
"scriptPhases": []
|
||||
},
|
||||
"android": {
|
||||
"sourceDir": "./node_modules/@react-native/oss-library-example/android",
|
||||
"packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;",
|
||||
"packageInstance": "new OSSLibraryExamplePackage()",
|
||||
"buildTypes": ["staging", "debug", "release"],
|
||||
"libraryName": "OSSLibraryExampleSpec",
|
||||
"componentDescriptors": [
|
||||
"SampleNativeComponentComponentDescriptor"
|
||||
],
|
||||
"cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt",
|
||||
"cxxModuleCMakeListsModuleName": null,
|
||||
"cxxModuleCMakeListsPath": null,
|
||||
"cxxModuleHeaderName": null,
|
||||
"dependencyConfiguration": "implementation",
|
||||
"isPureCxxDependency": false
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"ios": {
|
||||
"podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec",
|
||||
"version": "0.0.1",
|
||||
"configurations": [],
|
||||
"scriptPhases": []
|
||||
},
|
||||
"android": {
|
||||
"sourceDir": "./node_modules/@react-native/oss-library-example/android",
|
||||
"packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;",
|
||||
"packageInstance": "new OSSLibraryExamplePackage()",
|
||||
"buildTypes": ["staging", "debug", "release"],
|
||||
"libraryName": "OSSLibraryExampleSpec",
|
||||
"componentDescriptors": [
|
||||
"SampleNativeComponentComponentDescriptor"
|
||||
],
|
||||
"cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt",
|
||||
"cxxModuleCMakeListsModuleName": null,
|
||||
"cxxModuleCMakeListsPath": null,
|
||||
"cxxModuleHeaderName": null,
|
||||
"dependencyConfiguration": "implementation",
|
||||
"isPureCxxDependency": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val map = getLibrariesToAutolink(validJsonFile)
|
||||
assertThat(map.keys).containsExactly(":react-native_oss-library-example")
|
||||
@@ -105,25 +108,26 @@ class ReactSettingsExtensionTest {
|
||||
val validJsonFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"ios": {
|
||||
"podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec",
|
||||
"version": "0.0.1",
|
||||
"configurations": [],
|
||||
"scriptPhases": []
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"ios": {
|
||||
"podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec",
|
||||
"version": "0.0.1",
|
||||
"configurations": [],
|
||||
"scriptPhases": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val map = getLibrariesToAutolink(validJsonFile)
|
||||
assertThat(map.keys).isEmpty()
|
||||
@@ -258,7 +262,8 @@ class ReactSettingsExtensionTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
tempFolder.newFile("yarn.lock").apply { writeText("I'm a lockfile") }
|
||||
val lockfileCollection = project.files("yarn.lock")
|
||||
@@ -311,7 +316,8 @@ class ReactSettingsExtensionTest {
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
tempFolder.newFile("yarn.lock").apply { writeText("I'm a lockfile") }
|
||||
val lockfileCollection = project.files("yarn.lock")
|
||||
@@ -356,9 +362,10 @@ class ReactSettingsExtensionTest {
|
||||
val invalidConfigFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{}
|
||||
"""
|
||||
.trimIndent())
|
||||
{}
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles))
|
||||
.isTrue()
|
||||
@@ -377,11 +384,12 @@ class ReactSettingsExtensionTest {
|
||||
val invalidConfigFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0"
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0"
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles))
|
||||
.isTrue()
|
||||
@@ -400,12 +408,13 @@ class ReactSettingsExtensionTest {
|
||||
val invalidConfigFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles))
|
||||
.isTrue()
|
||||
@@ -424,25 +433,26 @@ class ReactSettingsExtensionTest {
|
||||
val invalidConfigFile =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"ios": {
|
||||
"podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec",
|
||||
"version": "0.0.1",
|
||||
"configurations": [],
|
||||
"scriptPhases": []
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"ios": {
|
||||
"podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec",
|
||||
"version": "0.0.1",
|
||||
"configurations": [],
|
||||
"scriptPhases": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles))
|
||||
.isTrue()
|
||||
|
||||
@@ -31,7 +31,8 @@ tasks.withType<KotlinCompile>().configureEach {
|
||||
// See comment above on JDK 11 support
|
||||
jvmTarget.set(JvmTarget.JVM_11)
|
||||
allWarningsAsErrors.set(
|
||||
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false)
|
||||
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ tasks.withType<KotlinCompile>().configureEach {
|
||||
// See comment above on JDK 11 support
|
||||
jvmTarget.set(JvmTarget.JVM_11)
|
||||
allWarningsAsErrors.set(
|
||||
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false)
|
||||
project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+159
-139
@@ -39,20 +39,21 @@ class JsonUtilsTest {
|
||||
val oldJsonConfig =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"name": "yet another npm package",
|
||||
"codegenConfig": {
|
||||
"libraries": [
|
||||
{
|
||||
"name": "an awesome library",
|
||||
"jsSrcsDir": "../js/",
|
||||
"android": {}
|
||||
"name": "yet another npm package",
|
||||
"codegenConfig": {
|
||||
"libraries": [
|
||||
{
|
||||
"name": "an awesome library",
|
||||
"jsSrcsDir": "../js/",
|
||||
"android": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val parsed = JsonUtils.fromPackageJson(oldJsonConfig)!!
|
||||
|
||||
@@ -66,21 +67,22 @@ class JsonUtilsTest {
|
||||
val validJson =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"name": "yet another npm package",
|
||||
"codegenConfig": {
|
||||
"name": "an awesome library",
|
||||
"jsSrcsDir": "../js/",
|
||||
"android": {
|
||||
"javaPackageName": "com.awesome.library"
|
||||
},
|
||||
"ios": {
|
||||
"other ios only keys": "which are ignored during parsing"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
{
|
||||
"name": "yet another npm package",
|
||||
"codegenConfig": {
|
||||
"name": "an awesome library",
|
||||
"jsSrcsDir": "../js/",
|
||||
"android": {
|
||||
"javaPackageName": "com.awesome.library"
|
||||
},
|
||||
"ios": {
|
||||
"other ios only keys": "which are ignored during parsing"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
|
||||
val parsed = JsonUtils.fromPackageJson(validJson)!!
|
||||
|
||||
@@ -111,11 +113,12 @@ class JsonUtilsTest {
|
||||
val validJson =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"version": "1000.0.0"
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
{
|
||||
"version": "1000.0.0"
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
val parsed = JsonUtils.fromPackageJson(validJson)!!
|
||||
|
||||
assertThat("1000.0.0").isEqualTo(parsed.version)
|
||||
@@ -133,11 +136,12 @@ class JsonUtilsTest {
|
||||
val validJson =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0"
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0"
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!!
|
||||
|
||||
assertThat("1000.0.0").isEqualTo(parsed.reactNativeVersion)
|
||||
@@ -148,32 +152,33 @@ class JsonUtilsTest {
|
||||
val validJson =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"project": {
|
||||
"ios": {
|
||||
"sourceDir": "./packages/rn-tester",
|
||||
"xcodeProject": {
|
||||
"name": "RNTesterPods.xcworkspace",
|
||||
"isWorkspace": true
|
||||
},
|
||||
"automaticPodsInstallation": false
|
||||
},
|
||||
"android": {
|
||||
"sourceDir": "./packages/rn-tester",
|
||||
"appName": "RN-Tester",
|
||||
"packageName": "com.facebook.react.uiapp",
|
||||
"applicationId": "com.facebook.react.uiapp",
|
||||
"mainActivity": ".RNTesterActivity",
|
||||
"watchModeCommandParams": [
|
||||
"--mode HermesDebug"
|
||||
],
|
||||
"dependencyConfiguration": "implementation"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"project": {
|
||||
"ios": {
|
||||
"sourceDir": "./packages/rn-tester",
|
||||
"xcodeProject": {
|
||||
"name": "RNTesterPods.xcworkspace",
|
||||
"isWorkspace": true
|
||||
},
|
||||
"automaticPodsInstallation": false
|
||||
},
|
||||
"android": {
|
||||
"sourceDir": "./packages/rn-tester",
|
||||
"appName": "RN-Tester",
|
||||
"packageName": "com.facebook.react.uiapp",
|
||||
"applicationId": "com.facebook.react.uiapp",
|
||||
"mainActivity": ".RNTesterActivity",
|
||||
"watchModeCommandParams": [
|
||||
"--mode HermesDebug"
|
||||
],
|
||||
"dependencyConfiguration": "implementation"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!!
|
||||
|
||||
assertThat("./packages/rn-tester").isEqualTo(parsed.project!!.android!!.sourceDir)
|
||||
@@ -192,36 +197,37 @@ class JsonUtilsTest {
|
||||
val validJson =
|
||||
createJsonFile(
|
||||
"""
|
||||
|
||||
> AwesomeProject@0.0.1 npx
|
||||
> rnc-cli config
|
||||
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"project": {
|
||||
"ios": {
|
||||
"sourceDir": "./packages/rn-tester",
|
||||
"xcodeProject": {
|
||||
"name": "RNTesterPods.xcworkspace",
|
||||
"isWorkspace": true
|
||||
},
|
||||
"automaticPodsInstallation": false
|
||||
},
|
||||
"android": {
|
||||
"sourceDir": "./packages/rn-tester",
|
||||
"appName": "RN-Tester",
|
||||
"packageName": "com.facebook.react.uiapp",
|
||||
"applicationId": "com.facebook.react.uiapp",
|
||||
"mainActivity": ".RNTesterActivity",
|
||||
"watchModeCommandParams": [
|
||||
"--mode HermesDebug"
|
||||
],
|
||||
"dependencyConfiguration": "implementation"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
|
||||
> AwesomeProject@0.0.1 npx
|
||||
> rnc-cli config
|
||||
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"project": {
|
||||
"ios": {
|
||||
"sourceDir": "./packages/rn-tester",
|
||||
"xcodeProject": {
|
||||
"name": "RNTesterPods.xcworkspace",
|
||||
"isWorkspace": true
|
||||
},
|
||||
"automaticPodsInstallation": false
|
||||
},
|
||||
"android": {
|
||||
"sourceDir": "./packages/rn-tester",
|
||||
"appName": "RN-Tester",
|
||||
"packageName": "com.facebook.react.uiapp",
|
||||
"applicationId": "com.facebook.react.uiapp",
|
||||
"mainActivity": ".RNTesterActivity",
|
||||
"watchModeCommandParams": [
|
||||
"--mode HermesDebug"
|
||||
],
|
||||
"dependencyConfiguration": "implementation"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!!
|
||||
|
||||
assertThat("./packages/rn-tester").isEqualTo(parsed.project!!.android!!.sourceDir)
|
||||
@@ -239,41 +245,42 @@ class JsonUtilsTest {
|
||||
val validJson =
|
||||
createJsonFile(
|
||||
"""
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"ios": {
|
||||
"podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec",
|
||||
"version": "0.0.1",
|
||||
"configurations": [],
|
||||
"scriptPhases": []
|
||||
},
|
||||
"android": {
|
||||
"sourceDir": "./node_modules/@react-native/oss-library-example/android",
|
||||
"packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;",
|
||||
"packageInstance": "new OSSLibraryExamplePackage()",
|
||||
"buildTypes": ["staging", "debug", "release"],
|
||||
"libraryName": "OSSLibraryExampleSpec",
|
||||
"componentDescriptors": [
|
||||
"SampleNativeComponentComponentDescriptor"
|
||||
],
|
||||
"cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt",
|
||||
"cxxModuleCMakeListsModuleName": null,
|
||||
"cxxModuleCMakeListsPath": null,
|
||||
"cxxModuleHeaderName": null,
|
||||
"dependencyConfiguration": "implementation",
|
||||
"isPureCxxDependency": false
|
||||
{
|
||||
"reactNativeVersion": "1000.0.0",
|
||||
"dependencies": {
|
||||
"@react-native/oss-library-example": {
|
||||
"root": "./node_modules/@react-native/oss-library-example",
|
||||
"name": "@react-native/oss-library-example",
|
||||
"platforms": {
|
||||
"ios": {
|
||||
"podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec",
|
||||
"version": "0.0.1",
|
||||
"configurations": [],
|
||||
"scriptPhases": []
|
||||
},
|
||||
"android": {
|
||||
"sourceDir": "./node_modules/@react-native/oss-library-example/android",
|
||||
"packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;",
|
||||
"packageInstance": "new OSSLibraryExamplePackage()",
|
||||
"buildTypes": ["staging", "debug", "release"],
|
||||
"libraryName": "OSSLibraryExampleSpec",
|
||||
"componentDescriptors": [
|
||||
"SampleNativeComponentComponentDescriptor"
|
||||
],
|
||||
"cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt",
|
||||
"cxxModuleCMakeListsModuleName": null,
|
||||
"cxxModuleCMakeListsPath": null,
|
||||
"cxxModuleHeaderName": null,
|
||||
"dependencyConfiguration": "implementation",
|
||||
"isPureCxxDependency": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
.trimIndent())
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!!
|
||||
|
||||
assertThat("./node_modules/@react-native/oss-library-example")
|
||||
@@ -287,73 +294,86 @@ class JsonUtilsTest {
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.sourceDir)
|
||||
.sourceDir
|
||||
)
|
||||
assertThat("import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;")
|
||||
.isEqualTo(
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.packageImportPath)
|
||||
.packageImportPath
|
||||
)
|
||||
assertThat("new OSSLibraryExamplePackage()")
|
||||
.isEqualTo(
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.packageInstance)
|
||||
.packageInstance
|
||||
)
|
||||
assertThat(listOf("staging", "debug", "release"))
|
||||
.isEqualTo(
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.buildTypes)
|
||||
.buildTypes
|
||||
)
|
||||
assertThat("OSSLibraryExampleSpec")
|
||||
.isEqualTo(
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.libraryName)
|
||||
.libraryName
|
||||
)
|
||||
assertThat(listOf("SampleNativeComponentComponentDescriptor"))
|
||||
.isEqualTo(
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.componentDescriptors)
|
||||
.componentDescriptors
|
||||
)
|
||||
assertThat(
|
||||
"./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt")
|
||||
"./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt"
|
||||
)
|
||||
.isEqualTo(
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.cmakeListsPath)
|
||||
.cmakeListsPath
|
||||
)
|
||||
assertThat(
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.cxxModuleHeaderName)
|
||||
.cxxModuleHeaderName
|
||||
)
|
||||
.isNull()
|
||||
assertThat(
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.cxxModuleCMakeListsPath)
|
||||
.cxxModuleCMakeListsPath
|
||||
)
|
||||
.isNull()
|
||||
assertThat(
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.cxxModuleCMakeListsModuleName)
|
||||
.cxxModuleCMakeListsModuleName
|
||||
)
|
||||
.isNull()
|
||||
assertThat("implementation")
|
||||
.isEqualTo(
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.dependencyConfiguration)
|
||||
.dependencyConfiguration
|
||||
)
|
||||
assertThat(
|
||||
parsed.dependencies!!["@react-native/oss-library-example"]!!
|
||||
.platforms!!
|
||||
.android!!
|
||||
.isPureCxxDependency!!)
|
||||
.isPureCxxDependency!!
|
||||
)
|
||||
.isFalse()
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
"@babel/plugin-transform-unicode-regex": "^7.24.7",
|
||||
"@babel/template": "^7.25.0",
|
||||
"@react-native/babel-plugin-codegen": "0.82.0-main",
|
||||
"babel-plugin-syntax-hermes-parser": "0.31.2",
|
||||
"babel-plugin-syntax-hermes-parser": "0.32.0",
|
||||
"babel-plugin-transform-flow-enums": "^0.0.2",
|
||||
"react-refresh": "^0.14.0"
|
||||
},
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@react-native/babel-preset": "0.82.0-main",
|
||||
"hermes-parser": "0.31.2",
|
||||
"hermes-parser": "0.32.0",
|
||||
"nullthrows": "^1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/parser": "^7.25.3",
|
||||
"glob": "^7.1.1",
|
||||
"hermes-parser": "0.31.2",
|
||||
"hermes-parser": "0.32.0",
|
||||
"invariant": "^2.2.4",
|
||||
"nullthrows": "^1.1.1",
|
||||
"yargs": "^17.6.2"
|
||||
@@ -45,7 +45,7 @@
|
||||
"@babel/plugin-transform-nullish-coalescing-operator": "^7.24.7",
|
||||
"@babel/plugin-transform-optional-chaining": "^7.24.8",
|
||||
"@babel/preset-env": "^7.25.3",
|
||||
"hermes-estree": "0.31.2",
|
||||
"hermes-estree": "0.32.0",
|
||||
"micromatch": "^4.0.4",
|
||||
"prettier": "3.6.2",
|
||||
"rimraf": "^3.0.2"
|
||||
|
||||
+4
@@ -350,6 +350,8 @@ function setDefaultValue(
|
||||
common.default = ((defaultValue ? defaultValue : 0): number);
|
||||
break;
|
||||
case 'FloatTypeAnnotation':
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
common.default = ((defaultValue === null
|
||||
? null
|
||||
: defaultValue
|
||||
@@ -357,6 +359,8 @@ function setDefaultValue(
|
||||
: 0): number | null);
|
||||
break;
|
||||
case 'BooleanTypeAnnotation':
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
common.default = defaultValue === null ? null : !!defaultValue;
|
||||
break;
|
||||
case 'StringTypeAnnotation':
|
||||
|
||||
@@ -77,6 +77,8 @@ const ActionSheetIOS = {
|
||||
callback: (buttonIndex: number) => void,
|
||||
) {
|
||||
invariant(
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
typeof options === 'object' && options !== null,
|
||||
'Options must be a valid object',
|
||||
);
|
||||
@@ -162,6 +164,8 @@ const ActionSheetIOS = {
|
||||
successCallback: Function | ((success: boolean, method: ?string) => void),
|
||||
) {
|
||||
invariant(
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
typeof options === 'object' && options !== null,
|
||||
'Options must be a valid object',
|
||||
);
|
||||
|
||||
@@ -18,6 +18,8 @@ export class URLSearchParams {
|
||||
}
|
||||
|
||||
constructor(params?: Record<string, string> | string | [string, string][]) {
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
if (params === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1503,7 +1503,7 @@ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {
|
||||
keyboardNeverPersistTaps &&
|
||||
this._keyboardIsDismissible() &&
|
||||
e.target != null &&
|
||||
// $FlowFixMe[incompatible-type]
|
||||
// $FlowFixMe Error supressed during the migration of HostInstance to ReactNativeElement
|
||||
!TextInputState.isTextInput(e.target)
|
||||
) {
|
||||
return true;
|
||||
|
||||
Vendored
-1
@@ -4,7 +4,6 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @fantom_flags enableFixForParentTagDuringReparenting:true
|
||||
* @fantom_flags enableViewCulling:true
|
||||
* @flow strict-local
|
||||
* @format
|
||||
|
||||
@@ -18,6 +18,7 @@ import type {
|
||||
} from '../../Types/CoreEventTypes';
|
||||
import type {ViewProps} from '../View/ViewPropTypes';
|
||||
|
||||
import ReactNativeElement from '../../../src/private/webapis/dom/nodes/ReactNativeElement';
|
||||
import {type ColorValue, type TextStyleProp} from '../../StyleSheet/StyleSheet';
|
||||
import * as React from 'react';
|
||||
|
||||
@@ -1037,13 +1038,19 @@ export type TextInputProps = $ReadOnly<{
|
||||
...TextInputBaseProps,
|
||||
}>;
|
||||
|
||||
export interface TextInputInstance extends HostInstance {
|
||||
+clear: () => void;
|
||||
+isFocused: () => boolean;
|
||||
+getNativeRef: () => ?HostInstance;
|
||||
+setSelection: (start: number, end: number) => void;
|
||||
/**
|
||||
* TextInput monkey-patches the native element instance with these methods.
|
||||
* It isn't technically a class but this is the most elegant way to type it.
|
||||
*/
|
||||
declare class _TextInputInstance extends ReactNativeElement {
|
||||
clear(): void;
|
||||
isFocused(): boolean;
|
||||
getNativeRef(): ?ReactNativeElement;
|
||||
setSelection(start: number, end: number): void;
|
||||
}
|
||||
|
||||
export type TextInputInstance = _TextInputInstance;
|
||||
|
||||
/**
|
||||
* A foundational component for inputting text into the app via a
|
||||
* keyboard. Props provide configurability for several features, such as
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ jest.unmock('../TextInput');
|
||||
throw new Error('Expected `textInputElement` to be non-null');
|
||||
}
|
||||
|
||||
// $FlowFixMe[prop-missing]
|
||||
// $FlowFixMe
|
||||
textInputElement.currentProps = textInputElement.props;
|
||||
expect(textInputElement.isFocused()).toBe(false);
|
||||
|
||||
|
||||
Vendored
+2
@@ -58,10 +58,12 @@ export default class ReactFabricHostComponent implements NativeMethods {
|
||||
}
|
||||
|
||||
blur() {
|
||||
// $FlowFixMe - Error supressed during the migration of HostInstance to ReactNativeElement
|
||||
TextInputState.blurTextInput(this);
|
||||
}
|
||||
|
||||
focus() {
|
||||
// $FlowFixMe - Error supressed during the migration of HostInstance to ReactNativeElement
|
||||
TextInputState.focusTextInput(this);
|
||||
}
|
||||
|
||||
|
||||
-54
@@ -14,7 +14,6 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
|
||||
import type {HostInstance} from 'react-native';
|
||||
|
||||
import ReactNativeElement from '../../../../src/private/webapis/dom/nodes/ReactNativeElement';
|
||||
import {getRawNativeDOMForTests} from '../../../../src/private/webapis/dom/nodes/specs/NativeDOM';
|
||||
import TextInputState from '../../../Components/TextInput/TextInputState';
|
||||
import View from '../../../Components/View/View';
|
||||
import ReactFabricHostComponent from '../ReactFabricHostComponent';
|
||||
@@ -349,58 +348,5 @@ describe('ReactFabricPublicInstance', () => {
|
||||
.toJSX(),
|
||||
).toEqual(<rn-view testID={'second test id'} />);
|
||||
});
|
||||
|
||||
// TODO: delete when NativeDOM.setNativeProps is NOT nullable.
|
||||
// This logic is to ensure compatibility with old app versions without the native module method.
|
||||
if (ReactNativeFeatureFlags.enableAccessToHostTreeInFabric()) {
|
||||
let RawNativeDOM;
|
||||
let originalSetNativeProps;
|
||||
|
||||
beforeAll(() => {
|
||||
RawNativeDOM = nullthrows(getRawNativeDOMForTests());
|
||||
originalSetNativeProps = RawNativeDOM.setNativeProps;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// $FlowExpectedError[cannot-write]
|
||||
RawNativeDOM.setNativeProps = originalSetNativeProps;
|
||||
});
|
||||
|
||||
it('should propagate changes to the host component (when NativeDOM.setNativeProps is not available)', () => {
|
||||
// $FlowExpectedError[cannot-write]
|
||||
RawNativeDOM.setNativeProps = null;
|
||||
|
||||
expect(RawNativeDOM.setNativeProps).toBeNull();
|
||||
|
||||
const root = Fantom.createRoot();
|
||||
const nodeRef = createRef<HostInstance>();
|
||||
|
||||
Fantom.runTask(() => {
|
||||
root.render(<View ref={nodeRef} testID="first test id" />);
|
||||
});
|
||||
|
||||
expect(
|
||||
root
|
||||
.getRenderedOutput({
|
||||
props: ['testID'],
|
||||
})
|
||||
.toJSX(),
|
||||
).toEqual(<rn-view testID={'first test id'} />);
|
||||
|
||||
const element = nullthrows(nodeRef.current);
|
||||
|
||||
Fantom.runTask(() => {
|
||||
element.setNativeProps({testID: 'second test id'});
|
||||
});
|
||||
|
||||
expect(
|
||||
root
|
||||
.getRenderedOutput({
|
||||
props: ['testID'],
|
||||
})
|
||||
.toJSX(),
|
||||
).toEqual(<rn-view testID={'second test id'} />);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+118
-118
@@ -9,19 +9,71 @@
|
||||
*/
|
||||
|
||||
import type {HostInstance} from '../../src/private/types/HostInstance';
|
||||
import type {
|
||||
InternalInstanceHandle,
|
||||
Node,
|
||||
} from '../Renderer/shims/ReactNativeTypes';
|
||||
import typeof ReactFabricType from '../Renderer/shims/ReactFabric';
|
||||
import typeof ReactNativeType from '../Renderer/shims/ReactNative';
|
||||
import type {RootTag} from './RootTag';
|
||||
|
||||
import {
|
||||
onCaughtError,
|
||||
onRecoverableError,
|
||||
onUncaughtError,
|
||||
} from '../../src/private/renderer/errorhandling/ErrorHandlers';
|
||||
import {type RootTag} from './RootTag';
|
||||
import * as React from 'react';
|
||||
|
||||
let cachedFabricRenderer;
|
||||
let cachedPaperRenderer;
|
||||
|
||||
function getFabricRenderer(): ReactFabricType {
|
||||
if (cachedFabricRenderer == null) {
|
||||
cachedFabricRenderer = require('../Renderer/shims/ReactFabric').default;
|
||||
}
|
||||
return cachedFabricRenderer;
|
||||
}
|
||||
|
||||
function getPaperRenderer(): ReactNativeType {
|
||||
if (cachedPaperRenderer == null) {
|
||||
cachedPaperRenderer = require('../Renderer/shims/ReactNative').default;
|
||||
}
|
||||
return cachedPaperRenderer;
|
||||
}
|
||||
|
||||
const getMethod: (<MethodName: $Keys<ReactFabricType>>(
|
||||
() => ReactFabricType,
|
||||
MethodName,
|
||||
) => ReactFabricType[MethodName]) &
|
||||
(<MethodName: $Keys<ReactNativeType>>(
|
||||
() => ReactNativeType,
|
||||
MethodName,
|
||||
) => ReactNativeType[MethodName]) = (getRenderer, methodName) => {
|
||||
let cachedImpl;
|
||||
|
||||
// $FlowExpectedError
|
||||
return function (arg1, arg2, arg3, arg4, arg5, arg6) {
|
||||
if (cachedImpl == null) {
|
||||
// $FlowExpectedError
|
||||
cachedImpl = getRenderer()[methodName];
|
||||
}
|
||||
|
||||
// $FlowExpectedError
|
||||
return cachedImpl(arg1, arg2, arg3, arg4, arg5);
|
||||
};
|
||||
};
|
||||
|
||||
function getFabricMethod<MethodName: $Keys<ReactFabricType>>(
|
||||
methodName: MethodName,
|
||||
): ReactFabricType[MethodName] {
|
||||
return getMethod(getFabricRenderer, methodName);
|
||||
}
|
||||
|
||||
function getPaperMethod<MethodName: $Keys<ReactNativeType>>(
|
||||
methodName: MethodName,
|
||||
): ReactNativeType[MethodName] {
|
||||
return getMethod(getPaperRenderer, methodName);
|
||||
}
|
||||
|
||||
let cachedFabricRender;
|
||||
let cachedPaperRender;
|
||||
|
||||
export function renderElement({
|
||||
element,
|
||||
rootTag,
|
||||
@@ -34,50 +86,30 @@ export function renderElement({
|
||||
useConcurrentRoot: boolean,
|
||||
}): void {
|
||||
if (useFabric) {
|
||||
require('../Renderer/shims/ReactFabric').default.render(
|
||||
element,
|
||||
rootTag,
|
||||
null,
|
||||
useConcurrentRoot,
|
||||
{
|
||||
onCaughtError,
|
||||
onUncaughtError,
|
||||
onRecoverableError,
|
||||
},
|
||||
);
|
||||
if (cachedFabricRender == null) {
|
||||
cachedFabricRender = getFabricRenderer().render;
|
||||
}
|
||||
|
||||
cachedFabricRender(element, rootTag, null, useConcurrentRoot, {
|
||||
onCaughtError,
|
||||
onUncaughtError,
|
||||
onRecoverableError,
|
||||
});
|
||||
} else {
|
||||
require('../Renderer/shims/ReactNative').default.render(
|
||||
element,
|
||||
rootTag,
|
||||
undefined,
|
||||
{
|
||||
onCaughtError,
|
||||
onUncaughtError,
|
||||
onRecoverableError,
|
||||
},
|
||||
);
|
||||
if (cachedPaperRender == null) {
|
||||
cachedPaperRender = getPaperRenderer().render;
|
||||
}
|
||||
|
||||
cachedPaperRender(element, rootTag, undefined, {
|
||||
onCaughtError,
|
||||
onUncaughtError,
|
||||
onRecoverableError,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function findHostInstance_DEPRECATED<TElementType: React.ElementType>(
|
||||
// $FlowFixMe[incompatible-type]
|
||||
componentOrHandle: ?(React.ElementRef<TElementType> | number),
|
||||
): ?HostInstance {
|
||||
return require('../Renderer/shims/ReactNative').default.findHostInstance_DEPRECATED(
|
||||
// $FlowFixMe[incompatible-type]
|
||||
componentOrHandle,
|
||||
);
|
||||
}
|
||||
|
||||
export function findNodeHandle<TElementType: React.ElementType>(
|
||||
// $FlowFixMe[incompatible-type]
|
||||
componentOrHandle: ?(React.ElementRef<TElementType> | number),
|
||||
): ?number {
|
||||
return require('../Renderer/shims/ReactNative').default.findNodeHandle(
|
||||
// $FlowFixMe[incompatible-type]
|
||||
componentOrHandle,
|
||||
);
|
||||
}
|
||||
let cachedFabricDispatchCommand;
|
||||
let cachedPaperDispatchCommand;
|
||||
|
||||
export function dispatchCommand(
|
||||
handle: HostInstance,
|
||||
@@ -87,90 +119,58 @@ export function dispatchCommand(
|
||||
if (global.RN$Bridgeless === true) {
|
||||
// Note: this function has the same implementation in the legacy and new renderer.
|
||||
// However, evaluating the old renderer comes with some side effects.
|
||||
return require('../Renderer/shims/ReactFabric').default.dispatchCommand(
|
||||
handle,
|
||||
command,
|
||||
args,
|
||||
);
|
||||
if (cachedFabricDispatchCommand == null) {
|
||||
cachedFabricDispatchCommand = getFabricRenderer().dispatchCommand;
|
||||
}
|
||||
|
||||
return cachedFabricDispatchCommand(handle, command, args);
|
||||
} else {
|
||||
return require('../Renderer/shims/ReactNative').default.dispatchCommand(
|
||||
handle,
|
||||
command,
|
||||
args,
|
||||
);
|
||||
if (cachedPaperDispatchCommand == null) {
|
||||
cachedPaperDispatchCommand = getPaperRenderer().dispatchCommand;
|
||||
}
|
||||
|
||||
return cachedPaperDispatchCommand(handle, command, args);
|
||||
}
|
||||
}
|
||||
|
||||
export function sendAccessibilityEvent(
|
||||
handle: HostInstance,
|
||||
eventType: string,
|
||||
): void {
|
||||
return require('../Renderer/shims/ReactNative').default.sendAccessibilityEvent(
|
||||
handle,
|
||||
eventType,
|
||||
);
|
||||
}
|
||||
export const findHostInstance_DEPRECATED: <TElementType: React.ElementType>(
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
componentOrHandle: ?(React.ElementRef<TElementType> | number),
|
||||
) => ?HostInstance = getPaperMethod('findHostInstance_DEPRECATED');
|
||||
|
||||
export const findNodeHandle: <TElementType: React.ElementType>(
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
componentOrHandle: ?(React.ElementRef<TElementType> | number),
|
||||
) => ?number = getPaperMethod('findNodeHandle');
|
||||
|
||||
export const sendAccessibilityEvent: ReactNativeType['sendAccessibilityEvent'] =
|
||||
getPaperMethod('sendAccessibilityEvent');
|
||||
|
||||
/**
|
||||
* This method is used by AppRegistry to unmount a root when using the old
|
||||
* React Native renderer (Paper).
|
||||
*/
|
||||
export function unmountComponentAtNodeAndRemoveContainer(rootTag: RootTag) {
|
||||
// $FlowExpectedError[incompatible-type] rootTag is an opaque type so we can't really cast it as is.
|
||||
const rootTagAsNumber: number = rootTag;
|
||||
require('../Renderer/shims/ReactNative').default.unmountComponentAtNodeAndRemoveContainer(
|
||||
rootTagAsNumber,
|
||||
);
|
||||
}
|
||||
export const unmountComponentAtNodeAndRemoveContainer: (
|
||||
rootTag: RootTag,
|
||||
) => void =
|
||||
// $FlowExpectedError[incompatible-type]
|
||||
getPaperMethod('unmountComponentAtNodeAndRemoveContainer');
|
||||
|
||||
export function unstable_batchedUpdates<T>(
|
||||
fn: T => void,
|
||||
bookkeeping: T,
|
||||
): void {
|
||||
// This doesn't actually do anything when batching updates for a Fabric root.
|
||||
return require('../Renderer/shims/ReactNative').default.unstable_batchedUpdates(
|
||||
fn,
|
||||
bookkeeping,
|
||||
);
|
||||
}
|
||||
export const unstable_batchedUpdates: ReactNativeType['unstable_batchedUpdates'] =
|
||||
getPaperMethod('unstable_batchedUpdates');
|
||||
|
||||
export const isChildPublicInstance: ReactNativeType['isChildPublicInstance'] =
|
||||
getPaperMethod('isChildPublicInstance');
|
||||
|
||||
export const getNodeFromInternalInstanceHandle: ReactFabricType['getNodeFromInternalInstanceHandle'] =
|
||||
getFabricMethod('getNodeFromInternalInstanceHandle');
|
||||
|
||||
export const getPublicInstanceFromInternalInstanceHandle: ReactFabricType['getPublicInstanceFromInternalInstanceHandle'] =
|
||||
getFabricMethod('getPublicInstanceFromInternalInstanceHandle');
|
||||
|
||||
export const getPublicInstanceFromRootTag: ReactFabricType['getPublicInstanceFromRootTag'] =
|
||||
getFabricMethod('getPublicInstanceFromRootTag');
|
||||
|
||||
export function isProfilingRenderer(): boolean {
|
||||
return Boolean(__DEV__);
|
||||
}
|
||||
|
||||
export function isChildPublicInstance(
|
||||
parentInstance: HostInstance,
|
||||
childInstance: HostInstance,
|
||||
): boolean {
|
||||
return require('../Renderer/shims/ReactNative').default.isChildPublicInstance(
|
||||
parentInstance,
|
||||
childInstance,
|
||||
);
|
||||
}
|
||||
|
||||
export function getNodeFromInternalInstanceHandle(
|
||||
internalInstanceHandle: InternalInstanceHandle,
|
||||
): ?Node {
|
||||
// This is only available in Fabric
|
||||
return require('../Renderer/shims/ReactFabric').default.getNodeFromInternalInstanceHandle(
|
||||
internalInstanceHandle,
|
||||
);
|
||||
}
|
||||
|
||||
export function getPublicInstanceFromInternalInstanceHandle(
|
||||
internalInstanceHandle: InternalInstanceHandle,
|
||||
): mixed /*PublicInstance | PublicTextInstance | null*/ {
|
||||
// This is only available in Fabric
|
||||
return require('../Renderer/shims/ReactFabric').default.getPublicInstanceFromInternalInstanceHandle(
|
||||
internalInstanceHandle,
|
||||
);
|
||||
}
|
||||
|
||||
export function getPublicInstanceFromRootTag(
|
||||
rootTag: number,
|
||||
): mixed /*PublicRootInstance | null*/ {
|
||||
// This is only available in Fabric
|
||||
return require('../Renderer/shims/ReactFabric').default.getPublicInstanceFromRootTag(
|
||||
rootTag,
|
||||
);
|
||||
}
|
||||
|
||||
+3
-1
@@ -7,7 +7,7 @@
|
||||
* @noformat
|
||||
* @nolint
|
||||
* @flow strict-local
|
||||
* @generated SignedSource<<83073425aa3f71ced2c8c51f25a25938>>
|
||||
* @generated SignedSource<<1f7876c0dc0b05685a730513dc410236>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -82,6 +82,8 @@ export function register(name: string, callback: () => ViewConfig): string {
|
||||
typeof callback === 'function',
|
||||
'View config getter callback for component `%s` must be a function (received `%s`)',
|
||||
name,
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
callback === null ? 'null' : typeof callback,
|
||||
);
|
||||
viewConfigCallbacks.set(name, callback);
|
||||
|
||||
@@ -83,6 +83,8 @@ class Share {
|
||||
options?: ShareOptions = {},
|
||||
): Promise<{action: string, activityType: ?string}> {
|
||||
invariant(
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
typeof content === 'object' && content !== null,
|
||||
'Content to share must be a valid object',
|
||||
);
|
||||
@@ -91,6 +93,8 @@ class Share {
|
||||
'At least one of URL or message is required',
|
||||
);
|
||||
invariant(
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
typeof options === 'object' && options !== null,
|
||||
'Options must be a valid object',
|
||||
);
|
||||
|
||||
@@ -165,6 +165,8 @@ const HMRClient: HMRClientNativeInterface = {
|
||||
// Moving to top gives errors due to NativeModules not being initialized
|
||||
const DevLoadingView = require('./DevLoadingView').default;
|
||||
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
const serverHost = port !== null && port !== '' ? `${host}:${port}` : host;
|
||||
|
||||
const serverScheme = scheme;
|
||||
|
||||
+2
@@ -33,6 +33,8 @@ function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<mixed>>(
|
||||
if (__DEV__) {
|
||||
if (
|
||||
typeof object !== 'object' ||
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
object === null ||
|
||||
Object.isFrozen(object) ||
|
||||
Object.isSealed(object)
|
||||
|
||||
@@ -232,6 +232,8 @@ const WebSocketInterceptor = {
|
||||
|
||||
_arrayBufferToString(data: string): ArrayBuffer | string {
|
||||
const value = base64.toByteArray(data).buffer;
|
||||
/* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
|
||||
* roll out. See https://fburl.com/workplace/5whu3i34. */
|
||||
if (value === undefined || value === null) {
|
||||
return '(no value)';
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ let reactNativeDependencies = BinaryTarget(
|
||||
|
||||
let hermesPrebuilt = BinaryTarget(
|
||||
name: .hermesPrebuilt,
|
||||
path: ".build/artifacts/hermes/destroot/Library/Frameworks/universal/hermes.xcframework",
|
||||
path: ".build/artifacts/hermes/destroot/Library/Frameworks/universal/hermesvm.xcframework",
|
||||
searchPaths: [".build/artifacts/hermes/destroot/include"]
|
||||
)
|
||||
|
||||
@@ -433,6 +433,7 @@ let reactFabricComponents = RNTarget(
|
||||
"components/view/platform/android",
|
||||
"components/view/platform/windows",
|
||||
"components/view/platform/macos",
|
||||
"components/switch/iosswitch/react/renderer/components/switch/MacOSSwitchShadowNode.mm",
|
||||
"components/textinput/platform/android",
|
||||
"components/text/platform/android",
|
||||
"components/textinput/platform/macos",
|
||||
@@ -445,7 +446,7 @@ let reactFabricComponents = RNTarget(
|
||||
"conponents/rncore", // this was the old folder where RN Core Components were generated. If you ran codegen in the past, you might have some files in it that might make the build fail.
|
||||
],
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging],
|
||||
sources: ["components/inputaccessory", "components/modal", "components/safeareaview", "components/text", "components/text/platform/cxx", "components/textinput", "components/textinput/platform/ios/", "components/unimplementedview", "components/virtualview", "components/virtualviewexperimental", "textlayoutmanager", "textlayoutmanager/platform/ios"]
|
||||
sources: ["components/inputaccessory", "components/modal", "components/safeareaview", "components/text", "components/text/platform/cxx", "components/textinput", "components/textinput/platform/ios/", "components/unimplementedview", "components/virtualview", "components/virtualviewexperimental", "textlayoutmanager", "textlayoutmanager/platform/ios", "components/switch/iosswitch"]
|
||||
)
|
||||
|
||||
/// React-FabricImage.podspec
|
||||
|
||||
@@ -53,6 +53,7 @@ RCT_EXTERN CGFloat RCTScreenScale(void);
|
||||
RCT_EXTERN CGFloat RCTFontSizeMultiplier(void);
|
||||
RCT_EXTERN CGSize RCTScreenSize(void);
|
||||
RCT_EXTERN CGSize RCTViewportSize(void);
|
||||
RCT_EXTERN CGSize RCTSwitchSize(void);
|
||||
|
||||
// Round float coordinates to nearest whole screen pixel (not point)
|
||||
RCT_EXTERN CGFloat RCTRoundPixelValue(CGFloat value);
|
||||
|
||||
@@ -410,6 +410,18 @@ CGSize RCTViewportSize(void)
|
||||
return window ? window.bounds.size : RCTScreenSize();
|
||||
}
|
||||
|
||||
CGSize RCTSwitchSize(void)
|
||||
{
|
||||
static CGSize rctSwitchSize;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
RCTUnsafeExecuteOnMainQueueSync(^{
|
||||
rctSwitchSize = [UISwitch new].intrinsicContentSize;
|
||||
});
|
||||
});
|
||||
return rctSwitchSize;
|
||||
}
|
||||
|
||||
CGFloat RCTRoundPixelValue(CGFloat value)
|
||||
{
|
||||
CGFloat scale = RCTScreenScale();
|
||||
|
||||
+1
-1
@@ -134,7 +134,7 @@ using namespace facebook::react;
|
||||
}
|
||||
|
||||
auto imageSource = _state->getData().getImageSource();
|
||||
imageSource.size = {image.size.width, image.size.height};
|
||||
imageSource.size = {.width = image.size.width, .height = image.size.height};
|
||||
|
||||
static_cast<const ImageEventEmitter &>(*_eventEmitter).onLoad(imageSource);
|
||||
static_cast<const ImageEventEmitter &>(*_eventEmitter).onLoadEnd();
|
||||
|
||||
+1
-1
@@ -9,10 +9,10 @@
|
||||
|
||||
#import <React/RCTConversions.h>
|
||||
|
||||
#import <react/renderer/components/FBReactNativeSpec/ComponentDescriptors.h>
|
||||
#import <react/renderer/components/FBReactNativeSpec/EventEmitters.h>
|
||||
#import <react/renderer/components/FBReactNativeSpec/Props.h>
|
||||
#import <react/renderer/components/FBReactNativeSpec/RCTComponentViewHelpers.h>
|
||||
#import <react/renderer/components/switch/AppleSwitchComponentDescriptor.h>
|
||||
|
||||
#import "RCTFabricComponentsPlugins.h"
|
||||
|
||||
|
||||
+1
-1
@@ -734,7 +734,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
||||
toPosition:selectedTextRange.start];
|
||||
NSInteger end = [_backedTextInputView offsetFromPosition:_backedTextInputView.beginningOfDocument
|
||||
toPosition:selectedTextRange.end];
|
||||
return AttributedString::Range{(int)start, (int)(end - start)};
|
||||
return AttributedString::Range{.location = (int)start, .length = (int)(end - start)};
|
||||
}
|
||||
|
||||
- (void)_restoreTextSelection
|
||||
|
||||
@@ -165,7 +165,8 @@ static Class<RCTComponentViewProtocol> RCTComponentViewClassWithName(const char
|
||||
auto componentHandle = reinterpret_cast<ComponentHandle>(componentName);
|
||||
auto constructor = [RCTLegacyViewManagerInteropComponentView componentDescriptorProvider].constructor;
|
||||
|
||||
auto provider = ComponentDescriptorProvider{componentHandle, componentName, flavor, constructor};
|
||||
auto provider = ComponentDescriptorProvider{
|
||||
.handle = componentHandle, .name = componentName, .flavor = flavor, .constructor = constructor};
|
||||
|
||||
_providerRegistry.add(provider);
|
||||
_componentViewClasses[componentHandle] =
|
||||
@@ -179,7 +180,8 @@ static Class<RCTComponentViewProtocol> RCTComponentViewClassWithName(const char
|
||||
auto componentName = ComponentName{flavor->c_str()};
|
||||
auto componentHandle = reinterpret_cast<ComponentHandle>(componentName);
|
||||
auto constructor = [RCTUnimplementedViewComponentView componentDescriptorProvider].constructor;
|
||||
auto provider = ComponentDescriptorProvider{componentHandle, componentName, flavor, constructor};
|
||||
auto provider = ComponentDescriptorProvider{
|
||||
.handle = componentHandle, .name = componentName, .flavor = flavor, .constructor = constructor};
|
||||
|
||||
_providerRegistry.add(provider);
|
||||
_componentViewClasses[componentHandle] =
|
||||
|
||||
@@ -153,7 +153,7 @@ inline CATransform3D RCTCATransform3DFromTransformMatrix(const facebook::react::
|
||||
|
||||
inline facebook::react::Point RCTPointFromCGPoint(const CGPoint &point)
|
||||
{
|
||||
return {point.x, point.y};
|
||||
return {.x = point.x, .y = point.y};
|
||||
}
|
||||
|
||||
inline facebook::react::Float RCTFloatFromCGFloat(CGFloat value)
|
||||
@@ -166,12 +166,12 @@ inline facebook::react::Float RCTFloatFromCGFloat(CGFloat value)
|
||||
|
||||
inline facebook::react::Size RCTSizeFromCGSize(const CGSize &size)
|
||||
{
|
||||
return {RCTFloatFromCGFloat(size.width), RCTFloatFromCGFloat(size.height)};
|
||||
return {.width = RCTFloatFromCGFloat(size.width), .height = RCTFloatFromCGFloat(size.height)};
|
||||
}
|
||||
|
||||
inline facebook::react::Rect RCTRectFromCGRect(const CGRect &rect)
|
||||
{
|
||||
return {RCTPointFromCGPoint(rect.origin), RCTSizeFromCGSize(rect.size)};
|
||||
return {.origin = RCTPointFromCGPoint(rect.origin), .size = RCTSizeFromCGSize(rect.size)};
|
||||
}
|
||||
|
||||
inline facebook::react::EdgeInsets RCTEdgeInsetsFromUIEdgeInsets(const UIEdgeInsets &edgeInsets)
|
||||
|
||||
@@ -207,20 +207,20 @@ static std::vector<ProcessedColorStop> processColorTransitionHints(const std::ve
|
||||
// Position the new color stops
|
||||
if (leftDist > rightDist) {
|
||||
for (int y = 0; y < 7; ++y) {
|
||||
ProcessedColorStop newStop{SharedColor(), offsetLeft + leftDist * ((7.0f + y) / 13.0f)};
|
||||
ProcessedColorStop newStop{.color = SharedColor(), .position = offsetLeft + leftDist * ((7.0f + y) / 13.0f)};
|
||||
newStops.push_back(newStop);
|
||||
}
|
||||
ProcessedColorStop stop1{SharedColor(), offset + rightDist * (1.0f / 3.0f)};
|
||||
ProcessedColorStop stop2{SharedColor(), offset + rightDist * (2.0f / 3.0f)};
|
||||
ProcessedColorStop stop1{.color = SharedColor(), .position = offset + rightDist * (1.0f / 3.0f)};
|
||||
ProcessedColorStop stop2{.color = SharedColor(), .position = offset + rightDist * (2.0f / 3.0f)};
|
||||
newStops.push_back(stop1);
|
||||
newStops.push_back(stop2);
|
||||
} else {
|
||||
ProcessedColorStop stop1{SharedColor(), offsetLeft + leftDist * (1.0f / 3.0f)};
|
||||
ProcessedColorStop stop2{SharedColor(), offsetLeft + leftDist * (2.0f / 3.0f)};
|
||||
ProcessedColorStop stop1{.color = SharedColor(), .position = offsetLeft + leftDist * (1.0f / 3.0f)};
|
||||
ProcessedColorStop stop2{.color = SharedColor(), .position = offsetLeft + leftDist * (2.0f / 3.0f)};
|
||||
newStops.push_back(stop1);
|
||||
newStops.push_back(stop2);
|
||||
for (int y = 0; y < 7; ++y) {
|
||||
ProcessedColorStop newStop{SharedColor(), offset + rightDist * (y / 13.0f)};
|
||||
ProcessedColorStop newStop{.color = SharedColor(), .position = offset + rightDist * (y / 13.0f)};
|
||||
newStops.push_back(newStop);
|
||||
}
|
||||
}
|
||||
@@ -297,7 +297,7 @@ static std::vector<ProcessedColorStop> processColorTransitionHints(const std::ve
|
||||
// largest specified position of any color stop or transition hint before it.
|
||||
if (newPosition.has_value()) {
|
||||
newPosition = std::max(newPosition.value(), maxPositionSoFar.value());
|
||||
fixedColorStops[i] = ProcessedColorStop{colorStop.color, newPosition};
|
||||
fixedColorStops[i] = ProcessedColorStop{.color = colorStop.color, .position = newPosition};
|
||||
maxPositionSoFar = newPosition;
|
||||
} else {
|
||||
hasNullPositions = true;
|
||||
@@ -320,8 +320,8 @@ static std::vector<ProcessedColorStop> processColorTransitionHints(const std::ve
|
||||
if (startPosition.has_value()) {
|
||||
auto increment = (endPosition.value() - startPosition.value()) / (unpositionedStops + 1);
|
||||
for (size_t j = 1; j <= unpositionedStops; j++) {
|
||||
fixedColorStops[lastDefinedIndex + j] =
|
||||
ProcessedColorStop{colorStops[lastDefinedIndex + j].color, startPosition.value() + increment * j};
|
||||
fixedColorStops[lastDefinedIndex + j] = ProcessedColorStop{
|
||||
.color = colorStops[lastDefinedIndex + j].color, .position = startPosition.value() + increment * j};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,8 @@ RadiusVector RadiusToCorner(
|
||||
bool isCircle,
|
||||
RadialGradientSize::SizeKeyword keyword)
|
||||
{
|
||||
std::array<CGPoint, 4> corners = {{{0, 0}, {width, 0}, {width, height}, {0, height}}};
|
||||
std::array<CGPoint, 4> corners = {
|
||||
{{.x = 0, .y = 0}, {.x = width, .y = 0}, {.x = width, .y = height}, {.x = 0, .y = height}}};
|
||||
|
||||
size_t cornerIndex = 0;
|
||||
CGFloat distance = hypot(centerX - corners[cornerIndex].x, centerY - corners[cornerIndex].y);
|
||||
|
||||
@@ -75,6 +75,7 @@ Pod::Spec.new do |s|
|
||||
"react/renderer/components/scrollview/platform/cxx",
|
||||
"react/renderer/components/text/platform/cxx",
|
||||
"react/renderer/components/textinput/platform/ios",
|
||||
"react/renderer/components/switch/iosswitch",
|
||||
]);
|
||||
|
||||
add_dependency(s, "React-graphics", :additional_framework_paths => ["react/renderer/graphics/platform/ios"])
|
||||
|
||||
@@ -119,7 +119,8 @@ using namespace facebook::react;
|
||||
.props([] {
|
||||
auto sharedProps = std::make_shared<RootProps>();
|
||||
auto &props = *sharedProps;
|
||||
props.layoutConstraints = LayoutConstraints{{0, 0}, {500, 500}};
|
||||
props.layoutConstraints = LayoutConstraints{
|
||||
.minimumSize = {.width = 0, .height = 0}, .maximumSize = {.width = 500, .height = 500}};
|
||||
auto &yogaStyle = props.yogaStyle;
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(200));
|
||||
@@ -416,7 +417,8 @@ static ParagraphShadowNode::ConcreteState::Shared stateWithShadowNode(
|
||||
.props([] {
|
||||
auto sharedProps = std::make_shared<RootProps>();
|
||||
auto &props = *sharedProps;
|
||||
props.layoutConstraints = LayoutConstraints{{0, 0}, {500, 500}};
|
||||
props.layoutConstraints = LayoutConstraints{
|
||||
.minimumSize = {.width = 0, .height = 0}, .maximumSize = {.width = 500, .height = 500}};
|
||||
auto &yogaStyle = props.yogaStyle;
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(200));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(200));
|
||||
|
||||
@@ -131,7 +131,7 @@ static UIFont *cachedSystemFont(CGFloat size, RCTFontWeight weight)
|
||||
RCTFontWeight weight;
|
||||
};
|
||||
|
||||
CacheKey key{size, weight};
|
||||
CacheKey key{.size = size, .weight = weight};
|
||||
NSValue *cacheKey = [[NSValue alloc] initWithBytes:&key objCType:@encode(CacheKey)];
|
||||
UIFont *font = [fontCache objectForKey:cacheKey];
|
||||
|
||||
|
||||
@@ -1018,10 +1018,6 @@ public abstract interface class com/facebook/react/bridge/NotThreadSafeBridgeIdl
|
||||
public abstract fun onTransitionToBridgeIdle ()V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/bridge/OnBatchCompleteListener {
|
||||
public abstract fun onBatchComplete ()V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/bridge/PerformanceCounter {
|
||||
public abstract fun getPerformanceCounters ()Ljava/util/Map;
|
||||
public abstract fun profileNextBatch ()V
|
||||
@@ -1863,15 +1859,9 @@ public class com/facebook/react/defaults/DefaultReactActivityDelegate : com/face
|
||||
public final class com/facebook/react/defaults/DefaultReactHost {
|
||||
public static final field INSTANCE Lcom/facebook/react/defaults/DefaultReactHost;
|
||||
public static final fun getDefaultReactHost (Landroid/content/Context;Lcom/facebook/react/ReactNativeHost;Lcom/facebook/react/runtime/JSRuntimeFactory;)Lcom/facebook/react/ReactHost;
|
||||
public static final fun getDefaultReactHost (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/runtime/JSRuntimeFactory;ZLjava/util/List;)Lcom/facebook/react/ReactHost;
|
||||
public static final fun getDefaultReactHost (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/runtime/JSRuntimeFactory;ZLjava/util/List;Lkotlin/jvm/functions/Function1;Lcom/facebook/react/runtime/BindingsInstaller;)Lcom/facebook/react/ReactHost;
|
||||
public static final fun getDefaultReactHost (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;)Lcom/facebook/react/ReactHost;
|
||||
public static final fun getDefaultReactHost (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;Lkotlin/jvm/functions/Function1;Lcom/facebook/react/runtime/BindingsInstaller;)Lcom/facebook/react/ReactHost;
|
||||
public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Lcom/facebook/react/ReactNativeHost;Lcom/facebook/react/runtime/JSRuntimeFactory;ILjava/lang/Object;)Lcom/facebook/react/ReactHost;
|
||||
public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/runtime/JSRuntimeFactory;ZLjava/util/List;ILjava/lang/Object;)Lcom/facebook/react/ReactHost;
|
||||
public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/runtime/JSRuntimeFactory;ZLjava/util/List;Lkotlin/jvm/functions/Function1;Lcom/facebook/react/runtime/BindingsInstaller;ILjava/lang/Object;)Lcom/facebook/react/ReactHost;
|
||||
public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;ILjava/lang/Object;)Lcom/facebook/react/ReactHost;
|
||||
public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;Lkotlin/jvm/functions/Function1;Lcom/facebook/react/runtime/BindingsInstaller;ILjava/lang/Object;)Lcom/facebook/react/ReactHost;
|
||||
}
|
||||
|
||||
public abstract class com/facebook/react/defaults/DefaultReactNativeHost : com/facebook/react/ReactNativeHost {
|
||||
@@ -1973,7 +1963,7 @@ public abstract interface class com/facebook/react/devsupport/DevServerHelper$Pa
|
||||
public abstract fun onPackagerReloadCommand ()V
|
||||
}
|
||||
|
||||
public abstract class com/facebook/react/devsupport/DevSupportManagerBase : com/facebook/react/devsupport/interfaces/DevSupportManager, com/facebook/react/devsupport/interfaces/PerfMonitorV2Handler {
|
||||
public abstract class com/facebook/react/devsupport/DevSupportManagerBase : com/facebook/react/devsupport/interfaces/DevSupportManager {
|
||||
public static final field Companion Lcom/facebook/react/devsupport/DevSupportManagerBase$Companion;
|
||||
public fun <init> (Landroid/content/Context;Lcom/facebook/react/devsupport/ReactInstanceDevHelper;Ljava/lang/String;ZLcom/facebook/react/devsupport/interfaces/RedBoxHandler;Lcom/facebook/react/devsupport/interfaces/DevBundleDownloadListener;ILjava/util/Map;Lcom/facebook/react/common/SurfaceDelegateFactory;Lcom/facebook/react/devsupport/interfaces/DevLoadingViewManager;Lcom/facebook/react/devsupport/interfaces/PausedInDebuggerOverlayManager;)V
|
||||
public fun addCustomDevOption (Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/DevOptionHandler;)V
|
||||
@@ -2031,7 +2021,6 @@ public abstract class com/facebook/react/devsupport/DevSupportManagerBase : com/
|
||||
public fun startInspector ()V
|
||||
public fun stopInspector ()V
|
||||
public fun toggleElementInspector ()V
|
||||
public fun unstable_updatePerfMonitor (Ljava/lang/String;I)V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/devsupport/DevSupportManagerBase$CallbackWithBundleLoader {
|
||||
@@ -4369,7 +4358,6 @@ public class com/facebook/react/uimanager/UIManagerModule : com/facebook/react/b
|
||||
public fun addRootView (Landroid/view/View;Lcom/facebook/react/bridge/WritableMap;)I
|
||||
public fun addUIBlock (Lcom/facebook/react/uimanager/UIBlock;)V
|
||||
public fun addUIManagerEventListener (Lcom/facebook/react/bridge/UIManagerListener;)V
|
||||
public fun addUIManagerListener (Lcom/facebook/react/uimanager/UIManagerModuleListener;)V
|
||||
public fun clearJSResponder ()V
|
||||
public fun configureNextLayoutAnimation (Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/Callback;)V
|
||||
public static fun createConstants (Ljava/util/List;Ljava/util/Map;Ljava/util/Map;)Ljava/util/Map;
|
||||
@@ -4406,7 +4394,6 @@ public class com/facebook/react/uimanager/UIManagerModule : com/facebook/react/b
|
||||
public fun receiveEvent (ILjava/lang/String;Lcom/facebook/react/bridge/WritableMap;)V
|
||||
public fun removeRootView (I)V
|
||||
public fun removeUIManagerEventListener (Lcom/facebook/react/bridge/UIManagerListener;)V
|
||||
public fun removeUIManagerListener (Lcom/facebook/react/uimanager/UIManagerModuleListener;)V
|
||||
public fun resolveCustomDirectEventName (Ljava/lang/String;)Ljava/lang/String;
|
||||
public fun resolveRootTagFromReactTag (I)I
|
||||
public fun resolveView (I)Landroid/view/View;
|
||||
|
||||
@@ -74,7 +74,14 @@ val GLOG_VERSION = libs.versions.glog.get()
|
||||
|
||||
val preparePrefab by
|
||||
tasks.registering(PreparePrefabHeadersTask::class) {
|
||||
dependsOn(prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog)
|
||||
dependsOn(
|
||||
prepareBoost,
|
||||
prepareDoubleConversion,
|
||||
prepareFastFloat,
|
||||
prepareFmt,
|
||||
prepareFolly,
|
||||
prepareGlog,
|
||||
)
|
||||
dependsOn("generateCodegenArtifactsFromSchema")
|
||||
// To export to a ReactNativePrefabProcessingEntities.kt once all
|
||||
// libraries have been moved. We keep it here for now as it make easier to
|
||||
@@ -108,21 +115,25 @@ val preparePrefab by
|
||||
// react_devtoolsruntimesettings
|
||||
Pair(
|
||||
"../ReactCommon/react/devtoolsruntimesettings/",
|
||||
"react/devtoolsruntimesettings/"),
|
||||
"react/devtoolsruntimesettings/",
|
||||
),
|
||||
// react_renderer_animations
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/animations/",
|
||||
"react/renderer/animations/"),
|
||||
"react/renderer/animations/",
|
||||
),
|
||||
// react_renderer_bridging
|
||||
Pair("../ReactCommon/react/renderer/bridging/", "react/renderer/bridging/"),
|
||||
// react_renderer_componentregistry
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/componentregistry/",
|
||||
"react/renderer/componentregistry/"),
|
||||
"react/renderer/componentregistry/",
|
||||
),
|
||||
// react_renderer_consistency
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/consistency/",
|
||||
"react/renderer/consistency/"),
|
||||
"react/renderer/consistency/",
|
||||
),
|
||||
// react_renderer_core
|
||||
Pair("../ReactCommon/react/renderer/core/", "react/renderer/core/"),
|
||||
// react_renderer_css
|
||||
@@ -137,7 +148,8 @@ val preparePrefab by
|
||||
// react_renderer_imagemanager
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/imagemanager/",
|
||||
"react/renderer/imagemanager/"),
|
||||
"react/renderer/imagemanager/",
|
||||
),
|
||||
Pair("../ReactCommon/react/renderer/imagemanager/platform/cxx/", ""),
|
||||
// react_renderer_mounting
|
||||
Pair("../ReactCommon/react/renderer/mounting/", "react/renderer/mounting/"),
|
||||
@@ -150,37 +162,45 @@ val preparePrefab by
|
||||
// rrc_image
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/components/image/",
|
||||
"react/renderer/components/image/"),
|
||||
"react/renderer/components/image/",
|
||||
),
|
||||
// rrc_view
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/components/view/",
|
||||
"react/renderer/components/view/"),
|
||||
"react/renderer/components/view/",
|
||||
),
|
||||
Pair("../ReactCommon/react/renderer/components/view/platform/android/", ""),
|
||||
// rrc_root
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/components/root/",
|
||||
"react/renderer/components/root/"),
|
||||
"react/renderer/components/root/",
|
||||
),
|
||||
// runtimeexecutor
|
||||
Pair("../ReactCommon/runtimeexecutor/", ""),
|
||||
// react_renderer_textlayoutmanager
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/textlayoutmanager/",
|
||||
"react/renderer/textlayoutmanager/"),
|
||||
"react/renderer/textlayoutmanager/",
|
||||
),
|
||||
Pair("../ReactCommon/react/renderer/textlayoutmanager/platform/android/", ""),
|
||||
// rrc_text
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/components/text/",
|
||||
"react/renderer/components/text/"),
|
||||
"react/renderer/components/text/",
|
||||
),
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/attributedstring",
|
||||
"react/renderer/attributedstring"),
|
||||
"react/renderer/attributedstring",
|
||||
),
|
||||
// rrc_textinput
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/components/textinput/",
|
||||
"react/renderer/components/textinput/"),
|
||||
"react/renderer/components/textinput/",
|
||||
),
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/components/textinput/platform/android/",
|
||||
""),
|
||||
"",
|
||||
),
|
||||
// react_newarchdefaults
|
||||
Pair("src/main/jni/react/newarchdefaults", ""),
|
||||
// react_nativemodule_core
|
||||
@@ -197,20 +217,24 @@ val preparePrefab by
|
||||
Pair("../ReactCommon/react/nativemodule/core/platform/android/", ""),
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/componentregistry/",
|
||||
"react/renderer/componentregistry/"),
|
||||
"react/renderer/componentregistry/",
|
||||
),
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/components/root/",
|
||||
"react/renderer/components/root/"),
|
||||
"react/renderer/components/root/",
|
||||
),
|
||||
Pair("../ReactCommon/react/renderer/core/", "react/renderer/core/"),
|
||||
Pair("../ReactCommon/react/renderer/debug/", "react/renderer/debug/"),
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/leakchecker/",
|
||||
"react/renderer/leakchecker/"),
|
||||
"react/renderer/leakchecker/",
|
||||
),
|
||||
Pair("../ReactCommon/react/renderer/mapbuffer/", "react/renderer/mapbuffer/"),
|
||||
Pair("../ReactCommon/react/renderer/mounting/", "react/renderer/mounting/"),
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/runtimescheduler/",
|
||||
"react/renderer/runtimescheduler/"),
|
||||
"react/renderer/runtimescheduler/",
|
||||
),
|
||||
Pair("../ReactCommon/react/renderer/scheduler/", "react/renderer/scheduler/"),
|
||||
Pair("../ReactCommon/react/renderer/telemetry/", "react/renderer/telemetry/"),
|
||||
Pair("../ReactCommon/react/renderer/uimanager/", "react/renderer/uimanager/"),
|
||||
@@ -222,22 +246,32 @@ val preparePrefab by
|
||||
// react_performance_timeline
|
||||
Pair(
|
||||
"../ReactCommon/react/performance/timeline/",
|
||||
"react/performance/timeline/"),
|
||||
"react/performance/timeline/",
|
||||
),
|
||||
// react_performance_cdpmetrics
|
||||
Pair(
|
||||
"../ReactCommon/react/performance/cdpmetrics/",
|
||||
"react/performance/cdpmetrics/",
|
||||
),
|
||||
// react_renderer_observers_events
|
||||
Pair(
|
||||
"../ReactCommon/react/renderer/observers/events/",
|
||||
"react/renderer/observers/events/"),
|
||||
"react/renderer/observers/events/",
|
||||
),
|
||||
// react_timing
|
||||
Pair("../ReactCommon/react/timing/", "react/timing/"),
|
||||
// yoga
|
||||
Pair("../ReactCommon/yoga/", ""),
|
||||
Pair("src/main/jni/first-party/yogajni/jni", ""),
|
||||
)),
|
||||
),
|
||||
),
|
||||
PrefabPreprocessingEntry(
|
||||
"hermestooling",
|
||||
// hermes_executor
|
||||
Pair("../ReactCommon/hermes/inspector-modern/", "hermes/inspector-modern/")),
|
||||
))
|
||||
Pair("../ReactCommon/hermes/inspector-modern/", "hermes/inspector-modern/"),
|
||||
),
|
||||
)
|
||||
)
|
||||
outputDir.set(prefabHeadersDir)
|
||||
}
|
||||
|
||||
@@ -252,7 +286,8 @@ val downloadBoost by
|
||||
tasks.registering(Download::class) {
|
||||
dependsOn(createNativeDepsDirectories)
|
||||
src(
|
||||
"https://archives.boost.io/release/${BOOST_VERSION.replace("_", ".")}/source/boost_${BOOST_VERSION}.tar.gz")
|
||||
"https://archives.boost.io/release/${BOOST_VERSION.replace("_", ".")}/source/boost_${BOOST_VERSION}.tar.gz"
|
||||
)
|
||||
onlyIfModified(true)
|
||||
overwrite(false)
|
||||
retries(5)
|
||||
@@ -275,7 +310,8 @@ val downloadDoubleConversion by
|
||||
tasks.registering(Download::class) {
|
||||
dependsOn(createNativeDepsDirectories)
|
||||
src(
|
||||
"https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz")
|
||||
"https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz"
|
||||
)
|
||||
onlyIfModified(true)
|
||||
overwrite(false)
|
||||
retries(5)
|
||||
@@ -414,7 +450,8 @@ val buildCodegenCLI by
|
||||
fileTree(codegenDir) {
|
||||
include("lib/**/*.js")
|
||||
include("lib/**/*.js.flow")
|
||||
})
|
||||
}
|
||||
)
|
||||
rootProjectName.set(rootProject.name)
|
||||
}
|
||||
|
||||
@@ -525,7 +562,8 @@ android {
|
||||
"-DANDROID_STL=c++_shared",
|
||||
"-DANDROID_TOOLCHAIN=clang",
|
||||
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
|
||||
"-DCMAKE_POLICY_DEFAULT_CMP0069=NEW")
|
||||
"-DCMAKE_POLICY_DEFAULT_CMP0069=NEW",
|
||||
)
|
||||
|
||||
targets(
|
||||
"reactnative",
|
||||
@@ -550,11 +588,13 @@ android {
|
||||
buildCodegenCLI,
|
||||
"generateCodegenArtifactsFromSchema",
|
||||
prepareNative3pDependencies,
|
||||
preparePrefab)
|
||||
preparePrefab,
|
||||
)
|
||||
tasks.getByName("generateCodegenSchemaFromJavaScript").dependsOn(buildCodegenCLI)
|
||||
prepareKotlinBuildScriptModel.dependsOn("preBuild")
|
||||
prepareKotlinBuildScriptModel.dependsOn(
|
||||
":packages:react-native:ReactAndroid:hermes-engine:preBuild")
|
||||
":packages:react-native:ReactAndroid:hermes-engine:preBuild"
|
||||
)
|
||||
|
||||
sourceSets.getByName("main") {
|
||||
res.setSrcDirs(
|
||||
@@ -564,7 +604,9 @@ android {
|
||||
"src/main/res/views/alert",
|
||||
"src/main/res/views/modal",
|
||||
"src/main/res/views/uimanager",
|
||||
"src/main/res/views/view"))
|
||||
"src/main/res/views/view",
|
||||
)
|
||||
)
|
||||
java.exclude("com/facebook/react/processing")
|
||||
java.exclude("com/facebook/react/module/processing")
|
||||
}
|
||||
@@ -581,7 +623,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 other engines
|
||||
// that will include the necessary .so files to load.
|
||||
jniLibs.excludes.add("**/libhermes.so")
|
||||
jniLibs.excludes.add("**/libhermesvm.so")
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
|
||||
@@ -122,14 +122,16 @@ val unzipHermes by
|
||||
// NOTE: ideally, we would like CMake to be installed automatically by the `externalNativeBuild`
|
||||
// below. To do that, we would need the various `ConfigureCMake*` tasks to run *before*
|
||||
// `configureBuildForHermes` and `buildHermesC` so that CMake is available for their run. But the
|
||||
// `ConfigureCMake*` tasks depend upon the `ImportHermesc.cmake` file which is actually generated by
|
||||
// `ConfigureCMake*` tasks depend upon the `ImportHostCompilers.cmake` file which is actually
|
||||
// generated by
|
||||
// the two tasks mentioned before, so we install CMake manually to break the circular dependency.
|
||||
|
||||
val installCMake by
|
||||
tasks.registering(CustomExecTask::class) {
|
||||
onlyIfProvidedPathDoesNotExists.set(cmakePath)
|
||||
commandLine(
|
||||
windowsAwareCommandLine(getSDKManagerPath(), "--install", "cmake;${cmakeVersion}"))
|
||||
windowsAwareCommandLine(getSDKManagerPath(), "--install", "cmake;${cmakeVersion}")
|
||||
)
|
||||
}
|
||||
|
||||
val configureBuildForHermes by
|
||||
@@ -196,7 +198,7 @@ val buildHermesLib by
|
||||
"--build",
|
||||
hermesBuildDir.toString(),
|
||||
"--target",
|
||||
"libhermes",
|
||||
"hermesvm",
|
||||
"-j",
|
||||
ndkBuildJobs,
|
||||
)
|
||||
@@ -257,16 +259,17 @@ android {
|
||||
"-DANDROID_STL=c++_shared",
|
||||
"-DANDROID_PIE=True",
|
||||
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
|
||||
"-DIMPORT_HERMESC=${File(hermesBuildDir, "ImportHermesc.cmake").toString()}",
|
||||
"-DIMPORT_HOST_COMPILERS=${File(hermesBuildDir, "ImportHostCompilers.cmake").toString()}",
|
||||
"-DJSI_DIR=${jsiDir}",
|
||||
"-DHERMES_BUILD_SHARED_JSI=True",
|
||||
"-DHERMES_RELEASE_VERSION=for RN ${version}",
|
||||
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True",
|
||||
// We intentionally build Hermes with Intl support only. This is to simplify
|
||||
// the build setup and to avoid overcomplicating the build-type matrix.
|
||||
"-DHERMES_ENABLE_INTL=True")
|
||||
"-DHERMES_ENABLE_INTL=True",
|
||||
)
|
||||
|
||||
targets("libhermes")
|
||||
targets("hermesvm")
|
||||
}
|
||||
}
|
||||
ndk { abiFilters.addAll(reactNativeArchitectures()) }
|
||||
@@ -302,7 +305,8 @@ android {
|
||||
arguments(
|
||||
"-DCMAKE_BUILD_TYPE=MinSizeRel",
|
||||
// For release builds, we don't want to enable the Hermes Debugger.
|
||||
"-DHERMES_ENABLE_DEBUGGER=False")
|
||||
"-DHERMES_ENABLE_DEBUGGER=False",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,12 +347,7 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
prefab {
|
||||
create("libhermes") {
|
||||
headers = prefabHeadersDir.absolutePath
|
||||
libraryName = "libhermes"
|
||||
}
|
||||
}
|
||||
prefab { create("hermesvm") { headers = prefabHeadersDir.absolutePath } }
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@ public class HermesExecutor internal constructor(enableDebugger: Boolean, debugg
|
||||
@Throws(UnsatisfiedLinkError::class)
|
||||
public fun loadLibrary() {
|
||||
if (mode == null) {
|
||||
// libhermes must be loaded explicitly to invoke its JNI_OnLoad.
|
||||
SoLoader.loadLibrary("hermes")
|
||||
// libhermesvm must be loaded explicitly to invoke its JNI_OnLoad.
|
||||
SoLoader.loadLibrary("hermesvm")
|
||||
SoLoader.loadLibrary("hermes_executor")
|
||||
// libhermes_executor is built differently for Debug & Release so we load the proper mode.
|
||||
mode = if (ReactBuildConfig.DEBUG) "Debug" else "Release"
|
||||
|
||||
+6
-3
@@ -25,7 +25,8 @@ public abstract class BaseReactPackage : ReactPackage {
|
||||
@Deprecated("Migrate to [BaseReactPackage] and implement [getModule] instead.")
|
||||
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
||||
throw UnsupportedOperationException(
|
||||
"createNativeModules method is not supported. Use getModule() method instead.")
|
||||
"createNativeModules method is not supported. Use getModule() method instead."
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,8 +67,10 @@ public abstract class BaseReactPackage : ReactPackage {
|
||||
// This Iterator is used to create the NativeModule registry. The NativeModule
|
||||
// registry must not have TurboModules. Therefore, if TurboModules are enabled, and
|
||||
// the current NativeModule is a TurboModule, we need to skip iterating over it.
|
||||
if (ReactNativeNewArchitectureFeatureFlags.useTurboModules() &&
|
||||
reactModuleInfo.isTurboModule) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.useTurboModules() &&
|
||||
reactModuleInfo.isTurboModule
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
+5
-11
@@ -54,7 +54,8 @@ import com.facebook.systrace.Systrace
|
||||
SourceCodeModule::class,
|
||||
TimingModule::class,
|
||||
com.facebook.react.uimanager.UIManagerModule::class,
|
||||
])
|
||||
]
|
||||
)
|
||||
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
|
||||
@Deprecated(
|
||||
message = "This class is part of Legacy Architecture and will be removed in a future release",
|
||||
@@ -65,7 +66,7 @@ internal class CoreModulesPackage(
|
||||
private val hardwareBackBtnHandler: DefaultHardwareBackBtnHandler,
|
||||
private val lazyViewManagersEnabled: Boolean,
|
||||
private val minTimeLeftInFrameForNonBatchedOperationMs: Int,
|
||||
) : BaseReactPackage(), ReactPackageLogger {
|
||||
) : BaseReactPackage() {
|
||||
/**
|
||||
* This method is overridden, since OSS does not run the annotation processor to generate
|
||||
* [CoreModulesPackage.ReactModuleInfoProvider] class. Here we check if it exists with the method
|
||||
@@ -153,7 +154,8 @@ internal class CoreModulesPackage(
|
||||
DeviceInfoModule.NAME -> DeviceInfoModule(reactContext)
|
||||
else ->
|
||||
throw IllegalArgumentException(
|
||||
"In CoreModulesPackage, could not find Native module for $name")
|
||||
"In CoreModulesPackage, could not find Native module for $name"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,14 +196,6 @@ internal class CoreModulesPackage(
|
||||
}
|
||||
}
|
||||
|
||||
override fun startProcessPackage() {
|
||||
ReactMarker.logMarker(ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_START)
|
||||
}
|
||||
|
||||
override fun endProcessPackage() {
|
||||
ReactMarker.logMarker(ReactMarkerConstants.PROCESS_CORE_REACT_PACKAGE_END)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
init {
|
||||
LegacyArchitectureLogger.assertLegacyArchitecture(
|
||||
|
||||
+2
-1
@@ -26,7 +26,8 @@ public class DebugCorePackage public constructor() :
|
||||
lazy(LazyThreadSafetyMode.NONE) {
|
||||
mapOf(
|
||||
DebuggingOverlayManager.REACT_CLASS to
|
||||
ModuleSpec.viewManagerSpec { DebuggingOverlayManager() })
|
||||
ModuleSpec.viewManagerSpec { DebuggingOverlayManager() }
|
||||
)
|
||||
}
|
||||
|
||||
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider {
|
||||
|
||||
+4
-2
@@ -145,7 +145,8 @@ public abstract class HeadlessJsTaskService : Service(), HeadlessJsTaskEventList
|
||||
invokeStartTask(context, taskConfig)
|
||||
reactHost.removeReactInstanceEventListener(this)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
reactHost.start()
|
||||
} else {
|
||||
val reactInstanceManager = reactNativeHost.reactInstanceManager
|
||||
@@ -155,7 +156,8 @@ public abstract class HeadlessJsTaskService : Service(), HeadlessJsTaskEventList
|
||||
invokeStartTask(context, taskConfig)
|
||||
reactInstanceManager.removeReactInstanceEventListener(this)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
reactInstanceManager.createReactContextInBackground()
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -25,8 +25,10 @@ internal class ReactAndroidHWInputDeviceHelper {
|
||||
fun handleKeyEvent(ev: KeyEvent, context: ReactContext) {
|
||||
val eventKeyCode = ev.keyCode
|
||||
val eventKeyAction = ev.action
|
||||
if ((eventKeyAction == KeyEvent.ACTION_UP || eventKeyAction == KeyEvent.ACTION_DOWN) &&
|
||||
KEY_EVENTS_ACTIONS.containsKey(eventKeyCode)) {
|
||||
if (
|
||||
(eventKeyAction == KeyEvent.ACTION_UP || eventKeyAction == KeyEvent.ACTION_DOWN) &&
|
||||
KEY_EVENTS_ACTIONS.containsKey(eventKeyCode)
|
||||
) {
|
||||
dispatchEvent(context, KEY_EVENTS_ACTIONS[eventKeyCode], lastFocusedViewId, eventKeyAction)
|
||||
}
|
||||
}
|
||||
|
||||
+59
-37
@@ -59,7 +59,8 @@ public open class ReactDelegate {
|
||||
* used for New Architecture.
|
||||
*/
|
||||
@Deprecated(
|
||||
"Use one of the other constructors instead to account for New Architecture. Deprecated since 0.75.0")
|
||||
"Use one of the other constructors instead to account for New Architecture. Deprecated since 0.75.0"
|
||||
)
|
||||
public constructor(
|
||||
activity: Activity,
|
||||
reactNativeHost: ReactNativeHost?,
|
||||
@@ -104,11 +105,14 @@ public open class ReactDelegate {
|
||||
|
||||
private val devSupportManager: DevSupportManager?
|
||||
get() =
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost?.devSupportManager != null) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost?.devSupportManager != null
|
||||
) {
|
||||
reactHost?.devSupportManager
|
||||
} else if (reactNativeHost?.hasInstance() == true &&
|
||||
reactNativeHost?.reactInstanceManager != null) {
|
||||
} else if (
|
||||
reactNativeHost?.hasInstance() == true && reactNativeHost?.reactInstanceManager != null
|
||||
) {
|
||||
reactNativeHost?.reactInstanceManager?.devSupportManager
|
||||
} else {
|
||||
null
|
||||
@@ -117,10 +121,12 @@ public open class ReactDelegate {
|
||||
public fun onHostResume() {
|
||||
if (activity !is DefaultHardwareBackBtnHandler) {
|
||||
throw ClassCastException(
|
||||
"Host Activity `${activity.javaClass.simpleName}` does not implement DefaultHardwareBackBtnHandler")
|
||||
"Host Activity `${activity.javaClass.simpleName}` does not implement DefaultHardwareBackBtnHandler"
|
||||
)
|
||||
}
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null
|
||||
) {
|
||||
reactHost?.onHostResume(activity, activity as DefaultHardwareBackBtnHandler)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
@@ -132,8 +138,9 @@ public open class ReactDelegate {
|
||||
}
|
||||
|
||||
public fun onUserLeaveHint() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null
|
||||
) {
|
||||
reactHost?.onHostLeaveHint(activity)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
@@ -143,8 +150,9 @@ public open class ReactDelegate {
|
||||
}
|
||||
|
||||
public fun onHostPause() {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null
|
||||
) {
|
||||
reactHost?.onHostPause(activity)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
@@ -155,8 +163,9 @@ public open class ReactDelegate {
|
||||
|
||||
public fun onHostDestroy() {
|
||||
unloadApp()
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null
|
||||
) {
|
||||
reactHost?.onHostDestroy(activity)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
@@ -166,8 +175,9 @@ public open class ReactDelegate {
|
||||
}
|
||||
|
||||
public fun onBackPressed(): Boolean {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null
|
||||
) {
|
||||
reactHost?.onBackPressed()
|
||||
return true
|
||||
} else {
|
||||
@@ -180,8 +190,9 @@ public open class ReactDelegate {
|
||||
}
|
||||
|
||||
public fun onNewIntent(intent: Intent): Boolean {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null
|
||||
) {
|
||||
reactHost?.onNewIntent(intent)
|
||||
return true
|
||||
} else {
|
||||
@@ -199,9 +210,11 @@ public open class ReactDelegate {
|
||||
data: Intent?,
|
||||
shouldForwardToReactInstance: Boolean,
|
||||
) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null &&
|
||||
shouldForwardToReactInstance) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null &&
|
||||
shouldForwardToReactInstance
|
||||
) {
|
||||
reactHost?.onActivityResult(activity, requestCode, resultCode, data)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true && shouldForwardToReactInstance) {
|
||||
@@ -213,8 +226,9 @@ public open class ReactDelegate {
|
||||
}
|
||||
|
||||
public fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null
|
||||
) {
|
||||
reactHost?.onWindowFocusChange(hasFocus)
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
@@ -224,8 +238,9 @@ public open class ReactDelegate {
|
||||
}
|
||||
|
||||
public fun onConfigurationChanged(newConfig: Configuration?) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null
|
||||
) {
|
||||
reactHost?.onConfigurationChanged(checkNotNull(activity))
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true) {
|
||||
@@ -235,11 +250,13 @@ public open class ReactDelegate {
|
||||
}
|
||||
|
||||
public fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
|
||||
if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD &&
|
||||
((ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost?.devSupportManager != null) ||
|
||||
(reactNativeHost?.hasInstance() == true &&
|
||||
reactNativeHost?.useDeveloperSupport == true))) {
|
||||
if (
|
||||
keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD &&
|
||||
((ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost?.devSupportManager != null) ||
|
||||
(reactNativeHost?.hasInstance() == true &&
|
||||
reactNativeHost?.useDeveloperSupport == true))
|
||||
) {
|
||||
event.startTracking()
|
||||
return true
|
||||
}
|
||||
@@ -248,8 +265,9 @@ public open class ReactDelegate {
|
||||
|
||||
public fun onKeyLongPress(keyCode: Int): Boolean {
|
||||
if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD || keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() &&
|
||||
reactHost != null) {
|
||||
if (
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null
|
||||
) {
|
||||
val devSupportManager = reactHost?.devSupportManager
|
||||
// onKeyLongPress is a Dev API and not supported in RELEASE mode.
|
||||
if (devSupportManager != null && devSupportManager !is ReleaseDevSupportManager) {
|
||||
@@ -257,8 +275,9 @@ public open class ReactDelegate {
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
if (reactNativeHost?.hasInstance() == true &&
|
||||
reactNativeHost?.useDeveloperSupport == true) {
|
||||
if (
|
||||
reactNativeHost?.hasInstance() == true && reactNativeHost?.useDeveloperSupport == true
|
||||
) {
|
||||
reactNativeHost?.reactInstanceManager?.showDevOptionsDialog()
|
||||
return true
|
||||
}
|
||||
@@ -277,8 +296,10 @@ public open class ReactDelegate {
|
||||
reactHost?.reload("ReactDelegate.reload()")
|
||||
} else {
|
||||
runOnUiThread {
|
||||
if (reactNativeHost?.hasInstance() == true &&
|
||||
reactNativeHost?.reactInstanceManager != null) {
|
||||
if (
|
||||
reactNativeHost?.hasInstance() == true &&
|
||||
reactNativeHost?.reactInstanceManager != null
|
||||
) {
|
||||
reactNativeHost?.reactInstanceManager?.recreateReactContextInBackground()
|
||||
}
|
||||
}
|
||||
@@ -389,7 +410,8 @@ public open class ReactDelegate {
|
||||
}
|
||||
|
||||
@Deprecated(
|
||||
"Do not access [ReactInstanceManager] directly. This class is going away in the New Architecture. You should use [ReactHost] instead.")
|
||||
"Do not access [ReactInstanceManager] directly. This class is going away in the New Architecture. You should use [ReactHost] instead."
|
||||
)
|
||||
public fun getReactInstanceManager(): ReactInstanceManager {
|
||||
val nonNullReactNativeHost =
|
||||
checkNotNull(reactNativeHost) {
|
||||
|
||||
+4
-2
@@ -203,7 +203,8 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity {
|
||||
public fun build(): ReactFragment = newInstance(componentName, launchOptions, fabricEnabled)
|
||||
|
||||
@Deprecated(
|
||||
"You should not change call ReactFragment.setFabricEnabled. Instead enable the NewArchitecture for the whole application with newArchEnabled=true in your gradle.properties file")
|
||||
"You should not change call ReactFragment.setFabricEnabled. Instead enable the NewArchitecture for the whole application with newArchEnabled=true in your gradle.properties file"
|
||||
)
|
||||
public fun setFabricEnabled(fabricEnabled: Boolean): Builder {
|
||||
this.fabricEnabled = fabricEnabled
|
||||
return this
|
||||
@@ -216,7 +217,8 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity {
|
||||
protected const val ARG_FABRIC_ENABLED: String = "arg_fabric_enabled"
|
||||
|
||||
@Deprecated(
|
||||
"We will remove this and use a different solution for handling Fragment lifecycle events.")
|
||||
"We will remove this and use a different solution for handling Fragment lifecycle events."
|
||||
)
|
||||
protected const val ARG_DISABLE_HOST_LIFECYCLE_EVENTS: String =
|
||||
"arg_disable_host_lifecycle_events"
|
||||
|
||||
|
||||
+2
-7
@@ -143,6 +143,8 @@ import java.util.Set;
|
||||
*/
|
||||
@ThreadSafe
|
||||
@LegacyArchitecture
|
||||
@Deprecated(
|
||||
since = "This class is part of Legacy Architecture and will be removed in a future release")
|
||||
public class ReactInstanceManager {
|
||||
|
||||
static {
|
||||
@@ -1568,14 +1570,7 @@ public class ReactInstanceManager {
|
||||
SystraceMessage.beginSection(TRACE_TAG_REACT, "processPackage")
|
||||
.arg("className", reactPackage.getClass().getSimpleName())
|
||||
.flush();
|
||||
if (reactPackage instanceof ReactPackageLogger) {
|
||||
((ReactPackageLogger) reactPackage).startProcessPackage();
|
||||
}
|
||||
nativeModuleRegistryBuilder.processPackage(reactPackage);
|
||||
|
||||
if (reactPackage instanceof ReactPackageLogger) {
|
||||
((ReactPackageLogger) reactPackage).endProcessPackage();
|
||||
}
|
||||
SystraceMessage.endSection(TRACE_TAG_REACT).flush();
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -40,6 +40,10 @@ import com.facebook.react.packagerconnection.RequestHandler
|
||||
|
||||
/** Builder class for [ReactInstanceManager]. */
|
||||
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
|
||||
@Deprecated(
|
||||
message = "This class is part of Legacy Architecture and will be removed in a future release",
|
||||
level = DeprecationLevel.WARNING,
|
||||
)
|
||||
public class ReactInstanceManagerBuilder {
|
||||
private val packages: MutableList<ReactPackage> = mutableListOf()
|
||||
private var jsBundleAssetUrl: String? = null
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
|
||||
|
||||
/** Interface for the bridge to call for TTI start and end markers. */
|
||||
@Deprecated("This class is deprecated and will be removed in the next major release.")
|
||||
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
|
||||
internal interface ReactPackageLogger {
|
||||
fun startProcessPackage()
|
||||
|
||||
fun endProcessPackage()
|
||||
}
|
||||
+8
-4
@@ -135,8 +135,10 @@ public abstract class ReactPackageTurboModuleManagerDelegate : TurboModuleManage
|
||||
|
||||
for (moduleProvider in moduleProviders) {
|
||||
val moduleInfo: ReactModuleInfo? = packageModuleInfos[moduleProvider]?.get(moduleName)
|
||||
if (moduleInfo?.isTurboModule == true &&
|
||||
(resolvedModule == null || moduleInfo.canOverrideExistingModule)) {
|
||||
if (
|
||||
moduleInfo?.isTurboModule == true &&
|
||||
(resolvedModule == null || moduleInfo.canOverrideExistingModule)
|
||||
) {
|
||||
val module = moduleProvider.getModule(moduleName)
|
||||
if (module != null) {
|
||||
resolvedModule = module
|
||||
@@ -182,8 +184,10 @@ public abstract class ReactPackageTurboModuleManagerDelegate : TurboModuleManage
|
||||
|
||||
for (moduleProvider in moduleProviders) {
|
||||
val moduleInfo: ReactModuleInfo? = packageModuleInfos[moduleProvider]?.get(moduleName)
|
||||
if (moduleInfo?.isTurboModule == false &&
|
||||
(resolvedModule == null || moduleInfo.canOverrideExistingModule)) {
|
||||
if (
|
||||
moduleInfo?.isTurboModule == false &&
|
||||
(resolvedModule == null || moduleInfo.canOverrideExistingModule)
|
||||
) {
|
||||
val module = moduleProvider.getModule(moduleName)
|
||||
if (module != null) {
|
||||
resolvedModule = module
|
||||
|
||||
+2
-1
@@ -42,7 +42,8 @@ internal class AdditionAnimatedNode(
|
||||
acc + animatedNode.getValue()
|
||||
} else {
|
||||
throw JSApplicationCausedNativeException(
|
||||
"Illegal node ID set as an input for Animated.Add node")
|
||||
"Illegal node ID set as an input for Animated.Add node"
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user