[Gradle] KotlinNativeCompile: Only add -Xfragment{x} arguments for platform compilations
Shared Native compilations shall only use -Xcommon-sources w/o setting any of the -Xfragment arguments in K2 ^KT-57944 Verification Pending
This commit is contained in:
committed by
Space Team
parent
6c271eb24a
commit
ed2b817409
+5
-9
@@ -452,7 +452,8 @@ internal constructor(
|
|||||||
|
|
||||||
args.pluginOptions = compilerPlugins.flatMap { it.options.arguments }.toTypedArray()
|
args.pluginOptions = compilerPlugins.flatMap { it.options.arguments }.toTypedArray()
|
||||||
|
|
||||||
if (compilerOptions.usesK2.get()) {
|
/* Shared native compilations in K2 still use -Xcommon-sources and klib dependencies */
|
||||||
|
if (compilerOptions.usesK2.get() && sharedCompilationData == null) {
|
||||||
args.fragments = multiplatformStructure.fragmentsCompilerArgs
|
args.fragments = multiplatformStructure.fragmentsCompilerArgs
|
||||||
args.fragmentRefines = multiplatformStructure.fragmentRefinesCompilerArgs
|
args.fragmentRefines = multiplatformStructure.fragmentRefinesCompilerArgs
|
||||||
}
|
}
|
||||||
@@ -475,14 +476,9 @@ internal constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
sources { args ->
|
sources { args ->
|
||||||
if (compilerOptions.usesK2.get()) {
|
/* Shared native compilations in K2 still use -Xcommon-sources and klib dependencies */
|
||||||
/*
|
if (compilerOptions.usesK2.get() && sharedCompilationData == null) {
|
||||||
For now, we only pass multiplatform structure to K2 for platform compilations
|
args.fragmentSources = multiplatformStructure.fragmentSourcesCompilerArgs
|
||||||
Metadata compilations will compile against pre-compiled klibs from their dependsOn
|
|
||||||
*/
|
|
||||||
if (sharedCompilationData == null) {
|
|
||||||
args.fragmentSources = multiplatformStructure.fragmentSourcesCompilerArgs
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
args.commonSources = commonSourcesTree.files.takeIf { it.isNotEmpty() }?.toPathsArray()
|
args.commonSources = commonSourcesTree.files.takeIf { it.isNotEmpty() }?.toPathsArray()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user