@react-native/gradle-plugin 0.81.1 → 0.81.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt +2 -2
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +2 -0
- package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt +31 -0
package/package.json
CHANGED
|
@@ -100,10 +100,10 @@ abstract class ReactExtension @Inject constructor(val project: Project) {
|
|
|
100
100
|
* Allows to specify the debuggable variants (by default just 'debug'). Variants in this list will
|
|
101
101
|
* not be bundled (the bundle file will not be created and won't be copied over).
|
|
102
102
|
*
|
|
103
|
-
* Default: ['debug']
|
|
103
|
+
* Default: ['debug', 'debugOptimized']
|
|
104
104
|
*/
|
|
105
105
|
val debuggableVariants: ListProperty<String> =
|
|
106
|
-
objects.listProperty(String::class.java).convention(listOf("debug"))
|
|
106
|
+
objects.listProperty(String::class.java).convention(listOf("debug", "debugOptimized"))
|
|
107
107
|
|
|
108
108
|
/** Hermes Config */
|
|
109
109
|
|
|
@@ -18,6 +18,7 @@ import com.facebook.react.tasks.GenerateEntryPointTask
|
|
|
18
18
|
import com.facebook.react.tasks.GeneratePackageListTask
|
|
19
19
|
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFieldsForApp
|
|
20
20
|
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFieldsForLibraries
|
|
21
|
+
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildTypesForApp
|
|
21
22
|
import com.facebook.react.utils.AgpConfiguratorUtils.configureDevServerLocation
|
|
22
23
|
import com.facebook.react.utils.AgpConfiguratorUtils.configureNamespaceForLibraries
|
|
23
24
|
import com.facebook.react.utils.BackwardCompatUtils.configureBackwardCompatibilityReactMap
|
|
@@ -84,6 +85,7 @@ class ReactPlugin : Plugin<Project> {
|
|
|
84
85
|
configureAutolinking(project, extension)
|
|
85
86
|
configureCodegen(project, extension, rootExtension, isLibrary = false)
|
|
86
87
|
configureResources(project, extension)
|
|
88
|
+
configureBuildTypesForApp(project)
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
// Library Only Configuration
|
package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt
CHANGED
|
@@ -19,6 +19,7 @@ import java.net.Inet4Address
|
|
|
19
19
|
import java.net.NetworkInterface
|
|
20
20
|
import javax.xml.parsers.DocumentBuilder
|
|
21
21
|
import javax.xml.parsers.DocumentBuilderFactory
|
|
22
|
+
import kotlin.plus
|
|
22
23
|
import org.gradle.api.Action
|
|
23
24
|
import org.gradle.api.Project
|
|
24
25
|
import org.gradle.api.plugins.AppliedPlugin
|
|
@@ -27,6 +28,36 @@ import org.w3c.dom.Element
|
|
|
27
28
|
@Suppress("UnstableApiUsage")
|
|
28
29
|
internal object AgpConfiguratorUtils {
|
|
29
30
|
|
|
31
|
+
fun configureBuildTypesForApp(project: Project) {
|
|
32
|
+
val action =
|
|
33
|
+
Action<AppliedPlugin> {
|
|
34
|
+
project.extensions
|
|
35
|
+
.getByType(ApplicationAndroidComponentsExtension::class.java)
|
|
36
|
+
.finalizeDsl { ext ->
|
|
37
|
+
ext.buildTypes {
|
|
38
|
+
val debug =
|
|
39
|
+
getByName("debug").apply {
|
|
40
|
+
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
|
41
|
+
}
|
|
42
|
+
getByName("release").apply {
|
|
43
|
+
manifestPlaceholders["usesCleartextTraffic"] = "false"
|
|
44
|
+
}
|
|
45
|
+
maybeCreate("debugOptimized").apply {
|
|
46
|
+
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
|
47
|
+
initWith(debug)
|
|
48
|
+
externalNativeBuild {
|
|
49
|
+
cmake {
|
|
50
|
+
arguments("-DCMAKE_BUILD_TYPE=Release")
|
|
51
|
+
matchingFallbacks += listOf("release")
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
project.pluginManager.withPlugin("com.android.application", action)
|
|
59
|
+
}
|
|
60
|
+
|
|
30
61
|
fun configureBuildConfigFieldsForApp(project: Project, extension: ReactExtension) {
|
|
31
62
|
val action =
|
|
32
63
|
Action<AppliedPlugin> {
|