Skip to content

Commit 6f54846

Browse files
amartinzmeta-codesync[bot]
authored andcommitted
Allow overriding dev server ip via property (#55531)
Summary: Similiar to how a specific port can be set also allow for setting a specific ip for the dev server. This allows for easy configuration to aid in generating [reproducible builds](https://izzyondroid.org/docs/reproducibleBuilds/). ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID] [ADDED] - Allow specifying dev server ip via gradle property For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [ANDROID] [ADDED] - Allow specifying dev server ip via gradle property Pull Request resolved: #55531 Test Plan: 1) Add `reactNativeDevServerIp=localhost` to `gradle.properties` 2) Generate an APK 3) Analyze the APK and check that the value of the string resource type `react_native_dev_server_ip` matches the value set in `gradle.properties`. Reviewed By: cortinico Differential Revision: D93143296 Pulled By: CalixTang fbshipit-source-id: d0be23e9495f0ba1a6034dc31b6e725fd94a6a02
1 parent a308014 commit 6f54846

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ internal object AgpConfiguratorUtils {
8888
}
8989

9090
fun configureDevServerLocation(project: Project) {
91+
val devServerIp = project.properties["reactNativeDevServerIp"]?.toString() ?: getHostIpAddress()
9192
val devServerPort =
9293
project.properties["reactNativeDevServerPort"]?.toString() ?: DEFAULT_DEV_SERVER_PORT
9394

@@ -100,7 +101,7 @@ internal object AgpConfiguratorUtils {
100101
ext.defaultConfig.resValue(
101102
"string",
102103
"react_native_dev_server_ip",
103-
getHostIpAddress(),
104+
devServerIp,
104105
)
105106
ext.defaultConfig.resValue("integer", "react_native_dev_server_port", devServerPort)
106107
}

0 commit comments

Comments
 (0)