[K/N][tests] Support dependencies for cinterop modules

When building cinterop klibs, cinterop tool can accept dependencies,
which affects the way it processes the native library.
The test infrastructure allowed to specify cinterop module dependencies,
but didn't actually pass them to the tool.
This commit fixes that.
This commit is contained in:
Svyatoslav Scherbina
2024-01-02 12:15:56 +01:00
committed by Space Team
parent 945f602b91
commit ffb0b063a8
3 changed files with 7 additions and 0 deletions
@@ -146,6 +146,7 @@ internal fun AbstractNativeSimpleTest.cinteropToLibrary(
targets = targets,
freeCompilerArgs = freeCompilerArgs,
defFile = testCase.modules.single().files.single().location,
dependencies = emptyList(),
expectedArtifact = getLibraryArtifact(testCase, outputDir)
).result
}
@@ -323,11 +323,16 @@ internal class CInteropCompilation(
freeCompilerArgs: TestCompilerArgs,
defFile: File,
sources: List<File> = emptyList(),
dependencies: Iterable<CompiledDependency<KLIB>>,
expectedArtifact: KLIB
) : TestCompilation<KLIB>() {
override val result: TestCompilationResult<out KLIB> by lazy {
val extraArgsArray = buildList {
dependencies.forEach {
add("-l")
add(it.artifact.path)
}
addAll(freeCompilerArgs.cinteropArgs)
sources.forEach {
add("-Xcompile-source")
@@ -252,6 +252,7 @@ internal class TestCompilationFactory {
freeCompilerArgs = freeCompilerArgs,
defFile = defFile,
sources = cSourceFiles,
dependencies = dependencies.forKlib(),
expectedArtifact = klibArtifact
) to false // CInterop klib cannot be compiled into per-file cache
}