-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let RNGP set buildConfigFields for New Architecture and Hermes
Summary: This diff further simplifies the New App Template by removing the buildConfigFields for both Hermes and New Architecture with the React Native Gradle Plugin. Changelog: [Android] [Changed] - Let RNGP set buildConfigFields for New Architecture and Hermes Reviewed By: cipolleschi Differential Revision: D40139559 fbshipit-source-id: 202b6ac9c4c036a026a2ff3e8279087ffd363eaa
- Loading branch information
1 parent
40567c2
commit 7d2f48c
Showing
4 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...act-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* 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.utils | ||
|
||
import com.android.build.api.variant.AndroidComponentsExtension | ||
import com.facebook.react.utils.ProjectUtils.isHermesEnabled | ||
import com.facebook.react.utils.ProjectUtils.isNewArchEnabled | ||
import org.gradle.api.Action | ||
import org.gradle.api.Project | ||
import org.gradle.api.plugins.AppliedPlugin | ||
|
||
internal object AgpConfiguratorUtils { | ||
@Suppress("UnstableApiUsage") | ||
fun configureBuildConfigFields(project: Project) { | ||
val action = | ||
Action<AppliedPlugin> { | ||
project.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext -> | ||
ext.defaultConfig.buildConfigField( | ||
"boolean", "IS_NEW_ARCHITECTURE_ENABLED", project.isNewArchEnabled.toString()) | ||
ext.defaultConfig.buildConfigField( | ||
"boolean", "IS_HERMES_ENABLED", project.isHermesEnabled.toString()) | ||
} | ||
} | ||
project.pluginManager.withPlugin("com.android.application", action) | ||
project.pluginManager.withPlugin("com.android.library", action) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters