Add isStatic to the Framework. Static frameworks should not be copied to the application directory during xcode build.

This commit is contained in:
Pavel Punegov
2020-07-02 13:51:02 +03:00
committed by Pavel Punegov
parent 2a13a1158b
commit 6d7004bf68
3 changed files with 9 additions and 5 deletions
+2 -1
View File
@@ -4113,6 +4113,7 @@ Task frameworkTest(String name, Closure<FrameworkTest> 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']
}
@@ -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("\"", "\\\"") }
@@ -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<String> = emptyList(),
var bitcode: Boolean = false,
var isStatic: Boolean = false,
var artifact: String = name,
var library: String? = null,
var opts: List<String> = emptyList()