Temporary replace Hermes with V8 (#3847)
This commit is contained in:
parent
e5072ad444
commit
36e32f20b8
9 changed files with 2928 additions and 17 deletions
|
|
@ -75,7 +75,7 @@ import com.android.build.OutputFile
|
|||
project.ext.react = [
|
||||
entryFile: "index.js",
|
||||
bundleConfig: "metro.config.js",
|
||||
enableHermes: true,
|
||||
enableHermes: false,
|
||||
]
|
||||
|
||||
apply from: "../../node_modules/react-native/react.gradle"
|
||||
|
|
@ -105,18 +105,8 @@ def enableSeparateBuildPerCPUArchitecture = false
|
|||
*/
|
||||
def enableProguardInReleaseBuilds = false
|
||||
|
||||
/**
|
||||
* The preferred build flavor of JavaScriptCore.
|
||||
*
|
||||
* For example, to use the international variant, you can use:
|
||||
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
||||
*
|
||||
* The international variant includes ICU i18n library and necessary data
|
||||
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
||||
* give correct results when using with locales other than en-US. Note that
|
||||
* this variant is about 6MiB larger per architecture than default.
|
||||
*/
|
||||
def jscFlavor = 'org.webkit:android-jsc-intl:r241213'
|
||||
// Add v8-android - prebuilt libv8android.so into APK
|
||||
def jscFlavor = 'org.chromium:v8-android:+'
|
||||
|
||||
/**
|
||||
* Whether to enable the Hermes VM.
|
||||
|
|
@ -200,6 +190,11 @@ android {
|
|||
sourceCompatibility 1.8
|
||||
targetCompatibility 1.8
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
// Make sure libjsc.so does not packed in APK
|
||||
exclude "**/libjsc.so"
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
|
|
|||
|
|
@ -44,11 +44,17 @@ allprojects {
|
|||
jcenter()
|
||||
maven {
|
||||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
||||
url "$rootDir/../node_modules/react-native/android"
|
||||
// url "$rootDir/../node_modules/react-native/android"
|
||||
|
||||
// Replace AAR from original RN with AAR from react-native-v8
|
||||
url("$rootDir/../node_modules/react-native-v8/dist")
|
||||
}
|
||||
maven {
|
||||
// Local Maven repo containing AARs with JSC library built for Android
|
||||
url "$rootDir/../node_modules/jsc-android/dist"
|
||||
// url "$rootDir/../node_modules/jsc-android/dist"
|
||||
|
||||
// prebuilt libv8android.so
|
||||
url("$rootDir/../node_modules/v8-android/dist")
|
||||
}
|
||||
maven {
|
||||
url "https://jitpack.io"
|
||||
|
|
|
|||
2
index.js
2
index.js
|
|
@ -72,7 +72,7 @@ if (Platform.OS === 'android') {
|
|||
// defined in packager/modulePaths.js so they are included in the main bundle.
|
||||
|
||||
/*
|
||||
/!* eslint-disable no-console *!/
|
||||
//!* eslint-disable no-console *!/
|
||||
if (__DEV__) {
|
||||
const modules = require.getModules();
|
||||
const moduleIds = Object.keys(modules);
|
||||
|
|
|
|||
13
package-lock.json
generated
13
package-lock.json
generated
|
|
@ -12922,6 +12922,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"react-native-v8": {
|
||||
"version": "0.61.5-patch.0",
|
||||
"resolved": "https://registry.npmjs.org/react-native-v8/-/react-native-v8-0.61.5-patch.0.tgz",
|
||||
"integrity": "sha512-YmE5Kc03amCY4InZhjttKxjNeam5ii2wvRtM2BTvvll6Oq3v6IfXNEQimlkhuQMdDcAsoTzrs619JT9DiepvXQ==",
|
||||
"requires": {
|
||||
"v8-android": "7.8.x >= 7.8.1"
|
||||
}
|
||||
},
|
||||
"react-native-vector-icons": {
|
||||
"version": "6.6.0",
|
||||
"resolved": "https://registry.npmjs.org/react-native-vector-icons/-/react-native-vector-icons-6.6.0.tgz",
|
||||
|
|
@ -15520,6 +15528,11 @@
|
|||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
|
||||
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
|
||||
},
|
||||
"v8-android": {
|
||||
"version": "7.8.2",
|
||||
"resolved": "https://registry.npmjs.org/v8-android/-/v8-android-7.8.2.tgz",
|
||||
"integrity": "sha512-LZLtehBxj4rLgf3+gWs3ITTmnVvlD3KQubLzFmtdI+l3G9tbi8ckWm6tJv7KQXZu3L/ok5M2bZz1AGnofPiMfQ=="
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz",
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@
|
|||
"react-native-doc-viewer": "github:mattermost/react-native-doc-viewer#c913e54ec8e4a60753bc7dd39256fa4be8229d19",
|
||||
"react-native-document-picker": "3.2.4",
|
||||
"react-native-exception-handler": "2.10.8",
|
||||
"react-native-gesture-handler": "1.5.3",
|
||||
"react-native-fast-image": "7.0.2",
|
||||
"react-native-gesture-handler": "1.5.3",
|
||||
"react-native-haptic-feedback": "1.8.2",
|
||||
"react-native-image-gallery": "github:mattermost/react-native-image-gallery#c1a9f7118e90cc87d47620bc0584c9cac4b0cf38",
|
||||
"react-native-image-picker": "2.0.0",
|
||||
|
|
@ -60,6 +60,7 @@
|
|||
"react-native-slider": "0.11.0",
|
||||
"react-native-status-bar-size": "0.3.3",
|
||||
"react-native-svg": "10.1.0",
|
||||
"react-native-v8": "0.61.5-patch.0",
|
||||
"react-native-vector-icons": "6.6.0",
|
||||
"react-native-video": "5.0.2",
|
||||
"react-native-webview": "github:mattermost/react-native-webview#b5e22940a613869d3999feac9451ee65352f4fbe",
|
||||
|
|
|
|||
34
packager/README.md
Normal file
34
packager/README.md
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
### Steps to update the moduleNames.js and modulePaths.js
|
||||
|
||||
1. Uncomment the code snippet in index.js
|
||||
2. Run the app on an Android device/simulator in development mode
|
||||
3. Open the App, enable the JavaScript debugger from the debug menu, and open the debugger
|
||||
4. Copy the console output starting with `module.exports =` into `packager/moduleNames.js`
|
||||
4. Run `node packager/generateModulePaths.js`
|
||||
5. Run `./node_modules/.bin/eslint --fix packager/module*`
|
||||
6. Open modulePaths.js
|
||||
7. Remove entries for files that don't need to exist on app load:
|
||||
- announcement_banner
|
||||
- options_context
|
||||
- remove_markdown
|
||||
- retry_bar_indicator
|
||||
- search_bar
|
||||
- sidebars
|
||||
- swiper
|
||||
- team_icon
|
||||
- react-deep-force-update
|
||||
- react-devtools-core
|
||||
- react-native-video
|
||||
- react-native/Libraries/Core/Devtools
|
||||
- react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev
|
||||
- react-native/Libraries/YellowBox
|
||||
- redux-devtools-instrument
|
||||
- remove-redux-devtools
|
||||
- remotedev-utils
|
||||
- socketcluster-client
|
||||
- stacktrace-parser
|
||||
- react-navigation
|
||||
8. Change development versions of certain files to production ones:
|
||||
- configureStore.dev.js -> configureStore.prod.js
|
||||
- react/cjs/react.development.js -> react/cjs/react.production.min.js
|
||||
- schedule/cjs/scheduler-tracing.development.js -> schedule/cjs/scheduler-tracing.production.min.js
|
||||
46
packager/generateModulePaths.js
Normal file
46
packager/generateModulePaths.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
/* eslint-disable no-console */
|
||||
const execSync = require('child_process').execSync;
|
||||
const fs = require('fs');
|
||||
const moduleNames = require('./moduleNames');
|
||||
|
||||
const pjson = require('../package.json');
|
||||
const localPrefix = `${pjson.name}/`;
|
||||
|
||||
// Transforming to Module Paths
|
||||
// This script will convert the module names found in moduleNames.js
|
||||
// to the absolute module path that we need.
|
||||
const modulePaths = moduleNames.map((moduleName) => {
|
||||
if (moduleName.startsWith(localPrefix)) {
|
||||
return `./${moduleName.substring(localPrefix.length)}`;
|
||||
}
|
||||
if (moduleName.endsWith('.js')) {
|
||||
return `./node_modules/${moduleName}`;
|
||||
}
|
||||
try {
|
||||
const result = execSync(
|
||||
`grep "@providesModule ${moduleName}" $(find . -name ${moduleName}\\\\.js) -l`,
|
||||
).toString().trim().split('\n')[0];
|
||||
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
const paths = modulePaths.filter((path) => path != null).map((path) => `'${path}'`).join(',\n');
|
||||
|
||||
const fileData = `module.exports = [${paths}];`;
|
||||
|
||||
fs.writeFile('./packager/modulePaths.js', fileData, (err) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
console.log('Done');
|
||||
});
|
||||
1764
packager/moduleNames.js
Normal file
1764
packager/moduleNames.js
Normal file
File diff suppressed because it is too large
Load diff
1052
packager/modulePaths.js
Normal file
1052
packager/modulePaths.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue