[K/N] Add test for framework's bundle ID

This commit is contained in:
Ilya Matveev
2021-09-08 13:45:32 +07:00
committed by Space
parent 88d8d5199b
commit 0dd41eea19
3 changed files with 46 additions and 0 deletions
@@ -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 = ~"<key>CFBundleIdentifier</key>\n\\s*<string>Foo</string>"
def plistContent = file("$frameworkPath/Resources/Info.plist").text
if (!pattern.matcher(plistContent).find()) {
throw new Error("Unexpected Info.plist content:\n$plistContent")
}
}
}
}
/**