Merge pull request #56 from yonaskolb/xcodeproj_0.1.2

Upgrade to xcodeproj 0.1.2
This commit is contained in:
Yonas Kolb
2017-09-14 21:38:58 +02:00
committed by GitHub
5 changed files with 57 additions and 86 deletions
@@ -14,7 +14,7 @@
BF2753556301 = {isa = PBXBuildFile; fileRef = FR2993497801 /* MyFramework.framework */; };
BF3154421201 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FR5980633301 /* Assets.xcassets */; };
BF3515549501 /* MyFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = FR7740960501 /* MyFramework.h */; settings = {ATTRIBUTES = (Public, ); }; };
BF3862341101 = {isa = PBXBuildFile; fileRef = FR2993497801 /* MyFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BF3862341101 /* MyFramework.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = FR2993497801 /* MyFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BF4946816301 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = VG1473702401 /* Main.storyboard */; };
BF5986511201 = {isa = PBXBuildFile; fileRef = FR6523263101 /* TestProject.app */; };
BF9001417701 /* TestProjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FR6877173101 /* TestProjectTests.swift */; };
@@ -45,27 +45,27 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
BF3862341101 /* MyFramework.framework */,
BF3862341101 /* MyFramework.framework in Copy Files */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
FR1332263601 /* AppDelegate.swift */ = {isa = PBXFileReference; path = AppDelegate.swift; sourceTree = "<group>"; };
FR1345298501 /* Info.plist */ = {isa = PBXFileReference; path = Info.plist; sourceTree = "<group>"; };
FR1345298502 /* Info.plist */ = {isa = PBXFileReference; path = Info.plist; sourceTree = "<group>"; };
FR1345298503 /* Info.plist */ = {isa = PBXFileReference; path = Info.plist; sourceTree = "<group>"; };
FR2653659501 /* TestProjectTests.xctest */ = {isa = PBXFileReference; explicitFileType = xctest; includeInIndex = 0; path = TestProjectTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
FR2993497801 /* MyFramework.framework */ = {isa = PBXFileReference; explicitFileType = framework; includeInIndex = 0; path = MyFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FR3676338401 /* Base */ = {isa = PBXFileReference; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
FR3676338402 /* Base */ = {isa = PBXFileReference; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
FR5980633301 /* Assets.xcassets */ = {isa = PBXFileReference; path = Assets.xcassets; sourceTree = "<group>"; };
FR6218091901 /* ViewController.swift */ = {isa = PBXFileReference; path = ViewController.swift; sourceTree = "<group>"; };
FR6523263101 /* TestProject.app */ = {isa = PBXFileReference; explicitFileType = app; includeInIndex = 0; path = TestProject.app; sourceTree = BUILT_PRODUCTS_DIR; };
FR6877173101 /* TestProjectTests.swift */ = {isa = PBXFileReference; path = TestProjectTests.swift; sourceTree = "<group>"; };
FR7078510801 /* FrameworkFile.swift */ = {isa = PBXFileReference; path = FrameworkFile.swift; sourceTree = "<group>"; };
FR7740960501 /* MyFramework.h */ = {isa = PBXFileReference; path = MyFramework.h; sourceTree = "<group>"; };
FR1332263601 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
FR1345298501 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
FR1345298502 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
FR1345298503 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
FR2653659501 /* TestProjectTests.xctest */ = {isa = PBXFileReference; explicitFileType = xctest; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = TestProjectTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
FR2993497801 /* MyFramework.framework */ = {isa = PBXFileReference; explicitFileType = framework; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = MyFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; };
FR3676338401 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
FR3676338402 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
FR5980633301 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
FR6218091901 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
FR6523263101 /* TestProject.app */ = {isa = PBXFileReference; explicitFileType = app; includeInIndex = 0; lastKnownFileType = wrapper.application; path = TestProject.app; sourceTree = BUILT_PRODUCTS_DIR; };
FR6877173101 /* TestProjectTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestProjectTests.swift; sourceTree = "<group>"; };
FR7078510801 /* FrameworkFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FrameworkFile.swift; sourceTree = "<group>"; };
FR7740960501 /* MyFramework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyFramework.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
@@ -138,7 +138,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
BF3515549501 /* MyFramework.h */,
BF3515549501 /* MyFramework.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -176,7 +176,7 @@
SBP299349701 /* Sources */,
RBP299349701 /* Resources */,
HBP299349701 /* Headers */,
SSBP35382101 /* Run Script */,
SSBP35382101 /* Swiftlint */,
);
buildRules = (
);
@@ -193,9 +193,9 @@
SBP652326301 /* Sources */,
RBP652326301 /* Resources */,
HBP652326301 /* Headers */,
CFBP50493301 /* Copy Files */,
SSBP24648001 /* Run Script */,
SSBP19207501 /* Run Script */,
CFBP50493301 /* CopyFiles */,
SSBP24648001 /* Strip Unused Architectures from Frameworks */,
SSBP19207501 /* Swiftlint */,
);
buildRules = (
);
@@ -249,16 +249,16 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BF4946816301 /* Main.storyboard */,
BF1911148401 /* LaunchScreen.storyboard */,
BF3154421201 /* Assets.xcassets */,
BF3154421201 /* Assets.xcassets in Resources */,
BF1911148401 /* LaunchScreen.storyboard in Resources */,
BF4946816301 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
SSBP19207501 /* Run Script */ = {
SSBP19207501 /* Swiftlint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -269,10 +269,10 @@
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellPath = bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
SSBP24648001 /* Run Script */ = {
SSBP24648001 /* Strip Unused Architectures from Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -283,10 +283,10 @@
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
shellPath = bin/sh;
shellScript = "################################################################################\n#\n# Copyright 2015 Realm Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n################################################################################\n\n# This script strips all non-valid architectures from dynamic libraries in\n# the application's `Frameworks` directory.\n#\n# The following environment variables are required:\n#\n# BUILT_PRODUCTS_DIR\n# FRAMEWORKS_FOLDER_PATH\n# VALID_ARCHS\n# EXPANDED_CODE_SIGN_IDENTITY\n\n\n# Signs a framework with the provided identity\ncode_sign() {\n # Use the current code_sign_identitiy\n echo \"Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}\"\n echo \"/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements $1\"\n /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"\n}\n\n# Set working directory to product’s embedded frameworks\ncd \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n\nif [ \"$ACTION\" = \"install\" ]; then\n echo \"Copy .bcsymbolmap files to .xcarchive\"\n find . -name '*.bcsymbolmap' -type f -exec mv {} \"${CONFIGURATION_BUILD_DIR}\" \;\nelse\n # Delete *.bcsymbolmap files from framework bundle unless archiving\n find . -name '*.bcsymbolmap' -type f -exec rm -rf \"{}\" +\;\nfi\n\necho \"Stripping frameworks\"\n\nfor file in $(find . -type f -perm +111); do\n # Skip non-dynamic libraries\n if ! [[ \"$(file \"$file\")\" == *\"dynamically linked shared library\"* ]]; then\n continue\n fi\n # Get architectures for current file\n archs=\"$(lipo -info \"${file}\" | rev | cut -d ':' -f1 | rev)\"\n stripped=\"\"\n for arch in $archs; do\n if ! [[ \"${VALID_ARCHS}\" == *\"$arch\"* ]]; then\n # Strip non-valid architectures in-place\n lipo -remove \"$arch\" -output \"$file\" \"$file\" || exit 1\n stripped=\"$stripped $arch\"\n fi\n done\n if [[ \"$stripped\" != \"\" ]]; then\n echo \"Stripped $file of architectures:$stripped\"\n if [ \"${CODE_SIGNING_REQUIRED}\" == \"YES\" ]; then\n code_sign \"${file}\"\n fi\n fi\ndone\n";
};
SSBP35382101 /* Run Script */ = {
SSBP35382101 /* Swiftlint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -297,7 +297,7 @@
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellPath = bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */
@@ -307,7 +307,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BF9001417701 /* TestProjectTests.swift */,
BF9001417701 /* TestProjectTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -315,7 +315,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BF9155249601 /* FrameworkFile.swift */,
BF9155249601 /* FrameworkFile.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -323,8 +323,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BF1073850101 /* AppDelegate.swift */,
BF1744565901 /* ViewController.swift */,
BF1073850101 /* AppDelegate.swift in Sources */,
BF1744565901 /* ViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -569,8 +569,8 @@
XCCL26536501 /* Build configuration list for PBXNativeTarget "TestProjectTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
XCBC60448901 /* Release */,
XCBC89077001 /* Debug */,
XCBC60448901 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "";
@@ -596,8 +596,8 @@
XCCL81399401 /* Build configuration list for PBXProject */ = {
isa = XCConfigurationList;
buildConfigurations = (
XCBC88111401 /* Release */,
XCBC47994501 /* Debug */,
XCBC88111401 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
+3 -3
View File
@@ -12,7 +12,7 @@
},
{
"package": "Commander",
"repositoryURL": "https://github.com/kylef/Commander",
"repositoryURL": "https://github.com/kylef/Commander.git",
"state": {
"branch": null,
"revision": "4c320a3507d621d27f89514eb576664becfee643",
@@ -78,8 +78,8 @@
"repositoryURL": "https://github.com/swift-xcode/xcodeproj.git",
"state": {
"branch": null,
"revision": "a0d05f36203a50daa1a8e736f82bfa3124e98c40",
"version": "0.1.1"
"revision": "8686e141c85912cd4ce7b686cbed23d498430e09",
"version": "0.1.2"
}
}
]
+1 -1
View File
@@ -15,7 +15,7 @@ let package = Package(
.package(url: "https://github.com/yonaskolb/JSONUtilities.git", from: "3.3.0"),
.package(url: "https://github.com/kylef/Spectre.git", from: "0.7.0"),
.package(url: "https://github.com/onevcat/Rainbow.git", from: "2.1.0"),
.package(url: "https://github.com/swift-xcode/xcodeproj.git", .exact("0.1.1")),
.package(url: "https://github.com/swift-xcode/xcodeproj.git", from: "0.1.2"),
],
targets: [
.target(name: "XcodeGen", dependencies: [
@@ -10,17 +10,6 @@ import Foundation
import xcodeproj
import PathKit
extension Array where Element: Referenceable {
public var referenceList: [String] {
return map { $0.reference }
}
public var referenceSet: Set<String> {
return Set(referenceList)
}
}
extension Dictionary where Key == String, Value: Any {
public func merged(_ dictionary: [Key: Value]) -> [Key: Value] {
+17 -35
View File
@@ -57,27 +57,7 @@ public class PBXProjGenerator {
}
func addObject(_ object: PBXObject) {
switch object {
case let object as PBXBuildFile: project.buildFiles.append(object)
case let object as PBXAggregateTarget: project.aggregateTargets.append(object)
case let object as PBXContainerItemProxy: project.containerItemProxies.append(object)
case let object as PBXCopyFilesBuildPhase: project.copyFilesBuildPhases.append(object)
case let object as PBXGroup: project.groups.append(object)
case let object as PBXFileElement: project.fileElements.append(object)
case let object as XCConfigurationList: project.configurationLists.append(object)
case let object as XCBuildConfiguration: project.buildConfigurations.append(object)
case let object as PBXVariantGroup: project.variantGroups.append(object)
case let object as PBXTargetDependency: project.targetDependencies.append(object)
case let object as PBXSourcesBuildPhase: project.sourcesBuildPhases.append(object)
case let object as PBXShellScriptBuildPhase: project.shellScriptBuildPhases.append(object)
case let object as PBXResourcesBuildPhase: project.resourcesBuildPhases.append(object)
case let object as PBXFrameworksBuildPhase: project.frameworksBuildPhases.append(object)
case let object as PBXHeadersBuildPhase: project.headersBuildPhases.append(object)
case let object as PBXNativeTarget: project.nativeTargets.append(object)
case let object as PBXFileReference: project.fileReferences.append(object)
case let object as PBXProject: project.projects.append(object)
default: break
}
project.addObject(object)
}
public func generate() throws -> PBXProj {
@@ -89,7 +69,7 @@ public class PBXProjGenerator {
return XCBuildConfiguration(reference: generateUUID(XCBuildConfiguration.self, config.name), name: config.name, baseConfigurationReference: nil, buildSettings: buildSettings)
}
let buildConfigList = XCConfigurationList(reference: generateUUID(XCConfigurationList.self, spec.name), buildConfigurations: buildConfigs.referenceSet, defaultConfigurationName: buildConfigs.first?.name ?? "", defaultConfigurationIsVisible: 0)
let buildConfigList = XCConfigurationList(reference: generateUUID(XCConfigurationList.self, spec.name), buildConfigurations: buildConfigs.references, defaultConfigurationName: buildConfigs.first?.name ?? "", defaultConfigurationIsVisible: 0)
buildConfigs.forEach(addObject)
addObject(buildConfigList)
@@ -119,7 +99,7 @@ public class PBXProjGenerator {
addObject(platformGroup)
platforms.append(platformGroup)
}
let carthageGroup = PBXGroup(reference: generateUUID(PBXGroup.self, "Carthage"), children: platforms.referenceList, sourceTree: .group, name: "Carthage", path: carthageBuildPath)
let carthageGroup = PBXGroup(reference: generateUUID(PBXGroup.self, "Carthage"), children: platforms.references, sourceTree: .group, name: "Carthage", path: carthageBuildPath)
addObject(carthageGroup)
frameworkFiles.append(carthageGroup.reference)
}
@@ -130,7 +110,7 @@ public class PBXProjGenerator {
topLevelGroups.append(group)
}
let mainGroup = PBXGroup(reference: generateUUID(PBXGroup.self, "Project"), children: topLevelGroups.referenceList, sourceTree: .group)
let mainGroup = PBXGroup(reference: generateUUID(PBXGroup.self, "Project"), children: topLevelGroups.references, sourceTree: .group)
addObject(mainGroup)
let knownRegions: [String] = ["en", "Base"]
@@ -141,7 +121,7 @@ public class PBXProjGenerator {
mainGroup: mainGroup.reference,
developmentRegion: "English",
knownRegions: knownRegions,
targets: targets.referenceList,
targets: targets.references,
attributes: projectAttributes)
project.projects.append(root)
@@ -215,7 +195,7 @@ public class PBXProjGenerator {
return XCBuildConfiguration(reference: generateUUID(XCBuildConfiguration.self, config.name + target.name), name: config.name, baseConfigurationReference: baseConfigurationReference, buildSettings: buildSettings)
}
configs.forEach(addObject)
let buildConfigList = XCConfigurationList(reference: generateUUID(XCConfigurationList.self, target.name), buildConfigurations: configs.referenceSet, defaultConfigurationName: "")
let buildConfigList = XCConfigurationList(reference: generateUUID(XCConfigurationList.self, target.name), buildConfigurations: configs.references, defaultConfigurationName: "")
addObject(buildConfigList)
var dependancies: [String] = []
@@ -295,9 +275,9 @@ public class PBXProjGenerator {
let fileReference = targetFileReferences[target.name]!
var buildPhases: [String] = []
func getBuildFilesForPhase(_ buildPhase: BuildPhase) -> Set<String> {
func getBuildFilesForPhase(_ buildPhase: BuildPhase) -> [String] {
let files = sourceFilePaths.filter { getBuildPhaseForPath($0) == buildPhase }.map(generateSourceFile)
return Set(files.map { $0.buildFile.reference })
return files.map { $0.buildFile.reference }
}
func getBuildScript(buildScript: BuildScript) throws -> PBXShellScriptBuildPhase {
@@ -314,10 +294,12 @@ public class PBXProjGenerator {
reference: generateUUID(PBXShellScriptBuildPhase.self, String(describing: buildScript.name) + shellScript + target.name),
files: [],
name: buildScript.name ?? "Run Script",
inputPaths: Set(buildScript.inputFiles),
outputPaths: Set(buildScript.outputFiles),
shellPath: buildScript.shell ?? "/bin/sh",
inputPaths: buildScript.inputFiles,
outputPaths: buildScript.outputFiles,
shellScript: shellScript)
if let shell = buildScript.shell {
shellScriptPhase.shellPath = shell
}
shellScriptPhase.runOnlyForDeploymentPostprocessing = buildScript.runOnlyWhenInstalling ? 1 : 0
addObject(shellScriptPhase)
buildPhases.append(shellScriptPhase.reference)
@@ -342,7 +324,7 @@ public class PBXProjGenerator {
let frameworkBuildPhase = PBXFrameworksBuildPhase(
reference: generateUUID(PBXFrameworksBuildPhase.self, target.name),
files: Set(targetFrameworkBuildFiles),
files: targetFrameworkBuildFiles,
runOnlyForDeploymentPostprocessing: 0)
addObject(frameworkBuildPhase)
@@ -355,7 +337,7 @@ public class PBXProjGenerator {
reference: generateUUID(PBXCopyFilesBuildPhase.self, "embed app extensions" + target.name),
dstPath: "",
dstSubfolderSpec: .plugins,
files: Set(extensions))
files: extensions)
addObject(copyFilesPhase)
buildPhases.append(copyFilesPhase.reference)
@@ -367,7 +349,7 @@ public class PBXProjGenerator {
reference: generateUUID(PBXCopyFilesBuildPhase.self, "embed frameworks" + target.name),
dstPath: "",
dstSubfolderSpec: .frameworks,
files: Set(copyFiles))
files: copyFiles)
addObject(copyFilesPhase)
buildPhases.append(copyFilesPhase.reference)
@@ -377,7 +359,7 @@ public class PBXProjGenerator {
if target.type.isApp {
let inputPaths = carthageFrameworks.map { "$(SRCROOT)/\(carthageBuildPath)/\(target.platform)/\($0)\($0.contains(".") ? "" : ".framework")" }
let carthageScript = PBXShellScriptBuildPhase(reference: generateUUID(PBXShellScriptBuildPhase.self, "Carthage" + target.name), files: [], name: "Carthage", inputPaths: Set(inputPaths), outputPaths: [], shellPath: "/bin/sh", shellScript: "/usr/local/bin/carthage copy-frameworks\n")
let carthageScript = PBXShellScriptBuildPhase(reference: generateUUID(PBXShellScriptBuildPhase.self, "Carthage" + target.name), files: [], name: "Carthage", inputPaths: inputPaths, outputPaths: [], shellPath: "/bin/sh", shellScript: "/usr/local/bin/carthage copy-frameworks\n")
addObject(carthageScript)
buildPhases.append(carthageScript.reference)
}