From 6d7004bf68295f9c74df96dc78c428c6a5953924 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Thu, 2 Jul 2020 13:51:02 +0300 Subject: [PATCH] Add isStatic to the Framework. Static frameworks should not be copied to the application directory during xcode build. --- backend.native/tests/build.gradle | 3 ++- .../main/kotlin/org/jetbrains/kotlin/ExecutorService.kt | 9 +++++---- .../main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt | 2 ++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 3cf36f9b37f..db5221fdc84 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -4113,6 +4113,7 @@ Task frameworkTest(String name, Closure configurator) { } extraOpts fr.bitcode ? "-Xembed-bitcode" : "-Xembed-bitcode-marker" + extraOpts fr.isStatic ? "-Xstatic-framework" : "" extraOpts fr.opts extraOpts project.globalTestArgs @@ -4199,7 +4200,7 @@ if (isAppleTarget(project)) { bitcode = false artifact = frameworkArtifactName library = libraryName - opts = ['-Xstatic-framework'] + isStatic = true } swiftSources = ['objcexport'] } diff --git a/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt index de1e4ad1d5b..d3d7e838692 100644 --- a/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt +++ b/build-tools/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt @@ -501,10 +501,11 @@ fun KonanTestExecutable.configureXcodeBuild() { // Create a Frameworks folder inside the build dir. it += "mkdir -p \"\$TARGET_BUILD_DIR/\$FRAMEWORKS_FOLDER_PATH\"" // Copy each framework to the Frameworks dir. - it += frameworks.map { framework -> - val artifact = framework.artifact - "cp -r \"$testOutput/${this.name}/${project.testTarget.name}/$artifact.framework\" " + - "\"\$TARGET_BUILD_DIR/\$FRAMEWORKS_FOLDER_PATH/$artifact.framework\"" + it += frameworks.filter { framework -> !framework.isStatic } + .map { framework -> + val artifact = framework.artifact + "cp -r \"$testOutput/${this.name}/${project.testTarget.name}/$artifact.framework\" " + + "\"\$TARGET_BUILD_DIR/\$FRAMEWORKS_FOLDER_PATH/$artifact.framework\"" } } }.joinToString(separator = "\\n") { it.replace("\"", "\\\"") } diff --git a/build-tools/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt b/build-tools/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt index e5ee1649daf..991c6b3b4d1 100644 --- a/build-tools/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt +++ b/build-tools/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt @@ -46,6 +46,7 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable { * @param name is the framework name, * @param sources framework sources, * @param bitcode bitcode embedding in the framework, + * @param isStatic determines that framework is static * @param artifact the name of the resulting artifact, * @param library library dependency name, * @param opts additional options for the compiler. @@ -54,6 +55,7 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable { val name: String, var sources: List = emptyList(), var bitcode: Boolean = false, + var isStatic: Boolean = false, var artifact: String = name, var library: String? = null, var opts: List = emptyList()