mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix: prevent error when react extension was already created (#43694)
Summary: Currently the react-native-gradle-plugin does not allow the "react" plugin extension to already exist when running its apply block. I had a use-case where I wanted to create a new gradle plugin which would take care of applying the react plugin including setting some of its options. Without the change in this PR, this would currently turn into a build failure. ## Changelog: [ANDROID] [FIXED] - prevent error when the "react" extension was already created by another gradle plugin Pull Request resolved: https://github.com/facebook/react-native/pull/43694 Reviewed By: rshest Differential Revision: D55478611 Pulled By: zeyap fbshipit-source-id: cc743a99cb72ed315d21c52597efd5ee92a3be62
This commit is contained in:
committed by
Facebook GitHub Bot
parent
220588004b
commit
b9dad7fc0c
+4
-1
@@ -38,7 +38,10 @@ import org.gradle.internal.jvm.Jvm
|
||||
class ReactPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
checkJvmVersion(project)
|
||||
val extension = project.extensions.create("react", ReactExtension::class.java, project)
|
||||
val extension =
|
||||
project.rootProject.extensions.findByType(ReactExtension::class.java)
|
||||
?: project.rootProject.extensions.create("react", ReactExtension::class.java, project)
|
||||
|
||||
checkIfNewArchFlagIsSet(project, extension)
|
||||
|
||||
// We register a private extension on the rootProject so that project wide configs
|
||||
|
||||
Reference in New Issue
Block a user