Allow specifying phase order for copy files phases

Copy Files phases don't stop dependent targets from starting to compile. If some of the files being copied are needed for the dependent target to compile then they need to happen before the Compile Sources phase. This change allows specifying that.
This commit is contained in:
Brentley Jones
2018-09-19 09:00:59 -05:00
parent 731428ca29
commit e6a0af79a8
5 changed files with 35 additions and 7 deletions
+9 -2
View File
@@ -646,7 +646,13 @@ public class PBXProjGenerator {
return sourceFilesByCopyFiles.mapValues { getBuildFilesForSourceFiles($0) }
}
copyFilesBuildPhasesFiles.merge(getBuildFilesForCopyFilesPhases()) { $0 + $1 }
buildPhases += try target.prebuildScripts.map { try generateBuildScript(targetName: target.name, buildScript: $0) }
buildPhases += copyFilesBuildPhasesFiles
.filter { $0.key.phaseOrder == .preCompile }
.map { generateCopyFiles(targetName: target.name, copyFiles: $0, buildPhaseFiles: $1) }
let headersBuildPhaseFiles = getBuildFilesForPhase(.headers)
if !headersBuildPhaseFiles.isEmpty && (target.type == .framework || target.type == .dynamicLibrary) {
@@ -689,8 +695,9 @@ public class PBXProjGenerator {
buildPhases.append(script.reference)
}
copyFilesBuildPhasesFiles.merge(getBuildFilesForCopyFilesPhases()) { $0 + $1 }
buildPhases += copyFilesBuildPhasesFiles.map { generateCopyFiles(targetName: target.name, copyFiles: $0, buildPhaseFiles: $1) }
buildPhases += copyFilesBuildPhasesFiles
.filter { $0.key.phaseOrder == .postCompile }
.map { generateCopyFiles(targetName: target.name, copyFiles: $0, buildPhaseFiles: $1) }
if !targetFrameworkBuildFiles.isEmpty {
+4 -2
View File
@@ -73,7 +73,8 @@ class SourceGenerator {
if headerVisibility == .public {
chosenBuildPhase = .copyFiles(TargetSource.BuildPhase.CopyFilesSettings(
destination: .productsDirectory,
subpath: "include/$(PRODUCT_NAME)"
subpath: "include/$(PRODUCT_NAME)",
phaseOrder: .preCompile
))
} else {
chosenBuildPhase = nil
@@ -194,7 +195,8 @@ class SourceGenerator {
guard targetType == .staticLibrary else { return nil }
return .copyFiles(TargetSource.BuildPhase.CopyFilesSettings(
destination: .productsDirectory,
subpath: "include/$(PRODUCT_NAME)"
subpath: "include/$(PRODUCT_NAME)",
phaseOrder: .preCompile
))
case "framework": return .frameworks
case "xpc": return .copyFiles(.xpcServices)