[K/N] Add an option to specify a bundle ID of a produced framework

This commit is contained in:
Ilya Matveev
2021-09-08 17:09:33 +07:00
committed by Space
parent 0dd41eea19
commit bfe336b0db
5 changed files with 41 additions and 4 deletions
@@ -380,6 +380,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
}
})
putIfNotNull(RUNTIME_LOGS, arguments.runtimeLogs)
putIfNotNull(BUNDLE_ID, parseBundleId(arguments, outputKind, configuration))
}
}
}
@@ -642,7 +643,20 @@ private fun parseKeyValuePairs(
}
}?.toMap()
private fun parseBundleId(
arguments: K2NativeCompilerArguments,
outputKind: CompilerOutputKind,
configuration: CompilerConfiguration
): String? {
val argumentValue = arguments.bundleId
return if (argumentValue != null && outputKind != CompilerOutputKind.FRAMEWORK) {
configuration.report(STRONG_WARNING, "Setting a bundle ID is only supported when producing a framework " +
"but the compiler is producing ${outputKind.name.lowercase()}")
null
} else {
argumentValue
}
}
fun main(args: Array<String>) = K2Native.main(args)
fun mainNoExitWithGradleRenderer(args: Array<String>) = K2Native.mainNoExitWithGradleRenderer(args)
@@ -102,6 +102,13 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
// Make sure to prepend them with -X.
// Keep the list lexically sorted.
@Argument(
value = "-Xbundle-id",
valueDescription = "<id>",
description = "Bundle ID to be set in Info.plist of a produced framework"
)
var bundleId: String? = null
@Argument(
value = "-Xcache-directory",
valueDescription = "<path>",