diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index 8b831ca7c12..843f79638e3 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -5470,6 +5470,36 @@ if (isAppleTarget(project)) { swiftSources = ['framework/stacktraceByLibbacktrace/'] } + frameworkTest("testFrameworkBundleId") { + def currentTarget = project.target.name + enabled = currentTarget.startsWith("mac") + + konanArtifacts { + library("frameworkBundleIdLib", targets: [target.name]) { + srcFiles("framework/bundle_id/lib.kt") + delegate.getByTarget(target.name).configure{ + UtilsKt.dependsOnDist(it) + } + } + } + + framework("Foo") { + sources = ["framework/bundle_id/main.kt"] + library = "frameworkBundleIdLib" + def exportedLib = konanArtifacts[library].getArtifactByTarget(target.name) + opts = ["-Xexport-library=$exportedLib"] + } + swiftSources = [] + + doLast { + def frameworkPath = "$testOutputFramework/testFrameworkBundleId/$target/Foo.framework" + def pattern = ~"CFBundleIdentifier\n\\s*Foo" + def plistContent = file("$frameworkPath/Resources/Info.plist").text + if (!pattern.matcher(plistContent).find()) { + throw new Error("Unexpected Info.plist content:\n$plistContent") + } + } + } } /** diff --git a/kotlin-native/backend.native/tests/framework/bundle_id/lib.kt b/kotlin-native/backend.native/tests/framework/bundle_id/lib.kt new file mode 100644 index 00000000000..d33749088fe --- /dev/null +++ b/kotlin-native/backend.native/tests/framework/bundle_id/lib.kt @@ -0,0 +1,8 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package lib + +fun lib() {} \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/framework/bundle_id/main.kt b/kotlin-native/backend.native/tests/framework/bundle_id/main.kt new file mode 100644 index 00000000000..bd16f67684a --- /dev/null +++ b/kotlin-native/backend.native/tests/framework/bundle_id/main.kt @@ -0,0 +1,8 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package main + +fun main() {} \ No newline at end of file