@react-native/gradle-plugin 0.80.0-nightly-20250409-27a68616c → 0.80.0-nightly-20250412-675b51f56
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
CHANGED
|
@@ -17,7 +17,7 @@ import com.facebook.react.tasks.GenerateEntryPointTask
|
|
|
17
17
|
import com.facebook.react.tasks.GeneratePackageListTask
|
|
18
18
|
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFieldsForApp
|
|
19
19
|
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFieldsForLibraries
|
|
20
|
-
import com.facebook.react.utils.AgpConfiguratorUtils.
|
|
20
|
+
import com.facebook.react.utils.AgpConfiguratorUtils.configureDevServerLocation
|
|
21
21
|
import com.facebook.react.utils.AgpConfiguratorUtils.configureNamespaceForLibraries
|
|
22
22
|
import com.facebook.react.utils.BackwardCompatUtils.configureBackwardCompatibilityReactMap
|
|
23
23
|
import com.facebook.react.utils.DependencyUtils.configureDependencies
|
|
@@ -71,7 +71,7 @@ class ReactPlugin : Plugin<Project> {
|
|
|
71
71
|
|
|
72
72
|
configureReactNativeNdk(project, extension)
|
|
73
73
|
configureBuildConfigFieldsForApp(project, extension)
|
|
74
|
-
|
|
74
|
+
configureDevServerLocation(project)
|
|
75
75
|
configureBackwardCompatibilityReactMap(project)
|
|
76
76
|
configureJavaToolChains(project)
|
|
77
77
|
|
package/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt
CHANGED
|
@@ -14,6 +14,8 @@ import com.facebook.react.utils.ProjectUtils.areLegacyWarningsEnabled
|
|
|
14
14
|
import com.facebook.react.utils.ProjectUtils.isHermesEnabled
|
|
15
15
|
import com.facebook.react.utils.ProjectUtils.isNewArchEnabled
|
|
16
16
|
import java.io.File
|
|
17
|
+
import java.net.Inet4Address
|
|
18
|
+
import java.net.NetworkInterface
|
|
17
19
|
import javax.xml.parsers.DocumentBuilder
|
|
18
20
|
import javax.xml.parsers.DocumentBuilderFactory
|
|
19
21
|
import org.gradle.api.Action
|
|
@@ -53,13 +55,14 @@ internal object AgpConfiguratorUtils {
|
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
fun
|
|
58
|
+
fun configureDevServerLocation(project: Project) {
|
|
57
59
|
val devServerPort =
|
|
58
60
|
project.properties["reactNativeDevServerPort"]?.toString() ?: DEFAULT_DEV_SERVER_PORT
|
|
59
61
|
|
|
60
62
|
val action =
|
|
61
63
|
Action<AppliedPlugin> {
|
|
62
64
|
project.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext ->
|
|
65
|
+
ext.defaultConfig.resValue("string", "react_native_dev_server_ip", getHostIpAddress())
|
|
63
66
|
ext.defaultConfig.resValue("integer", "react_native_dev_server_port", devServerPort)
|
|
64
67
|
}
|
|
65
68
|
}
|
|
@@ -107,3 +110,12 @@ fun getPackageNameFromManifest(manifest: File): String? {
|
|
|
107
110
|
return null
|
|
108
111
|
}
|
|
109
112
|
}
|
|
113
|
+
|
|
114
|
+
internal fun getHostIpAddress(): String =
|
|
115
|
+
NetworkInterface.getNetworkInterfaces()
|
|
116
|
+
.asSequence()
|
|
117
|
+
.filter { it.isUp && !it.isLoopback }
|
|
118
|
+
.flatMap { it.inetAddresses.asSequence() }
|
|
119
|
+
.filter { it is Inet4Address && !it.isLoopbackAddress }
|
|
120
|
+
.map { it.hostAddress }
|
|
121
|
+
.firstOrNull() ?: "localhost"
|