[K/N][Tests] Fix FreeArgs
^KT-61259
This commit is contained in:
committed by
Space Team
parent
e4d36d3840
commit
e20b91ab30
+17
-14
@@ -95,20 +95,23 @@ internal abstract class BasicCompilation<A : TestCompilationArtifact>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun ArgsBuilder.applyFreeArgs() {
|
private fun ArgsBuilder.applyFreeArgs() {
|
||||||
when (this@BasicCompilation) {
|
// In TWO_STAGE_MULTI_MODULE mode, source->framework compilation is split to two stages, (or even three, if cache are involved)
|
||||||
is LibraryCompilation, is StaticCacheCompilation ->
|
// - `source -> klib` stage,
|
||||||
// In TWO_STAGE_MULTI_MODULE mode, source->framework compilation is split to
|
// - `klib -> static_cache stage(if caches enabled) and
|
||||||
// - `source -> klib` stage,
|
// - klib+static_cache -> framework
|
||||||
// - `klib -> static_cache stage(if caches enabled) and
|
// option `-Xstatic-framework` can be supplied only to last stage, so must be filtered out for other stages
|
||||||
// - klib+static_cache -> framework
|
fun BasicCompilation<*>.isNotApplicableOptionStaticFramework(it: String) =
|
||||||
// option `-Xstatic-framework` can be supplied only to `-p framework` stage, so must be filtered out for other stages
|
it == "-Xstatic-framework" && this !is ObjCFrameworkCompilation
|
||||||
add(freeCompilerArgs.compilerArgs.filter { it != "-Xstatic-framework" })
|
|
||||||
is ObjCFrameworkCompilation ->
|
// Lazy headers must be generated only during 1st stage, where actual source files are passed.
|
||||||
// Lazy headers must not be generated during 2nd stage of TWO_STAGE_MULTI_MODULE mode, since no source files are passed, only klib.
|
// If allowed for later stages -> incomplete lazy header would overwrite full lazy header generated during 1st stage, which would fail the test.
|
||||||
// If allowed, incomplete lazy header would overwrite full lazy header generated during 1st stage, which would fail the test.
|
fun isNotApplicableOptionEmitLazy(it: String) =
|
||||||
add(freeCompilerArgs.compilerArgs.filterNot { sourceModules.isEmpty() && it.startsWith("-Xemit-lazy-objc-header=") })
|
sourceModules.isEmpty() && it.startsWith("-Xemit-lazy-objc-header=")
|
||||||
else -> add(freeCompilerArgs.compilerArgs)
|
|
||||||
}
|
add(freeCompilerArgs.compilerArgs
|
||||||
|
.filterNot(::isNotApplicableOptionEmitLazy)
|
||||||
|
.filterNot(::isNotApplicableOptionStaticFramework)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ArgsBuilder.applyCompilerPlugins() {
|
private fun ArgsBuilder.applyCompilerPlugins() {
|
||||||
|
|||||||
Reference in New Issue
Block a user