Move Carthage copy-frameworks script earlier

With Xcode 10 run scripts will prevent dependent targets from starting to compile. The Carthage copy-frameworks script should be right after compilation to speed up compilation.
This commit is contained in:
Brentley Jones
2018-09-14 14:31:55 -05:00
parent 6819516979
commit aff1ae20d7
2 changed files with 22 additions and 23 deletions
+20 -21
View File
@@ -698,6 +698,26 @@ public class PBXProjGenerator {
buildPhases += copyFilesBuildPhasesFiles
.filter { $0.key.phaseOrder == .postCompile }
.map { generateCopyFiles(targetName: target.name, copyFiles: $0, buildPhaseFiles: $1) }
if !carthageFrameworksToEmbed.isEmpty {
let inputPaths = carthageFrameworksToEmbed
.map { "$(SRCROOT)/\(carthageBuildPath)/\(target.platform)/\($0)\($0.contains(".") ? "" : ".framework")" }
let outputPaths = carthageFrameworksToEmbed
.map { "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/\($0)\($0.contains(".") ? "" : ".framework")" }
let carthageExecutable = project.options.carthageExecutablePath ?? "carthage"
let carthageScript = createObject(
id: "Carthage" + target.name,
PBXShellScriptBuildPhase(
files: [],
name: "Carthage",
inputPaths: inputPaths,
outputPaths: outputPaths,
shellPath: "/bin/sh",
shellScript: "\(carthageExecutable) copy-frameworks\n"
)
)
buildPhases.append(carthageScript.reference)
}
if !targetFrameworkBuildFiles.isEmpty {
@@ -754,27 +774,6 @@ public class PBXProjGenerator {
buildPhases.append(copyFilesPhase.reference)
}
if !carthageFrameworksToEmbed.isEmpty {
let inputPaths = carthageFrameworksToEmbed
.map { "$(SRCROOT)/\(carthageBuildPath)/\(target.platform)/\($0)\($0.contains(".") ? "" : ".framework")" }
let outputPaths = carthageFrameworksToEmbed
.map { "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/\($0)\($0.contains(".") ? "" : ".framework")" }
let carthageExecutable = project.options.carthageExecutablePath ?? "carthage"
let carthageScript = createObject(
id: "Carthage" + target.name,
PBXShellScriptBuildPhase(
files: [],
name: "Carthage",
inputPaths: inputPaths,
outputPaths: outputPaths,
shellPath: "/bin/sh",
shellScript: "\(carthageExecutable) copy-frameworks\n"
)
)
buildPhases.append(carthageScript.reference)
}
let buildRules = target.buildRules.map { buildRule in
createObject(
id: "\(target.name)-\(buildRule.action)-\(buildRule.fileType)",