in hot-reload-core/src/main/kotlin/org/jetbrains/compose/reload/core/propertiesExtensions.kt [14:30]
public fun subprocessSystemProperties(
environment: Environment, orchestrationPort: Int? = null
): List<String> {
val hotReloadProperties = HotReloadProperty.entries.associateBy { it.key }
val targetProperties = System.getProperties().mapNotNull map@{ (key, value) ->
if (key !is String) return@map null
if (value !is String) return@map null
when (val hotReloadProperty = hotReloadProperties[key]) {
OrchestrationPort -> key to (orchestrationPort ?: value)
ParentPid -> key to ProcessHandle.current().pid().toString()
null -> if (key.startsWith("compose.reload")) key to value else null
else -> if (environment in hotReloadProperty.targets) key to value else null
}
}
return targetProperties.map { (key, value) -> "-D$key=$value" }
}