Quote module name in the generated modulemap

This fixes an issue where Kotlin projects named "umbrella" or
"framework" produce unimportable framework modules.

^KT-66565
This commit is contained in:
Timofey Solonin
2024-03-13 19:48:01 +01:00
committed by Space Team
parent 4ab5c3b74b
commit 9295f44eda
6 changed files with 25 additions and 5 deletions
@@ -203,6 +203,24 @@ abstract class FrameworkTestBase : AbstractNativeSimpleTest() {
compileAndRunSwift(testName, testCase)
}
@Test
fun testKT66565_usingModuleMapSyntaxInKotlinModuleNameMakesImportableModule() {
Assumptions.assumeTrue(targets.testTarget.family.isAppleFamily)
val reservedModuleMapSyntax = "umbrella"
val testName = "kt66565"
generateObjCFramework(testName, moduleName = reservedModuleMapSyntax)
SwiftCompilation(
testRunSettings,
listOf(testSuiteDir.resolve(testName).resolve("$testName.swift")),
TestCompilationArtifact.BinaryLibrary(buildDir.resolve("swiftObject")),
listOf(
"-c",
"-F", buildDir.absolutePath
),
outputFile = { library -> library.libraryFile }
).result.assertSuccess()
}
@Test
fun testStacktrace() {
val testName = "stacktrace"
@@ -468,13 +486,14 @@ abstract class FrameworkTestBase : AbstractNativeSimpleTest() {
testCompilerArgs: List<String> = emptyList(),
givenDependencies: Set<TestModule.Given> = emptySet(),
checks: TestRunChecks = TestRunChecks.Default(testRunSettings.get<Timeouts>().executionTimeout),
moduleName: String = name.replaceFirstChar { it.uppercase() },
): TestCase {
Assumptions.assumeTrue(targets.testTarget.family.isAppleFamily)
val testCase = generateObjCFrameworkTestCase(
TestKind.STANDALONE_NO_TR,
extras,
name.replaceFirstChar { it.uppercase() },
moduleName,
listOf(testSuiteDir.resolve(name).resolve("$name.kt")),
TestCompilerArgs(testCompilerArgs + listOf("-Xbinary=bundleId=$name")),
givenDependencies,