configure to build from source (#44920)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44920 Configure helloworld to build from source, using a combination of our [How to Build from Source](https://reactnative.dev/contributing/how-to-build-from-source#update-your-project-to-build-from-source) guide, as well as using rn-tester's config as a guide. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D58287748 fbshipit-source-id: 836b09416f4da4087fbdea4476d29cd226157914
This commit is contained in:
Родитель
6970854a15
Коммит
b2e6a37e5b
|
@ -23,7 +23,7 @@ react {
|
||||||
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
|
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
|
||||||
reactNativeDir = file("../../../react-native")
|
reactNativeDir = file("../../../react-native")
|
||||||
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
|
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
|
||||||
codegenDir = file("../../../react-native-codegen")
|
codegenDir = file("$rootDir/node_modules/@react-native/codegen")
|
||||||
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js,
|
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js,
|
||||||
// but now points to our simplified bundle wrapper.
|
// but now points to our simplified bundle wrapper.
|
||||||
cliFile = file("../../scripts/bundle.js")
|
cliFile = file("../../scripts/bundle.js")
|
||||||
|
|
|
@ -6,10 +6,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Autolinking has now moved into the React Native Gradle Plugin
|
// Autolinking has now moved into the React Native Gradle Plugin
|
||||||
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
|
pluginManagement { includeBuild("../../react-native-gradle-plugin") }
|
||||||
plugins { id("com.facebook.react.settings") }
|
plugins { id("com.facebook.react.settings") }
|
||||||
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
|
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
|
||||||
|
|
||||||
rootProject.name = 'HelloWorld'
|
rootProject.name = 'HelloWorld'
|
||||||
include ':app'
|
include ':app'
|
||||||
includeBuild('../../react-native-gradle-plugin')
|
includeBuild('../../react-native-gradle-plugin')
|
||||||
|
includeBuild('../../react-native') {
|
||||||
|
dependencySubstitution {
|
||||||
|
substitute(module("com.facebook.react:react-android")).using(project(":packages:react-native:ReactAndroid"))
|
||||||
|
substitute(module("com.facebook.react:react-native")).using(project(":packages:react-native:ReactAndroid"))
|
||||||
|
substitute(module("com.facebook.react:hermes-android")).using(project(":packages:react-native:ReactAndroid:hermes-engine"))
|
||||||
|
substitute(module("com.facebook.react:hermes-engine")).using(project(":packages:react-native:ReactAndroid:hermes-engine"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -794,7 +794,15 @@ react {
|
||||||
// module to apply the plugin to, so it's codegenDir and reactNativeDir won't be evaluated.
|
// module to apply the plugin to, so it's codegenDir and reactNativeDir won't be evaluated.
|
||||||
if (rootProject.name == "react-native-build-from-source") {
|
if (rootProject.name == "react-native-build-from-source") {
|
||||||
rootProject.extensions.getByType(PrivateReactExtension::class.java).apply {
|
rootProject.extensions.getByType(PrivateReactExtension::class.java).apply {
|
||||||
codegenDir = file("$rootDir/../@react-native/codegen")
|
// We try to guess where codegen lives. Generally is inside
|
||||||
|
// node_modules/@react-native/codegen. If the file is not existing, we
|
||||||
|
// fallback to ../react-native-codegen (used for hello-world app).
|
||||||
|
codegenDir =
|
||||||
|
if (file("$rootDir/../@react-native/codegen").exists()) {
|
||||||
|
file("$rootDir/../@react-native/codegen")
|
||||||
|
} else {
|
||||||
|
file("$rootDir/../react-native-codegen")
|
||||||
|
}
|
||||||
reactNativeDir = file("$rootDir")
|
reactNativeDir = file("$rootDir")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,3 +16,5 @@ plugins {
|
||||||
alias(libs.plugins.download) apply false
|
alias(libs.plugins.download) apply false
|
||||||
alias(libs.plugins.kotlin.android) apply false
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildscript { dependencies { classpath("com.facebook.react:react-native-gradle-plugin") } }
|
||||||
|
|
Загрузка…
Ссылка в новой задаче