From e336f5609300bca9d84aaeb9645290cb5a53a303 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 18 Nov 2019 18:07:46 +0900 Subject: [PATCH 01/14] Support .bundle dependency --- Sources/ProjectSpec/Dependency.swift | 6 ++++ Sources/XcodeGenKit/PBXProjGenerator.swift | 33 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/Sources/ProjectSpec/Dependency.swift b/Sources/ProjectSpec/Dependency.swift index ebd0084d..3a3e1a04 100644 --- a/Sources/ProjectSpec/Dependency.swift +++ b/Sources/ProjectSpec/Dependency.swift @@ -46,6 +46,7 @@ public struct Dependency: Equatable { case carthage(findFrameworks: Bool?, linkType: CarthageLinkType) case sdk(root: String?) case package(product: String?) + case bundle } } @@ -77,6 +78,9 @@ extension Dependency: JSONObjectConvertible { let product: String? = jsonDictionary.json(atKeyPath: "product") type = .package(product: product) reference = package + } else if let bundle: String = jsonDictionary.json(atKeyPath: "bundle") { + type = .bundle + reference = bundle } else { throw SpecParsingError.invalidDependency(jsonDictionary) } @@ -130,6 +134,8 @@ extension Dependency: JSONEncodable { dict["sdk"] = reference case .package: dict["package"] = reference + case .bundle: + dict["bundle"] = reference } return dict diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift index 212ee2ff..5c924a9e 100644 --- a/Sources/XcodeGenKit/PBXProjGenerator.swift +++ b/Sources/XcodeGenKit/PBXProjGenerator.swift @@ -22,6 +22,7 @@ public class PBXProjGenerator { var carthageFrameworksByPlatform: [String: Set] = [:] var frameworkFiles: [PBXFileElement] = [] + var bundleFiles: [PBXFileElement] = [] var generated = false @@ -213,6 +214,17 @@ public class PBXProjGenerator { derivedGroups.append(group) } + if !bundleFiles.isEmpty { + let group = addObject( + PBXGroup( + children: bundleFiles, + sourceTree: .group, + name: "Bundles" + ) + ) + derivedGroups.append(group) + } + mainGroup.children = Array(sourceGenerator.rootGroups) sortGroups(group: mainGroup) // add derived groups at the end @@ -647,6 +659,23 @@ public class PBXProjGenerator { PBXTargetDependency(product: packageDependency) ) dependencies.append(targetDependency) + case .bundle: + // Static and dynamic libraries can't copy resources + guard target.type != .staticLibrary && target.type != .dynamicLibrary else { break } + + let fileReference = sourceGenerator.getFileReference( + path: Path(dependency.reference), + inPath: project.basePath, + sourceTree: .buildProductsDir + ) + + let pbxBuildFile = PBXBuildFile(file: fileReference, settings: nil) + let buildFile = addObject(pbxBuildFile) + copyResourcesReferences.append(buildFile) + + if !bundleFiles.contains(fileReference) { + bundleFiles.append(fileReference) + } } } @@ -1047,6 +1076,10 @@ public class PBXProjGenerator { dependencies[dependency.reference] = dependency } } + case .bundle: + if isTopLevel { + dependencies[dependency.reference] = dependency + } } } From 7669d60d66e48384966456f0e09f74edb24b1e7a Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 18 Nov 2019 19:14:12 +0900 Subject: [PATCH 02/14] Add copying bundles phase to trigger building Bundle --- Sources/XcodeGenKit/PBXProjGenerator.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift index 5c924a9e..0446acbb 100644 --- a/Sources/XcodeGenKit/PBXProjGenerator.swift +++ b/Sources/XcodeGenKit/PBXProjGenerator.swift @@ -763,12 +763,21 @@ public class PBXProjGenerator { buildPhases += try target.postCompileScripts.map { try generateBuildScript(targetName: target.name, buildScript: $0) } - let resourcesBuildPhaseFiles = getBuildFilesForPhase(.resources) + copyResourcesReferences + let resourcesBuildPhaseFiles = getBuildFilesForPhase(.resources) if !resourcesBuildPhaseFiles.isEmpty { let resourcesBuildPhase = addObject(PBXResourcesBuildPhase(files: resourcesBuildPhaseFiles)) buildPhases.append(resourcesBuildPhase) } + if !copyResourcesReferences.isEmpty { + let copyBundlesPhase = addObject(PBXCopyFilesBuildPhase( + dstSubfolderSpec: .resources, + name: "Copy Bundles to Resources directory", + files: copyResourcesReferences + )) + buildPhases.append(copyBundlesPhase) + } + let swiftObjCInterfaceHeader = project.getCombinedBuildSetting("SWIFT_OBJC_INTERFACE_HEADER_NAME", target: target, config: project.configs[0]) as? String if target.type == .staticLibrary From 46925cdd7d7f6f681194c7cdcf6234ea47dcc9f1 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 20 Nov 2019 16:24:05 +0900 Subject: [PATCH 03/14] Separate Resources and Bundles --- Sources/XcodeGenKit/PBXProjGenerator.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift index 0446acbb..5868f39d 100644 --- a/Sources/XcodeGenKit/PBXProjGenerator.swift +++ b/Sources/XcodeGenKit/PBXProjGenerator.swift @@ -445,6 +445,7 @@ public class PBXProjGenerator { var copyFilesBuildPhasesFiles: [TargetSource.BuildPhase.CopyFilesSettings: [PBXBuildFile]] = [:] var copyFrameworksReferences: [PBXBuildFile] = [] var copyResourcesReferences: [PBXBuildFile] = [] + var copyBundlesReferences: [PBXBuildFile] = [] var copyWatchReferences: [PBXBuildFile] = [] var packageDependencies: [XCSwiftPackageProductDependency] = [] var extensions: [PBXBuildFile] = [] @@ -671,7 +672,7 @@ public class PBXProjGenerator { let pbxBuildFile = PBXBuildFile(file: fileReference, settings: nil) let buildFile = addObject(pbxBuildFile) - copyResourcesReferences.append(buildFile) + copyBundlesReferences.append(buildFile) if !bundleFiles.contains(fileReference) { bundleFiles.append(fileReference) @@ -763,17 +764,17 @@ public class PBXProjGenerator { buildPhases += try target.postCompileScripts.map { try generateBuildScript(targetName: target.name, buildScript: $0) } - let resourcesBuildPhaseFiles = getBuildFilesForPhase(.resources) + let resourcesBuildPhaseFiles = getBuildFilesForPhase(.resources) + copyResourcesReferences if !resourcesBuildPhaseFiles.isEmpty { let resourcesBuildPhase = addObject(PBXResourcesBuildPhase(files: resourcesBuildPhaseFiles)) buildPhases.append(resourcesBuildPhase) } - if !copyResourcesReferences.isEmpty { + if !copyBundlesReferences.isEmpty { let copyBundlesPhase = addObject(PBXCopyFilesBuildPhase( dstSubfolderSpec: .resources, name: "Copy Bundles to Resources directory", - files: copyResourcesReferences + files: copyBundlesReferences )) buildPhases.append(copyBundlesPhase) } From db1f711ac8a8f60af4d74036f0e52ddeae1640d0 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 20 Nov 2019 16:53:45 +0900 Subject: [PATCH 04/14] Add test case --- .../ProjectGeneratorTests.swift | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift index 48823f7c..3f4cfbed 100644 --- a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift +++ b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift @@ -381,6 +381,7 @@ class ProjectGeneratorTests: XCTestCase { // var expectedResourceFiles: [String: Set] = [:] + var expectedBundlesFiles: [String: Set] = [:] var expectedLinkedFiles: [String: Set] = [:] var expectedEmbeddedFrameworks: [String: Set] = [:] @@ -433,9 +434,11 @@ class ProjectGeneratorTests: XCTestCase { Dependency(type: .target, reference: iosFrameworkX.name /* , link: false */ ), Dependency(type: .framework, reference: "FrameworkX.framework" /* , link: false */ ), Dependency(type: .carthage(findFrameworks: false, linkType: .dynamic), reference: "CarthageZ"), + Dependency(type: .bundle, reference: "BundleA.bundle"), ] ) expectedResourceFiles[staticLibrary.name] = Set() + expectedBundlesFiles[staticLibrary.name] = Set() expectedLinkedFiles[staticLibrary.name] = Set([ iosFrameworkZ.filename, "FrameworkZ.framework", @@ -463,9 +466,13 @@ class ProjectGeneratorTests: XCTestCase { // Statically linked, so don't embed into test Dependency(type: .target, reference: staticLibrary.name), Dependency(type: .carthage(findFrameworks: false, linkType: .dynamic), reference: "CarthageB", embed: false), + Dependency(type: .bundle, reference: "BundleA.bundle"), ] ) expectedResourceFiles[iosFrameworkA.name] = Set() + expectedBundlesFiles[iosFrameworkA.name] = Set([ + "BundleA.bundle" + ]) expectedLinkedFiles[iosFrameworkA.name] = Set([ "FrameworkC.framework", iosFrameworkZ.filename, @@ -594,6 +601,8 @@ class ProjectGeneratorTests: XCTestCase { let resourcesPhases = pbxProject.resourcesBuildPhases.filter { buildPhases.contains($0) } let frameworkPhases = pbxProject.frameworksBuildPhases.filter { buildPhases.contains($0) } let copyFilesPhases = pbxProject.copyFilesBuildPhases.filter { buildPhases.contains($0) } + let embedFrameworkPhase = copyFilesPhases.first { $0.dstSubfolderSpec == .frameworks } + let copyBundlesPhase = copyFilesPhases.first { $0.dstSubfolderSpec == .resources } // All targets should have a compile sources phase, // except for the sticker pack one @@ -622,17 +631,24 @@ class ProjectGeneratorTests: XCTestCase { try expect(Set(linkFrameworks)) == expectedLinkedFiles } + var expectedCopyFilesPhasesCount = 0 // ensure only the right things are embedded, no more, no less - if let expectedEmbeddedFrameworks = expectedEmbeddedFrameworks[target.name] { - try expect(copyFilesPhases.count) == (expectedEmbeddedFrameworks.isEmpty ? 0 : 1) - if !expectedEmbeddedFrameworks.isEmpty { - let copyFiles = (copyFilesPhases[0].files ?? []) - .compactMap { $0.file?.nameOrPath } - try expect(Set(copyFiles)) == expectedEmbeddedFrameworks - } - } else { - try expect(copyFilesPhases.count) == 0 + if let expectedEmbeddedFrameworks = expectedEmbeddedFrameworks[target.name], !expectedEmbeddedFrameworks.isEmpty { + expectedCopyFilesPhasesCount += 1 + let copyFiles = (embedFrameworkPhase?.files ?? []) + .compactMap { $0.file?.nameOrPath } + try expect(Set(copyFiles)) == expectedEmbeddedFrameworks } + + if let expectedBundlesFiles = expectedBundlesFiles[target.name], + target.type != .staticLibrary && target.type != .dynamicLibrary { + expectedCopyFilesPhasesCount += 1 + let copyBundles = (copyBundlesPhase?.files ?? []) + .compactMap { $0.file?.nameOrPath } + try expect(Set(copyBundles)) == expectedBundlesFiles + } + print(target.name) + try expect(copyFilesPhases.count) == expectedCopyFilesPhasesCount } } From 8b9e6ed01b8639986d7e537fb15d72cb99f23246 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 20 Nov 2019 17:34:58 +0900 Subject: [PATCH 05/14] Update ProjectSpec.md --- Docs/ProjectSpec.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Docs/ProjectSpec.md b/Docs/ProjectSpec.md index b265edfc..fa2ca3c6 100644 --- a/Docs/ProjectSpec.md +++ b/Docs/ProjectSpec.md @@ -373,13 +373,14 @@ targets: ### Dependency -A dependency can be one of a 3 types: +A dependency can be one of a 6 types: - `target: name` - links to another target - `framework: path` - links to a framework - `carthage: name` - helper for linking to a Carthage framework - `sdk: name` - links to a dependency with the SDK. This can either be a relative path within the sdk root or a single filename that references a framework (.framework) or lib (.tbd) - `package: name` - links to a Swift Package. The name must match the name of a package defined in the top level `packages` +- `bundle: name` - adds the pre-built bundle for the supplied name to the copy resources build phase. This is useful when a dependency exists on a static library target that has an associated bundle target, both existing in a separate project. Only usable in target types which can copy resources. Always use `implicit: true`. This will not cause the bundle to be explicitly built. **Linking options**: @@ -391,7 +392,7 @@ A dependency can be one of a 3 types: **Implicit Framework options**: -This only applies to `framework` dependencies. Implicit framework dependencies are useful in Xcode Workspaces which have multiple `.xcodeproj` that are not embedded within each other yet have a dependency on a framework built in an adjacent `.xcodeproj`. By having `Find Implicit Dependencies` checked within your scheme `Build Options` Xcode can link built frameworks in `BUILT_PRODUCTS_DIR`. +This only applies to `framework` and `bundle` dependencies. Implicit framework dependencies are useful in Xcode Workspaces which have multiple `.xcodeproj` that are not embedded within each other yet have a dependency on a framework built in an adjacent `.xcodeproj`. By having `Find Implicit Dependencies` checked within your scheme `Build Options` Xcode can link built frameworks in `BUILT_PRODUCTS_DIR`. - [ ] **implicit**: **Bool** - Whether the framework is an implicit dependency. Defaults to `false` . From 626c868f80cf70677594736d968be6db100f2024 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 20 Nov 2019 17:35:41 +0900 Subject: [PATCH 06/14] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c720278..7828ee63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Add Carthage static framework dependencies support. [#688](https://github.com/yonaskolb/XcodeGen/pull/688) @giginet - Added `xcodegen dump` command [#710](https://github.com/yonaskolb/XcodeGen/pull/710) @yonaskolb - Added `--no-env` option to disable environment variables expansion [#704](https://github.com/yonaskolb/XcodeGen/pull/704) @rcari +- Added new dependency type, `bundle`. This allows targets to copy bundles from other projects [#616](https://github.com/yonaskolb/XcodeGen/pull/616) @bsmith11 #### Fixed - Improved variable expansion runtime [#704](https://github.com/yonaskolb/XcodeGen/pull/704) @rcari From f2452a86d119990e3e1671849a878a38edf6a0af Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 20 Nov 2019 20:39:30 +0900 Subject: [PATCH 07/14] Remove debug code --- Tests/XcodeGenKitTests/ProjectGeneratorTests.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift index 3f4cfbed..3877ee8a 100644 --- a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift +++ b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift @@ -647,7 +647,6 @@ class ProjectGeneratorTests: XCTestCase { .compactMap { $0.file?.nameOrPath } try expect(Set(copyBundles)) == expectedBundlesFiles } - print(target.name) try expect(copyFilesPhases.count) == expectedCopyFilesPhasesCount } } From 074791175cd7beaf58ca8a7a6dcd2563cb3b4c37 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 20 Nov 2019 19:26:42 -0800 Subject: [PATCH 08/14] Add bundle dependency to TestProject --- Tests/Fixtures/TestProject/project.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/Fixtures/TestProject/project.yml b/Tests/Fixtures/TestProject/project.yml index c0bf9b70..2e50a524 100644 --- a/Tests/Fixtures/TestProject/project.yml +++ b/Tests/Fixtures/TestProject/project.yml @@ -92,6 +92,7 @@ targets: - target: App_watchOS - target: iMessageApp - sdk: Contacts.framework + - bundle: BundleA.bundle scheme: testTargets: - App_iOS_Tests From 663ab0c3f94f80f178434bb5b1dcf71e613671cc Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 20 Nov 2019 19:31:48 -0800 Subject: [PATCH 09/14] Update Fixtures --- .../Project.xcodeproj/project.pbxproj | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj b/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj index 26e7e259..103ed91f 100644 --- a/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj +++ b/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj @@ -40,6 +40,7 @@ 21425F6DE3D493B6F1E33D21 /* Framework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41FC82ED1C4C3B7B3D7B2FB7 /* Framework.framework */; }; 216B220EC7961DF7CA9188B7 /* StaticLibrary_ObjC.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5A2B916A11DCC2565241359F /* StaticLibrary_ObjC.h */; }; 21CA04F29CD0DEB0DD27B808 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C5AC2545AE4D4F7F44E2E9B /* Result.framework */; }; + 240AB77B7BB08DC529B5C974 /* BundleA.bundle in Copy Bundles to Resources directory */ = {isa = PBXBuildFile; fileRef = E2AF3B572B3B2E815DA1844D /* BundleA.bundle */; }; 262891CCD5F74316610437FA /* Framework2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EF21DF245F66BEF5446AAEF /* Framework2.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 265B6A05C0198FD2EB485173 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93C033648A37D95027845BD3 /* main.swift */; }; 2730C6D0A35AED4ADD6EDF17 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0704B6CAFBB53E0EBB08F6B3 /* ViewController.swift */; settings = {COMPILER_FLAGS = "-Werror"; }; }; @@ -315,6 +316,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 32C3437B0218811108366142 /* Copy Bundles to Resources directory */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstSubfolderSpec = 7; + files = ( + 240AB77B7BB08DC529B5C974 /* BundleA.bundle in Copy Bundles to Resources directory */, + ); + name = "Copy Bundles to Resources directory"; + runOnlyForDeploymentPostprocessing = 0; + }; 6CB76DFA8662672C4245AF41 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -523,6 +534,7 @@ D70BE0C05E5779A077793BE6 /* Model 2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Model 2.xcdatamodel"; sourceTree = ""; }; D8A016580A3B8F72B820BFBF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; D8D8907E2CDA1295D0D94F53 /* StaticLibrary_Swift.a */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = archive.ar; path = StaticLibrary_Swift.a; sourceTree = BUILT_PRODUCTS_DIR; }; + E2AF3B572B3B2E815DA1844D /* BundleA.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = BundleA.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; E42335D1200CB7B8B91E962F /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = Base; path = Base.lproj/Localizable.stringsdict; sourceTree = ""; }; E43116070AFEF5D8C3A5A957 /* TestFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TestFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E55F45EACB0F382722D61C8D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -707,6 +719,7 @@ C2F3574CCEF023755DDB1A06 /* Mintfile */, 6B1603BA83AA0C7B94E45168 /* ResourceFolder */, 6BBE762F36D94AB6FFBFE834 /* SomeFile */, + 79DC4A1E4D2E0D3A215179BC /* Bundles */, FC1515684236259C50A7747F /* Frameworks */, AC523591AC7BE9275003D2DB /* Products */, ); @@ -786,6 +799,14 @@ path = "App_watchOS Extension"; sourceTree = ""; }; + 79DC4A1E4D2E0D3A215179BC /* Bundles */ = { + isa = PBXGroup; + children = ( + E2AF3B572B3B2E815DA1844D /* BundleA.bundle */, + ); + name = Bundles; + sourceTree = ""; + }; 80C3A0E524EC1ABCB9149EA2 /* XPC Service */ = { isa = PBXGroup; children = ( @@ -1103,6 +1124,7 @@ buildPhases = ( 6F573D15DE1F149EF128C492 /* Sources */, 8508BA1B733839E314AF2853 /* Resources */, + 32C3437B0218811108366142 /* Copy Bundles to Resources directory */, 865AAD9909027AC34D1374EA /* CopyFiles */, 37182EC208DBF03DB1BAF452 /* Carthage */, 117840B4DBC04099F6779D00 /* Frameworks */, From ea6ac80c87e4919db1c666dc58d211e48979e3fb Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 21 Nov 2019 16:30:58 +0900 Subject: [PATCH 10/14] Add AnotherProject for fixture --- Tests/FixtureTests/FixtureTests.swift | 1 + .../AnotherProject.xcodeproj/project.pbxproj | 533 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../TestProject/AnotherProject/project.yml | 8 + .../Project.xcodeproj/project.pbxproj | 8 +- .../contents.xcworkspacedata | 10 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + Tests/Fixtures/TestProject/build.sh | 4 +- Tests/Fixtures/TestProject/project.yml | 2 +- scripts/gen-fixtures.sh | 1 + 11 files changed, 583 insertions(+), 7 deletions(-) create mode 100644 Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.pbxproj create mode 100644 Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Tests/Fixtures/TestProject/AnotherProject/project.yml create mode 100644 Tests/Fixtures/TestProject/Workspace.xcworkspace/contents.xcworkspacedata create mode 100644 Tests/Fixtures/TestProject/Workspace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Tests/FixtureTests/FixtureTests.swift b/Tests/FixtureTests/FixtureTests.swift index 2d81a9e7..d4ebda33 100644 --- a/Tests/FixtureTests/FixtureTests.swift +++ b/Tests/FixtureTests/FixtureTests.swift @@ -11,6 +11,7 @@ class FixtureTests: XCTestCase { func testProjectFixture() { describe { $0.it("generates Test Project") { + try generateXcodeProject(specPath: fixturePath + "TestProject/AnotherProject/project.yml") try generateXcodeProject(specPath: fixturePath + "TestProject/project.yml") } $0.it("generates Carthage Project") { diff --git a/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.pbxproj b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.pbxproj new file mode 100644 index 00000000..3942aaee --- /dev/null +++ b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.pbxproj @@ -0,0 +1,533 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXFileReference section */ + 6023D61BF2C57E6AE09CE7A3 /* BundleX.bundle */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "wrapper.plug-in"; path = BundleX.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 60D6679FB526839EAFEA2EEE /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = config.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXGroup section */ + 3B245BCEF731A43880657E0E /* Configs */ = { + isa = PBXGroup; + children = ( + 60D6679FB526839EAFEA2EEE /* config.xcconfig */, + ); + name = Configs; + path = ../Configs; + sourceTree = ""; + }; + 4E8CFA4275C972686621210C = { + isa = PBXGroup; + children = ( + 3B245BCEF731A43880657E0E /* Configs */, + 6BB7980FAF18A93459B051A1 /* Products */, + ); + sourceTree = ""; + }; + 6BB7980FAF18A93459B051A1 /* Products */ = { + isa = PBXGroup; + children = ( + 6023D61BF2C57E6AE09CE7A3 /* BundleX.bundle */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 63A2D4898D974A06E85B07F8 /* BundleX */ = { + isa = PBXNativeTarget; + buildConfigurationList = 32C09717E388BCD9DB9E513C /* Build configuration list for PBXNativeTarget "BundleX" */; + buildPhases = ( + B3BCC260A0A2F2F00458816F /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = BundleX; + productName = BundleX; + productReference = 6023D61BF2C57E6AE09CE7A3 /* BundleX.bundle */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 1B166EB49192B73A9DD8E108 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + }; + buildConfigurationList = 3DFC1105373EDB6483D4BC5D /* Build configuration list for PBXProject "AnotherProject" */; + compatibilityVersion = "Xcode 10.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + Base, + en, + ); + mainGroup = 4E8CFA4275C972686621210C; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 63A2D4898D974A06E85B07F8 /* BundleX */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + B3BCC260A0A2F2F00458816F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 011619A463B654F60012FC9E /* Test Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_ID_SUFFIX = .test; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; + VALIDATE_PRODUCT = YES; + }; + name = "Test Release"; + }; + 03418826FAC3BC1FAB207D05 /* Production Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; + VALIDATE_PRODUCT = YES; + }; + name = "Production Release"; + }; + 039F4FBE2C50C67BCD6BD67B /* Staging Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_ID_SUFFIX = .staging; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; + VALIDATE_PRODUCT = YES; + }; + name = "Staging Release"; + }; + 270E1D32776D2D196D435FDA /* Staging Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_ID_SUFFIX = .staging; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = "Staging Debug"; + }; + 49FA7F235A6CA1F941192151 /* Staging Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Staging Release"; + }; + 4D621C4C28C8614EA5D6ADC2 /* Production Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Production Debug"; + }; + 56ADF89C9058B2C25F6C80CE /* Staging Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Staging Debug"; + }; + 5790F0FBCBF55A0DF258AD6A /* Production Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = "Production Debug"; + }; + 5F14CE04E33ACD729A0EE6B6 /* Test Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Test Debug"; + }; + 9BD6CAD5463121A1C3FED138 /* Production Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Production Release"; + }; + C3231A91F004B1D0018146DB /* Test Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 60D6679FB526839EAFEA2EEE /* config.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_ID_SUFFIX = .test; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = "Test Debug"; + }; + C7A4FCD4E277AD34B36E5185 /* Test Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Test Release"; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 32C09717E388BCD9DB9E513C /* Build configuration list for PBXNativeTarget "BundleX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4D621C4C28C8614EA5D6ADC2 /* Production Debug */, + 9BD6CAD5463121A1C3FED138 /* Production Release */, + 56ADF89C9058B2C25F6C80CE /* Staging Debug */, + 49FA7F235A6CA1F941192151 /* Staging Release */, + 5F14CE04E33ACD729A0EE6B6 /* Test Debug */, + C7A4FCD4E277AD34B36E5185 /* Test Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ""; + }; + 3DFC1105373EDB6483D4BC5D /* Build configuration list for PBXProject "AnotherProject" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5790F0FBCBF55A0DF258AD6A /* Production Debug */, + 03418826FAC3BC1FAB207D05 /* Production Release */, + 270E1D32776D2D196D435FDA /* Staging Debug */, + 039F4FBE2C50C67BCD6BD67B /* Staging Release */, + C3231A91F004B1D0018146DB /* Test Debug */, + 011619A463B654F60012FC9E /* Test Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = "Production Debug"; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1B166EB49192B73A9DD8E108 /* Project object */; +} diff --git a/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Tests/Fixtures/TestProject/AnotherProject/project.yml b/Tests/Fixtures/TestProject/AnotherProject/project.yml new file mode 100644 index 00000000..a777563e --- /dev/null +++ b/Tests/Fixtures/TestProject/AnotherProject/project.yml @@ -0,0 +1,8 @@ +name: AnotherProject +include: [../environments.yml] +configFiles: + Test Debug: ../Configs/config.xcconfig +targets: + BundleX: + type: bundle + platform: iOS diff --git a/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj b/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj index c9be2171..6ca4fe9f 100644 --- a/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj +++ b/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj @@ -40,7 +40,6 @@ 21425F6DE3D493B6F1E33D21 /* Framework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41FC82ED1C4C3B7B3D7B2FB7 /* Framework.framework */; }; 216B220EC7961DF7CA9188B7 /* StaticLibrary_ObjC.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5A2B916A11DCC2565241359F /* StaticLibrary_ObjC.h */; }; 21CA04F29CD0DEB0DD27B808 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C5AC2545AE4D4F7F44E2E9B /* Result.framework */; }; - 240AB77B7BB08DC529B5C974 /* BundleA.bundle in Copy Bundles to Resources directory */ = {isa = PBXBuildFile; fileRef = E2AF3B572B3B2E815DA1844D /* BundleA.bundle */; }; 262891CCD5F74316610437FA /* Framework2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EF21DF245F66BEF5446AAEF /* Framework2.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 265B6A05C0198FD2EB485173 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93C033648A37D95027845BD3 /* main.swift */; }; 2730C6D0A35AED4ADD6EDF17 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0704B6CAFBB53E0EBB08F6B3 /* ViewController.swift */; settings = {COMPILER_FLAGS = "-Werror"; }; }; @@ -123,6 +122,7 @@ E4D0F435405DABCB51C5B684 /* TestFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E43116070AFEF5D8C3A5A957 /* TestFramework.framework */; }; E5DD0AD6F7AE1DD4AF98B83E /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 65C8D6D1DDC1512D396C07B7 /* Localizable.stringsdict */; }; E8A135F768448632F8D77C8F /* StandaloneAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3571E41E19A5AB8AAAB04109 /* StandaloneAssets.xcassets */; }; + F07FC32458F3193917261C15 /* BundleX.bundle in Copy Bundles to Resources directory */ = {isa = PBXBuildFile; fileRef = 45C12576F5AA694DD0CE2132 /* BundleX.bundle */; }; F5D71267BB5A326BDD69D532 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E55F45EACB0F382722D61C8D /* Assets.xcassets */; }; F6537CE373C94809E6653758 /* Headers in Headers */ = {isa = PBXBuildFile; fileRef = 2E1E747C7BC434ADB80CC269 /* Headers */; settings = {ATTRIBUTES = (Public, ); }; }; F7423E8738EECF04795C7601 /* InterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3F6BCB5FEFB16F1BA368059 /* InterfaceController.swift */; }; @@ -323,7 +323,7 @@ buildActionMask = 2147483647; dstSubfolderSpec = 7; files = ( - 240AB77B7BB08DC529B5C974 /* BundleA.bundle in Copy Bundles to Resources directory */, + F07FC32458F3193917261C15 /* BundleX.bundle in Copy Bundles to Resources directory */, ); name = "Copy Bundles to Resources directory"; runOnlyForDeploymentPostprocessing = 0; @@ -479,6 +479,7 @@ 3EF21DF245F66BEF5446AAEF /* Framework2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Framework2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 40863AE6202CFCD0529D8438 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 41FC82ED1C4C3B7B3D7B2FB7 /* Framework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Framework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 45C12576F5AA694DD0CE2132 /* BundleX.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = BundleX.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 4BF4D16042A80576D259160C /* Model 3.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Model 3.xcdatamodel"; sourceTree = ""; }; 4D0BF47DF71A6DBA33ED23FD /* StaticLibrary_ObjC.a */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = archive.ar; path = StaticLibrary_ObjC.a; sourceTree = BUILT_PRODUCTS_DIR; }; 5116B3B58070BCD09F1487BA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -538,7 +539,6 @@ D8A016580A3B8F72B820BFBF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; D8D8907E2CDA1295D0D94F53 /* StaticLibrary_Swift.a */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = archive.ar; path = StaticLibrary_Swift.a; sourceTree = BUILT_PRODUCTS_DIR; }; DAA7880242A9DE61E68026CC /* Folder */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Folder; sourceTree = SOURCE_ROOT; }; - E2AF3B572B3B2E815DA1844D /* BundleA.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = BundleA.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; E42335D1200CB7B8B91E962F /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = Base; path = Base.lproj/Localizable.stringsdict; sourceTree = ""; }; E43116070AFEF5D8C3A5A957 /* TestFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TestFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E55F45EACB0F382722D61C8D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -806,7 +806,7 @@ 79DC4A1E4D2E0D3A215179BC /* Bundles */ = { isa = PBXGroup; children = ( - E2AF3B572B3B2E815DA1844D /* BundleA.bundle */, + 45C12576F5AA694DD0CE2132 /* BundleX.bundle */, ); name = Bundles; sourceTree = ""; diff --git a/Tests/Fixtures/TestProject/Workspace.xcworkspace/contents.xcworkspacedata b/Tests/Fixtures/TestProject/Workspace.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..c4110399 --- /dev/null +++ b/Tests/Fixtures/TestProject/Workspace.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Tests/Fixtures/TestProject/Workspace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Tests/Fixtures/TestProject/Workspace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/Tests/Fixtures/TestProject/Workspace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Tests/Fixtures/TestProject/build.sh b/Tests/Fixtures/TestProject/build.sh index a1e22bc4..b6cb372a 100755 --- a/Tests/Fixtures/TestProject/build.sh +++ b/Tests/Fixtures/TestProject/build.sh @@ -4,10 +4,10 @@ set -e carthage bootstrap --cache-builds echo " ⚙️ Building iOS app" -xcodebuild -quiet -project Project.xcodeproj -scheme "App_iOS Test" -configuration "Test Debug" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" +xcodebuild -quiet -workspace Workspace.xcworkspace -scheme "App_iOS Test" -configuration "Test Debug" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" echo "✅ Successfully built iOS app" echo " ⚙️ Building macOS app" -xcodebuild -quiet -project Project.xcodeproj -scheme "App_macOS" -configuration "Test Debug" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" +xcodebuild -quiet -workspace Workspace.xcworkspace -scheme "App_macOS" -configuration "Test Debug" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" echo "✅ Successfully built macOS app" diff --git a/Tests/Fixtures/TestProject/project.yml b/Tests/Fixtures/TestProject/project.yml index 75b39923..56a4c4b2 100644 --- a/Tests/Fixtures/TestProject/project.yml +++ b/Tests/Fixtures/TestProject/project.yml @@ -98,7 +98,7 @@ targets: - target: App_watchOS - target: iMessageApp - sdk: Contacts.framework - - bundle: BundleA.bundle + - bundle: BundleX.bundle scheme: testTargets: - App_iOS_Tests diff --git a/scripts/gen-fixtures.sh b/scripts/gen-fixtures.sh index e191a416..a3785436 100755 --- a/scripts/gen-fixtures.sh +++ b/scripts/gen-fixtures.sh @@ -1,6 +1,7 @@ #!/bin/bash set -e +swift run xcodegen --spec Tests/Fixtures/TestProject/AnotherProject/project.yml swift run xcodegen --spec Tests/Fixtures/TestProject/project.yml swift run xcodegen --spec Tests/Fixtures/CarthageProject/project.yml swift run xcodegen --spec Tests/Fixtures/SPM/project.yml From fc939fd84154b717c75e054dc684618d9c32153b Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 4 Dec 2019 23:42:44 +0900 Subject: [PATCH 11/14] Update ProjectSpec.md --- Docs/ProjectSpec.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Docs/ProjectSpec.md b/Docs/ProjectSpec.md index 043d34ce..140f239e 100644 --- a/Docs/ProjectSpec.md +++ b/Docs/ProjectSpec.md @@ -381,7 +381,7 @@ A dependency can be one of a 6 types: - `carthage: name` - helper for linking to a Carthage framework - `sdk: name` - links to a dependency with the SDK. This can either be a relative path within the sdk root or a single filename that references a framework (.framework) or lib (.tbd) - `package: name` - links to a Swift Package. The name must match the name of a package defined in the top level `packages` -- `bundle: name` - adds the pre-built bundle for the supplied name to the copy resources build phase. This is useful when a dependency exists on a static library target that has an associated bundle target, both existing in a separate project. Only usable in target types which can copy resources. Always use `implicit: true`. This will not cause the bundle to be explicitly built. +- `bundle: name` - adds the pre-built bundle for the supplied name to the copy resources build phase. This is useful when a dependency exists on a static library target that has an associated bundle target, both existing in a separate project. Only usable in target types which can copy resources. **Linking options**: @@ -393,7 +393,7 @@ A dependency can be one of a 6 types: **Implicit Framework options**: -This only applies to `framework` and `bundle` dependencies. Implicit framework dependencies are useful in Xcode Workspaces which have multiple `.xcodeproj` that are not embedded within each other yet have a dependency on a framework built in an adjacent `.xcodeproj`. By having `Find Implicit Dependencies` checked within your scheme `Build Options` Xcode can link built frameworks in `BUILT_PRODUCTS_DIR`. +This only applies to `framework` dependencies. Implicit framework dependencies are useful in Xcode Workspaces which have multiple `.xcodeproj` that are not embedded within each other yet have a dependency on a framework built in an adjacent `.xcodeproj`. By having `Find Implicit Dependencies` checked within your scheme `Build Options` Xcode can link built frameworks in `BUILT_PRODUCTS_DIR`. - [ ] **implicit**: **Bool** - Whether the framework is an implicit dependency. Defaults to `false` . From 9ad6ddb25e68d2e03d2e42db49088caee9abfdee Mon Sep 17 00:00:00 2001 From: yonaskolb Date: Sun, 5 Jan 2020 11:03:10 +1100 Subject: [PATCH 12/14] update SwiftCLI --- Package.resolved | 4 ++-- Package.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Package.resolved b/Package.resolved index b31ffa04..a8ffac65 100644 --- a/Package.resolved +++ b/Package.resolved @@ -51,8 +51,8 @@ "repositoryURL": "https://github.com/jakeheis/SwiftCLI.git", "state": { "branch": null, - "revision": "ba2268e67c07b9f9cfbc0801385e6238b36255eb", - "version": "5.3.2" + "revision": "c72c4564f8c0a24700a59824880536aca45a4cae", + "version": "6.0.1" } }, { diff --git a/Package.swift b/Package.swift index d6915829..070e7eda 100644 --- a/Package.swift +++ b/Package.swift @@ -17,7 +17,7 @@ let package = Package( .package(url: "https://github.com/kylef/Spectre.git", from: "0.9.0"), .package(url: "https://github.com/onevcat/Rainbow.git", from: "3.0.0"), .package(url: "https://github.com/tuist/XcodeProj.git", from: "7.4.0"), - .package(url: "https://github.com/jakeheis/SwiftCLI.git", .upToNextMinor(from: "5.3.2")), + .package(url: "https://github.com/jakeheis/SwiftCLI.git", from: "6.0.0"), ], targets: [ .target(name: "XcodeGen", dependencies: [ From 06a02425f6b87bcac779c13963ed35e368e8fc0f Mon Sep 17 00:00:00 2001 From: yonaskolb Date: Sun, 5 Jan 2020 11:24:14 +1100 Subject: [PATCH 13/14] use new property wrappers in SwiftCLI 6.0 --- Sources/XcodeGenCLI/Arguments.swift | 4 +- .../XcodeGenCLI/Commands/DumpCommand.swift | 20 +++------ .../Commands/GenerateCommand.swift | 41 +++++++------------ .../XcodeGenCLI/Commands/ProjectCommand.swift | 19 +++------ 4 files changed, 28 insertions(+), 56 deletions(-) diff --git a/Sources/XcodeGenCLI/Arguments.swift b/Sources/XcodeGenCLI/Arguments.swift index 29b90853..fef7c798 100644 --- a/Sources/XcodeGenCLI/Arguments.swift +++ b/Sources/XcodeGenCLI/Arguments.swift @@ -4,7 +4,7 @@ import SwiftCLI extension Path: ConvertibleFromString { - public static func convert(from: String) -> Path? { - Path(from) + public init?(input: String) { + self.init(input) } } diff --git a/Sources/XcodeGenCLI/Commands/DumpCommand.swift b/Sources/XcodeGenCLI/Commands/DumpCommand.swift index e6a78d3f..dc30fbda 100644 --- a/Sources/XcodeGenCLI/Commands/DumpCommand.swift +++ b/Sources/XcodeGenCLI/Commands/DumpCommand.swift @@ -6,19 +6,11 @@ import Yams class DumpCommand: ProjectCommand { - private let dumpType = Key( - "--type", - "-t", - description: """ - The type of dump to output. Either \(DumpType.allCases.map { "\"\($0.rawValue)\"" }.joined(separator: ", ")). Defaults to \(DumpType.defaultValue.rawValue). The "parsed" types parse the project into swift and then back again. - """ - ) + @Key("--type", "-t", description: "The type of dump to output. Either \(DumpType.allCases.map { "\"\($0.rawValue)\"" }.joined(separator: ", ")). Defaults to \(DumpType.defaultValue.rawValue). The \"parsed\" types parse the project into swift and then back again.") + private var dumpType: DumpType? - private let file = Key( - "--file", - "-f", - description: "The path of a file to write to. If not supplied will output to stdout" - ) + @Key("--file", "-f", description: "The path of a file to write to. If not supplied will output to stdout") + private var file: Path? init(version: Version) { super.init(version: version, @@ -27,7 +19,7 @@ class DumpCommand: ProjectCommand { } override func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws { - let type = dumpType.value ?? .defaultValue + let type = dumpType ?? .defaultValue let output: String switch type { @@ -49,7 +41,7 @@ class DumpCommand: ProjectCommand { output = project.debugDescription } - if let file = file.value { + if let file = file { try file.parent().mkpath() try file.write(output) } else { diff --git a/Sources/XcodeGenCLI/Commands/GenerateCommand.swift b/Sources/XcodeGenCLI/Commands/GenerateCommand.swift index 251368e9..d2319f4e 100644 --- a/Sources/XcodeGenCLI/Commands/GenerateCommand.swift +++ b/Sources/XcodeGenCLI/Commands/GenerateCommand.swift @@ -7,30 +7,17 @@ import XcodeProj class GenerateCommand: ProjectCommand { - let quiet = Flag( - "-q", - "--quiet", - description: "Suppress all informational and success output", - defaultValue: false - ) + @Flag("-q", "--quiet", description: "Suppress all informational and success output") + var quiet: Bool - let useCache = Flag( - "-c", - "--use-cache", - description: "Use a cache for the xcodegen spec. This will prevent unnecessarily generating the project if nothing has changed", - defaultValue: false - ) + @Flag("-c", "--use-cache", description: "Use a cache for the xcodegen spec. This will prevent unnecessarily generating the project if nothing has changed") + var useCache: Bool - let cacheFilePath = Key( - "--cache-path", - description: "Where the cache file will be loaded from and save to. Defaults to ~/.xcodegen/cache/{SPEC_PATH_HASH}" - ) + @Key("--cache-path", description: "Where the cache file will be loaded from and save to. Defaults to ~/.xcodegen/cache/{SPEC_PATH_HASH}") + var cacheFilePath: Path? - let projectDirectory = Key( - "-p", - "--project", - description: "The path to the directory where the project should be generated. Defaults to the directory the spec is in. The filename is defined in the project spec" - ) + @Key("-p", "--project", description: "The path to the directory where the project should be generated. Defaults to the directory the spec is in. The filename is defined in the project spec") + var projectDirectory: Path? init(version: Version) { super.init(version: version, @@ -40,7 +27,7 @@ class GenerateCommand: ProjectCommand { override func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws { - let projectDirectory = self.projectDirectory.value?.absolute() ?? projectSpecPath.parent() + let projectDirectory = self.projectDirectory?.absolute() ?? projectSpecPath.parent() // validate project dictionary do { @@ -51,12 +38,12 @@ class GenerateCommand: ProjectCommand { let projectPath = projectDirectory + "\(project.name).xcodeproj" - let cacheFilePath = self.cacheFilePath.value ?? + let cacheFilePath = self.cacheFilePath ?? Path("~/.xcodegen/cache/\(projectSpecPath.absolute().string.md5)").absolute() var cacheFile: CacheFile? // read cache - if useCache.value || self.cacheFilePath.value != nil { + if useCache || self.cacheFilePath != nil { do { cacheFile = try specLoader.generateCacheFile() } catch { @@ -129,19 +116,19 @@ class GenerateCommand: ProjectCommand { } func info(_ string: String) { - if !quiet.value { + if !quiet { stdout.print(string) } } func warning(_ string: String) { - if !quiet.value { + if !quiet { stdout.print(string.yellow) } } func success(_ string: String) { - if !quiet.value { + if !quiet { stdout.print(string.green) } } diff --git a/Sources/XcodeGenCLI/Commands/ProjectCommand.swift b/Sources/XcodeGenCLI/Commands/ProjectCommand.swift index 18c2faa1..7bb9dac8 100644 --- a/Sources/XcodeGenCLI/Commands/ProjectCommand.swift +++ b/Sources/XcodeGenCLI/Commands/ProjectCommand.swift @@ -11,18 +11,11 @@ class ProjectCommand: Command { let name: String let shortDescription: String - let spec = Key( - "-s", - "--spec", - description: "The path to the project spec file. Defaults to project.yml" - ) + @Key("-s", "--spec", description: "The path to the project spec file. Defaults to project.yml") + var spec: Path? - let disableEnvExpansion = Flag( - "-n", - "--no-env", - description: "Disable environment variable expansions", - defaultValue: false - ) + @Flag("-n", "--no-env", description: "Disable environment variable expansions") + var disableEnvExpansion: Bool init(version: Version, name: String, shortDescription: String) { self.version = version @@ -32,7 +25,7 @@ class ProjectCommand: Command { func execute() throws { - let projectSpecPath = (spec.value ?? "project.yml").absolute() + let projectSpecPath = (spec ?? "project.yml").absolute() if !projectSpecPath.exists { throw GenerationError.missingProjectSpec(projectSpecPath) @@ -41,7 +34,7 @@ class ProjectCommand: Command { let specLoader = SpecLoader(version: version) let project: Project - let variables: [String: String] = disableEnvExpansion.value ? [:] : ProcessInfo.processInfo.environment + let variables: [String: String] = disableEnvExpansion ? [:] : ProcessInfo.processInfo.environment do { project = try specLoader.loadProject(path: projectSpecPath, variables: variables) From 1a99ffd89cb1a4730f83bafd4f416ecf936ef823 Mon Sep 17 00:00:00 2001 From: yonaskolb Date: Sun, 5 Jan 2020 11:35:21 +1100 Subject: [PATCH 14/14] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5099f087..0d3c93e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ #### Added - Support for language and region settings on a target basis [#728](https://github.com/yonaskolb/XcodeGen/pull/728) @FranzBusch +#### Internal +- Update to SwiftCLI 6.0 and use the new property wrappers [#749](https://github.com/yonaskolb/XcodeGen/pull/749) @yonaskolb + ## 2.11.0 #### Added