From f0b1d1bf76a50b57e95265d1d72029705da5ed47 Mon Sep 17 00:00:00 2001 From: Artem Loenko Date: Thu, 18 Feb 2021 16:10:00 +0000 Subject: [PATCH 001/143] Add inline comments support to the `xcconfig` parser (#604) * Update xcconfig test data with comment examples * Adjust unit-tests for xcconfig * Update settingRegex regular expression with comments support * Fix comment spelling * Add an edge-case test when a comment has to space * Add CHANGELOG.md entry for the PR --- CHANGELOG.md | 1 + Fixtures/XCConfigs/Children.xcconfig | 4 ++-- Fixtures/XCConfigs/Parent.xcconfig | 5 ++++- Sources/XcodeProj/Utils/XCConfig.swift | 2 +- Tests/XcodeProjTests/Utils/XCConfigTests.swift | 2 ++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2ea80fa3..d42773498 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - JSON decoder not properly decoding `defaultConfigurationIsVisible` in some projects [#593](https://github.com/tuist/XcodeProj/pull/593) by [@tjwio](https://github.com/tjwio) - JSON decoder not properly decoding `proxyType` in some projects [#596](https://github.com/tuist/XcodeProj/issues/596) by [@tjwio](https://github.com/tjwio) - BuildPhaseTests not handling failure cases properly [#597](https://github.com/tuist/XcodeProj/issues/597) by [@tjwio](https://github.com/tjwio) +- `xcconfig` parser does not support inline comments [#602](https://github.com/tuist/XcodeProj/issues/602) by [@dive](https://github.com/dive) ## 7.18.0 - Penguin diff --git a/Fixtures/XCConfigs/Children.xcconfig b/Fixtures/XCConfigs/Children.xcconfig index fca8692d3..de28539ca 100644 --- a/Fixtures/XCConfigs/Children.xcconfig +++ b/Fixtures/XCConfigs/Children.xcconfig @@ -1,5 +1,5 @@ #include "Parent.xcconfig" -CONFIGURATION_BUILD_DIR = Test/ +CONFIGURATION_BUILD_DIR = Test/ // NOTE: Test comment line to check several slashes GCC_PREPROCESSOR_DEFINITIONS = $(inherited) -WARNING_CFLAGS = -Wall -Wno-direct-ivar-access -Wno-objc-missing-property-synthesis -Wno-readonly-iboutlet-property -Wno-switch-enum -Wno-padded \ No newline at end of file +WARNING_CFLAGS = -Wall -Wno-direct-ivar-access -Wno-objc-missing-property-synthesis -Wno-readonly-iboutlet-property -Wno-switch-enum -Wno-padded diff --git a/Fixtures/XCConfigs/Parent.xcconfig b/Fixtures/XCConfigs/Parent.xcconfig index d70cdb84d..796528af6 100644 --- a/Fixtures/XCConfigs/Parent.xcconfig +++ b/Fixtures/XCConfigs/Parent.xcconfig @@ -1,2 +1,5 @@ +// NOTE: Top level comment OTHER_SWIFT_FLAGS_XCODE_0821 = $(inherited) -OTHER_SWIFT_FLAGS_XCODE_0830 = $(inherited) -enable-bridging-pch \ No newline at end of file +OTHER_SWIFT_FLAGS_XCODE_0830 = $(inherited) -enable-bridging-pch +PRODUCT_NAME = $(TARGET_NAME) // NOTE: Test Comment +SWIFT_OPTIMIZATION_LEVEL = -Onone// Edge-case when a comment has no space diff --git a/Sources/XcodeProj/Utils/XCConfig.swift b/Sources/XcodeProj/Utils/XCConfig.swift index 77bdf7be9..640ad7668 100644 --- a/Sources/XcodeProj/Utils/XCConfig.swift +++ b/Sources/XcodeProj/Utils/XCConfig.swift @@ -99,7 +99,7 @@ final class XCConfigParser { // swiftlint:disable:next force_try private static var includeRegex = try! NSRegularExpression(pattern: "#include\\s+\"(.+\\.xcconfig)\"", options: .caseInsensitive) // swiftlint:disable:next force_try - private static var settingRegex = try! NSRegularExpression(pattern: "^([a-zA-Z0-9_\\[\\]=\\*~]+)\\s*=\\s*(\"?.*?\"?)\\s*(?:;\\s*)?$", options: []) + private static var settingRegex = try! NSRegularExpression(pattern: "^([a-zA-Z0-9_\\[\\]=\\*~]+)\\s*=\\s*(\"?.*?\"?)\\s*(?:;\\s*)?(?=$|\\/\\/)", options: []) } // MARK: - XCConfig Extension (Equatable) diff --git a/Tests/XcodeProjTests/Utils/XCConfigTests.swift b/Tests/XcodeProjTests/Utils/XCConfigTests.swift index 692c7d6c0..ade947b42 100644 --- a/Tests/XcodeProjTests/Utils/XCConfigTests.swift +++ b/Tests/XcodeProjTests/Utils/XCConfigTests.swift @@ -110,5 +110,7 @@ final class XCConfigIntegrationTests: XCTestCase { XCTAssertEqual(config.includes.count, 1) XCTAssertEqual(config.flattenedBuildSettings()["OTHER_SWIFT_FLAGS_XCODE_0821"] as? String, "$(inherited)") XCTAssertEqual(config.flattenedBuildSettings()["OTHER_SWIFT_FLAGS_XCODE_0830"] as? String, "$(inherited) -enable-bridging-pch") + XCTAssertEqual(config.flattenedBuildSettings()["PRODUCT_NAME"] as? String, "$(TARGET_NAME)") + XCTAssertEqual(config.flattenedBuildSettings()["SWIFT_OPTIMIZATION_LEVEL"] as? String, "-Onone") } } From c8afc799be95bbc6c329ba12d15342ffa7c4577d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Thu, 18 Feb 2021 17:18:26 +0100 Subject: [PATCH 002/143] Version 7.19.0 --- CHANGELOG.md | 2 ++ README.md | 4 ++-- XcodeProj_Carthage.xcodeproj/project.pbxproj | 5 +++-- .../xcshareddata/xcschemes/XcodeProj.xcscheme | 10 +-------- xcodeproj.podspec | 21 +++++++++---------- 5 files changed, 18 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d42773498..c8014fe70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next +## 7.19.0 - Kreuzberg + ### Fixed - JSON decoder not properly decoding `defaultConfigurationIsVisible` in some projects [#593](https://github.com/tuist/XcodeProj/pull/593) by [@tjwio](https://github.com/tjwio) diff --git a/README.md b/README.md index 71100a261..1db39bfd0 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.18.0")) + .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.19.0")) ], targets: [ .target( @@ -65,7 +65,7 @@ github "tuist/xcodeproj" ~> 7.11. ### CocoaPods ```ruby -pod 'xcodeproj', '~> 7.18.0 +pod 'xcodeproj', '~> 7.19.0 ``` ### Scripting diff --git a/XcodeProj_Carthage.xcodeproj/project.pbxproj b/XcodeProj_Carthage.xcodeproj/project.pbxproj index 684580c81..614b06b15 100644 --- a/XcodeProj_Carthage.xcodeproj/project.pbxproj +++ b/XcodeProj_Carthage.xcodeproj/project.pbxproj @@ -110,6 +110,7 @@ 7FAD067EE084B2EF5EFE4BFF /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; + dstPath = ""; dstSubfolderSpec = 10; files = ( ); @@ -734,7 +735,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.3; + SWIFT_VERSION = 5.3.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -875,7 +876,7 @@ SUPPORTED_PLATFORMS = macosx; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 5.3; + SWIFT_VERSION = 5.3.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; diff --git a/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme b/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme index 906385865..bfc23e82f 100644 --- a/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme +++ b/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme @@ -51,21 +51,13 @@ ReferencedContainer = "container:XcodeProj_Carthage.xcodeproj"> - - - - - - - - "https://github.com/tuist/xcodeproj.git", :tag => s.version.to_s } + s.source = { git: 'https://github.com/tuist/xcodeproj.git', tag: s.version.to_s } s.requires_arc = true - s.authors = "Tuist" - s.swift_version = "5.1" + s.authors = 'Tuist' + s.swift_version = '5.1' s.osx.deployment_target = '10.10' - s.source_files = "Sources/**/*.{swift}" + s.source_files = 'Sources/**/*.{swift}' s.module_name = 'XcodeProj' - s.dependency "PathKit", "~> 1.0.0" - s.dependency "AEXML", "~> 4.6.0" + s.dependency 'PathKit', '~> 1.0.0' + s.dependency 'AEXML', '~> 4.6.0' end From 4010ddaea76bc9fb9fd393f9af0435d8af233535 Mon Sep 17 00:00:00 2001 From: Franz Busch Date: Thu, 11 Mar 2021 18:42:13 +0100 Subject: [PATCH 003/143] Add runPostActionsOnFailure to scheme (#603) --- CHANGELOG.md | 1 + Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift | 1 + Sources/XcodeProj/Scheme/XCScheme+BuildAction.swift | 10 ++++++++-- .../Extensions/AEXML+XcodeFormatTests.swift | 5 ++++- Tests/XcodeProjTests/Scheme/XCSchemeTests.swift | 2 ++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8014fe70..f3303ebc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) ## Next +- Added `runPostActionsOnFailure` to `XCScheme` [#603](https://github.com/tuist/XcodeProj/pull/603) by [@FranzBusch](https://github.com/FranzBusch) ## 7.19.0 - Kreuzberg diff --git a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift index 4e0617b46..f19dd2001 100644 --- a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift +++ b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift @@ -13,6 +13,7 @@ let attributesOrder: [String: [String]] = [ "BuildAction": [ "parallelizeBuildables", "buildImplicitDependencies", + "runPostActionsOnFailure", ], "BuildActionEntry": [ "buildForTesting", diff --git a/Sources/XcodeProj/Scheme/XCScheme+BuildAction.swift b/Sources/XcodeProj/Scheme/XCScheme+BuildAction.swift index 2be673ade..561f9f2a1 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+BuildAction.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+BuildAction.swift @@ -75,6 +75,7 @@ extension XCScheme { public var buildActionEntries: [Entry] public var parallelizeBuild: Bool public var buildImplicitDependencies: Bool + public var runPostActionsOnFailure: Bool // MARK: - Init @@ -82,16 +83,19 @@ extension XCScheme { preActions: [ExecutionAction] = [], postActions: [ExecutionAction] = [], parallelizeBuild: Bool = false, - buildImplicitDependencies: Bool = false) { + buildImplicitDependencies: Bool = false, + runPostActionsOnFailure: Bool = false) { self.buildActionEntries = buildActionEntries self.parallelizeBuild = parallelizeBuild self.buildImplicitDependencies = buildImplicitDependencies + self.runPostActionsOnFailure = runPostActionsOnFailure super.init(preActions, postActions) } override init(element: AEXMLElement) throws { parallelizeBuild = element.attributes["parallelizeBuildables"].map { $0 == "YES" } ?? true buildImplicitDependencies = element.attributes["buildImplicitDependencies"].map { $0 == "YES" } ?? true + runPostActionsOnFailure = element.attributes["runPostActionsOnFailure"].map { $0 == "YES" } ?? false buildActionEntries = try element["BuildActionEntries"]["BuildActionEntry"] .all? .map(Entry.init) ?? [] @@ -115,6 +119,7 @@ extension XCScheme { attributes: [ "parallelizeBuildables": parallelizeBuild.xmlString, "buildImplicitDependencies": buildImplicitDependencies.xmlString, + "runPostActionsOnFailure": runPostActionsOnFailure.xmlString, ]) super.writeXML(parent: element) let entries = element.addChild(name: "BuildActionEntries") @@ -131,7 +136,8 @@ extension XCScheme { return super.isEqual(to: to) && buildActionEntries == rhs.buildActionEntries && parallelizeBuild == rhs.parallelizeBuild && - buildImplicitDependencies == rhs.buildImplicitDependencies + buildImplicitDependencies == rhs.buildImplicitDependencies && + runPostActionsOnFailure == rhs.runPostActionsOnFailure } } } diff --git a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift index f384be869..529a82c31 100644 --- a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift +++ b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift @@ -15,13 +15,15 @@ class AEXML_XcodeFormatTests: XCTestCase { + buildImplicitDependencies = "NO" + runPostActionsOnFailure = "YES"> """ func test_BuildAction_attributes_sorted_when_original_sorted() { validateAttributes(attributes: [ "parallelizeBuildables": "YES", + "runPostActionsOnFailure": "YES", "buildImplicitDependencies": "NO", ]) } @@ -30,6 +32,7 @@ class AEXML_XcodeFormatTests: XCTestCase { validateAttributes(attributes: [ "buildImplicitDependencies": "NO", "parallelizeBuildables": "YES", + "runPostActionsOnFailure": "YES", ]) } diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift index 7447f4cd4..0041486ea 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift @@ -253,6 +253,7 @@ final class XCSchemeIntegrationTests: XCTestCase { // Build action XCTAssertTrue(scheme.buildAction?.parallelizeBuild == true) XCTAssertTrue(scheme.buildAction?.buildImplicitDependencies == true) + XCTAssertTrue(scheme.buildAction?.runPostActionsOnFailure == false) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.testing) == true) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.running) == true) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.profiling) == true) @@ -419,6 +420,7 @@ final class XCSchemeIntegrationTests: XCTestCase { // Build action XCTAssertTrue(scheme.buildAction?.parallelizeBuild == true) XCTAssertTrue(scheme.buildAction?.buildImplicitDependencies == true) + XCTAssertTrue(scheme.buildAction?.runPostActionsOnFailure == false) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.testing) == true) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.running) == false) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.profiling) == true) From 6943d5c5f9085d070dbde3c669144e30d41ec635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Wed, 31 Mar 2021 12:28:26 +0200 Subject: [PATCH 004/143] Version 7.20.0 --- CHANGELOG.md | 3 +++ README.md | 4 ++-- .../xcshareddata/xcschemes/XcodeProj.xcscheme | 6 ++---- .../xcschemes/XcodeProj_Carthage-Project.xcscheme | 3 +-- xcodeproj.podspec | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3303ebc9..fe6a5dce9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) +## 7.20.0 - Sol + ## Next + - Added `runPostActionsOnFailure` to `XCScheme` [#603](https://github.com/tuist/XcodeProj/pull/603) by [@FranzBusch](https://github.com/FranzBusch) ## 7.19.0 - Kreuzberg diff --git a/README.md b/README.md index 1db39bfd0..5a4d582f8 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.19.0")) + .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.20.0")) ], targets: [ .target( @@ -65,7 +65,7 @@ github "tuist/xcodeproj" ~> 7.11. ### CocoaPods ```ruby -pod 'xcodeproj', '~> 7.19.0 +pod 'xcodeproj', '~> 7.20.0 ``` ### Scripting diff --git a/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme b/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme index bfc23e82f..066eafdeb 100644 --- a/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme +++ b/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme @@ -26,8 +26,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES" - disableMainThreadChecker = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -40,8 +39,7 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" - allowLocationSimulation = "YES" - disableMainThreadChecker = "YES"> + allowLocationSimulation = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES"> diff --git a/xcodeproj.podspec b/xcodeproj.podspec index 994190f00..cafffa775 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '7.19.0' + s.version = '7.20.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From c5419e148cc8044983863e24447047877a1aa9c6 Mon Sep 17 00:00:00 2001 From: Alfredo Delli Bovi Date: Mon, 19 Apr 2021 18:57:08 +0200 Subject: [PATCH 005/143] Improve md5 (#606) Co-authored-by: Alfredo Delli Bovi --- Sources/XcodeProj/Extensions/String+md5.swift | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/Sources/XcodeProj/Extensions/String+md5.swift b/Sources/XcodeProj/Extensions/String+md5.swift index 77ad4a934..5abdf59a7 100644 --- a/Sources/XcodeProj/Extensions/String+md5.swift +++ b/Sources/XcodeProj/Extensions/String+md5.swift @@ -32,12 +32,8 @@ extension String { } #if canImport(CryptoKit) if #available(OSX 10.15, *) { - var hasher = Insecure.MD5() - hasher.update(data: data) - let digest = hasher.finalize() - return digest.reduce(into: "") { hexString, byte in - hexString.append(String(format: "%02hhx", byte)) - } + return Insecure.MD5.hash(data: data) + .withUnsafeBytes { Array($0) }.hexString } else { return data.slowMD5 } @@ -47,6 +43,31 @@ extension String { } } +private let charA = UInt8(UnicodeScalar("a").value) +private let char0 = UInt8(UnicodeScalar("0").value) + +private extension DataProtocol { + var hexString: String { + let hexLen = self.count * 2 + let ptr = UnsafeMutablePointer.allocate(capacity: hexLen) + var offset = 0 + + self.regions.forEach { (_) in + for i in self { + ptr[Int(offset * 2)] = itoh((i >> 4) & 0xF) + ptr[Int(offset * 2 + 1)] = itoh(i & 0xF) + offset += 1 + } + } + + return String(bytesNoCopy: ptr, length: hexLen, encoding: .utf8, freeWhenDone: true)! + } + + func itoh(_ value: UInt8) -> UInt8 { + return (value > 9) ? (charA + value - 10) : (char0 + value) + } +} + private extension Data { // Custom md5 for systems without CryptoKit. var slowMD5: String { @@ -59,12 +80,7 @@ private extension Data { let MD5Calculator = MD5(message) let MD5Data = MD5Calculator.calculate() - - var MD5String = String() - for c in MD5Data { - MD5String += String(format: "%02x", c) - } - return MD5String + return MD5Data.hexString } } From 0c889906136b7cba277b9327e9a8217669bb4eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 19 Apr 2021 19:00:09 +0200 Subject: [PATCH 006/143] Version 7.21.0 --- CHANGELOG.md | 8 +++++++- README.md | 4 ++-- xcodeproj.podspec | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe6a5dce9..b7c64a787 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) +## 7.21.0 - Alfredo + +## Changed + +- Speed up md5 generation [#606](https://github.com/tuist/XcodeProj/pull/606) by [@adellibovi](https://github.com/adellibovi) + ## 7.20.0 - Sol -## Next +## Added - Added `runPostActionsOnFailure` to `XCScheme` [#603](https://github.com/tuist/XcodeProj/pull/603) by [@FranzBusch](https://github.com/FranzBusch) diff --git a/README.md b/README.md index 5a4d582f8..d9b8ea302 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.20.0")) + .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.21.0")) ], targets: [ .target( @@ -65,7 +65,7 @@ github "tuist/xcodeproj" ~> 7.11. ### CocoaPods ```ruby -pod 'xcodeproj', '~> 7.20.0 +pod 'xcodeproj', '~> 7.21.0 ``` ### Scripting diff --git a/xcodeproj.podspec b/xcodeproj.podspec index cafffa775..7776f0bb2 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '7.20.0' + s.version = '7.21.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From 5860027a19a46e0ac0c2e8e80b346dd34e7d47fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fo=C5=99t?= Date: Tue, 27 Apr 2021 11:29:34 +0200 Subject: [PATCH 007/143] Add CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER (#608) * Add CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER to projectAll * Update CHANGELOG * Remove whitespace --- CHANGELOG.md | 10 ++++++++-- Sources/XcodeProj/Utils/BuildSettingsProvider.swift | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7c64a787..2937b3f02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,20 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) +## Next + +### Added + +- `CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER` to default build setting [#608](https://github.com/tuist/XcodeProj/pull/608) by [@fortmarek](https://github.com/fortmarek) + ## 7.21.0 - Alfredo -## Changed +### Changed - Speed up md5 generation [#606](https://github.com/tuist/XcodeProj/pull/606) by [@adellibovi](https://github.com/adellibovi) ## 7.20.0 - Sol -## Added +### Added - Added `runPostActionsOnFailure` to `XCScheme` [#603](https://github.com/tuist/XcodeProj/pull/603) by [@FranzBusch](https://github.com/FranzBusch) diff --git a/Sources/XcodeProj/Utils/BuildSettingsProvider.swift b/Sources/XcodeProj/Utils/BuildSettingsProvider.swift index f9e2ffdd7..dbb23d314 100644 --- a/Sources/XcodeProj/Utils/BuildSettingsProvider.swift +++ b/Sources/XcodeProj/Utils/BuildSettingsProvider.swift @@ -120,6 +120,7 @@ public class BuildSettingsProvider { "CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF": "YES", "CLANG_WARN_OBJC_LITERAL_CONVERSION": "YES", "CLANG_WARN_OBJC_ROOT_CLASS": "YES_ERROR", + "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER": "YES", "CLANG_WARN_RANGE_LOOP_ANALYSIS": "YES", "CLANG_WARN_STRICT_PROTOTYPES": "YES", "CLANG_WARN_SUSPICIOUS_MOVE": "YES", From 3076b6dbda32169426dd4a6fc37a02ec870634ed Mon Sep 17 00:00:00 2001 From: Fero Date: Tue, 27 Apr 2021 12:51:40 +0200 Subject: [PATCH 008/143] =?UTF-8?q?=F0=9F=9B=91=20Prevent=20overwriting=20?= =?UTF-8?q?identical=20workspace=20data=20(#607)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * πŸ›‘ Prevent overwriting identical workspace data * πŸ›  Address review comment * 🀦 Okay XCWorkspace != XCWorkspaceData * πŸ›  Use data with glo path * 😎 Shift the responsibility of data equality to XCWorkspace * Update Sources/XcodeProj/Workspace/XCWorkspace.swift Co-authored-by: Marek FoΕ™t Co-authored-by: Marek FoΕ™t --- Sources/XcodeProj/Workspace/XCWorkspace.swift | 9 +++++++++ Sources/XcodeProj/Workspace/XCWorkspaceData.swift | 14 +++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Sources/XcodeProj/Workspace/XCWorkspace.swift b/Sources/XcodeProj/Workspace/XCWorkspace.swift index 55c575d3d..5732a9e7c 100644 --- a/Sources/XcodeProj/Workspace/XCWorkspace.swift +++ b/Sources/XcodeProj/Workspace/XCWorkspace.swift @@ -53,6 +53,15 @@ public final class XCWorkspace: Writable, Equatable { public func write(path: Path, override: Bool = true) throws { let dataPath = path + "contents.xcworkspacedata" if override, dataPath.exists { + if let existingContent: String = try? dataPath.read(), + existingContent == data.rawContents() { + // Raw data matches what's on disk + // there's no need to overwrite the contents + // this mitigates Xcode forcing users to + // close and re-open projects/workspaces + // on regeneration. + return + } try dataPath.delete() } try dataPath.mkpath() diff --git a/Sources/XcodeProj/Workspace/XCWorkspaceData.swift b/Sources/XcodeProj/Workspace/XCWorkspaceData.swift index 61b790ca4..2c2ff3a92 100644 --- a/Sources/XcodeProj/Workspace/XCWorkspaceData.swift +++ b/Sources/XcodeProj/Workspace/XCWorkspaceData.swift @@ -36,20 +36,24 @@ extension XCWorkspaceData: Writable { self.init(children: children) } - - // MARK: - - - public func write(path: Path, override: Bool = true) throws { + + func rawContents() -> String { let document = AEXMLDocument() let workspace = document.addChild(name: "Workspace", value: nil, attributes: ["version": "1.0"]) _ = children .map { $0.xmlElement() } .map(workspace.addChild) + return document.xmlXcodeFormat + } + // MARK: - + + public func write(path: Path, override: Bool = true) throws { + let rawXml = rawContents() if override, path.exists { try path.delete() } - try path.write(document.xmlXcodeFormat) + try path.write(rawXml) } } From 94e55232d227f9d78b811c98cb2e5d0cbd08987b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Tue, 27 Apr 2021 12:53:08 +0200 Subject: [PATCH 009/143] Version 7.22.0 --- CHANGELOG.md | 2 ++ README.md | 4 ++-- xcodeproj.podspec | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2937b3f02..e5cd3697a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next +## 7.22.0 - Ringui Dingui + ### Added - `CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER` to default build setting [#608](https://github.com/tuist/XcodeProj/pull/608) by [@fortmarek](https://github.com/fortmarek) diff --git a/README.md b/README.md index d9b8ea302..44f100d02 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.21.0")) + .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.22.0")) ], targets: [ .target( @@ -65,7 +65,7 @@ github "tuist/xcodeproj" ~> 7.11. ### CocoaPods ```ruby -pod 'xcodeproj', '~> 7.21.0 +pod 'xcodeproj', '~> 7.22.0 ``` ### Scripting diff --git a/xcodeproj.podspec b/xcodeproj.podspec index 7776f0bb2..64c342bc2 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '7.21.0' + s.version = '7.22.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From 77b7102bfc5824ad2d114430edd4cf9a1b4a8d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Tue, 27 Apr 2021 13:02:37 +0200 Subject: [PATCH 010/143] Fix changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5cd3697a..5633fdbfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ - `CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER` to default build setting [#608](https://github.com/tuist/XcodeProj/pull/608) by [@fortmarek](https://github.com/fortmarek) +### Fixed + +- Prevent overwriting identical workspace data [#607](https://github.com/tuist/XcodeProj/pull/607) by [@ferologics](https://github.com/ferologics) + ## 7.21.0 - Alfredo ### Changed From be702b93150292396b0d068cea2a7ffa27f8e36b Mon Sep 17 00:00:00 2001 From: "freddi(Yuki Aki)" Date: Sat, 1 May 2021 21:23:01 +0900 Subject: [PATCH 011/143] Allows passing `BuildableIdentifier` String to `BuildableReference` initializer (#605) - Added an initializer which receives buildableIdentifier as a String - This is needed when adding targets from local swift packages to a scheme --- CHANGELOG.md | 4 ++++ .../Scheme/XCScheme+BuildableReference.swift | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5633fdbfa..6e2785f85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Next +### Added + +- Allows passing BuildableIdentifier String to BuildableReference initializer [#605](https://github.com/tuist/XcodeProj/pull/605) by [@freddi-kit](https://github.com/freddi-kit) + ## 7.22.0 - Ringui Dingui ### Added diff --git a/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift b/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift index ba768c034..43c8a08a6 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift @@ -46,6 +46,18 @@ extension XCScheme { self.blueprintName = blueprintName } + public init(referencedContainer: String, + blueprintIdentifier: String, + buildableName: String, + blueprintName: String, + buildableIdentifier: String = "primary") { + self.referencedContainer = referencedContainer + self.blueprint = .string(blueprintIdentifier) + self.buildableName = buildableName + self.buildableIdentifier = buildableIdentifier + self.blueprintName = blueprintName + } + // MARK: - XML init(element: AEXMLElement) throws { From fd0d3d5f82c25540aa2acddb33d7826aa4e2c791 Mon Sep 17 00:00:00 2001 From: Yonas Kolb Date: Tue, 18 May 2021 15:49:51 +1000 Subject: [PATCH 012/143] Fix Linux (#615) * remove objc * update changelog --- CHANGELOG.md | 4 ++++ Sources/XcodeProj/Scheme/XCScheme+SerialAction.swift | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e2785f85..6a6e05253 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - Allows passing BuildableIdentifier String to BuildableReference initializer [#605](https://github.com/tuist/XcodeProj/pull/605) by [@freddi-kit](https://github.com/freddi-kit) +### Fixed + +- Fixed building on Linux [#615](https://github.com/tuist/XcodeProj/pull/615) by [@yonaskolb](https://github.com/yonaskolb) + ## 7.22.0 - Ringui Dingui ### Added diff --git a/Sources/XcodeProj/Scheme/XCScheme+SerialAction.swift b/Sources/XcodeProj/Scheme/XCScheme+SerialAction.swift index 0f55ce8fc..4a02b06b3 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+SerialAction.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+SerialAction.swift @@ -39,7 +39,7 @@ extension XCScheme { // MARK: - Equatable - @objc dynamic func isEqual(to: Any?) -> Bool { + func isEqual(to: Any?) -> Bool { guard let rhs = to as? SerialAction else { return false } return preActions == rhs.preActions && postActions == rhs.postActions From 45e349e1c4e4da1a85a7b9392b737acde2e2f2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Tue, 18 May 2021 07:58:34 +0200 Subject: [PATCH 013/143] Version 7.23.0 --- CHANGELOG.md | 1 + Package.resolved | 4 ++-- Project.swift | 1 - README.md | 8 ++++---- XcodeProj_Carthage.xcodeproj/project.pbxproj | 10 ++++------ .../project.xcworkspace/contents.xcworkspacedata | 3 +++ .../xcshareddata/xcschemes/XcodeProj.xcscheme | 3 ++- .../xcschemes/XcodeProj_Carthage-Project.xcscheme | 3 ++- xcodeproj.podspec | 2 +- 9 files changed, 19 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a6e05253..c7321bd70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Next +## 7.23.0 - Bonsai ### Added - Allows passing BuildableIdentifier String to BuildableReference initializer [#605](https://github.com/tuist/XcodeProj/pull/605) by [@freddi-kit](https://github.com/freddi-kit) diff --git a/Package.resolved b/Package.resolved index 9b55b3616..cd537a787 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/tadija/AEXML", "state": { "branch": null, - "revision": "502c4d43a6cc9c395d19111e09dc62ad834977b5", - "version": "4.6.0" + "revision": "8623e73b193386909566a9ca20203e33a09af142", + "version": "4.5.0" } }, { diff --git a/Project.swift b/Project.swift index cf19b20f0..d96f3f5ac 100644 --- a/Project.swift +++ b/Project.swift @@ -11,6 +11,5 @@ let project = Project(name: "XcodeProj_Carthage", dependencies: [ .framework(path: "Carthage/Build/Mac/AEXML.framework"), .framework(path: "Carthage/Build/Mac/PathKit.framework"), - .framework(path: "Carthage/Build/Mac/XcodeProjCExt.framework"), ]), ]) diff --git a/README.md b/README.md index 44f100d02..ba33e46d3 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.22.0")) + .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.23.0")) ], targets: [ .target( @@ -59,13 +59,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 7.11. +github "tuist/xcodeproj" ~> 7.23.0 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 7.22.0 +pod 'xcodeproj', '~> 7.23.0 ``` ### Scripting @@ -77,7 +77,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 7.11. +import XcodeProj // @tuist ~> 7.23.0 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/XcodeProj_Carthage.xcodeproj/project.pbxproj b/XcodeProj_Carthage.xcodeproj/project.pbxproj index 614b06b15..ea35e92d8 100644 --- a/XcodeProj_Carthage.xcodeproj/project.pbxproj +++ b/XcodeProj_Carthage.xcodeproj/project.pbxproj @@ -57,7 +57,6 @@ 80988B37A199C50A3C7A352A /* XCScheme+StoreKitConfigurationFileReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59D8B63E53C03F46C90D951D /* XCScheme+StoreKitConfigurationFileReference.swift */; }; 809908EF4E6E71285D110707 /* PBXNativeTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BD1A6E5AC6502EDE59541C8 /* PBXNativeTarget.swift */; }; 8242B39EB786ADA4A8B32EF3 /* XCBuildConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D07BF1A8B705E35271076BA1 /* XCBuildConfiguration.swift */; }; - 82FA5AD52A7F345C0E7CB14D /* XcodeProjCExt.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC65006CBA60CAA1F78F6CED /* XcodeProjCExt.framework */; }; 84C672F79741BBA0937580EA /* Sourcery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A33AF969BDFF0250420A5E8 /* Sourcery.swift */; }; 8EE72814658F0A23A01AD1E6 /* XCBreakpointList.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC0BF3D061052148207584A5 /* XCBreakpointList.swift */; }; 903A9EC1B895A4920A322898 /* XCScheme+ArchiveAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66F7E3085922F586144F562A /* XCScheme+ArchiveAction.swift */; }; @@ -204,7 +203,6 @@ D07BF1A8B705E35271076BA1 /* XCBuildConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCBuildConfiguration.swift; sourceTree = ""; }; D2D78F3ED94EB9E973644780 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; D4AA26E4818BC76E4CB28CEB /* PBXFileElement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBXFileElement.swift; sourceTree = ""; }; - DC65006CBA60CAA1F78F6CED /* XcodeProjCExt.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = XcodeProjCExt.framework; sourceTree = ""; }; DE15F98D3349F2FCED4A913A /* PBXTargetDependency.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBXTargetDependency.swift; sourceTree = ""; }; DF277186917C67A6FF4993F6 /* XCScheme+BuildableReference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCScheme+BuildableReference.swift"; sourceTree = ""; }; E06554AB0BF2937025BC45C6 /* PBXObjectReference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBXObjectReference.swift; sourceTree = ""; }; @@ -228,7 +226,6 @@ files = ( 1ADDD97C53AEC0990F693CDA /* AEXML.framework in Frameworks */, 5A9C450597EC43859570B863 /* PathKit.framework in Frameworks */, - 82FA5AD52A7F345C0E7CB14D /* XcodeProjCExt.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -326,7 +323,6 @@ children = ( 0C950F23FEF894B133070990 /* AEXML.framework */, F89DAD13D5505D59F10D0C9F /* PathKit.framework */, - DC65006CBA60CAA1F78F6CED /* XcodeProjCExt.framework */, ); path = Mac; sourceTree = ""; @@ -735,7 +731,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.3.2; + SWIFT_VERSION = 5.4; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -767,6 +763,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -817,6 +814,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -876,7 +874,7 @@ SUPPORTED_PLATFORMS = macosx; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 5.3.2; + SWIFT_VERSION = 5.4; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; diff --git a/XcodeProj_Carthage.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/XcodeProj_Carthage.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 94b2795e2..919434a62 100644 --- a/XcodeProj_Carthage.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/XcodeProj_Carthage.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -1,4 +1,7 @@ + + diff --git a/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme b/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme index 066eafdeb..e9d1ffa1a 100644 --- a/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme +++ b/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme @@ -4,7 +4,8 @@ version = "1.3"> + buildImplicitDependencies = "YES" + runPostActionsOnFailure = "NO"> + buildImplicitDependencies = "YES" + runPostActionsOnFailure = "NO"> Date: Tue, 1 Jun 2021 22:18:20 +0200 Subject: [PATCH 014/143] Fix add group to have correct parent set (#614) * Fix add group to have correct parent set * Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ Sources/XcodeProj/Objects/Files/PBXGroup.swift | 2 +- .../Objects/Files/PBXGroupTests.swift | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7321bd70..28e389501 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Next +### Fixed + +- Adding group set incorrect parent in case of complex path [#614](https://github.com/tuist/XcodeProj/pull/614) by [@avdyushin](https://github.com/avdyushin) + ## 7.23.0 - Bonsai ### Added diff --git a/Sources/XcodeProj/Objects/Files/PBXGroup.swift b/Sources/XcodeProj/Objects/Files/PBXGroup.swift index 5387cdc3b..c2bded056 100644 --- a/Sources/XcodeProj/Objects/Files/PBXGroup.swift +++ b/Sources/XcodeProj/Objects/Files/PBXGroup.swift @@ -138,7 +138,7 @@ public extension PBXGroup { return groupName.components(separatedBy: "/").reduce(into: [PBXGroup]()) { groups, name in let group = groups.last ?? self let newGroup = PBXGroup(children: [], sourceTree: .group, name: name, path: options.contains(.withoutFolder) ? nil : name) - newGroup.parent = self + newGroup.parent = group group.childrenReferences.append(newGroup.reference) objects.add(object: newGroup) groups.append(newGroup) diff --git a/Tests/XcodeProjTests/Objects/Files/PBXGroupTests.swift b/Tests/XcodeProjTests/Objects/Files/PBXGroupTests.swift index d0e5a72b8..6fd5360d5 100644 --- a/Tests/XcodeProjTests/Objects/Files/PBXGroupTests.swift +++ b/Tests/XcodeProjTests/Objects/Files/PBXGroupTests.swift @@ -39,6 +39,22 @@ final class PBXGroupTests: XCTestCase { XCTAssertNotNil(childGroup?.parent) } + func test_addGroup_assignAllParents() { + let project = makeEmptyPBXProj() + let group = PBXGroup(children: [], + sourceTree: .group, + name: "group") + project.add(object: group) + + let expectGroups = ["foo", "bar", "baz"] + let createdGroups = try? group.addGroup(named: expectGroups.joined(separator: "/")) + + XCTAssertEqual(3, createdGroups?.count) + XCTAssertEqual(createdGroups?[0].parent?.name, "group") + XCTAssertEqual(createdGroups?[1].parent?.name, "foo") + XCTAssertEqual(createdGroups?[2].parent?.name, "bar") + } + func test_addVariantGroup() { let project = makeEmptyPBXProj() let group = PBXGroup(children: [], From 1e3cfc3e540092393ae72971def0c2a6e54e5821 Mon Sep 17 00:00:00 2001 From: Vlad Gorlov Date: Thu, 17 Jun 2021 11:27:33 +0200 Subject: [PATCH 015/143] Added new product types. (#618) * Added new product types. * [#617] Change-log update. * Added new tests to PBXProductTypeTests * [#617] Fixes copy/paste issue. --- CHANGELOG.md | 1 + Sources/XcodeProj/Objects/Targets/PBXProductType.swift | 6 ++++++ .../Objects/Targets/PBXProductTypeTests.swift | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28e389501..d24fd6653 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixed - Adding group set incorrect parent in case of complex path [#614](https://github.com/tuist/XcodeProj/pull/614) by [@avdyushin](https://github.com/avdyushin) +- Added the `com.apple.product-type.driver-extension` and `com.apple.product-type.system-extension` PBXProductType [#618](https://github.com/tuist/XcodeProj/pull/618) by [@vgorloff](https://github.com/vgorloff). ## 7.23.0 - Bonsai ### Added diff --git a/Sources/XcodeProj/Objects/Targets/PBXProductType.swift b/Sources/XcodeProj/Objects/Targets/PBXProductType.swift index 389d0ee35..7ec12ffb1 100644 --- a/Sources/XcodeProj/Objects/Targets/PBXProductType.swift +++ b/Sources/XcodeProj/Objects/Targets/PBXProductType.swift @@ -29,6 +29,8 @@ public enum PBXProductType: String, Decodable { case intentsServiceExtension = "com.apple.product-type.app-extension.intents-service" case onDemandInstallCapableApplication = "com.apple.product-type.application.on-demand-install-capable" case metalLibrary = "com.apple.product-type.metal-library" + case driverExtension = "com.apple.product-type.driver-extension" + case systemExtension = "com.apple.product-type.system-extension" /// Returns the file extension for the given product type. public var fileExtension: String? { @@ -59,6 +61,10 @@ public enum PBXProductType: String, Decodable { return "xcframework" case .metalLibrary: return "metallib" + case .systemExtension: + return "systemextension" + case .driverExtension: + return "dext" case .none: return nil } diff --git a/Tests/XcodeProjTests/Objects/Targets/PBXProductTypeTests.swift b/Tests/XcodeProjTests/Objects/Targets/PBXProductTypeTests.swift index f783d7649..f0c62e312 100644 --- a/Tests/XcodeProjTests/Objects/Targets/PBXProductTypeTests.swift +++ b/Tests/XcodeProjTests/Objects/Targets/PBXProductTypeTests.swift @@ -94,4 +94,12 @@ final class PBXProductTypeTests: XCTestCase { func test_appClip_hasTheRightValue() { XCTAssertEqual(PBXProductType.onDemandInstallCapableApplication.rawValue, "com.apple.product-type.application.on-demand-install-capable") } + + func test_driverExtension_hasTheRightValue() { + XCTAssertEqual(PBXProductType.driverExtension.rawValue, "com.apple.product-type.driver-extension") + } + + func test_systemExtension_hasTheRightValue() { + XCTAssertEqual(PBXProductType.systemExtension.rawValue, "com.apple.product-type.system-extension") + } } From 3bfa83fc2dcd22f8c129a7e4077d0e687e2660c2 Mon Sep 17 00:00:00 2001 From: Kas Date: Thu, 17 Jun 2021 10:27:56 +0100 Subject: [PATCH 016/143] Make `runPostActionsOnFailure` optional (#619) * Make `runPostActionsOnFailure` optional Resolves: https://github.com/tuist/tuist/issues/2991 - Generated projects had `runPostActionsOnFailure` set in their schemes by default to `NO` - Xcode ends up removing this attribute when it's value is `NO` resultting in producing git diffs for any checked in projects that were previously generated - To mitigate this, the `runPostActionsOnFailure` option is being changed to an optional one where it's only written in the case it's explicitly defined to a specific value Test Plan: - Verify unit tests pass * Update change log --- CHANGELOG.md | 4 + .../Schemes/RunPostActionsOnFailure.xcscheme | 79 +++++++++++++++++++ .../Scheme/XCScheme+BuildAction.swift | 21 +++-- .../XcodeProjTests/Scheme/XCSchemeTests.swift | 31 +++++++- 4 files changed, 125 insertions(+), 10 deletions(-) create mode 100644 Fixtures/Schemes/RunPostActionsOnFailure.xcscheme diff --git a/CHANGELOG.md b/CHANGELOG.md index d24fd6653..a81de142f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ - Adding group set incorrect parent in case of complex path [#614](https://github.com/tuist/XcodeProj/pull/614) by [@avdyushin](https://github.com/avdyushin) - Added the `com.apple.product-type.driver-extension` and `com.apple.product-type.system-extension` PBXProductType [#618](https://github.com/tuist/XcodeProj/pull/618) by [@vgorloff](https://github.com/vgorloff). +### Changed + +- **Breaking** Make `runPostActionsOnFailure` optional [#619](https://github.com/tuist/XcodeProj/pull/619) by [@kwridan](https://github.com/kwridan) + ## 7.23.0 - Bonsai ### Added diff --git a/Fixtures/Schemes/RunPostActionsOnFailure.xcscheme b/Fixtures/Schemes/RunPostActionsOnFailure.xcscheme new file mode 100644 index 000000000..995928c83 --- /dev/null +++ b/Fixtures/Schemes/RunPostActionsOnFailure.xcscheme @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/XcodeProj/Scheme/XCScheme+BuildAction.swift b/Sources/XcodeProj/Scheme/XCScheme+BuildAction.swift index 561f9f2a1..147d7cf1a 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+BuildAction.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+BuildAction.swift @@ -75,7 +75,7 @@ extension XCScheme { public var buildActionEntries: [Entry] public var parallelizeBuild: Bool public var buildImplicitDependencies: Bool - public var runPostActionsOnFailure: Bool + public var runPostActionsOnFailure: Bool? // MARK: - Init @@ -84,7 +84,7 @@ extension XCScheme { postActions: [ExecutionAction] = [], parallelizeBuild: Bool = false, buildImplicitDependencies: Bool = false, - runPostActionsOnFailure: Bool = false) { + runPostActionsOnFailure: Bool? = nil) { self.buildActionEntries = buildActionEntries self.parallelizeBuild = parallelizeBuild self.buildImplicitDependencies = buildImplicitDependencies @@ -95,7 +95,7 @@ extension XCScheme { override init(element: AEXMLElement) throws { parallelizeBuild = element.attributes["parallelizeBuildables"].map { $0 == "YES" } ?? true buildImplicitDependencies = element.attributes["buildImplicitDependencies"].map { $0 == "YES" } ?? true - runPostActionsOnFailure = element.attributes["runPostActionsOnFailure"].map { $0 == "YES" } ?? false + runPostActionsOnFailure = element.attributes["runPostActionsOnFailure"].map { $0 == "YES" } buildActionEntries = try element["BuildActionEntries"]["BuildActionEntry"] .all? .map(Entry.init) ?? [] @@ -114,13 +114,18 @@ extension XCScheme { // MARK: - XML func xmlElement() -> AEXMLElement { + var attributes = [ + "parallelizeBuildables": parallelizeBuild.xmlString, + "buildImplicitDependencies": buildImplicitDependencies.xmlString, + ] + + if let runPostActionsOnFailure = runPostActionsOnFailure { + attributes["runPostActionsOnFailure"] = runPostActionsOnFailure.xmlString + } + let element = AEXMLElement(name: "BuildAction", value: nil, - attributes: [ - "parallelizeBuildables": parallelizeBuild.xmlString, - "buildImplicitDependencies": buildImplicitDependencies.xmlString, - "runPostActionsOnFailure": runPostActionsOnFailure.xmlString, - ]) + attributes: attributes) super.writeXML(parent: element) let entries = element.addChild(name: "BuildActionEntries") buildActionEntries.forEach { entry in diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift index 0041486ea..3cea6f5d3 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift @@ -245,6 +245,28 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertNotEqual(runnableA1, remoteRunnableA1) } + func test_buildAction_runPostActionsOnFailure() throws { + // Given / When + let subject = try XCScheme(path: runPostActionsOnFailureSchemePath) + + // Then + let buildAction = try XCTUnwrap(subject.buildAction) + XCTAssertTrue(buildAction.runPostActionsOnFailure == true) + } + + func test_buildAction_runPostActionsOnFailure_serializingAndDeserializing() throws { + // Given + let scheme = try XCScheme(path: runPostActionsOnFailureSchemePath) + let subject = try XCTUnwrap(scheme.buildAction) + + // When + let xml = subject.xmlElement() + let reconstructedSubject = try XCScheme.BuildAction(element: xml) + + // Then + XCTAssertEqual(reconstructedSubject, subject) + } + // MARK: - Private private func assert(scheme: XCScheme) { @@ -253,7 +275,7 @@ final class XCSchemeIntegrationTests: XCTestCase { // Build action XCTAssertTrue(scheme.buildAction?.parallelizeBuild == true) XCTAssertTrue(scheme.buildAction?.buildImplicitDependencies == true) - XCTAssertTrue(scheme.buildAction?.runPostActionsOnFailure == false) + XCTAssertNil(scheme.buildAction?.runPostActionsOnFailure) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.testing) == true) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.running) == true) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.profiling) == true) @@ -420,7 +442,7 @@ final class XCSchemeIntegrationTests: XCTestCase { // Build action XCTAssertTrue(scheme.buildAction?.parallelizeBuild == true) XCTAssertTrue(scheme.buildAction?.buildImplicitDependencies == true) - XCTAssertTrue(scheme.buildAction?.runPostActionsOnFailure == false) + XCTAssertNil(scheme.buildAction?.runPostActionsOnFailure) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.testing) == true) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.running) == false) XCTAssertTrue(scheme.buildAction?.buildActionEntries.first?.buildFor.contains(.profiling) == true) @@ -526,4 +548,9 @@ final class XCSchemeIntegrationTests: XCTestCase { private var watchAppSchemePath: Path { fixturesPath() + "iOS/AppWithExtensions/AppWithExtensions.xcodeproj/xcshareddata/xcschemes/WatchApp.xcscheme" } + + private var runPostActionsOnFailureSchemePath: Path { + // A scheme with the `runPostActionsOnFailure` enabled + fixturesPath() + "Schemes/RunPostActionsOnFailure.xcscheme" + } } From 5115e424acb201ab7bb32049d4d79d264c697cd8 Mon Sep 17 00:00:00 2001 From: Dalton Claybrook Date: Thu, 17 Jun 2021 06:02:33 -0400 Subject: [PATCH 017/143] Add ability to initialize scheme without a blueprint identifier (#612) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add ability to initialize scheme without a blueprint identifier * Add test for serialization * Update changelog Co-authored-by: Pedro PiΓ±era BuendΓ­a --- CHANGELOG.md | 1 + Fixtures/Schemes/NoBlueprintID.xcscheme | 33 +++++++++++++++ .../Scheme/XCScheme+BuildableReference.swift | 41 ++++++++++--------- .../XcodeProjTests/Scheme/XCSchemeTests.swift | 18 ++++++++ 4 files changed, 73 insertions(+), 20 deletions(-) create mode 100644 Fixtures/Schemes/NoBlueprintID.xcscheme diff --git a/CHANGELOG.md b/CHANGELOG.md index a81de142f..7afe7c158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixed - Adding group set incorrect parent in case of complex path [#614](https://github.com/tuist/XcodeProj/pull/614) by [@avdyushin](https://github.com/avdyushin) +- **Breaking** Fixed issue where some schemes could not be deserialized because a buildable reference did not contain a blueprint identifier [#612](https://github.com/tuist/XcodeProj/pull/612) by [@daltonclaybrook](https://github.com/daltonclaybrook) - Added the `com.apple.product-type.driver-extension` and `com.apple.product-type.system-extension` PBXProductType [#618](https://github.com/tuist/XcodeProj/pull/618) by [@vgorloff](https://github.com/vgorloff). ### Changed diff --git a/Fixtures/Schemes/NoBlueprintID.xcscheme b/Fixtures/Schemes/NoBlueprintID.xcscheme new file mode 100644 index 000000000..ef67cbfcf --- /dev/null +++ b/Fixtures/Schemes/NoBlueprintID.xcscheme @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift b/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift index 43c8a08a6..0a092295f 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift @@ -23,9 +23,9 @@ extension XCScheme { blueprint = .reference(object.reference) } - private var blueprint: Blueprint - public var blueprintIdentifier: String { - blueprint.string + private var blueprint: Blueprint? + public var blueprintIdentifier: String? { + blueprint?.string } public var buildableName: String @@ -35,24 +35,24 @@ extension XCScheme { // MARK: - Init public init(referencedContainer: String, - blueprint: PBXObject, + blueprint: PBXObject?, buildableName: String, blueprintName: String, buildableIdentifier: String = "primary") { self.referencedContainer = referencedContainer - self.blueprint = .reference(blueprint.reference) + self.blueprint = blueprint.map { Blueprint.reference($0.reference) } self.buildableName = buildableName self.buildableIdentifier = buildableIdentifier self.blueprintName = blueprintName } public init(referencedContainer: String, - blueprintIdentifier: String, + blueprintIdentifier: String?, buildableName: String, blueprintName: String, buildableIdentifier: String = "primary") { self.referencedContainer = referencedContainer - self.blueprint = .string(blueprintIdentifier) + self.blueprint = blueprintIdentifier.map(Blueprint.string) self.buildableName = buildableName self.buildableIdentifier = buildableIdentifier self.blueprintName = blueprintName @@ -64,9 +64,6 @@ extension XCScheme { guard let buildableIdentifier = element.attributes["BuildableIdentifier"] else { throw XCSchemeError.missing(property: "BuildableIdentifier") } - guard let blueprintIdentifier = element.attributes["BlueprintIdentifier"] else { - throw XCSchemeError.missing(property: "BlueprintIdentifier") - } guard let buildableName = element.attributes["BuildableName"] else { throw XCSchemeError.missing(property: "BuildableName") } @@ -77,22 +74,26 @@ extension XCScheme { throw XCSchemeError.missing(property: "ReferencedContainer") } self.buildableIdentifier = buildableIdentifier - blueprint = .string(blueprintIdentifier) + let blueprintIdentifier = element.attributes["BlueprintIdentifier"] + self.blueprint = blueprintIdentifier.map(Blueprint.string) self.buildableName = buildableName self.blueprintName = blueprintName self.referencedContainer = referencedContainer } func xmlElement() -> AEXMLElement { - AEXMLElement(name: "BuildableReference", - value: nil, - attributes: [ - "BuildableIdentifier": buildableIdentifier, - "BlueprintIdentifier": blueprint.string, - "BuildableName": buildableName, - "BlueprintName": blueprintName, - "ReferencedContainer": referencedContainer, - ]) + var attributes: [String: String] = [ + "BuildableIdentifier": buildableIdentifier, + "BuildableName": buildableName, + "BlueprintName": blueprintName, + "ReferencedContainer": referencedContainer, + ] + if let blueprintIdentifier = blueprint?.string { + attributes["BlueprintIdentifier"] = blueprintIdentifier + } + return AEXMLElement(name: "BuildableReference", + value: nil, + attributes: attributes) } // MARK: - Equatable diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift index 3cea6f5d3..8a6325a1a 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift @@ -245,6 +245,19 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertNotEqual(runnableA1, remoteRunnableA1) } + func test_schemeWithoutBlueprintIdentifier_canBeCreated() { + let subject = try? XCScheme(path: noBlueprintIDPath) + XCTAssertNotNil(subject) + } + + func test_schemeWithoutBlueprintIdentifier_serializesWithoutBlueprintIdentifier() throws { + let subject = try XCScheme(path: noBlueprintIDPath) + let buildable = try XCTUnwrap(subject.buildAction?.buildActionEntries.first?.buildableReference) + let buildableXML = buildable.xmlElement() + XCTAssertNotNil(buildableXML.attributes["BlueprintName"]) + XCTAssertNil(buildableXML.attributes["BlueprintIdentifier"]) + } + func test_buildAction_runPostActionsOnFailure() throws { // Given / When let subject = try XCScheme(path: runPostActionsOnFailureSchemePath) @@ -545,6 +558,11 @@ final class XCSchemeIntegrationTests: XCTestCase { fixturesPath() + "Schemes/MinimalInformation.xcscheme" } + /// Path to a scheme with a buildable reference that contains no blueprint identifier + private var noBlueprintIDPath: Path { + fixturesPath() + "Schemes/NoBlueprintID.xcscheme" + } + private var watchAppSchemePath: Path { fixturesPath() + "iOS/AppWithExtensions/AppWithExtensions.xcodeproj/xcshareddata/xcschemes/WatchApp.xcscheme" } From 0b18c3e7a10c241323397a80cb445051f4494971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Thu, 17 Jun 2021 12:13:43 +0200 Subject: [PATCH 018/143] Version 8.0.0 --- CHANGELOG.md | 1 + README.md | 24 ++++++++++++++++-------- xcodeproj.podspec | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7afe7c158..82cd05ef0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Next +## 8.0.0 - Amor ### Fixed - Adding group set incorrect parent in case of complex path [#614](https://github.com/tuist/XcodeProj/pull/614) by [@avdyushin](https://github.com/avdyushin) diff --git a/README.md b/README.md index ba33e46d3..05f1ad43f 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,18 @@ XcodeProj is a library written in Swift for parsing and working with Xcode proje --- -- [Projects Using XcodeProj](#projects-using-xcodeproj) -- [Installation](#installation) -- [Contributing](#contributing) -- [License](#license) +- [XcodeProj](#xcodeproj) + - [Projects Using XcodeProj](#projects-using-xcodeproj) + - [Installation](#installation) + - [Swift Package Manager](#swift-package-manager) + - [Carthage](#carthage) + - [CocoaPods](#cocoapods) + - [Scripting](#scripting) + - [Documentation πŸ“](#documentation-) + - [References πŸ“š](#references-) + - [Contributing](#contributing) + - [License](#license) + - [Contributors ✨](#contributors-) ## Projects Using XcodeProj @@ -43,7 +51,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "7.23.0")) + .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "8.0.0")) ], targets: [ .target( @@ -59,13 +67,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 7.23.0 +github "tuist/xcodeproj" ~> 8.0.0 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 7.23.0 +pod 'xcodeproj', '~> 8.0.0 ``` ### Scripting @@ -77,7 +85,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 7.23.0 +import XcodeProj // @tuist ~> 8.0.0 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/xcodeproj.podspec b/xcodeproj.podspec index 7aa68a4e4..a1c510590 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '7.23.0' + s.version = '8.0.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From e4f1ee6db0cd4cc8d10a1f17f7171746c7a6779b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Jul 2021 09:48:58 +0200 Subject: [PATCH 019/143] Bump rake from 13.0.3 to 13.0.6 (#622) --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c62584803..d4e8a1249 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -83,7 +83,7 @@ GEM netrc (0.11.0) open4 (1.3.4) public_suffix (4.0.6) - rake (13.0.3) + rake (13.0.6) redcarpet (3.5.1) rouge (3.24.0) ruby-macho (1.4.0) From 4ca27e3a4c403d17d46f727a6d4b7c50afc3a8d3 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Sun, 12 Sep 2021 09:28:24 -0700 Subject: [PATCH 020/143] Remove unnecessary force unwrap (#631) This validates at least one path exists, and reuses that variable instead --- Sources/XcodeProj/Project/XcodeProj.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Sources/XcodeProj/Project/XcodeProj.swift b/Sources/XcodeProj/Project/XcodeProj.swift index ceddb6bdf..2f14c24f3 100644 --- a/Sources/XcodeProj/Project/XcodeProj.swift +++ b/Sources/XcodeProj/Project/XcodeProj.swift @@ -22,11 +22,9 @@ public final class XcodeProj: Equatable { var sharedData: XCSharedData? if !path.exists { throw XCodeProjError.notFound(path: path) } - let pbxprojPaths = path.glob("*.pbxproj") - if pbxprojPaths.isEmpty { + guard let pbxprojPath = path.glob("*.pbxproj").first else { throw XCodeProjError.pbxprojNotFound(path: path) } - let pbxprojPath = pbxprojPaths.first! let (pbxProjData, pbxProjDictionary) = try XcodeProj.readPBXProj(path: pbxprojPath) let context = ProjectDecodingContext( pbxProjValueReader: { key in @@ -36,7 +34,7 @@ public final class XcodeProj: Equatable { let plistDecoder = XcodeprojPropertyListDecoder(context: context) pbxproj = try plistDecoder.decode(PBXProj.self, from: pbxProjData) - try pbxproj.updateProjectName(path: pbxprojPaths.first!) + try pbxproj.updateProjectName(path: pbxprojPath) let xcworkspacePaths = path.glob("*.xcworkspace") if xcworkspacePaths.isEmpty { workspace = XCWorkspace() From b1bcbfd58b3c6b5c3255ca56c673dee6a448028d Mon Sep 17 00:00:00 2001 From: Alfredo Delli Bovi Date: Mon, 13 Sep 2021 11:15:38 +0200 Subject: [PATCH 021/143] Improve performance of commented string (#635) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Improve performance of commented string * Update Sources/XcodeProj/Utils/CommentedString.swift Co-authored-by: Marek FoΕ™t * Update CHANGELOG.md Co-authored-by: Marek FoΕ™t Co-authored-by: Alfredo Delli Bovi Co-authored-by: Marek FoΕ™t --- CHANGELOG.md | 4 ++ Sources/XcodeProj/Utils/CommentedString.swift | 68 +++---------------- 2 files changed, 14 insertions(+), 58 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82cd05ef0..0f6917ace 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Next +### Changed + +- Improve performance of commented string [#635](https://github.com/tuist/XcodeProj/pull/635) by [@adellibovi](https://github.com/adellibovi) + ## 8.0.0 - Amor ### Fixed diff --git a/Sources/XcodeProj/Utils/CommentedString.swift b/Sources/XcodeProj/Utils/CommentedString.swift index 69b7dc328..a3663eec8 100644 --- a/Sources/XcodeProj/Utils/CommentedString.swift +++ b/Sources/XcodeProj/Utils/CommentedString.swift @@ -28,49 +28,8 @@ struct CommentedString { return invalidSet }() - /// Substrings that cause Xcode to quote the string content. - /// - /// Matches the strings `___` and `//`. - private let invalidStrings: Trie = [ - "_": ["_": "_"], - "/": "/" - ] - - /// A tree of characters to efficiently match string prefixes. - private enum Trie: ExpressibleByDictionaryLiteral, ExpressibleByUnicodeScalarLiteral { - case match - case next([(UnicodeScalar, Trie)]) - - init(dictionaryLiteral elements: (UnicodeScalar, Trie)...) { - self = .next(elements) - } - - init(unicodeScalarLiteral value: UnicodeScalar) { - self = .next([(value, .match)]) - } - - /// Accepts a character and mutates to the subtree of strings which match that character. If the character does - /// not match, resets to `default`. - mutating func match(_ character: UnicodeScalar, orResetTo default: Trie) { - switch self { - case .match: - return - case .next(let options): - for (key, subtrie) in options where key == character { - self = subtrie - return - } - self = `default` - } - } - - var accepted: Bool { - switch self { - case .match: return true - case .next: return false - } - } - } + /// Set of characters that are invalid. + private static var specialCheckCharacters = CharacterSet(charactersIn: "_/") /// Returns a valid string for Xcode projects. var validString: String { @@ -81,19 +40,15 @@ struct CommentedString { default: break } - var needsQuoting = false - var matchingInvalidPrefix: Trie = self.invalidStrings + if string.rangeOfCharacter(from: CommentedString.invalidCharacters) == nil { + if string.rangeOfCharacter(from: CommentedString.specialCheckCharacters) == nil { + return string + } else if !string.contains("//") && !string.contains("___") { + return string + } + } let escaped = string.reduce(into: "") { escaped, character in - quote: if !needsQuoting { - for scalar in character.unicodeScalars { - matchingInvalidPrefix.match(scalar, orResetTo: self.invalidStrings) - if matchingInvalidPrefix.accepted || CommentedString.invalidCharacters.contains(scalar) { - needsQuoting = true - break quote - } - } - } // As an optimization, only look at the first scalar. This means we're doing a numeric comparison instead // of comparing arbitrary-length characters. This is safe because all our cases are a single scalar. switch character.unicodeScalars.first { @@ -109,10 +64,7 @@ struct CommentedString { escaped.append(character) } } - if needsQuoting { - return "\"\(escaped)\"" - } - return escaped + return "\"\(escaped)\"" } } From 37c8c5347208c0a2e68941957b364aa27da0a5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 13 Sep 2021 11:22:15 +0200 Subject: [PATCH 022/143] Version 8.1.0 --- CHANGELOG.md | 2 +- README.md | 8 ++++---- RELEASE.md | 14 +++++++++++--- TapestryConfig.swift | 14 -------------- xcodeproj.podspec | 2 +- 5 files changed, 17 insertions(+), 23 deletions(-) delete mode 100644 TapestryConfig.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f6917ace..c9e2ca1e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) ## Next - +## 8.1.0 - Barcelona ### Changed - Improve performance of commented string [#635](https://github.com/tuist/XcodeProj/pull/635) by [@adellibovi](https://github.com/adellibovi) diff --git a/README.md b/README.md index 05f1ad43f..f8556a8b6 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "8.0.0")) + .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "8.1.0")) ], targets: [ .target( @@ -67,13 +67,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 8.0.0 +github "tuist/xcodeproj" ~> 8.1.0 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 8.0.0 +pod 'xcodeproj', '~> 8.1.0 ``` ### Scripting @@ -85,7 +85,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 8.0.0 +import XcodeProj // @tuist ~> 8.1.0 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/RELEASE.md b/RELEASE.md index c58657b4b..198c6087d 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -2,6 +2,14 @@ In this document you'll find all the necessary steps to release a new version of `xcodeproj`: -1. Run `tapestry release version-number` (eg `tapestry release 7.1.0`) *(Install [tapestry](https://github.com/ackeecz/tapestry) and [tuist](https://github.com/tuist/tuist) if you don't have them installed already)*. -2. Create a new release on [GitHub](https://github.com/tuist/XcodeProj) including the information from the last entry in the `CHANGELOG.md`. -3. Attach `XcodeProj.framework.zip` to the GitHub release. +1. Make sure you are in the `main` branch. +2. Determine the next version based on the unreleased changes. +3. Add the version section to the `CHANGELOG.md`, update the versions in the `README.md` and the `xcodeproj.podspec` file. +4. Commit the changes and tag them `git commit -m "Version x.y.z"` & `git tag x.y.z`. +5. Push the changes `git commit push origin main --tags` +6. Generate the project by running `tuist generate`. +7. Update Carthage dependencies by running `bundle exec rake carthage_update_dependencies`. +8. Run the release checks by running `bundle exec rake release_check`. +9. Publish a new version of the Pod by running `bundle exec pod trunk push --allow-warnings --verbose`. +10. Archive the Carthage binary by running `bundle exec rake archive_carthage`. +11. Create the release on GitHub including the release notes from the `CHANGELOG.md` and attach the archive `XcodeProj.framework.zip` generated by Carthage. diff --git a/TapestryConfig.swift b/TapestryConfig.swift deleted file mode 100644 index 5054f6e3a..000000000 --- a/TapestryConfig.swift +++ /dev/null @@ -1,14 +0,0 @@ -import PackageDescription - -let config = TapestryConfig(release: Release(actions: [.pre(.dependenciesCompatibility([.cocoapods, .spm(.all)])), - .pre(tool: "tuist", arguments: ["generate"]), - .pre(tool: "bundle", arguments: ["exec", "rake", "carthage_update_dependencies"]), - .pre(tool: "bundle", arguments: ["exec", "rake", "release_check"]), - .pre(.docsUpdate), - .post(tool: "bundle", arguments: ["exec", "pod", "trunk", "push", "--allow-warnings", "--verbose"]), - .post(tool: "bundle", arguments: ["exec", "rake", "archive_carthage"])], - add: ["README.md", - "xcodeproj.podspec", - "CHANGELOG.md"], - commitMessage: "Version \(Argument.version)", - push: true)) diff --git a/xcodeproj.podspec b/xcodeproj.podspec index a1c510590..66b0bea86 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.0.0' + s.version = '8.1.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From 043bec13af76d975aa11f499da50e2df9f8a88d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 13 Sep 2021 11:30:28 +0200 Subject: [PATCH 023/143] Update Carhage project --- XcodeProj_Carthage.xcodeproj/project.pbxproj | 4 ++-- .../xcshareddata/xcschemes/XcodeProj.xcscheme | 3 +-- .../xcschemes/XcodeProj_Carthage-Project.xcscheme | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/XcodeProj_Carthage.xcodeproj/project.pbxproj b/XcodeProj_Carthage.xcodeproj/project.pbxproj index ea35e92d8..d9ae6e0a5 100644 --- a/XcodeProj_Carthage.xcodeproj/project.pbxproj +++ b/XcodeProj_Carthage.xcodeproj/project.pbxproj @@ -731,7 +731,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.4; + SWIFT_VERSION = 5.4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -874,7 +874,7 @@ SUPPORTED_PLATFORMS = macosx; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 5.4; + SWIFT_VERSION = 5.4.2; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; diff --git a/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme b/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme index e9d1ffa1a..066eafdeb 100644 --- a/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme +++ b/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme @@ -4,8 +4,7 @@ version = "1.3"> + buildImplicitDependencies = "YES"> + buildImplicitDependencies = "YES"> Date: Mon, 13 Sep 2021 18:39:11 +0900 Subject: [PATCH 024/143] Update README.md (#634) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Pedro PiΓ±era BuendΓ­a --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f8556a8b6..aabb000b1 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/xcodeproj.git", .upToNextMajor(from: "8.1.0")) + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.1.0")) ], targets: [ .target( From 418e9c9c55625690fdc77c04965fa75c585db3eb Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 13 Sep 2021 11:39:22 +0200 Subject: [PATCH 025/143] docs: add muukii as a contributor for content (#636) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 23 ++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 98c74b7b0..f50fbd044 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -67,6 +67,15 @@ "contributions": [ "code" ] + }, + { + "login": "muukii", + "name": "Muukii", + "avatar_url": "https://avatars.githubusercontent.com/u/1888355?v=4", + "profile": "http://muukii.app", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index aabb000b1..387da39f9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ # XcodeProj - -[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors-) - +[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -157,17 +155,20 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d - - - - - - - + + + + + + + + + +

Joseph Colicchio

πŸ€”

deatondg

πŸ€”

Dan Fleming

πŸ’»

Sascha Schwabbauer

πŸ€”

Marcin Iwanicki

🚧

Adam Khazi

🚧

Elliott Williams

πŸ’»

Joseph Colicchio

πŸ€”

deatondg

πŸ€”

Dan Fleming

πŸ’»

Sascha Schwabbauer

πŸ€”

Marcin Iwanicki

🚧

Adam Khazi

🚧

Elliott Williams

πŸ’»

Muukii

πŸ–‹
- + From d3f90003945336b97d0397ad6ebdcdcbc08e7eb0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Sep 2021 11:39:59 +0200 Subject: [PATCH 026/143] Bump cocoapods from 1.10.1 to 1.11.0 (#633) Bumps [cocoapods](https://github.com/CocoaPods/CocoaPods) from 1.10.1 to 1.11.0. - [Release notes](https://github.com/CocoaPods/CocoaPods/releases) - [Changelog](https://github.com/CocoaPods/CocoaPods/blob/master/CHANGELOG.md) - [Commits](https://github.com/CocoaPods/CocoaPods/compare/1.10.1...1.11.0) --- updated-dependencies: - dependency-name: cocoapods dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile | 2 +- Gemfile.lock | 67 +++++++++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/Gemfile b/Gemfile index 225c83192..3f25545c3 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" gem "rake" gem "jazzy" -gem "cocoapods", "1.10.1" +gem "cocoapods", "1.11.0" gem "colorize", "~> 0.8.1" gem "redcarpet", "~> 3.5.1" diff --git a/Gemfile.lock b/Gemfile.lock index d4e8a1249..d2d35b9fe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,22 +2,23 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.3) - activesupport (5.2.4.4) + activesupport (6.1.4.1) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - addressable (2.7.0) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) claide (1.0.3) - cocoapods (1.10.1) - addressable (~> 2.6) + cocoapods (1.11.0) + addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.10.1) + cocoapods-core (= 1.11.0) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.4.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -28,41 +29,41 @@ GEM escape (~> 0.0.4) fourflusher (>= 2.3.0, < 3.0) gh_inspector (~> 1.0) - molinillo (~> 0.6.6) + molinillo (~> 0.8.0) nap (~> 1.0) - ruby-macho (~> 1.4) - xcodeproj (>= 1.19.0, < 2.0) - cocoapods-core (1.10.1) - activesupport (> 5.0, < 6) - addressable (~> 2.6) + ruby-macho (>= 1.0, < 3.0) + xcodeproj (>= 1.21.0, < 2.0) + cocoapods-core (1.11.0) + activesupport (>= 5.0, < 7) + addressable (~> 2.8) algoliasearch (~> 1.0) concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) netrc (~> 0.11) - public_suffix + public_suffix (~> 4.0) typhoeus (~> 1.0) - cocoapods-deintegrate (1.0.4) - cocoapods-downloader (1.4.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (1.5.0) cocoapods-plugins (1.0.0) nap - cocoapods-search (1.0.0) - cocoapods-trunk (1.5.0) + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) colorize (0.8.1) - concurrent-ruby (1.1.7) + concurrent-ruby (1.1.9) escape (0.0.4) - ethon (0.12.0) - ffi (>= 1.3.0) - ffi (1.14.2) + ethon (0.14.0) + ffi (>= 1.15.0) + ffi (1.15.4) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) httpclient (2.8.3) - i18n (1.8.7) + i18n (1.8.10) concurrent-ruby (~> 1.0) jazzy (0.13.6) cocoapods (~> 1.5) @@ -75,8 +76,8 @@ GEM xcinvoke (~> 0.3.0) json (2.5.1) liferaft (0.0.6) - minitest (5.14.3) - molinillo (0.6.6) + minitest (5.14.4) + molinillo (0.8.0) mustache (1.1.1) nanaimo (0.3.0) nap (1.1.0) @@ -85,30 +86,32 @@ GEM public_suffix (4.0.6) rake (13.0.6) redcarpet (3.5.1) + rexml (3.2.5) rouge (3.24.0) - ruby-macho (1.4.0) + ruby-macho (2.5.1) sassc (2.4.0) ffi (~> 1.9) sqlite3 (1.4.2) - thread_safe (0.3.6) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (1.2.9) - thread_safe (~> 0.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) xcinvoke (0.3.0) liferaft (~> 0.0.6) - xcodeproj (1.19.0) + xcodeproj (1.21.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + zeitwerk (2.4.2) PLATFORMS ruby DEPENDENCIES - cocoapods (= 1.10.1) + cocoapods (= 1.11.0) colorize (~> 0.8.1) jazzy rake From 510371ea696acc081b9bc1a0e72a12a0005cad7c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 13 Sep 2021 11:41:23 +0200 Subject: [PATCH 027/143] docs: add nnsnodnb as a contributor for code (#637) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index f50fbd044..c538b306c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -76,6 +76,15 @@ "contributions": [ "content" ] + }, + { + "login": "nnsnodnb", + "name": "Yuya Oka", + "avatar_url": "https://avatars.githubusercontent.com/u/9856514?v=4", + "profile": "https://nnsnodnb.github.io", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 387da39f9..a3a5c5fe8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -165,6 +165,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Muukii

πŸ–‹ +
Yuya Oka

πŸ’» From 95652e5c4250bcb78b00c3daac8d9a1b08c26dc9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Sep 2021 11:43:19 +0200 Subject: [PATCH 028/143] Bump jazzy from 0.13.6 to 0.14.0 (#629) Bumps [jazzy](https://github.com/realm/jazzy) from 0.13.6 to 0.14.0. - [Release notes](https://github.com/realm/jazzy/releases) - [Changelog](https://github.com/realm/jazzy/blob/master/CHANGELOG.md) - [Commits](https://github.com/realm/jazzy/compare/v0.13.6...v0.14.0) --- updated-dependencies: - dependency-name: jazzy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d2d35b9fe..3385e205c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,7 +44,7 @@ GEM public_suffix (~> 4.0) typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) - cocoapods-downloader (1.5.0) + cocoapods-downloader (1.5.1) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.1) @@ -65,11 +65,12 @@ GEM httpclient (2.8.3) i18n (1.8.10) concurrent-ruby (~> 1.0) - jazzy (0.13.6) + jazzy (0.14.0) cocoapods (~> 1.5) mustache (~> 1.1) - open4 + open4 (~> 1.3) redcarpet (~> 3.4) + rexml (~> 3.2) rouge (>= 2.0.6, < 4.0) sassc (~> 2.1) sqlite3 (~> 1.3) @@ -87,7 +88,7 @@ GEM rake (13.0.6) redcarpet (3.5.1) rexml (3.2.5) - rouge (3.24.0) + rouge (3.26.0) ruby-macho (2.5.1) sassc (2.4.0) ffi (~> 1.9) From b575d3bcab0e7681fa4b76ef4e119d1603e572b6 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 13 Sep 2021 11:43:28 +0200 Subject: [PATCH 029/143] docs: add keith as a contributor for content (#638) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index c538b306c..2110760a3 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -85,6 +85,15 @@ "contributions": [ "code" ] + }, + { + "login": "keith", + "name": "Keith Smiley", + "avatar_url": "https://avatars.githubusercontent.com/u/283886?v=4", + "profile": "https://smileykeith.com", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index a3a5c5fe8..40ea63cc3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -166,6 +166,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Muukii

πŸ–‹
Yuya Oka

πŸ’» +
Keith Smiley

πŸ–‹ From a39f29d458e33c3b3d9a4bcabcfabf703655e7ef Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Mon, 13 Sep 2021 02:43:52 -0700 Subject: [PATCH 030/143] Fix indentation in example (#630) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix indentation in example This also adds a trailing `,` for easier copy pasting to projects with existing dependencies * It's case sensitive too apparently Co-authored-by: Pedro PiΓ±era BuendΓ­a --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 40ea63cc3..c220d7733 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,8 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.1.0")) - ], + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.1.0")), + ], targets: [ .target( name: "myproject", From 64afa87b9cf0418820beaa51710f395f216a196a Mon Sep 17 00:00:00 2001 From: Ian Leitch Date: Mon, 13 Sep 2021 11:45:05 +0200 Subject: [PATCH 031/143] Add String overload of PBXFileElement.fullPath(sourceRoot:) (#624) --- Sources/XcodeProj/Objects/Files/PBXFileElement.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sources/XcodeProj/Objects/Files/PBXFileElement.swift b/Sources/XcodeProj/Objects/Files/PBXFileElement.swift index fb245cd55..573e8ee8e 100644 --- a/Sources/XcodeProj/Objects/Files/PBXFileElement.swift +++ b/Sources/XcodeProj/Objects/Files/PBXFileElement.swift @@ -144,6 +144,15 @@ public class PBXFileElement: PBXContainerItem, PlistSerializable { // MARK: - Helpers public extension PBXFileElement { + /// Returns a file absolute path. + /// + /// - Parameter sourceRoot: project source root. + /// - Returns: file element absolute path. + /// - Throws: an error if the absolute path cannot be obtained. + func fullPath(sourceRoot: String) throws -> String? { + try fullPath(sourceRoot: Path(sourceRoot))?.absolute().string + } + /// Returns a file absolute path. /// /// - Parameter sourceRoot: project source root. From 04fd1644ed73dfd29b44f2c17e06d0c49d104ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 13 Sep 2021 11:46:26 +0200 Subject: [PATCH 032/143] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9e2ca1e3..aa2d84366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) ## Next + +### Added + +- Support obtaining the full path of a file element by passing the source root as a string [#624](https://github.com/tuist/XcodeProj/pull/624) by [@ileitch](https://github.com/ileitch). ## 8.1.0 - Barcelona ### Changed From b00832152792237334715829a8e8fe8472555a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 13 Sep 2021 11:46:41 +0200 Subject: [PATCH 033/143] Remove dependabot configuration --- .github/dependabot.yml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 4017f57c9..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: 2 -updates: -- package-ecosystem: bundler - directory: "/" - schedule: - interval: daily - time: '11:00' - open-pull-requests-limit: 10 From f2ee957612054b2b38baff58d2d881078fbc0178 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 13 Sep 2021 11:47:21 +0200 Subject: [PATCH 034/143] docs: add ileitch as a contributor for code (#639) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 2110760a3..559bfa24b 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -94,6 +94,15 @@ "contributions": [ "content" ] + }, + { + "login": "ileitch", + "name": "Ian Leitch", + "avatar_url": "https://avatars.githubusercontent.com/u/48235?v=4", + "profile": "https://github.com/ileitch", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index c220d7733..3fd40cd99 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -167,6 +167,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Muukii

πŸ–‹
Yuya Oka

πŸ’»
Keith Smiley

πŸ–‹ +
Ian Leitch

πŸ’» From d31c485cbd6bc09122d6dde5ca7ae7d190571502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 13 Sep 2021 11:52:09 +0200 Subject: [PATCH 035/143] Add FUNDING.yml document --- .github/FUNDING.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..fae50dada --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +open_collective: tuistapp +github: tuist From 41eb6303e2b00c470d897e0cdd19929b1d39421e Mon Sep 17 00:00:00 2001 From: Daniil Subbotin Date: Mon, 13 Sep 2021 13:04:44 +0300 Subject: [PATCH 036/143] Fix bug: if `RemoteRunnable` doesn't contains `BuildableReference` XcodeProj removes xcscheme file (#627) Closes #626 --- ...RunnableWithoutBuildableReference.xcscheme | 98 +++++++++++ .../Scheme/XCScheme+LaunchAction.swift | 2 +- .../Scheme/XCScheme+ProfileAction.swift | 2 +- .../XcodeProj/Scheme/XCScheme+Runnable.swift | 8 +- .../XcodeProjTests/Scheme/XCSchemeTests.swift | 155 ++++++++++++++++-- 5 files changed, 250 insertions(+), 15 deletions(-) create mode 100644 Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme diff --git a/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme b/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme new file mode 100644 index 000000000..669fdba94 --- /dev/null +++ b/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift b/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift index 3a4e8edca..28f794df5 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift @@ -148,7 +148,7 @@ extension XCScheme { selectedDebuggerIdentifier = element.attributes["selectedDebuggerIdentifier"] ?? XCScheme.defaultDebugger selectedLauncherIdentifier = element.attributes["selectedLauncherIdentifier"] ?? XCScheme.defaultLauncher launchStyle = element.attributes["launchStyle"].flatMap { Style(rawValue: $0) } ?? .auto - askForAppToLaunch = element.attributes["askForAppToLaunch"].map { $0 == "YES" } + askForAppToLaunch = element.attributes["askForAppToLaunch"].map { $0 == "YES" || $0 == "Yes" } useCustomWorkingDirectory = element.attributes["useCustomWorkingDirectory"] == "YES" ignoresPersistentStateOnLaunch = element.attributes["ignoresPersistentStateOnLaunch"] == "YES" debugDocumentVersioning = element.attributes["debugDocumentVersioning"].map { $0 == "YES" } ?? true diff --git a/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift b/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift index a91acf98a..c11e06dc8 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift @@ -60,7 +60,7 @@ extension XCScheme { savedToolIdentifier = element.attributes["savedToolIdentifier"] ?? "" useCustomWorkingDirectory = element.attributes["useCustomWorkingDirectory"] == "YES" debugDocumentVersioning = element.attributes["debugDocumentVersioning"].map { $0 == "YES" } ?? true - askForAppToLaunch = element.attributes["askForAppToLaunch"].map { $0 == "YES" } + askForAppToLaunch = element.attributes["askForAppToLaunch"].map { $0 == "YES" || $0 == "Yes" } ignoresPersistentStateOnLaunch = element.attributes["ignoresPersistentStateOnLaunch"].map { $0 == "YES" } ?? false let buildableProductRunnableElement = element["BuildableProductRunnable"] diff --git a/Sources/XcodeProj/Scheme/XCScheme+Runnable.swift b/Sources/XcodeProj/Scheme/XCScheme+Runnable.swift index 6fb8b489e..b7173dc2c 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+Runnable.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+Runnable.swift @@ -6,7 +6,7 @@ extension XCScheme { // MARK: - Attributes public var runnableDebuggingMode: String - public var buildableReference: BuildableReference + public var buildableReference: BuildableReference? // MARK: - Init @@ -18,7 +18,7 @@ extension XCScheme { init(element: AEXMLElement) throws { runnableDebuggingMode = element.attributes["runnableDebuggingMode"] ?? "0" - buildableReference = try BuildableReference(element: element["BuildableReference"]) + buildableReference = try? BuildableReference(element: element["BuildableReference"]) } // MARK: - XML @@ -27,7 +27,9 @@ extension XCScheme { let element = AEXMLElement(name: "Runnable", value: nil, attributes: ["runnableDebuggingMode": runnableDebuggingMode]) - element.addChild(buildableReference.xmlElement()) + if let buildableReference = buildableReference { + element.addChild(buildableReference.xmlElement()) + } return element } diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift index 8a6325a1a..98fcc5190 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift @@ -15,6 +15,34 @@ final class XCSchemeIntegrationTests: XCTestCase { modify: { $0 }, assertion: { assert(scheme: $1) }) } + + func test_read_runnableWithoutBuildableReferenceScheme() { + let subject = try? XCScheme(path: runnableWithoutBuildableReferenceSchemePath) + + XCTAssertNotNil(subject) + if let subject = subject { + assert(runnableWithoutBuildableReferenceScheme: subject) + } + } + + func test_remoteRunnable_runnableWithoutBuildableReferenceScheme() throws { + // Given / When + let subject = try XCScheme(path: runnableWithoutBuildableReferenceSchemePath) + + // Then + let launchAction = try XCTUnwrap(subject.launchAction) + let remoteRunnable = try XCTUnwrap(launchAction.runnable as? XCScheme.RemoteRunnable) + XCTAssertEqual(remoteRunnable.bundleIdentifier, "me.ava.Ava-Staging") + XCTAssertEqual(remoteRunnable.runnableDebuggingMode, "1") + XCTAssertEqual(remoteRunnable.remotePath, "/var/containers/Bundle/Application/018F0933-05E8-4359-9955-39E0523C4246/Ava.app") + } + + func test_write_runnableWithoutBuildableReferenceScheme() { + testWrite(from: runnableWithoutBuildableReferenceSchemePath, + initModel: { try? XCScheme(path: $0) }, + modify: { $0 }, + assertion: { assert(runnableWithoutBuildableReferenceScheme: $1) }) + } func test_read_minimalScheme() { let subject = try? XCScheme(path: minimalSchemePath) @@ -372,11 +400,11 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.profileAction?.debugDocumentVersioning, true) XCTAssertNil(scheme.profileAction?.askForAppToLaunch) XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.runnableDebuggingMode, "0") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference.buildableIdentifier, "primary") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference.blueprintIdentifier, "23766C111EAA3484007A9026") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference.buildableName, "iOS.app") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference.blueprintName, "iOS") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference.referencedContainer, "container:Project.xcodeproj") + XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.buildableIdentifier, "primary") + XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.blueprintIdentifier, "23766C111EAA3484007A9026") + XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.buildableName, "iOS.app") + XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.blueprintName, "iOS") + XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.referencedContainer, "container:Project.xcodeproj") XCTAssertEqual(scheme.profileAction?.preActions.isEmpty, true) XCTAssertEqual(scheme.profileAction?.postActions.first?.title, "Run Script") XCTAssertEqual(scheme.profileAction?.postActions.first?.scriptText, "echo analysis done") @@ -404,11 +432,11 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.launchAction?.debugServiceExtension, "internal") XCTAssertEqual(scheme.launchAction?.allowLocationSimulation, true) XCTAssertEqual(scheme.launchAction?.runnable?.runnableDebuggingMode, "0") - XCTAssertEqual(scheme.launchAction?.runnable?.buildableReference.buildableIdentifier, "primary") - XCTAssertEqual(scheme.launchAction?.runnable?.buildableReference.blueprintIdentifier, "23766C111EAA3484007A9026") - XCTAssertEqual(scheme.launchAction?.runnable?.buildableReference.buildableName, "iOS.app") - XCTAssertEqual(scheme.launchAction?.runnable?.buildableReference.blueprintName, "iOS") - XCTAssertEqual(scheme.launchAction?.runnable?.buildableReference.referencedContainer, "container:Project.xcodeproj") + XCTAssertEqual(scheme.launchAction?.runnable?.buildableReference?.buildableIdentifier, "primary") + XCTAssertEqual(scheme.launchAction?.runnable?.buildableReference?.blueprintIdentifier, "23766C111EAA3484007A9026") + XCTAssertEqual(scheme.launchAction?.runnable?.buildableReference?.buildableName, "iOS.app") + XCTAssertEqual(scheme.launchAction?.runnable?.buildableReference?.blueprintName, "iOS") + XCTAssertEqual(scheme.launchAction?.runnable?.buildableReference?.referencedContainer, "container:Project.xcodeproj") XCTAssertEqual(scheme.launchAction?.locationScenarioReference?.identifier, "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier") XCTAssertEqual(scheme.launchAction?.locationScenarioReference?.referenceType, "1") XCTAssertEqual(scheme.launchAction?.preActions.first?.title, "") @@ -447,6 +475,109 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertTrue(launchCLIArgs.arguments[0].enabled) XCTAssertNil(scheme.launchAction?.customLLDBInitFile) } + + private func assert(runnableWithoutBuildableReferenceScheme scheme: XCScheme) { + XCTAssertEqual(scheme.version, "2.0") + XCTAssertEqual(scheme.lastUpgradeVersion, "1230", "\(scheme.lastUpgradeVersion!) not equals 1230") + + // Build action + XCTAssertTrue(scheme.buildAction?.parallelizeBuild == true) + XCTAssertTrue(scheme.buildAction?.buildImplicitDependencies == true) + XCTAssertNil(scheme.buildAction?.runPostActionsOnFailure) + XCTAssertEqual(scheme.buildAction?.buildActionEntries.count, 2) + XCTAssertTrue(scheme.buildAction?.buildActionEntries[0].buildFor.contains(.testing) == true) + XCTAssertTrue(scheme.buildAction?.buildActionEntries[0].buildFor.contains(.running) == true) + XCTAssertTrue(scheme.buildAction?.buildActionEntries[0].buildFor.contains(.profiling) == true) + XCTAssertTrue(scheme.buildAction?.buildActionEntries[0].buildFor.contains(.archiving) == true) + XCTAssertTrue(scheme.buildAction?.buildActionEntries[0].buildFor.contains(.analyzing) == true) + XCTAssertEqual(scheme.buildAction?.buildActionEntries[0].buildableReference.buildableIdentifier, "primary") + XCTAssertEqual(scheme.buildAction?.buildActionEntries[0].buildableReference.blueprintIdentifier, "FE7C11D21B6DB70D0041DF02") + XCTAssertEqual(scheme.buildAction?.buildActionEntries[0].buildableReference.buildableName, "Ava.app") + XCTAssertEqual(scheme.buildAction?.buildActionEntries[0].buildableReference.blueprintName, "core-ava") + XCTAssertEqual(scheme.buildAction?.buildActionEntries[0].buildableReference.referencedContainer, "container:core-ava.xcodeproj") + + XCTAssertTrue(scheme.buildAction?.buildActionEntries[1].buildFor.contains(.testing) == true) + XCTAssertTrue(scheme.buildAction?.buildActionEntries[1].buildFor.contains(.running) == false) + XCTAssertTrue(scheme.buildAction?.buildActionEntries[1].buildFor.contains(.profiling) == false) + XCTAssertTrue(scheme.buildAction?.buildActionEntries[1].buildFor.contains(.archiving) == false) + XCTAssertTrue(scheme.buildAction?.buildActionEntries[1].buildFor.contains(.analyzing) == false) + XCTAssertEqual(scheme.buildAction?.buildActionEntries[1].buildableReference.buildableIdentifier, "primary") + XCTAssertEqual(scheme.buildAction?.buildActionEntries[1].buildableReference.blueprintIdentifier, "9942115E25C4D3B7000711CE") + XCTAssertEqual(scheme.buildAction?.buildActionEntries[1].buildableReference.buildableName, "AvaTests.xctest") + XCTAssertEqual(scheme.buildAction?.buildActionEntries[1].buildableReference.blueprintName, "AvaTests") + XCTAssertEqual(scheme.buildAction?.buildActionEntries[1].buildableReference.referencedContainer, "container:core-ava.xcodeproj") + + // Test action + XCTAssertEqual(scheme.testAction?.buildConfiguration, "Debug") + XCTAssertEqual(scheme.testAction?.selectedDebuggerIdentifier, "Xcode.DebuggerFoundation.Debugger.LLDB") + XCTAssertEqual(scheme.testAction?.selectedLauncherIdentifier, "Xcode.DebuggerFoundation.Launcher.LLDB") + XCTAssertTrue(scheme.testAction?.shouldUseLaunchSchemeArgsEnv == true) + XCTAssertTrue(scheme.testAction?.codeCoverageEnabled == false) + XCTAssertEqual(scheme.testAction?.onlyGenerateCoverageForSpecifiedTargets, nil) + XCTAssertNil(scheme.testAction?.macroExpansion) + XCTAssertEqual(scheme.testAction?.enableAddressSanitizer, false) + XCTAssertEqual(scheme.testAction?.enableASanStackUseAfterReturn, false) + XCTAssertEqual(scheme.testAction?.enableThreadSanitizer, false) + XCTAssertEqual(scheme.testAction?.enableUBSanitizer, false) + XCTAssertEqual(scheme.testAction?.disableMainThreadChecker, false) + XCTAssertEqual(scheme.testAction?.additionalOptions.isEmpty, true) + XCTAssertNil(scheme.testAction?.commandlineArguments) + XCTAssertNil(scheme.testAction?.environmentVariables) + + // Launch action + XCTAssertEqual(scheme.launchAction?.selectedDebuggerIdentifier, XCScheme.defaultDebugger) + XCTAssertEqual(scheme.launchAction?.selectedLauncherIdentifier, XCScheme.defaultLauncher) + XCTAssertEqual(scheme.launchAction?.buildConfiguration, "Staging") + XCTAssertEqual(scheme.launchAction?.launchStyle, XCScheme.LaunchAction.Style.auto) + XCTAssertTrue(scheme.launchAction?.askForAppToLaunch == true) + XCTAssertTrue(scheme.launchAction?.useCustomWorkingDirectory == false) + XCTAssertTrue(scheme.launchAction?.ignoresPersistentStateOnLaunch == false) + XCTAssertTrue(scheme.launchAction?.debugDocumentVersioning == true) + XCTAssertEqual(scheme.launchAction?.debugServiceExtension, XCScheme.LaunchAction.defaultDebugServiceExtension) + XCTAssertTrue(scheme.launchAction?.allowLocationSimulation == true) + XCTAssertNil(scheme.launchAction?.locationScenarioReference) + XCTAssertNil(scheme.launchAction?.commandlineArguments) + XCTAssertEqual(scheme.launchAction?.enableAddressSanitizer, false) + XCTAssertEqual(scheme.launchAction?.enableASanStackUseAfterReturn, false) + XCTAssertEqual(scheme.launchAction?.enableThreadSanitizer, false) + XCTAssertEqual(scheme.launchAction?.stopOnEveryThreadSanitizerIssue, false) + XCTAssertEqual(scheme.launchAction?.enableUBSanitizer, false) + XCTAssertEqual(scheme.launchAction?.stopOnEveryUBSanitizerIssue, false) + XCTAssertEqual(scheme.launchAction?.disableMainThreadChecker, false) + XCTAssertEqual(scheme.launchAction?.stopOnEveryMainThreadCheckerIssue, false) + XCTAssertEqual(scheme.launchAction?.additionalOptions.isEmpty, true) + XCTAssertNil(scheme.launchAction?.storeKitConfigurationFileReference) + XCTAssertEqual(scheme.launchAction?.macroExpansion?.buildableIdentifier, "primary") + XCTAssertEqual(scheme.launchAction?.macroExpansion?.blueprintIdentifier, "FE7C11D21B6DB70D0041DF02") + XCTAssertEqual(scheme.launchAction?.macroExpansion?.buildableName, "Ava.app") + XCTAssertEqual(scheme.launchAction?.macroExpansion?.blueprintName, "core-ava") + XCTAssertEqual(scheme.launchAction?.macroExpansion?.referencedContainer, "container:core-ava.xcodeproj") + XCTAssertNil(scheme.launchAction?.environmentVariables) + + // Profile action + XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.runnableDebuggingMode, "0") + XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.blueprintIdentifier, "FE7C11D21B6DB70D0041DF02") + XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.buildableIdentifier, "primary") + XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.blueprintName, "core-ava") + XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.buildableName, "Ava.app") + XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.referencedContainer, "container:core-ava.xcodeproj") + XCTAssertEqual(scheme.profileAction?.buildConfiguration, "Release") + XCTAssertTrue(scheme.profileAction?.shouldUseLaunchSchemeArgsEnv == true) + XCTAssertEqual(scheme.profileAction?.savedToolIdentifier, "") + XCTAssertTrue(scheme.profileAction?.useCustomWorkingDirectory == false) + XCTAssertTrue(scheme.profileAction?.debugDocumentVersioning == true) + XCTAssertNil(scheme.profileAction?.askForAppToLaunch) + XCTAssertNil(scheme.profileAction?.commandlineArguments) + XCTAssertNil(scheme.profileAction?.environmentVariables) + + // Analyze action + XCTAssertEqual(scheme.analyzeAction?.buildConfiguration, "Debug") + + // Archive action + XCTAssertEqual(scheme.archiveAction?.buildConfiguration, "Release") + XCTAssertTrue(scheme.archiveAction?.revealArchiveInOrganizer == true) + XCTAssertNil(scheme.archiveAction?.customArchiveName) + } private func assert(minimalScheme scheme: XCScheme) { XCTAssertEqual(scheme.version, "1.3") @@ -557,6 +688,10 @@ final class XCSchemeIntegrationTests: XCTestCase { // but minimal in the sense it doesn't have most of the standard elements and attributes. fixturesPath() + "Schemes/MinimalInformation.xcscheme" } + + private var runnableWithoutBuildableReferenceSchemePath: Path { + fixturesPath() + "Schemes/RunnableWithoutBuildableReference.xcscheme" + } /// Path to a scheme with a buildable reference that contains no blueprint identifier private var noBlueprintIDPath: Path { From 3a93b47a34860a4d7dbcd9cc0ae8e9543c179c61 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 13 Sep 2021 12:04:58 +0200 Subject: [PATCH 037/143] docs: add subdan as a contributor for code (#640) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 559bfa24b..e0b6f7aaa 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -103,6 +103,15 @@ "contributions": [ "code" ] + }, + { + "login": "subdan", + "name": "Daniil Subbotin", + "avatar_url": "https://avatars.githubusercontent.com/u/410293?v=4", + "profile": "https://github.com/subdan", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 3fd40cd99..2078db907 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -168,6 +168,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Yuya Oka

πŸ’»
Keith Smiley

πŸ–‹
Ian Leitch

πŸ’» +
Daniil Subbotin

πŸ’» From ea4c39763f2e65177085e2df3fe9c656cb7d25a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 13 Sep 2021 12:06:09 +0200 Subject: [PATCH 038/143] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa2d84366..a4c21cd9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ ### Added - Support obtaining the full path of a file element by passing the source root as a string [#624](https://github.com/tuist/XcodeProj/pull/624) by [@ileitch](https://github.com/ileitch). + +### Fixed + +- If RemoteRunnable doesn't contains BuildableReference XcodeProj removes xcscheme file [#627](https://github.com/tuist/XcodeProj/pull/627) by [@subdan](https://github.com/subdan). ## 8.1.0 - Barcelona ### Changed From 73828de6e565d5f2ee17a67e6c1cc3d1ce4c1299 Mon Sep 17 00:00:00 2001 From: Yuya Oka Date: Mon, 13 Sep 2021 19:07:12 +0900 Subject: [PATCH 039/143] Update AEXML v4.6.1 (#632) * Update AEXML v4.6.1 * Remove .swift-version --- .swift-version | 1 - Cartfile | 2 +- Cartfile.resolved | 2 +- Package.resolved | 4 ++-- Package.swift | 2 +- xcodeproj.podspec | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 .swift-version diff --git a/.swift-version b/.swift-version deleted file mode 100644 index a75b92f1e..000000000 --- a/.swift-version +++ /dev/null @@ -1 +0,0 @@ -5.1 diff --git a/Cartfile b/Cartfile index dfc7532ed..89344226f 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ github "tuist/PathKit" == 1.0.0 -github "tadija/AEXML" == 4.6.0 +github "tadija/AEXML" == 4.6.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index e53ee3616..25e945995 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ -github "tadija/AEXML" "4.6.0" +github "tadija/AEXML" "4.6.1" github "tuist/PathKit" "1.0.0" diff --git a/Package.resolved b/Package.resolved index cd537a787..123c89ef4 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/tadija/AEXML", "state": { "branch": null, - "revision": "8623e73b193386909566a9ca20203e33a09af142", - "version": "4.5.0" + "revision": "38f7d00b23ecd891e1ee656fa6aeebd6ba04ecc3", + "version": "4.6.1" } }, { diff --git a/Package.swift b/Package.swift index 95e46cdf7..147f14d3f 100644 --- a/Package.swift +++ b/Package.swift @@ -8,7 +8,7 @@ let package = Package( .library(name: "XcodeProj", targets: ["XcodeProj"]), ], dependencies: [ - .package(url: "https://github.com/tadija/AEXML", .upToNextMinor(from: "4.5.0")), + .package(url: "https://github.com/tadija/AEXML", .upToNextMinor(from: "4.6.1")), .package(url: "https://github.com/kylef/PathKit", .upToNextMinor(from: "1.0.0")), ], targets: [ diff --git a/xcodeproj.podspec b/xcodeproj.podspec index 66b0bea86..448e5304b 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -15,5 +15,5 @@ Pod::Spec.new do |s| s.module_name = 'XcodeProj' s.dependency 'PathKit', '~> 1.0.0' - s.dependency 'AEXML', '~> 4.6.0' + s.dependency 'AEXML', '~> 4.6.1' end From 2a610ab477634c8e375ba65602d2bfbf6ca012f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era=20Buend=C3=ADa?= Date: Mon, 13 Sep 2021 12:09:58 +0200 Subject: [PATCH 040/143] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 2078db907..af9a9e068 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) [![Release](https://img.shields.io/github/release/tuist/xcodeproj.svg)](https://github.com/tuist/xcodeproj/releases) [![Code Coverage](https://codecov.io/gh/tuist/xcodeproj/branch/main/graph/badge.svg)](https://codecov.io/gh/tuist/xcodeproj) -[![Slack](http://slack.tuist.io/badge.svg)](http://slack.tuist.io/) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/tuist/xcodeproj/blob/main/LICENSE.md) XcodeProj is a library written in Swift for parsing and working with Xcode projects. It's heavily inspired by [CocoaPods XcodeProj](https://github.com/CocoaPods/Xcodeproj) and [xcode](https://www.npmjs.com/package/xcode). From 5c9d987e32da7a0dca21fc09afb7a0a7591d9de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 13 Sep 2021 12:09:31 +0200 Subject: [PATCH 041/143] CI improvements --- .github/workflows/checks.yml | 15 --------------- .../workflows/{package.yml => xcodeproj.yml} | 19 ++++++++++++++++--- CHANGELOG.md | 4 ++++ 3 files changed, 20 insertions(+), 18 deletions(-) delete mode 100644 .github/workflows/checks.yml rename .github/workflows/{package.yml => xcodeproj.yml} (72%) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml deleted file mode 100644 index 65d4a0e02..000000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,15 +0,0 @@ -# https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idname -name: Checks - -on: [push, pull_request] - -jobs: - swiftlint: - name: Swiftlint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: GitHub Action for SwiftLint - uses: pepibumur/action-swiftlint@0d4afd006bb24e4525b5afcefd4ab5e2537193ac - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/package.yml b/.github/workflows/xcodeproj.yml similarity index 72% rename from .github/workflows/package.yml rename to .github/workflows/xcodeproj.yml index b1af51c6d..56021a382 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/xcodeproj.yml @@ -1,15 +1,19 @@ # https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idname -name: Package +name: XcodeProj on: [push, pull_request] +concurrency: + group: xcodeproj-${{ github.head_ref }} + cancel-in-progress: true + jobs: build: name: Build (macOS) runs-on: macos-latest strategy: matrix: - xcode: ["11.3", "11.3.1", "11.4"] + xcode: ["11.3", "11.3.1", "11.4", "12.0.1", "12.4", "12.5.1"] steps: - uses: actions/checkout@v1 - name: Select Xcode ${{ matrix.xcode }} @@ -28,7 +32,7 @@ jobs: runs-on: macos-latest strategy: matrix: - xcode: ["11.3", "11.3.1", "11.4", "12.0.1"] + xcode: ["11.3", "11.3.1", "11.4", "12.0.1", "12.4", "12.5.1"] steps: - uses: actions/checkout@v1 - name: Select Xcode ${{ matrix.xcode }} @@ -46,3 +50,12 @@ jobs: - uses: actions/checkout@v1 - name: Build and run tests run: swift test --enable-test-discovery + swiftlint: + name: Swiftlint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: GitHub Action for SwiftLint + uses: pepibumur/action-swiftlint@0d4afd006bb24e4525b5afcefd4ab5e2537193ac + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index a4c21cd9d..cc5c56e36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ ### Fixed - If RemoteRunnable doesn't contains BuildableReference XcodeProj removes xcscheme file [#627](https://github.com/tuist/XcodeProj/pull/627) by [@subdan](https://github.com/subdan). + +### Changed + +- Updated AEXML to 4.6.1 [#632](https://github.com/tuist/XcodeProj/pull/632) by [@nnsnodnb](https://github.com/nnsnodnb). ## 8.1.0 - Barcelona ### Changed From 8e83191dba8bcbfc0be4d7c48bf1e02e7fedc88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 13 Sep 2021 12:11:41 +0200 Subject: [PATCH 042/143] Version 8.2.0 --- CHANGELOG.md | 1 + README.md | 8 ++++---- xcodeproj.podspec | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc5c56e36..af7c6e098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Next +### 8.2.0 - Bubbles ### Added - Support obtaining the full path of a file element by passing the source root as a string [#624](https://github.com/tuist/XcodeProj/pull/624) by [@ileitch](https://github.com/ileitch). diff --git a/README.md b/README.md index af9a9e068..359856fc9 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.1.0")), + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.2.0")), ], targets: [ .target( @@ -64,13 +64,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 8.1.0 +github "tuist/xcodeproj" ~> 8.2.0 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 8.1.0 +pod 'xcodeproj', '~> 8.2.0 ``` ### Scripting @@ -82,7 +82,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 8.1.0 +import XcodeProj // @tuist ~> 8.2.0 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/xcodeproj.podspec b/xcodeproj.podspec index 448e5304b..006a6eee3 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.1.0' + s.version = '8.2.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From 304b1d417f3da321bb29575c037f9ca61f0ec61a Mon Sep 17 00:00:00 2001 From: Florentin Bekier Date: Tue, 14 Sep 2021 21:05:48 +0200 Subject: [PATCH 043/143] Add CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED to projectAll (#641) * Add CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED to projectAll * Update CHANGELOG --- CHANGELOG.md | 4 ++++ Sources/XcodeProj/Utils/BuildSettingsProvider.swift | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index af7c6e098..21798c40e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Next +### Added + +- `CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED` to default build setting [#641](https://github.com/tuist/XcodeProj/pull/641) by [@flowbe](https://github.com/flowbe) + ### 8.2.0 - Bubbles ### Added diff --git a/Sources/XcodeProj/Utils/BuildSettingsProvider.swift b/Sources/XcodeProj/Utils/BuildSettingsProvider.swift index dbb23d314..b8c5514b6 100644 --- a/Sources/XcodeProj/Utils/BuildSettingsProvider.swift +++ b/Sources/XcodeProj/Utils/BuildSettingsProvider.swift @@ -97,6 +97,7 @@ public class BuildSettingsProvider { private static func projectAll() -> BuildSettings { [ "ALWAYS_SEARCH_USER_PATHS": "NO", + "CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED": "YES", "CLANG_ANALYZER_NONNULL": "YES", "CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION": "YES_AGGRESSIVE", "CLANG_CXX_LANGUAGE_STANDARD": "gnu++14", From 8c12577a2e07b119c85bbee118e719cc4c9f8af7 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 14 Sep 2021 21:06:02 +0200 Subject: [PATCH 044/143] docs: add flowbe as a contributor for code (#642) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index e0b6f7aaa..2adf733c0 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -112,6 +112,15 @@ "contributions": [ "code" ] + }, + { + "login": "flowbe", + "name": "Florentin Bekier", + "avatar_url": "https://avatars.githubusercontent.com/u/8288625?v=4", + "profile": "https://www.florentin.tech", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 359856fc9..b4ea82a4e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -168,6 +168,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Keith Smiley

πŸ–‹
Ian Leitch

πŸ’»
Daniil Subbotin

πŸ’» +
Florentin Bekier

πŸ’» From a2cf76335141d28e876b91fd1e19637bc9285b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Fri, 17 Sep 2021 15:01:11 +0200 Subject: [PATCH 045/143] Update Package.resolved --- Package.resolved | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.resolved b/Package.resolved index 123c89ef4..ec3fb3842 100644 --- a/Package.resolved +++ b/Package.resolved @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/kylef/Spectre.git", "state": { "branch": null, - "revision": "f717bbce0e19f0129fc001b2b6bed43b70fd8b87", - "version": "0.9.1" + "revision": "f79d4ecbf8bc4e1579fbd86c3e1d652fb6876c53", + "version": "0.9.2" } } ] From 3a22f2f51e4317700870fcbee49bc65606d462b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Fri, 17 Sep 2021 17:28:49 +0200 Subject: [PATCH 046/143] Update pacakges --- Package.resolved | 4 ++-- Package.swift | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Package.resolved b/Package.resolved index ec3fb3842..862c225e5 100644 --- a/Package.resolved +++ b/Package.resolved @@ -3,7 +3,7 @@ "pins": [ { "package": "AEXML", - "repositoryURL": "https://github.com/tadija/AEXML", + "repositoryURL": "https://github.com/tadija/AEXML.git", "state": { "branch": null, "revision": "38f7d00b23ecd891e1ee656fa6aeebd6ba04ecc3", @@ -12,7 +12,7 @@ }, { "package": "PathKit", - "repositoryURL": "https://github.com/kylef/PathKit", + "repositoryURL": "https://github.com/kylef/PathKit.git", "state": { "branch": null, "revision": "73f8e9dca9b7a3078cb79128217dc8f2e585a511", diff --git a/Package.swift b/Package.swift index 147f14d3f..e31baf94b 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.0 +// swift-tools-version:5.2.0 import PackageDescription @@ -8,8 +8,8 @@ let package = Package( .library(name: "XcodeProj", targets: ["XcodeProj"]), ], dependencies: [ - .package(url: "https://github.com/tadija/AEXML", .upToNextMinor(from: "4.6.1")), - .package(url: "https://github.com/kylef/PathKit", .upToNextMinor(from: "1.0.0")), + .package(url: "https://github.com/tadija/AEXML.git", .upToNextMinor(from: "4.6.1")), + .package(url: "https://github.com/kylef/PathKit.git", .upToNextMinor(from: "1.0.0")), ], targets: [ .target(name: "XcodeProj", From 21ceb79854e21ac49f30fac8799b8b423c3faec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Fri, 17 Sep 2021 17:34:10 +0200 Subject: [PATCH 047/143] Drop Xcode 11 support --- .github/workflows/xcodeproj.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/xcodeproj.yml b/.github/workflows/xcodeproj.yml index 56021a382..c15507b30 100644 --- a/.github/workflows/xcodeproj.yml +++ b/.github/workflows/xcodeproj.yml @@ -13,7 +13,7 @@ jobs: runs-on: macos-latest strategy: matrix: - xcode: ["11.3", "11.3.1", "11.4", "12.0.1", "12.4", "12.5.1"] + xcode: ["12.0.1", "12.4", "12.5.1"] steps: - uses: actions/checkout@v1 - name: Select Xcode ${{ matrix.xcode }} @@ -32,7 +32,7 @@ jobs: runs-on: macos-latest strategy: matrix: - xcode: ["11.3", "11.3.1", "11.4", "12.0.1", "12.4", "12.5.1"] + xcode: ["12.0.1", "12.4", "12.5.1"] steps: - uses: actions/checkout@v1 - name: Select Xcode ${{ matrix.xcode }} From 2ba6090fe7646e0f9438bc8179beab5c3c9ec57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 20 Sep 2021 12:32:02 +0200 Subject: [PATCH 048/143] Replace 12.5.1 by 12.5 --- .github/workflows/xcodeproj.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/xcodeproj.yml b/.github/workflows/xcodeproj.yml index c15507b30..320868e37 100644 --- a/.github/workflows/xcodeproj.yml +++ b/.github/workflows/xcodeproj.yml @@ -13,7 +13,7 @@ jobs: runs-on: macos-latest strategy: matrix: - xcode: ["12.0.1", "12.4", "12.5.1"] + xcode: ["12.0.1", "12.4", "12.5"] steps: - uses: actions/checkout@v1 - name: Select Xcode ${{ matrix.xcode }} From 02477d7d3b093e987fef14fa274112970b013743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 20 Sep 2021 12:44:27 +0200 Subject: [PATCH 049/143] Turn 12.5.1 into 12.5 also in the Test job --- .github/workflows/xcodeproj.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/xcodeproj.yml b/.github/workflows/xcodeproj.yml index 320868e37..a640405f5 100644 --- a/.github/workflows/xcodeproj.yml +++ b/.github/workflows/xcodeproj.yml @@ -32,7 +32,7 @@ jobs: runs-on: macos-latest strategy: matrix: - xcode: ["12.0.1", "12.4", "12.5.1"] + xcode: ["12.0.1", "12.4", "12.5"] steps: - uses: actions/checkout@v1 - name: Select Xcode ${{ matrix.xcode }} From 316fb754543b84391f7b5dd6d7694268af319faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 20 Sep 2021 13:02:10 +0200 Subject: [PATCH 050/143] Run on macOS 11 --- .github/workflows/xcodeproj.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/xcodeproj.yml b/.github/workflows/xcodeproj.yml index a640405f5..e74f6860f 100644 --- a/.github/workflows/xcodeproj.yml +++ b/.github/workflows/xcodeproj.yml @@ -10,10 +10,10 @@ concurrency: jobs: build: name: Build (macOS) - runs-on: macos-latest + runs-on: macos-11 strategy: matrix: - xcode: ["12.0.1", "12.4", "12.5"] + xcode: ["12.4", "12.5"] steps: - uses: actions/checkout@v1 - name: Select Xcode ${{ matrix.xcode }} @@ -29,10 +29,10 @@ jobs: run: swift build -c release test: name: Test (macOS) - runs-on: macos-latest + runs-on: macos-11 strategy: matrix: - xcode: ["12.0.1", "12.4", "12.5"] + xcode: ["12.4", "12.5"] steps: - uses: actions/checkout@v1 - name: Select Xcode ${{ matrix.xcode }} From 2c89f5c624178170268a5126a4d5a38f61ded639 Mon Sep 17 00:00:00 2001 From: Vadim Smal Date: Mon, 20 Sep 2021 12:09:45 +0100 Subject: [PATCH 051/143] Fix Xcode 13 build error (#643) Co-authored-by: Vadim Smal --- Sources/XcodeProj/Extensions/Path+Extras.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/XcodeProj/Extensions/Path+Extras.swift b/Sources/XcodeProj/Extensions/Path+Extras.swift index 9a20677cd..5b7c70d21 100644 --- a/Sources/XcodeProj/Extensions/Path+Extras.swift +++ b/Sources/XcodeProj/Extensions/Path+Extras.swift @@ -24,7 +24,10 @@ extension Path { /// - Returns: found directories and files. func glob(_ pattern: String) -> [Path] { var gt = glob_t() - let cPattern = strdup((self + pattern).string) + guard let cPattern = strdup((self + pattern).string) else { + globfree(>) + return [] + } defer { globfree(>) free(cPattern) From c2994d3194950cb8e2ca11f624f4dabf78296b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Mon, 20 Sep 2021 13:15:10 +0200 Subject: [PATCH 052/143] Revert "Fix Xcode 13 build error (#643)" This reverts commit 2c89f5c624178170268a5126a4d5a38f61ded639. --- Sources/XcodeProj/Extensions/Path+Extras.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Sources/XcodeProj/Extensions/Path+Extras.swift b/Sources/XcodeProj/Extensions/Path+Extras.swift index 5b7c70d21..9a20677cd 100644 --- a/Sources/XcodeProj/Extensions/Path+Extras.swift +++ b/Sources/XcodeProj/Extensions/Path+Extras.swift @@ -24,10 +24,7 @@ extension Path { /// - Returns: found directories and files. func glob(_ pattern: String) -> [Path] { var gt = glob_t() - guard let cPattern = strdup((self + pattern).string) else { - globfree(>) - return [] - } + let cPattern = strdup((self + pattern).string) defer { globfree(>) free(cPattern) From ada359887322a84895b1ea70875b1b8d0f89d508 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 13:15:52 +0200 Subject: [PATCH 053/143] docs: add CognitiveDisson as a contributor for bug (#645) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 2adf733c0..564054c2f 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -121,6 +121,15 @@ "contributions": [ "code" ] + }, + { + "login": "CognitiveDisson", + "name": "Vadim Smal", + "avatar_url": "https://avatars.githubusercontent.com/u/10621118?v=4", + "profile": "https://github.com/CognitiveDisson", + "contributions": [ + "bug" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index b4ea82a4e..ea5d3a5d5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-14-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -169,6 +169,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Ian Leitch

πŸ’»
Daniil Subbotin

πŸ’»
Florentin Bekier

πŸ’» +
Vadim Smal

πŸ› From 24a61fbf9fe790ec65a50a13d29fa80328ba7de4 Mon Sep 17 00:00:00 2001 From: Jared Sorge Date: Wed, 22 Sep 2021 23:34:14 -0700 Subject: [PATCH 054/143] Update package dependencies (#646) --- Package.resolved | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Package.resolved b/Package.resolved index 862c225e5..234bed8df 100644 --- a/Package.resolved +++ b/Package.resolved @@ -15,8 +15,8 @@ "repositoryURL": "https://github.com/kylef/PathKit.git", "state": { "branch": null, - "revision": "73f8e9dca9b7a3078cb79128217dc8f2e585a511", - "version": "1.0.0" + "revision": "3bfd2737b700b9a36565a8c94f4ad2b050a5e574", + "version": "1.0.1" } }, { @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/kylef/Spectre.git", "state": { "branch": null, - "revision": "f79d4ecbf8bc4e1579fbd86c3e1d652fb6876c53", - "version": "0.9.2" + "revision": "26cc5e9ae0947092c7139ef7ba612e34646086c7", + "version": "0.10.1" } } ] From 56af16e4237215b447f8ab72c737c494a3a20c97 Mon Sep 17 00:00:00 2001 From: fortmarek Date: Thu, 23 Sep 2021 08:37:39 +0200 Subject: [PATCH 055/143] Version 8.3.0 --- CHANGELOG.md | 5 +++++ README.md | 8 ++++---- xcodeproj.podspec | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21798c40e..c5561bdb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,15 @@ ## Next +### 8.3.0 - Mojo ### Added - `CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED` to default build setting [#641](https://github.com/tuist/XcodeProj/pull/641) by [@flowbe](https://github.com/flowbe) +### Fixed + +- Xcode 13 build issues [#646](https://github.com/tuist/XcodeProj/pull/646) by [@jsorge](https://github.com/jsorge) + ### 8.2.0 - Bubbles ### Added diff --git a/README.md b/README.md index ea5d3a5d5..df41198e1 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.2.0")), + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.3.0")), ], targets: [ .target( @@ -64,13 +64,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 8.2.0 +github "tuist/xcodeproj" ~> 8.3.0 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 8.2.0 +pod 'xcodeproj', '~> 8.3.0 ``` ### Scripting @@ -82,7 +82,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 8.2.0 +import XcodeProj // @tuist ~> 8.3.0 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/xcodeproj.podspec b/xcodeproj.podspec index 006a6eee3..64a7ef958 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.2.0' + s.version = '8.3.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From acfe03a35cfc438ef9adb2e1b187b41926bfab78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Mat=C4=9Bj?= Date: Thu, 23 Sep 2021 13:39:35 +0200 Subject: [PATCH 056/143] Fix Xcode 13 build (#648) --- .github/workflows/xcodeproj.yml | 4 ++-- Sources/XcodeProj/Extensions/Path+Extras.swift | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/xcodeproj.yml b/.github/workflows/xcodeproj.yml index e74f6860f..5d95e7d10 100644 --- a/.github/workflows/xcodeproj.yml +++ b/.github/workflows/xcodeproj.yml @@ -13,7 +13,7 @@ jobs: runs-on: macos-11 strategy: matrix: - xcode: ["12.4", "12.5"] + xcode: ["12.4", "12.5", "13.0"] steps: - uses: actions/checkout@v1 - name: Select Xcode ${{ matrix.xcode }} @@ -32,7 +32,7 @@ jobs: runs-on: macos-11 strategy: matrix: - xcode: ["12.4", "12.5"] + xcode: ["12.4", "12.5", "13.0"] steps: - uses: actions/checkout@v1 - name: Select Xcode ${{ matrix.xcode }} diff --git a/Sources/XcodeProj/Extensions/Path+Extras.swift b/Sources/XcodeProj/Extensions/Path+Extras.swift index 9a20677cd..b26a48976 100644 --- a/Sources/XcodeProj/Extensions/Path+Extras.swift +++ b/Sources/XcodeProj/Extensions/Path+Extras.swift @@ -24,7 +24,9 @@ extension Path { /// - Returns: found directories and files. func glob(_ pattern: String) -> [Path] { var gt = glob_t() - let cPattern = strdup((self + pattern).string) + guard let cPattern = strdup((self + pattern).string) else { + fatalError("strdup returned null: Likely out of memory") + } defer { globfree(>) free(cPattern) From 446f3a0db73e141c7f57e26fcdb043096b1db52c Mon Sep 17 00:00:00 2001 From: fortmarek Date: Thu, 23 Sep 2021 13:41:51 +0200 Subject: [PATCH 057/143] Version 8.3.1 --- CHANGELOG.md | 6 ++++++ README.md | 8 ++++---- xcodeproj.podspec | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5561bdb4..4b5c5f5b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Next + +### 8.3.1 +### Fixed + +- Fix Xcode 13 build [#648](https://github.com/tuist/XcodeProj/pull/648) by [@raptorxcz](https://github.com/raptorxcz) + ### 8.3.0 - Mojo ### Added diff --git a/README.md b/README.md index df41198e1..6b27e9d64 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.3.0")), + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.3.1")), ], targets: [ .target( @@ -64,13 +64,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 8.3.0 +github "tuist/xcodeproj" ~> 8.3.1 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 8.3.0 +pod 'xcodeproj', '~> 8.3.1 ``` ### Scripting @@ -82,7 +82,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 8.3.0 +import XcodeProj // @tuist ~> 8.3.1 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/xcodeproj.podspec b/xcodeproj.podspec index 64a7ef958..b479489e4 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.3.0' + s.version = '8.3.1' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From 78895f1ef01cb5a762039ad831ccb0eb413f4519 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Tue, 5 Oct 2021 19:26:32 +0200 Subject: [PATCH 058/143] Update jazzy to version 0.14.1 (#649) Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> --- Gemfile.lock | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3385e205c..119f197a4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,8 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.3) + CFPropertyList (3.0.4) + rexml activesupport (6.1.4.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) @@ -65,7 +66,7 @@ GEM httpclient (2.8.3) i18n (1.8.10) concurrent-ruby (~> 1.0) - jazzy (0.14.0) + jazzy (0.14.1) cocoapods (~> 1.5) mustache (~> 1.1) open4 (~> 1.3) @@ -88,7 +89,7 @@ GEM rake (13.0.6) redcarpet (3.5.1) rexml (3.2.5) - rouge (3.26.0) + rouge (3.26.1) ruby-macho (2.5.1) sassc (2.4.0) ffi (~> 1.9) From 5a8b1d5190b0ce59791f6d8520cb17069262e845 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 17:14:02 +0200 Subject: [PATCH 059/143] docs: add freddi-kit as a contributor for code (#651) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 564054c2f..cdbb40ca0 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -130,6 +130,15 @@ "contributions": [ "bug" ] + }, + { + "login": "freddi-kit", + "name": "freddi(Yuki Aki)", + "avatar_url": "https://avatars.githubusercontent.com/u/13707872?v=4", + "profile": "http://freddi.dev", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 6b27e9d64..8f88f78fd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-14-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-15-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -171,6 +171,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Florentin Bekier

πŸ’»
Vadim Smal

πŸ› + +
freddi(Yuki Aki)

πŸ’» + From 49787856e91688b71c9a16fb11a77cc7be5f6366 Mon Sep 17 00:00:00 2001 From: "freddi(Yuki Aki)" Date: Fri, 15 Oct 2021 00:14:11 +0900 Subject: [PATCH 060/143] Implement custom Deriveddata path in WorkspaceSettings (#650) * implement deriveddata path in WorkspaceSettings * fix derivedDataLocationStyle to optional * add fixture test * update changelog * fix readme --- CHANGELOG.md | 3 ++ .../OriginalAbsoluteDerivedData.xcsettings | 12 ++++++ .../OriginalRelativeDerivedData.xcsettings | 12 ++++++ .../XcodeProj/Project/WorkspaceSettings.swift | 42 ++++++++++++++++++- .../Project/WorkspaceSettingsTests.swift | 18 ++++++++ 5 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 Fixtures/WorkspaceSettings/OriginalAbsoluteDerivedData.xcsettings create mode 100644 Fixtures/WorkspaceSettings/OriginalRelativeDerivedData.xcsettings diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b5c5f5b8..bf60ddd3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Next +### Added + +- Support customized DerrivedData path in `WorkspaceSettings` [#650](https://github.com/tuist/XcodeProj/pull/650) by [@freddi-kit](https://github.com/freddi-kit). ### 8.3.1 ### Fixed diff --git a/Fixtures/WorkspaceSettings/OriginalAbsoluteDerivedData.xcsettings b/Fixtures/WorkspaceSettings/OriginalAbsoluteDerivedData.xcsettings new file mode 100644 index 000000000..a8063b134 --- /dev/null +++ b/Fixtures/WorkspaceSettings/OriginalAbsoluteDerivedData.xcsettings @@ -0,0 +1,12 @@ + + + + + BuildSystemType + Original + DerivedDataCustomLocation + /User/xcodeproj/DerivedData + DerivedDataLocationStyle + AbsolutePath + + diff --git a/Fixtures/WorkspaceSettings/OriginalRelativeDerivedData.xcsettings b/Fixtures/WorkspaceSettings/OriginalRelativeDerivedData.xcsettings new file mode 100644 index 000000000..236929fd8 --- /dev/null +++ b/Fixtures/WorkspaceSettings/OriginalRelativeDerivedData.xcsettings @@ -0,0 +1,12 @@ + + + + + BuildSystemType + Original + DerivedDataCustomLocation + CustomizedDerivedData + DerivedDataLocationStyle + WorkspaceRelativePath + + diff --git a/Sources/XcodeProj/Project/WorkspaceSettings.swift b/Sources/XcodeProj/Project/WorkspaceSettings.swift index 128f9f89d..8f1e51815 100644 --- a/Sources/XcodeProj/Project/WorkspaceSettings.swift +++ b/Sources/XcodeProj/Project/WorkspaceSettings.swift @@ -15,9 +15,26 @@ public class WorkspaceSettings: Codable, Equatable, Writable { /// New build system case new } + + public enum DerivedDataLocationStyle: String { + /// Default derived data + case `default` = "Default" + + /// Absolute path + case absolutePath = "AbsolutePath" + + /// Relative paht + case workspaceRelativePath = "WorkspaceRelativePath" + } /// Workspace build system. public var buildSystem: BuildSystem + + /// Workspace DerivedData directory. + public var derivedDataLocationStyle: DerivedDataLocationStyle? + + /// Path to workspace DerivedData directory. + public var derivedDataCustomLocation: String? /// When true, Xcode auto-creates schemes in the project. public var autoCreateSchemes: Bool? @@ -27,6 +44,8 @@ public class WorkspaceSettings: Codable, Equatable, Writable { /// - buildSystem: Build system. enum CodingKeys: String, CodingKey { case buildSystem = "BuildSystemType" + case derivedDataLocationStyle = "DerivedDataLocationStyle" + case derivedDataCustomLocation = "DerivedDataCustomLocation" case autoCreateSchemes = "IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded" } @@ -34,10 +53,16 @@ public class WorkspaceSettings: Codable, Equatable, Writable { /// /// - Parameters: /// - buildSystem: Workspace build system. + /// - derivedDataLocationStyle: Workspace DerivedData directory. + /// - derivedDataCustomLocation: Path to workspace DerivedData directory. /// - autoCreateSchemes: When true, Xcode auto-creates schemes in the project. init(buildSystem: BuildSystem = .new, + derivedDataLocationStyle: DerivedDataLocationStyle? = nil, + derivedDataCustomLocation: String? = nil, autoCreateSchemes: Bool? = nil) { self.buildSystem = buildSystem + self.derivedDataLocationStyle = derivedDataLocationStyle + self.derivedDataCustomLocation = derivedDataCustomLocation self.autoCreateSchemes = autoCreateSchemes } @@ -53,6 +78,13 @@ public class WorkspaceSettings: Codable, Equatable, Writable { } else { buildSystem = .new } + if let derivedDataLocationStyleString: String = try container.decodeIfPresent(.derivedDataLocationStyle), + let derivedDataLocationStyle = DerivedDataLocationStyle(rawValue: derivedDataLocationStyleString) { + self.derivedDataLocationStyle = derivedDataLocationStyle + } else { + derivedDataLocationStyle = .default + } + derivedDataCustomLocation = try container.decodeIfPresent(.derivedDataCustomLocation) autoCreateSchemes = try container.decodeIfPresent(.autoCreateSchemes) } @@ -65,6 +97,12 @@ public class WorkspaceSettings: Codable, Equatable, Writable { if buildSystem == .original { try container.encode(buildSystem.rawValue, forKey: .buildSystem) } + if let derivedDataLocationStyle = derivedDataLocationStyle { + try container.encode(derivedDataLocationStyle.rawValue, forKey: .derivedDataLocationStyle) + } + if let derivedDataCustomLocation = derivedDataCustomLocation { + try container.encode(derivedDataCustomLocation, forKey: .derivedDataCustomLocation) + } if let autoCreateSchemes = autoCreateSchemes { try container.encode(autoCreateSchemes, forKey: .autoCreateSchemes) } @@ -92,7 +130,9 @@ public class WorkspaceSettings: Codable, Equatable, Writable { /// - Returns: True if the two instances are the same. public static func == (lhs: WorkspaceSettings, rhs: WorkspaceSettings) -> Bool { lhs.buildSystem == rhs.buildSystem && - lhs.autoCreateSchemes == rhs.autoCreateSchemes + lhs.autoCreateSchemes == rhs.autoCreateSchemes && + lhs.derivedDataLocationStyle == rhs.derivedDataLocationStyle && + lhs.derivedDataCustomLocation == rhs.derivedDataCustomLocation } /// Writes the workspace settings. diff --git a/Tests/XcodeProjTests/Project/WorkspaceSettingsTests.swift b/Tests/XcodeProjTests/Project/WorkspaceSettingsTests.swift index 8ae3e1816..9e55a425e 100644 --- a/Tests/XcodeProjTests/Project/WorkspaceSettingsTests.swift +++ b/Tests/XcodeProjTests/Project/WorkspaceSettingsTests.swift @@ -23,6 +23,20 @@ final class WorkspaceSettingsTests: XCTestCase { XCTAssertTrue(got.autoCreateSchemes == true) } + func test_init_when_relative_derivedData_is_enabled() throws { + let path = fixturesPath() + "WorkspaceSettings/OriginalRelativeDerivedData.xcsettings" + let got = try WorkspaceSettings.at(path: path) + XCTAssertTrue(got.derivedDataCustomLocation == "CustomizedDerivedData") + XCTAssertTrue(got.derivedDataLocationStyle == .workspaceRelativePath) + } + + func test_init_when_absolute_derivedData_is_enabled() throws { + let path = fixturesPath() + "WorkspaceSettings/OriginalAbsoluteDerivedData.xcsettings" + let got = try WorkspaceSettings.at(path: path) + XCTAssertTrue(got.derivedDataCustomLocation == "/User/xcodeproj/DerivedData") + XCTAssertTrue(got.derivedDataLocationStyle == .absolutePath) + } + func test_equals() { let lhs = WorkspaceSettings(buildSystem: .new) let rhs = WorkspaceSettings(buildSystem: .original) @@ -36,10 +50,14 @@ final class WorkspaceSettingsTests: XCTestCase { var settings = try WorkspaceSettings.at(path: path) settings.buildSystem = .original + settings.derivedDataLocationStyle = .workspaceRelativePath + settings.derivedDataCustomLocation = "DerivedData" try settings.write(path: copyPath, override: true) settings = try WorkspaceSettings.at(path: copyPath) XCTAssertEqual(settings.buildSystem, .original) + XCTAssertEqual(settings.derivedDataLocationStyle, .workspaceRelativePath) + XCTAssertEqual(settings.derivedDataCustomLocation, "DerivedData") } } } From 1330d6d6fa9b7932eca8c688f98d298443e78821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Thu, 14 Oct 2021 17:15:41 +0200 Subject: [PATCH 061/143] Version 8.4.0 --- CHANGELOG.md | 2 +- README.md | 8 ++++---- xcodeproj.podspec | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf60ddd3c..b91650011 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) ## Next - +### 8.4.0 ### Added - Support customized DerrivedData path in `WorkspaceSettings` [#650](https://github.com/tuist/XcodeProj/pull/650) by [@freddi-kit](https://github.com/freddi-kit). diff --git a/README.md b/README.md index 8f88f78fd..489c9231d 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.3.1")), + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.4.0")), ], targets: [ .target( @@ -64,13 +64,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 8.3.1 +github "tuist/xcodeproj" ~> 8.4.0 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 8.3.1 +pod 'xcodeproj', '~> 8.4.0 ``` ### Scripting @@ -82,7 +82,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 8.3.1 +import XcodeProj // @tuist ~> 8.4.0 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/xcodeproj.podspec b/xcodeproj.podspec index b479489e4..ae025273f 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.3.1' + s.version = '8.4.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From 5ddd9c817382fdbf1e48c49023e299a6a0580e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era=20Buend=C3=ADa?= Date: Thu, 14 Oct 2021 18:29:10 +0200 Subject: [PATCH 062/143] Update the project to Tuist 2 (#652) --- Tuist/Config.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tuist/Config.swift b/Tuist/Config.swift index 78af64add..c482b403c 100644 --- a/Tuist/Config.swift +++ b/Tuist/Config.swift @@ -1,6 +1,6 @@ import ProjectDescription -let config = TuistConfig(generationOptions: [ +let config = Config(generationOptions: [ // If we generate the manifest target Carthage will attempt to compile it too. // .generateManifest ]) From 8998757fabaa18237994cf33af304bea8e530a0c Mon Sep 17 00:00:00 2001 From: Ikko Ashimine Date: Fri, 15 Oct 2021 02:42:39 +0900 Subject: [PATCH 063/143] Fix typo in WorkspaceSettings.swift (#653) --- Sources/XcodeProj/Project/WorkspaceSettings.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/XcodeProj/Project/WorkspaceSettings.swift b/Sources/XcodeProj/Project/WorkspaceSettings.swift index 8f1e51815..8bab7b90f 100644 --- a/Sources/XcodeProj/Project/WorkspaceSettings.swift +++ b/Sources/XcodeProj/Project/WorkspaceSettings.swift @@ -68,7 +68,7 @@ public class WorkspaceSettings: Codable, Equatable, Writable { /// Initializes the settings decoding the values from the plist representation. /// - /// - Parameter decoder: Propertly list decoder. + /// - Parameter decoder: Property list decoder. /// - Throws: An error if required attributes are missing or have a wrong type. public required init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) From 0f76476c78184e4707863918c881404db114eb3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era=20Buend=C3=ADa?= Date: Fri, 15 Oct 2021 18:36:39 +0200 Subject: [PATCH 064/143] Add XCSchemeManagement struct (#565) * Add XCSchemeManagement struct * Update CHANGELOG * Address comments * Add some logs * Fix the linux tests * Set default branch * Add some logs * Store the file as an xml file --- .github/workflows/xcodeproj.yml | 5 + CHANGELOG.md | 1 + Fixtures/Schemes/xcschememanagement.plist | 29 +++ .../XcodeProj/Scheme/XCSchemeManagement.swift | 178 ++++++++++++++++++ .../Extensions/XCTestCase+Shell.swift | 25 +++ .../Project/PBXProjIntegrationTests.swift | 24 --- .../Scheme/XCSchemeManagementTests.swift | 57 ++++++ 7 files changed, 295 insertions(+), 24 deletions(-) create mode 100644 Fixtures/Schemes/xcschememanagement.plist create mode 100644 Sources/XcodeProj/Scheme/XCSchemeManagement.swift create mode 100644 Tests/XcodeProjTests/Extensions/XCTestCase+Shell.swift create mode 100644 Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift diff --git a/.github/workflows/xcodeproj.yml b/.github/workflows/xcodeproj.yml index 5d95e7d10..e974c0e25 100644 --- a/.github/workflows/xcodeproj.yml +++ b/.github/workflows/xcodeproj.yml @@ -48,6 +48,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - name: Set Git config + run: | + git config --global user.email "xcodeproj@tuist.io" + git config --global user.name "xcodeproj" + git config --global init.defaultBranch main - name: Build and run tests run: swift test --enable-test-discovery swiftlint: diff --git a/CHANGELOG.md b/CHANGELOG.md index b91650011..ece92e96e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Added - Support customized DerrivedData path in `WorkspaceSettings` [#650](https://github.com/tuist/XcodeProj/pull/650) by [@freddi-kit](https://github.com/freddi-kit). +- Add XCSchemeManagement struct https://github.com/tuist/XcodeProj/pull/565 by @pepibumur. ### 8.3.1 ### Fixed diff --git a/Fixtures/Schemes/xcschememanagement.plist b/Fixtures/Schemes/xcschememanagement.plist new file mode 100644 index 000000000..7a0865f0c --- /dev/null +++ b/Fixtures/Schemes/xcschememanagement.plist @@ -0,0 +1,29 @@ + + + + + SchemeUserState + + Tuist.xcscheme_^#shared#^_ + + orderHint + 0 + isShown + + + XcodeProj.xcscheme + + orderHint + 1 + + + SuppressBuildableAutocreation + + E525238B16245A900012E2BA + + primary + + + + + diff --git a/Sources/XcodeProj/Scheme/XCSchemeManagement.swift b/Sources/XcodeProj/Scheme/XCSchemeManagement.swift new file mode 100644 index 000000000..838bf4ab6 --- /dev/null +++ b/Sources/XcodeProj/Scheme/XCSchemeManagement.swift @@ -0,0 +1,178 @@ +import Foundation +import PathKit + +public enum XCSchemeManagementError: Error, Equatable, LocalizedError, CustomStringConvertible { + /// Thrown when the user tries to initialize a XCSchemeManagement instace passing a path to a file that doesn't exist. + case notFound(path: Path) + + public var description: String { + switch self { + case let .notFound(path): + return "Couldn't initialize XCSchemeManagement because the file at path \(path.string) was not found." + } + } + + public var errorDescription: String? { + return description + } +} + +/// This struct represents the xcschememanagement.plist file that is generated by Xcode +/// to attach metdata to schemes such as the order of schemes orwhether a scheme is shared or no. +/// The file is formatted as a property list file. +public struct XCSchemeManagement: Codable { + + public struct AutocreationBuildable: Equatable, Codable { + var primary: Bool + } + + /// Scheme configuration object. + public struct UserStateScheme: Equatable, Codable { + + /// Coding keys + public enum CodingKeys: String, CodingKey { + case shared + case orderHint + case isShown + case name + } + + /// Name of the scheme (with the .xcscheme extension) + public var name: String + + /// True if the scheme should be shared. + public var shared: Bool + + /// Attribute used by Xcode to sort the schemes. + public var orderHint: Int? + + /// True if the scheme should be shown in the list of schemes. + public var isShown: Bool? + + /// The key that should be used when encoding the scheme configuration. + var key: String { + var key = name + if shared { + key.append("_^#shared#^_") + } + return key + } + + /// It initializes the scheme configuration with its attributes. + /// - Parameters: + /// - name: Name of the scheme (with the .xcscheme extension) + /// - shared: True if the scheme should be shared. + /// - orderHint: Attribute used by Xcode to sort the schemes. + /// - isShown: True if the scheme should be shown in the list of schemes. + public init(name: String, + shared: Bool = false, + orderHint: Int? = nil, + isShown: Bool? = nil) { + self.name = name + self.shared = shared + self.orderHint = orderHint + self.isShown = isShown + } + + // MARK: - Codable + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.orderHint = try container.decodeIfPresent(.orderHint) + self.isShown = try container.decodeIfPresent(.isShown) + self.shared = try container.decodeIfPresent(.shared) ?? false + self.name = try container.decode(.name) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if let orderHint = orderHint { + try container.encode(orderHint, forKey: .orderHint) + } + if let isShown = isShown { + try container.encode(isShown, forKey: .isShown) + } + } + } + + + /// Coding keys. + public enum CodingKeys: String, CodingKey { + case schemeUserState = "SchemeUserState" + case suppressBuildableAutocreation = "SuppressBuildableAutocreation" + } + + /// An array that contains the configuration of the schemes. + public var schemeUserState: [XCSchemeManagement.UserStateScheme]? + + /// A dictionary where the key is the object reference of the target, and the value the configuration for auto-creating schemes. + public var suppressBuildableAutocreation: [String: XCSchemeManagement.AutocreationBuildable]? + + + /// Default constructor. + /// - Parameters: + /// - schemeUserState: An array that contains the configuration of the schemes. + /// - suppressBuildableAutocreation: A dictionary where the key is the object reference of the target, and the value the configuration for auto-creating schemes. + public init(schemeUserState: [XCSchemeManagement.UserStateScheme]? = nil, + suppressBuildableAutocreation: [String: XCSchemeManagement.AutocreationBuildable]? = nil) { + self.schemeUserState = schemeUserState + self.suppressBuildableAutocreation = suppressBuildableAutocreation + } + + /// Initializes the XCSchemeManagement instance by parsing an existing xcschememanagement.plist + /// - Parameter path: Path to the xcschememanagement.plist file. + /// - Throws: An error if the file is malformated. + public init(path: Path) throws { + if !path.exists { + throw XCSchemeManagementError.notFound(path: path) + } + let decoder = XcodeprojPropertyListDecoder() + self = try decoder.decode(XCSchemeManagement.self, from: try path.read()) + } + + /// Converts the object into a property list and writes it at the given path. + /// - Parameter path: Path to the file where it should be written. + /// - Throws: An error if the write fails. + public func write(path: Path) throws { + let encoder = PropertyListEncoder() + encoder.outputFormat = .xml + try encoder.encode(self).write(to: path.url) + } + // MARK: - Codable + + public init(from decoder: Decoder) throws { + let plistDecoder = XcodeprojPropertyListDecoder() + let container = try decoder.container(keyedBy: CodingKeys.self) + self.suppressBuildableAutocreation = try container.decodeIfPresent(.suppressBuildableAutocreation) + if let schemeUserStateDictionary = try container.decodeIfPresent([String: Any].self, forKey: .schemeUserState) { + self.schemeUserState = try schemeUserStateDictionary.compactMap({ (key, value) -> XCSchemeManagement.UserStateScheme? in + var name = key + guard var valueDictionary = value as? [String: Any] else { return nil } + if key.contains("_^#shared#^_") { + valueDictionary["shared"] = true + name = key.replacingOccurrences(of: "_^#shared#^_", with: "") + } + valueDictionary["name"] = name + + let data = try PropertyListSerialization.data(fromPropertyList: valueDictionary, format: .xml, options: 0) + return try plistDecoder.decode(XCSchemeManagement.UserStateScheme.self, from: data) + }) + } else { + self.suppressBuildableAutocreation = nil + } + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + if let suppressBuildableAutocreation = suppressBuildableAutocreation { + try container.encode(suppressBuildableAutocreation, forKey: .suppressBuildableAutocreation) + } + + if let schemeUserState = schemeUserState { + let encodableSchemeUserState = schemeUserState + .reduce(into: [String: XCSchemeManagement.UserStateScheme]()) { $0[$1.key] = $1 } + try container.encode(encodableSchemeUserState, forKey: .schemeUserState) + } + } +} diff --git a/Tests/XcodeProjTests/Extensions/XCTestCase+Shell.swift b/Tests/XcodeProjTests/Extensions/XCTestCase+Shell.swift new file mode 100644 index 000000000..5ea654b4c --- /dev/null +++ b/Tests/XcodeProjTests/Extensions/XCTestCase+Shell.swift @@ -0,0 +1,25 @@ +import Foundation + +/// Returns the output of running `executable` with `args`. Throws an error if the process exits indicating failure. +@discardableResult +func checkedOutput(_ executable: String, _ args: [String]) throws -> String? { + let process = Process() + let output = Pipe() + + if executable.contains("/") { + process.launchPath = executable + } else { + process.launchPath = try checkedOutput("/usr/bin/which", [executable])?.trimmingCharacters(in: .newlines) + } + + process.arguments = args + process.standardOutput = output + process.launch() + process.waitUntilExit() + + guard process.terminationStatus == 0 else { + throw NSError(domain: NSPOSIXErrorDomain, code: Int(process.terminationStatus)) + } + + return String(data: output.fileHandleForReading.readDataToEndOfFile(), encoding: .utf8) +} diff --git a/Tests/XcodeProjTests/Objects/Project/PBXProjIntegrationTests.swift b/Tests/XcodeProjTests/Objects/Project/PBXProjIntegrationTests.swift index 9a672d9c0..93838e4d0 100644 --- a/Tests/XcodeProjTests/Objects/Project/PBXProjIntegrationTests.swift +++ b/Tests/XcodeProjTests/Objects/Project/PBXProjIntegrationTests.swift @@ -84,27 +84,3 @@ final class PBXProjIntegrationTests: XCTestCase { XCTAssertEqual(proj.objects.remoteSwiftPackageReferences.count, 1) } } - -/// Returns the output of running `executable` with `args`. Throws an error if the process exits indicating failure. -@discardableResult -private func checkedOutput(_ executable: String, _ args: [String]) throws -> String? { - let process = Process() - let output = Pipe() - - if executable.contains("/") { - process.launchPath = executable - } else { - process.launchPath = try checkedOutput("/usr/bin/which", [executable])?.trimmingCharacters(in: .newlines) - } - - process.arguments = args - process.standardOutput = output - process.launch() - process.waitUntilExit() - - guard process.terminationStatus == 0 else { - throw NSError(domain: NSPOSIXErrorDomain, code: Int(process.terminationStatus)) - } - - return String(data: output.fileHandleForReading.readDataToEndOfFile(), encoding: .utf8) -} diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift new file mode 100644 index 000000000..5b42b50de --- /dev/null +++ b/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift @@ -0,0 +1,57 @@ +import Foundation +import XCTest +import AEXML +import PathKit +@testable import XcodeProj + +final class XCSchemeManagementTests: XCTestCase { + func test_init_from_path() throws { + // Given + let path = fixturesPath() + "Schemes/xcschememanagement.plist" + + // When + let got = try XCSchemeManagement.init(path: path) + + // Then + let autocreationTarget = try XCTUnwrap(got.suppressBuildableAutocreation?["E525238B16245A900012E2BA"]) + XCTAssertEqual(autocreationTarget.primary, true) + + let tuistScheme = try XCTUnwrap(got.schemeUserState?.first(where: {$0.name == "Tuist.xcscheme"})) + XCTAssertEqual(tuistScheme.name, "Tuist.xcscheme") + XCTAssertTrue(tuistScheme.shared) + XCTAssertEqual(tuistScheme.isShown, true) + XCTAssertEqual(tuistScheme.orderHint, 0) + + let xcodeprojScheme = try XCTUnwrap(got.schemeUserState?.first(where: {$0.name == "XcodeProj.xcscheme"})) + XCTAssertEqual(xcodeprojScheme.name, "XcodeProj.xcscheme") + XCTAssertFalse(xcodeprojScheme.shared) + XCTAssertNil(xcodeprojScheme.isShown) + XCTAssertEqual(xcodeprojScheme.orderHint, 1) + } + + func test_write_produces_no_diff() throws { + let tmpDir = try Path.uniqueTemporary() + defer { + try? tmpDir.delete() + } + + try tmpDir.chdir { + // Write + let plistPath = tmpDir + "xcschememanagement.plist" + let subject = XCSchemeManagement(schemeUserState: [.init(name: "Test.xcscheme", shared: true, orderHint: 0, isShown: true)], + suppressBuildableAutocreation: ["E525238B16245A900012E2BA": .init(primary: true)]) + try subject.write(path: plistPath) + + // Create a commit + try checkedOutput("git", ["init"]) + try checkedOutput("git", ["add", "."]) + try checkedOutput("git", ["commit", "-m", "test"]) + + // Write again + try subject.write(path: plistPath) + + let got = try checkedOutput("git", ["status"]) + XCTAssertTrue(got?.contains("nothing to commit") ?? false) + } + } +} From 2db72013b66df2cfc041b9526034798c1a55bac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Fri, 15 Oct 2021 18:40:50 +0200 Subject: [PATCH 065/143] Update constants --- CHANGELOG.md | 3 +++ Sources/XcodeProj/Project/Xcode.swift | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ece92e96e..967131ad7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ - Support customized DerrivedData path in `WorkspaceSettings` [#650](https://github.com/tuist/XcodeProj/pull/650) by [@freddi-kit](https://github.com/freddi-kit). - Add XCSchemeManagement struct https://github.com/tuist/XcodeProj/pull/565 by @pepibumur. +### Changed +- Update the last-known and default constants to align with Xcode 13. + ### 8.3.1 ### Fixed diff --git a/Sources/XcodeProj/Project/Xcode.swift b/Sources/XcodeProj/Project/Xcode.swift index 6384e9a59..6e6a91d95 100644 --- a/Sources/XcodeProj/Project/Xcode.swift +++ b/Sources/XcodeProj/Project/Xcode.swift @@ -7,41 +7,41 @@ public struct Xcode { /// Last known SDKs. public struct SDK { /// Last known SDK for iOS. - public static let ios: String = "12.0" + public static let ios: String = "14.0" /// Last known SDK for macOS. - public static let macos: String = "10.14" + public static let macos: String = "10.15" /// Last known SDK for tvOS. - public static let tvos: String = "12.0" + public static let tvos: String = "14.0" /// Last known SDK for watchos. - public static let watchos: String = "5.0" + public static let watchos: String = "7.0" } /// Last known archive version for Xcodeproj. public static let archiveVersion: UInt = 1 /// Last known Swift version (stable). - public static let swiftVersion = "4.2" + public static let swiftVersion = "5.4.2" /// Last known object version for Xcodeproj. - public static let objectVersion: UInt = 54 + public static let objectVersion: UInt = 55 /// Last known upgrade check. - public static let upgradeCheck = "1000" + public static let upgradeCheck = "1240" /// Last known Swift upgrade check. - public static let swiftUpgradeCheck = "1000" + public static let swiftUpgradeCheck = "1240" } /// Default values. public struct Default { /// The default object version for Xcodeproj. - public static let objectVersion: UInt = 52 // Xcode 11 + public static let objectVersion: UInt = 46 /// Default compatibility version. - public static let compatibilityVersion: String = "Xcode 9.3" + public static let compatibilityVersion: String = "Xcode 13.0" /// Default development region. public static let developmentRegion: String = "en" From 6ad244ac36f52e6ef4ffbf8613f8f36407b485e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Fri, 15 Oct 2021 18:42:30 +0200 Subject: [PATCH 066/143] Version 8.5.0 --- CHANGELOG.md | 14 ++++++++++---- README.md | 8 ++++---- xcodeproj.podspec | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 967131ad7..add4a6e93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,27 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) ## Next -### 8.4.0 + +## 8.5.0 + ### Added -- Support customized DerrivedData path in `WorkspaceSettings` [#650](https://github.com/tuist/XcodeProj/pull/650) by [@freddi-kit](https://github.com/freddi-kit). - Add XCSchemeManagement struct https://github.com/tuist/XcodeProj/pull/565 by @pepibumur. ### Changed - Update the last-known and default constants to align with Xcode 13. +## 8.4.0 +### Added + +- Support customized DerrivedData path in `WorkspaceSettings` [#650](https://github.com/tuist/XcodeProj/pull/650) by [@freddi-kit](https://github.com/freddi-kit). + ### 8.3.1 ### Fixed - Fix Xcode 13 build [#648](https://github.com/tuist/XcodeProj/pull/648) by [@raptorxcz](https://github.com/raptorxcz) -### 8.3.0 - Mojo +## 8.3.0 - Mojo ### Added - `CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED` to default build setting [#641](https://github.com/tuist/XcodeProj/pull/641) by [@flowbe](https://github.com/flowbe) @@ -24,7 +30,7 @@ - Xcode 13 build issues [#646](https://github.com/tuist/XcodeProj/pull/646) by [@jsorge](https://github.com/jsorge) -### 8.2.0 - Bubbles +## 8.2.0 - Bubbles ### Added - Support obtaining the full path of a file element by passing the source root as a string [#624](https://github.com/tuist/XcodeProj/pull/624) by [@ileitch](https://github.com/ileitch). diff --git a/README.md b/README.md index 489c9231d..604ffd7bd 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.4.0")), + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.5.0")), ], targets: [ .target( @@ -64,13 +64,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 8.4.0 +github "tuist/xcodeproj" ~> 8.5.0 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 8.4.0 +pod 'xcodeproj', '~> 8.5.0 ``` ### Scripting @@ -82,7 +82,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 8.4.0 +import XcodeProj // @tuist ~> 8.5.0 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/xcodeproj.podspec b/xcodeproj.podspec index ae025273f..91f70b7d0 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.4.0' + s.version = '8.5.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From 05a48b11b8ea0a863d60f4e9aa2ecc8a7dfd4224 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 3 Dec 2021 13:10:17 +0100 Subject: [PATCH 067/143] docs: add KrisRJack as a contributor for code (#656) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index cdbb40ca0..28f4ec158 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -139,6 +139,15 @@ "contributions": [ "code" ] + }, + { + "login": "KrisRJack", + "name": "Kristopher Jackson", + "avatar_url": "https://avatars.githubusercontent.com/u/35638500?v=4", + "profile": "http://KrisRJack.com", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 604ffd7bd..3b1d79af2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-15-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -173,6 +173,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
freddi(Yuki Aki)

πŸ’» +
Kristopher Jackson

πŸ’» From 1e4016ad68ebbed2dec7213501bacae92eebeb29 Mon Sep 17 00:00:00 2001 From: Kristopher Jackson Date: Fri, 3 Dec 2021 09:03:19 -0500 Subject: [PATCH 068/143] Added locationScenarioReference to TestableReference (#654) --- CHANGELOG.md | 3 +++ .../Scheme/XCScheme+TestableReference.swift | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index add4a6e93..2978acf1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) ## Next +### Added + +- Support for location added to test targets (`TestableReference`) [#654](https://github.com/tuist/XcodeProj/pull/654) by [@KrisRJack](https://github.com/KrisRJack) ## 8.5.0 diff --git a/Sources/XcodeProj/Scheme/XCScheme+TestableReference.swift b/Sources/XcodeProj/Scheme/XCScheme+TestableReference.swift index fbe0c04f5..ac73ba3ac 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+TestableReference.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+TestableReference.swift @@ -10,6 +10,7 @@ extension XCScheme { public var randomExecutionOrdering: Bool public var useTestSelectionWhitelist: Bool? public var buildableReference: BuildableReference + public var locationScenarioReference: LocationScenarioReference? public var skippedTests: [TestItem] public var selectedTests: [TestItem] @@ -19,6 +20,7 @@ extension XCScheme { parallelizable: Bool = false, randomExecutionOrdering: Bool = false, buildableReference: BuildableReference, + locationScenarioReference: LocationScenarioReference? = nil, skippedTests: [TestItem] = [], selectedTests: [TestItem] = [], useTestSelectionWhitelist: Bool? = nil) { @@ -26,6 +28,7 @@ extension XCScheme { self.parallelizable = parallelizable self.randomExecutionOrdering = randomExecutionOrdering self.buildableReference = buildableReference + self.locationScenarioReference = locationScenarioReference self.useTestSelectionWhitelist = useTestSelectionWhitelist self.selectedTests = selectedTests self.skippedTests = skippedTests @@ -37,6 +40,12 @@ extension XCScheme { useTestSelectionWhitelist = element.attributes["useTestSelectionWhitelist"] == "YES" randomExecutionOrdering = element.attributes["testExecutionOrdering"] == "random" buildableReference = try BuildableReference(element: element["BuildableReference"]) + + if element["LocationScenarioReference"].all?.first != nil { + locationScenarioReference = try LocationScenarioReference(element: element["LocationScenarioReference"]) + } else { + locationScenarioReference = nil + } if let selectedTests = element["SelectedTests"]["Test"].all { self.selectedTests = try selectedTests.map(TestItem.init) @@ -64,6 +73,10 @@ extension XCScheme { attributes: attributes) element.addChild(buildableReference.xmlElement()) + if let locationScenarioReference = locationScenarioReference { + element.addChild(locationScenarioReference.xmlElement()) + } + if useTestSelectionWhitelist == true { if !selectedTests.isEmpty { let selectedTestsElement = element.addChild(name: "SelectedTests") @@ -89,6 +102,7 @@ extension XCScheme { lhs.parallelizable == rhs.parallelizable && lhs.randomExecutionOrdering == rhs.randomExecutionOrdering && lhs.buildableReference == rhs.buildableReference && + lhs.locationScenarioReference == rhs.locationScenarioReference && lhs.useTestSelectionWhitelist == rhs.useTestSelectionWhitelist && lhs.skippedTests == rhs.skippedTests && lhs.selectedTests == rhs.selectedTests From a9a469884e966b61bba7df94feee219b7efbae56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Fri, 15 Oct 2021 18:44:17 +0200 Subject: [PATCH 069/143] Recreate the carthage project --- XcodeProj_Carthage.xcodeproj/project.pbxproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/XcodeProj_Carthage.xcodeproj/project.pbxproj b/XcodeProj_Carthage.xcodeproj/project.pbxproj index d9ae6e0a5..2a558b0f8 100644 --- a/XcodeProj_Carthage.xcodeproj/project.pbxproj +++ b/XcodeProj_Carthage.xcodeproj/project.pbxproj @@ -27,6 +27,7 @@ 3A59F800668B0D6F550B9C09 /* PBXGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 249AAF8AE1978D1546C0ADB5 /* PBXGroup.swift */; }; 3D5DBC9A4315D97D1B39CF19 /* PBXProjEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41A031713D5F31DDCC2D61EF /* PBXProjEncoder.swift */; }; 3E2EE77196F6B2BECE8DF3DB /* BuildSettingsProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1977C44246CCF9C13AB856C2 /* BuildSettingsProvider.swift */; }; + 468F48B3D19F3D1611181A2E /* XCSchemeManagement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69BA327A9CAF3CCFF60AD469 /* XCSchemeManagement.swift */; }; 46A5D9862729AC0C6D85D4FB /* XCScheme+BuildAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = E525B9A065757F329F0E4002 /* XCScheme+BuildAction.swift */; }; 4716E044E5786AC68205911A /* XCVersionGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E419CA05304074ADCDACE8 /* XCVersionGroup.swift */; }; 494EF8FD09FAEE56F6ACF3BE /* XCWorkspaceDataElementLocationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE25C88F5874509586B3AD4 /* XCWorkspaceDataElementLocationType.swift */; }; @@ -169,6 +170,7 @@ 66F7E3085922F586144F562A /* XCScheme+ArchiveAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCScheme+ArchiveAction.swift"; sourceTree = ""; }; 683F0C05F5FD6006924AA43C /* CommentedString.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentedString.swift; sourceTree = ""; }; 694034B4B7C9DF231B007A84 /* XCScheme+SerialAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCScheme+SerialAction.swift"; sourceTree = ""; }; + 69BA327A9CAF3CCFF60AD469 /* XCSchemeManagement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCSchemeManagement.swift; sourceTree = ""; }; 6A113CBABFAE791D1B9C6BBE /* BuildSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BuildSettings.swift; sourceTree = ""; }; 6B2C739F39DD3CC1B77E1075 /* PBXProj.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBXProj.swift; sourceTree = ""; }; 72E6494F0E28769F9B11FD30 /* BuildPhase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BuildPhase.swift; sourceTree = ""; }; @@ -352,6 +354,7 @@ 161E967D0979EF34C7DF6348 /* XCScheme+TestAction.swift */, 7DFDD2E86D3F0ADE3502A29A /* XCScheme+TestItem.swift */, 87331972540CB510D7E0C333 /* XCScheme+TestPlanReference.swift */, + 69BA327A9CAF3CCFF60AD469 /* XCSchemeManagement.swift */, ); path = Scheme; sourceTree = ""; @@ -681,6 +684,7 @@ D5D82B59980521FBA427EED8 /* XCScheme+TestPlanReference.swift in Sources */, 0390AF375B465D1DC7AB6194 /* XCScheme+TestableReference.swift in Sources */, E113D0F651A2213459C65387 /* XCScheme.swift in Sources */, + 468F48B3D19F3D1611181A2E /* XCSchemeManagement.swift in Sources */, 3E2EE77196F6B2BECE8DF3DB /* BuildSettingsProvider.swift in Sources */, 4E9B74BA2A6381FEDEA26092 /* CommentedString.swift in Sources */, BD7A3EBFD6C9D1AA78E6E822 /* Decoders.swift in Sources */, @@ -741,6 +745,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -792,6 +797,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; From aa2a42c7a744ca18b5918771fdd6cf40f9753db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Fri, 3 Dec 2021 16:00:43 +0100 Subject: [PATCH 070/143] Version 8.6.0 --- CHANGELOG.md | 2 ++ README.md | 8 ++++---- xcodeproj.podspec | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2978acf1e..367418959 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) ## Next + +## 8.6.0 ### Added - Support for location added to test targets (`TestableReference`) [#654](https://github.com/tuist/XcodeProj/pull/654) by [@KrisRJack](https://github.com/KrisRJack) diff --git a/README.md b/README.md index 3b1d79af2..f78ca78c3 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.5.0")), + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.6.0")), ], targets: [ .target( @@ -64,13 +64,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 8.5.0 +github "tuist/xcodeproj" ~> 8.6.0 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 8.5.0 +pod 'xcodeproj', '~> 8.6.0 ``` ### Scripting @@ -82,7 +82,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 8.5.0 +import XcodeProj // @tuist ~> 8.6.0 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/xcodeproj.podspec b/xcodeproj.podspec index 91f70b7d0..941d65665 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.5.0' + s.version = '8.6.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From 5fd76223e2bd51af9c3baad5134f3581e0df5893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Fri, 3 Dec 2021 18:07:07 +0100 Subject: [PATCH 071/143] Update the Carthage project --- XcodeProj_Carthage.xcodeproj/project.pbxproj | 24 +++----------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/XcodeProj_Carthage.xcodeproj/project.pbxproj b/XcodeProj_Carthage.xcodeproj/project.pbxproj index 2a558b0f8..d7ff76fe0 100644 --- a/XcodeProj_Carthage.xcodeproj/project.pbxproj +++ b/XcodeProj_Carthage.xcodeproj/project.pbxproj @@ -532,7 +532,6 @@ buildPhases = ( 65398CA885D62783C577D0FA /* Sources */, 987C550AD2D049BE77E633BD /* Resources */, - 2C9C6B5EADA641EDF5BC523E /* Embed Precompiled Frameworks */, 7FAD067EE084B2EF5EFE4BFF /* Embed Frameworks */, ECC1E0A3315EECC3AF534E1B /* Frameworks */, ); @@ -555,7 +554,7 @@ }; }; buildConfigurationList = 477F800A701B31C60A80EACC /* Build configuration list for PBXProject "XcodeProj_Carthage" */; - compatibilityVersion = "Xcode 9.3"; + compatibilityVersion = "Xcode 13.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -582,23 +581,6 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 2C9C6B5EADA641EDF5BC523E /* Embed Precompiled Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Embed Precompiled Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "echo \"Skipping, nothing to be embedded.\""; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ 65398CA885D62783C577D0FA /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -735,7 +717,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.4.2; + SWIFT_VERSION = 5.5.1; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -880,7 +862,7 @@ SUPPORTED_PLATFORMS = macosx; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 5.4.2; + SWIFT_VERSION = 5.5.1; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; From 520b9c8cbeb7c9809894f5bc25273ecb8f1b0787 Mon Sep 17 00:00:00 2001 From: Jake Prickett Date: Thu, 16 Dec 2021 07:20:51 -0500 Subject: [PATCH 072/143] Add docc file type support (#660) * Add Support for .docc source files * Update CHANGELOG.md * Update CHANGELOG.md --- CHANGELOG.md | 3 +++ Sources/XcodeProj/Project/Xcode.swift | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 367418959..0125f7db8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) ## Next +### Added + +- Add DocC Xcode File Type (`.docc`) [#660](https://github.com/tuist/XcodeProj/pull/660) by [@Jake-Prickett](https://github.com/Jake-Prickett) ## 8.6.0 ### Added diff --git a/Sources/XcodeProj/Project/Xcode.swift b/Sources/XcodeProj/Project/Xcode.swift index 6e6a91d95..2a990af2e 100644 --- a/Sources/XcodeProj/Project/Xcode.swift +++ b/Sources/XcodeProj/Project/Xcode.swift @@ -124,6 +124,7 @@ public struct Xcode { "defs": "sourcecode.mig", "dext": "wrapper.driver-extension", "dict": "text.plist", + "docc": "folder.documentationcatalog", "dsym": "wrapper.dsym", "dtd": "text.xml", "dylan": "sourcecode.dylan", From c6f26c3840bbfbc7ef04dbe220eb8d9c96c438d3 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 16 Dec 2021 13:21:11 +0100 Subject: [PATCH 073/143] docs: add Jake-Prickett as a contributor for code (#661) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 28f4ec158..4619b181c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -148,6 +148,15 @@ "contributions": [ "code" ] + }, + { + "login": "Jake-Prickett", + "name": "Jake Prickett", + "avatar_url": "https://avatars.githubusercontent.com/u/26095410?v=4", + "profile": "https://github.com/Jake-Prickett", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index f78ca78c3..f162ff99f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-17-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -174,6 +174,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
freddi(Yuki Aki)

πŸ’»
Kristopher Jackson

πŸ’» +
Jake Prickett

πŸ’» From 714e350a6600e3db1e77b3db3f78acac96ac93b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Thu, 16 Dec 2021 13:21:49 +0100 Subject: [PATCH 074/143] Version 8.7.0 --- CHANGELOG.md | 2 ++ README.md | 8 ++++---- xcodeproj.podspec | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0125f7db8..2c6484763 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) ## Next + +## 8.7.0 ### Added - Add DocC Xcode File Type (`.docc`) [#660](https://github.com/tuist/XcodeProj/pull/660) by [@Jake-Prickett](https://github.com/Jake-Prickett) diff --git a/README.md b/README.md index f162ff99f..ebacb4ff7 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.6.0")), + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.7.0")), ], targets: [ .target( @@ -64,13 +64,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 8.6.0 +github "tuist/xcodeproj" ~> 8.7.0 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 8.6.0 +pod 'xcodeproj', '~> 8.7.0 ``` ### Scripting @@ -82,7 +82,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 8.6.0 +import XcodeProj // @tuist ~> 8.7.0 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/xcodeproj.podspec b/xcodeproj.podspec index 941d65665..81e231050 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.6.0' + s.version = '8.7.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From fae1867893ba4ccf0a57e55e1a9b4097246d4cd2 Mon Sep 17 00:00:00 2001 From: Jake Adams Date: Thu, 16 Dec 2021 09:25:09 -0500 Subject: [PATCH 075/143] Make `WorkspaceSettings` initializer `public` (#658) * Require `WorkspaceSettings.autoCreateSchemes` and make initializer `public`. * Revert to optional boolean. * Update encoder as well. * Set output format to `xml` to avoid binary default. --- .../XcodeProj/Project/WorkspaceSettings.swift | 24 +++++++++++-------- .../Project/WorkspaceSettingsTests.swift | 6 ++--- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Sources/XcodeProj/Project/WorkspaceSettings.swift b/Sources/XcodeProj/Project/WorkspaceSettings.swift index 8bab7b90f..4cf306b57 100644 --- a/Sources/XcodeProj/Project/WorkspaceSettings.swift +++ b/Sources/XcodeProj/Project/WorkspaceSettings.swift @@ -15,24 +15,24 @@ public class WorkspaceSettings: Codable, Equatable, Writable { /// New build system case new } - + public enum DerivedDataLocationStyle: String { /// Default derived data case `default` = "Default" /// Absolute path case absolutePath = "AbsolutePath" - + /// Relative paht case workspaceRelativePath = "WorkspaceRelativePath" } /// Workspace build system. public var buildSystem: BuildSystem - + /// Workspace DerivedData directory. public var derivedDataLocationStyle: DerivedDataLocationStyle? - + /// Path to workspace DerivedData directory. public var derivedDataCustomLocation: String? @@ -56,10 +56,11 @@ public class WorkspaceSettings: Codable, Equatable, Writable { /// - derivedDataLocationStyle: Workspace DerivedData directory. /// - derivedDataCustomLocation: Path to workspace DerivedData directory. /// - autoCreateSchemes: When true, Xcode auto-creates schemes in the project. - init(buildSystem: BuildSystem = .new, - derivedDataLocationStyle: DerivedDataLocationStyle? = nil, - derivedDataCustomLocation: String? = nil, - autoCreateSchemes: Bool? = nil) { + public init(buildSystem: BuildSystem = .new, + derivedDataLocationStyle: DerivedDataLocationStyle? = nil, + derivedDataCustomLocation: String? = nil, + autoCreateSchemes: Bool? = nil) + { self.buildSystem = buildSystem self.derivedDataLocationStyle = derivedDataLocationStyle self.derivedDataCustomLocation = derivedDataCustomLocation @@ -73,13 +74,15 @@ public class WorkspaceSettings: Codable, Equatable, Writable { public required init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) if let buildSystemString: String = try container.decodeIfPresent(.buildSystem), - let buildSystem = BuildSystem(rawValue: buildSystemString) { + let buildSystem = BuildSystem(rawValue: buildSystemString) + { self.buildSystem = buildSystem } else { buildSystem = .new } if let derivedDataLocationStyleString: String = try container.decodeIfPresent(.derivedDataLocationStyle), - let derivedDataLocationStyle = DerivedDataLocationStyle(rawValue: derivedDataLocationStyleString) { + let derivedDataLocationStyle = DerivedDataLocationStyle(rawValue: derivedDataLocationStyleString) + { self.derivedDataLocationStyle = derivedDataLocationStyle } else { derivedDataLocationStyle = .default @@ -142,6 +145,7 @@ public class WorkspaceSettings: Codable, Equatable, Writable { /// - Throws: writing error if something goes wrong. public func write(path: Path, override: Bool) throws { let encoder = PropertyListEncoder() + encoder.outputFormat = .xml let data = try encoder.encode(self) if override, path.exists { try path.delete() diff --git a/Tests/XcodeProjTests/Project/WorkspaceSettingsTests.swift b/Tests/XcodeProjTests/Project/WorkspaceSettingsTests.swift index 9e55a425e..7c70e40d6 100644 --- a/Tests/XcodeProjTests/Project/WorkspaceSettingsTests.swift +++ b/Tests/XcodeProjTests/Project/WorkspaceSettingsTests.swift @@ -29,7 +29,7 @@ final class WorkspaceSettingsTests: XCTestCase { XCTAssertTrue(got.derivedDataCustomLocation == "CustomizedDerivedData") XCTAssertTrue(got.derivedDataLocationStyle == .workspaceRelativePath) } - + func test_init_when_absolute_derivedData_is_enabled() throws { let path = fixturesPath() + "WorkspaceSettings/OriginalAbsoluteDerivedData.xcsettings" let got = try WorkspaceSettings.at(path: path) @@ -38,8 +38,8 @@ final class WorkspaceSettingsTests: XCTestCase { } func test_equals() { - let lhs = WorkspaceSettings(buildSystem: .new) - let rhs = WorkspaceSettings(buildSystem: .original) + let lhs = WorkspaceSettings(buildSystem: .new, autoCreateSchemes: true) + let rhs = WorkspaceSettings(buildSystem: .original, autoCreateSchemes: true) XCTAssertNotEqual(lhs, rhs) } From c75c3acc25460195cfd203a04dde165395bf00e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Pi=C3=B1era?= Date: Thu, 16 Dec 2021 15:46:39 +0100 Subject: [PATCH 076/143] Version 8.7.1 --- CHANGELOG.md | 5 +++++ README.md | 8 ++++---- xcodeproj.podspec | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c6484763..d3ec3b4b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Next +## 8.7.1 + +### Changed +- Make WorkspaceSettings initializer public [#658](https://github.com/tuist/XcodeProj/pull/658) by [@jakeatoms](https://github.com/jakeatoms) + ## 8.7.0 ### Added diff --git a/README.md b/README.md index ebacb4ff7..449a470c4 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.7.0")), + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.7.1")), ], targets: [ .target( @@ -64,13 +64,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 8.7.0 +github "tuist/xcodeproj" ~> 8.7.1 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 8.7.0 +pod 'xcodeproj', '~> 8.7.1 ``` ### Scripting @@ -82,7 +82,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 8.7.0 +import XcodeProj // @tuist ~> 8.7.1 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/xcodeproj.podspec b/xcodeproj.podspec index 81e231050..e063e07e6 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.7.0' + s.version = '8.7.1' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From fd5b3d7a5112e91eca0434ad2bb28ce1fed9cf8c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 16 Dec 2021 15:48:02 +0100 Subject: [PATCH 077/143] docs: add jakeatoms as a contributor for code (#662) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 4619b181c..c0351ffdc 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -157,6 +157,15 @@ "contributions": [ "code" ] + }, + { + "login": "jakeatoms", + "name": "Jake Adams", + "avatar_url": "https://avatars.githubusercontent.com/u/3605966?v=4", + "profile": "http://www.jakeadams.co", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 449a470c4..72831c173 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-17-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-18-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -175,6 +175,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
freddi(Yuki Aki)

πŸ’»
Kristopher Jackson

πŸ’»
Jake Prickett

πŸ’» +
Jake Adams

πŸ’» From b030c965498b9e7d76044049b22844910fee23eb Mon Sep 17 00:00:00 2001 From: Brentley Jones Date: Mon, 28 Feb 2022 14:05:41 -0600 Subject: [PATCH 078/143] Fix equality checking of dictionaries (#667) --- .../XcodeProj/Objects/Sourcery/Equality.generated.swift | 8 ++++---- Templates/Equality.stencil | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/XcodeProj/Objects/Sourcery/Equality.generated.swift b/Sources/XcodeProj/Objects/Sourcery/Equality.generated.swift index 9daa37a2d..7b9c985e4 100644 --- a/Sources/XcodeProj/Objects/Sourcery/Equality.generated.swift +++ b/Sources/XcodeProj/Objects/Sourcery/Equality.generated.swift @@ -15,7 +15,7 @@ extension PBXBuildFile { func isEqual(to rhs: PBXBuildFile) -> Bool { if fileReference != rhs.fileReference { return false } if productReference != rhs.productReference { return false } - if !NSDictionary(dictionary: settings ?? [:]).isEqual(to: rhs.settings ?? [:]) { return false } + if !NSDictionary(dictionary: settings ?? [:]).isEqual(NSDictionary(dictionary: rhs.settings ?? [:])) { return false } if platformFilter != rhs.platformFilter { return false } if buildPhase != rhs.buildPhase { return false } return super.isEqual(to: rhs) @@ -166,8 +166,8 @@ extension PBXProject { if projectReferences != rhs.projectReferences { return false } if projectRoots != rhs.projectRoots { return false } if targetReferences != rhs.targetReferences { return false } - if !NSDictionary(dictionary: attributes).isEqual(to: rhs.attributes) { return false } - if !NSDictionary(dictionary: targetAttributeReferences).isEqual(to: rhs.targetAttributeReferences) { return false } + if !NSDictionary(dictionary: attributes).isEqual(NSDictionary(dictionary: rhs.attributes)) { return false } + if !NSDictionary(dictionary: targetAttributeReferences).isEqual(NSDictionary(dictionary: rhs.targetAttributeReferences)) { return false } if packageReferences != rhs.packageReferences { return false } return super.isEqual(to: rhs) } @@ -257,7 +257,7 @@ extension XCBuildConfiguration { /// :nodoc: func isEqual(to rhs: XCBuildConfiguration) -> Bool { if baseConfigurationReference != rhs.baseConfigurationReference { return false } - if !NSDictionary(dictionary: buildSettings).isEqual(to: rhs.buildSettings) { return false } + if !NSDictionary(dictionary: buildSettings).isEqual(NSDictionary(dictionary: rhs.buildSettings)) { return false } if name != rhs.name { return false } return super.isEqual(to: rhs) } diff --git a/Templates/Equality.stencil b/Templates/Equality.stencil index d8d155a8c..4d149477d 100644 --- a/Templates/Equality.stencil +++ b/Templates/Equality.stencil @@ -6,7 +6,7 @@ extension {{ type.name }} { func isEqual(to rhs: {{ type.name }}) -> Bool { {% for variable in type.storedVariables %} {% if variable.typeName.dictionary %} - if !NSDictionary(dictionary: {{ variable.name}}{% if variable.typeName.isOptional %} ?? [:]{% endif %}).isEqual(to: rhs.{{ variable.name }}{% if variable.typeName.isOptional %} ?? [:]{% endif %}) { return false } + if !NSDictionary(dictionary: {{ variable.name}}{% if variable.typeName.isOptional %} ?? [:]{% endif %}).isEqual(NSDictionary(dictionary: rhs.{{ variable.name }}{% if variable.typeName.isOptional %} ?? [:]{% endif %})) { return false } {% elif variable|!annotated:"skipEquality" %} if {{ variable.name }} != rhs.{{ variable.name }} { return false } {% endif %} From 6f2c1a7e40da1b600277899b9365c6a5cb2df818 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Sun, 20 Mar 2022 12:06:47 +0100 Subject: [PATCH 079/143] Update jazzy to version 0.14.2 (#669) Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> --- Gemfile.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 119f197a4..69b17eeed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.4) + CFPropertyList (3.0.5) rexml - activesupport (6.1.4.1) + activesupport (6.1.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -15,7 +15,7 @@ GEM httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) - claide (1.0.3) + claide (1.1.0) cocoapods (1.11.0) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) @@ -57,16 +57,16 @@ GEM colorize (0.8.1) concurrent-ruby (1.1.9) escape (0.0.4) - ethon (0.14.0) + ethon (0.15.0) ffi (>= 1.15.0) - ffi (1.15.4) + ffi (1.15.5) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) httpclient (2.8.3) - i18n (1.8.10) + i18n (1.10.0) concurrent-ruby (~> 1.0) - jazzy (0.14.1) + jazzy (0.14.2) cocoapods (~> 1.5) mustache (~> 1.1) open4 (~> 1.3) @@ -76,9 +76,9 @@ GEM sassc (~> 2.1) sqlite3 (~> 1.3) xcinvoke (~> 0.3.0) - json (2.5.1) + json (2.6.1) liferaft (0.0.6) - minitest (5.14.4) + minitest (5.15.0) molinillo (0.8.0) mustache (1.1.1) nanaimo (0.3.0) @@ -89,7 +89,7 @@ GEM rake (13.0.6) redcarpet (3.5.1) rexml (3.2.5) - rouge (3.26.1) + rouge (3.28.0) ruby-macho (2.5.1) sassc (2.4.0) ffi (~> 1.9) @@ -107,7 +107,7 @@ GEM colored2 (~> 3.1) nanaimo (~> 0.3.0) rexml (~> 3.2.4) - zeitwerk (2.4.2) + zeitwerk (2.5.4) PLATFORMS ruby From 6b7707cedd8dde065560868193b0e0a6e32ce10b Mon Sep 17 00:00:00 2001 From: Isaac Halvorson Date: Tue, 5 Apr 2022 14:54:08 -0500 Subject: [PATCH 080/143] Quiet new warnings from Xcode 13.3 (#673) * Rename .self to ._self to quiet Xcode 13.3 * Change _self to current * Switch swiftlint GitHub action to norio-nomura/action-swiftlint@3.2.1 --- .github/workflows/xcodeproj.yml | 2 +- Sources/XcodeProj/Workspace/XCWorkspace.swift | 2 +- .../Workspace/XCWorkspaceDataElementLocationType.swift | 10 +++++----- .../Workspace/XCWorkspaceDataTests.swift | 6 +++--- Tests/XcodeProjTests/Workspace/XCWorkspaceTests.swift | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/xcodeproj.yml b/.github/workflows/xcodeproj.yml index e974c0e25..5e61b10b9 100644 --- a/.github/workflows/xcodeproj.yml +++ b/.github/workflows/xcodeproj.yml @@ -61,6 +61,6 @@ jobs: steps: - uses: actions/checkout@v1 - name: GitHub Action for SwiftLint - uses: pepibumur/action-swiftlint@0d4afd006bb24e4525b5afcefd4ab5e2537193ac + uses: norio-nomura/action-swiftlint@3.2.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Sources/XcodeProj/Workspace/XCWorkspace.swift b/Sources/XcodeProj/Workspace/XCWorkspace.swift index 5732a9e7c..a2b549a6d 100644 --- a/Sources/XcodeProj/Workspace/XCWorkspace.swift +++ b/Sources/XcodeProj/Workspace/XCWorkspace.swift @@ -28,7 +28,7 @@ public final class XCWorkspace: Writable, Equatable { /// Initializes a default workspace with a single reference that points to self: public convenience init() { - let data = XCWorkspaceData(children: [.file(.init(location: .self("")))]) + let data = XCWorkspaceData(children: [.file(.init(location: .current("")))]) self.init(data: data) } diff --git a/Sources/XcodeProj/Workspace/XCWorkspaceDataElementLocationType.swift b/Sources/XcodeProj/Workspace/XCWorkspaceDataElementLocationType.swift index f7401ac96..aac0d8bdb 100644 --- a/Sources/XcodeProj/Workspace/XCWorkspaceDataElementLocationType.swift +++ b/Sources/XcodeProj/Workspace/XCWorkspaceDataElementLocationType.swift @@ -9,7 +9,7 @@ public enum XCWorkspaceDataElementLocationType { case container(String) // "Relative to container" case developer(String) // "Relative to Developer Directory" case group(String) // "Relative to group" - case `self`(String) // Single project workspace in xcodeproj directory + case current(String) // Single project workspace in xcodeproj directory case other(String, String) public var schema: String { @@ -22,7 +22,7 @@ public enum XCWorkspaceDataElementLocationType { return "developer" case .group: return "group" - case .self: + case .current: return "self" case let .other(schema, _): return schema @@ -39,7 +39,7 @@ public enum XCWorkspaceDataElementLocationType { return path case let .group(path): return path - case let .self(path): + case let .current(path): return path case let .other(_, path): return path @@ -62,7 +62,7 @@ public enum XCWorkspaceDataElementLocationType { case "group": self = .group(path) case "self": - self = .self(path) + self = .current(path) default: self = .other(schema, path) } @@ -86,7 +86,7 @@ extension XCWorkspaceDataElementLocationType: Equatable { return lhs == rhs case let (.group(lhs), .group(rhs)): return lhs == rhs - case let (.self(lhs), .self(rhs)): + case let (.current(lhs), .current(rhs)): return lhs == rhs case let (.other(lhs0, lhs1), .other(rhs0, rhs1)): return lhs0 == rhs0 && lhs1 == rhs1 diff --git a/Tests/XcodeProjTests/Workspace/XCWorkspaceDataTests.swift b/Tests/XcodeProjTests/Workspace/XCWorkspaceDataTests.swift index e3effd94a..420ea7ed2 100644 --- a/Tests/XcodeProjTests/Workspace/XCWorkspaceDataTests.swift +++ b/Tests/XcodeProjTests/Workspace/XCWorkspaceDataTests.swift @@ -10,7 +10,7 @@ final class XCWorkspaceDataTests: XCTestCase { override func setUp() { super.setUp() fileRef = XCWorkspaceDataFileRef( - location: .self("path") + location: .current("path") ) subject = XCWorkspaceData(children: []) } @@ -26,7 +26,7 @@ final class XCWorkspaceDataIntegrationTests: XCTestCase { let path = fixturePath() let got = try XCWorkspaceData(path: path) if case let XCWorkspaceDataElement.file(location: fileRef) = got.children.first! { - XCTAssertEqual(fileRef.location, .self("")) + XCTAssertEqual(fileRef.location, .current("")) } else { XCTAssertTrue(false, "Expected file reference") } @@ -45,7 +45,7 @@ final class XCWorkspaceDataIntegrationTests: XCTestCase { initModel: { try? XCWorkspaceData(path: $0) }, modify: { $0.children.append( - .group(.init(location: .self("shakira"), + .group(.init(location: .current("shakira"), name: "shakira", children: [])) ) diff --git a/Tests/XcodeProjTests/Workspace/XCWorkspaceTests.swift b/Tests/XcodeProjTests/Workspace/XCWorkspaceTests.swift index 0142bca86..a4820b1c5 100644 --- a/Tests/XcodeProjTests/Workspace/XCWorkspaceTests.swift +++ b/Tests/XcodeProjTests/Workspace/XCWorkspaceTests.swift @@ -19,7 +19,7 @@ final class XCWorkspaceIntegrationTests: XCTestCase { func test_init_returnsAWorkspaceWithTheCorrectReference() { XCTAssertEqual(XCWorkspace().data.children.count, 1) - XCTAssertEqual(XCWorkspace().data.children.first, .file(.init(location: .self("")))) + XCTAssertEqual(XCWorkspace().data.children.first, .file(.init(location: .current("")))) } func test_equatable_emptyWorkspacesAreEqual() { From e1462528f3417969711ff655fbfaebe028fe7305 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 20:50:38 +0200 Subject: [PATCH 081/143] Update cocoapods-downloader to version 1.6.3 (#675) Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 69b17eeed..5b62c4e92 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -45,7 +45,7 @@ GEM public_suffix (~> 4.0) typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) - cocoapods-downloader (1.5.1) + cocoapods-downloader (1.6.3) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.1) From 668509f68a297314ac7b8e4b799295f2e92dcdb4 Mon Sep 17 00:00:00 2001 From: Ikko Ashimine Date: Sun, 24 Apr 2022 17:08:41 +0900 Subject: [PATCH 082/143] Fix typo in PBXOutputSettings.swift (#678) preceeding -> preceding --- Sources/XcodeProj/Objects/Project/PBXOutputSettings.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/XcodeProj/Objects/Project/PBXOutputSettings.swift b/Sources/XcodeProj/Objects/Project/PBXOutputSettings.swift index c6813001d..374e725a1 100644 --- a/Sources/XcodeProj/Objects/Project/PBXOutputSettings.swift +++ b/Sources/XcodeProj/Objects/Project/PBXOutputSettings.swift @@ -81,7 +81,7 @@ public enum PBXNavigatorFileOrder { /// Leave the files unsorted. case unsorted - /// Sort the file by their file name. This is a case sensitive sort with uppercase name preceeding lowercase names. + /// Sort the file by their file name. This is a case sensitive sort with uppercase name preceding lowercase names. case byFilename /// Sorts the files by their file names with all groups appear at the top of the list. From 077da3f0307c4d24a721ed4f7137a75fa443b549 Mon Sep 17 00:00:00 2001 From: Brentley Jones Date: Wed, 27 Apr 2022 15:03:16 -0500 Subject: [PATCH 083/143] Add `addDependency()` helper method to `PBXAggregateTarget` (#677) --- .../Objects/Targets/PBXAggregateTarget.swift | 27 +++++++++++++++++ .../Targets/PBXAggregateTargetTests.swift | 30 +++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/Sources/XcodeProj/Objects/Targets/PBXAggregateTarget.swift b/Sources/XcodeProj/Objects/Targets/PBXAggregateTarget.swift index e963ecd2a..ec87371fe 100644 --- a/Sources/XcodeProj/Objects/Targets/PBXAggregateTarget.swift +++ b/Sources/XcodeProj/Objects/Targets/PBXAggregateTarget.swift @@ -15,3 +15,30 @@ extension PBXAggregateTarget: PlistSerializable { return try plistValues(proj: proj, isa: PBXAggregateTarget.isa, reference: reference) } } + +// MARK: - Helpers + +public extension PBXAggregateTarget { + /// Adds a local target dependency to the target. + /// + /// - Parameter target: dependency target. + /// - Returns: target dependency reference. + /// - Throws: an error if the dependency cannot be created. + func addDependency(target: PBXTarget) throws -> PBXTargetDependency? { + let objects = try target.objects() + guard let project = objects.projects.first?.value else { + return nil + } + let proxy = PBXContainerItemProxy(containerPortal: .project(project), + remoteGlobalID: .object(target), + proxyType: .nativeTarget, + remoteInfo: target.name) + objects.add(object: proxy) + let targetDependency = PBXTargetDependency(name: target.name, + target: target, + targetProxy: proxy) + objects.add(object: targetDependency) + dependencies.append(targetDependency) + return targetDependency + } +} diff --git a/Tests/XcodeProjTests/Objects/Targets/PBXAggregateTargetTests.swift b/Tests/XcodeProjTests/Objects/Targets/PBXAggregateTargetTests.swift index 3e879e75a..d16bfd075 100644 --- a/Tests/XcodeProjTests/Objects/Targets/PBXAggregateTargetTests.swift +++ b/Tests/XcodeProjTests/Objects/Targets/PBXAggregateTargetTests.swift @@ -27,4 +27,34 @@ final class PBXAggregateTargetTests: XCTestCase { "name": "name", ] } + + func test_addDependency() throws { + let objects = PBXObjects(objects: []) + + let configurationList = XCConfigurationList.fixture() + let mainGroup = PBXGroup.fixture() + objects.add(object: configurationList) + objects.add(object: mainGroup) + + let project = PBXProject(name: "Project", + buildConfigurationList: configurationList, + compatibilityVersion: "0", + mainGroup: mainGroup) + + objects.add(object: project) + let target = PBXAggregateTarget(name: "Target", buildConfigurationList: nil) + let dependency = PBXAggregateTarget(name: "Dependency", buildConfigurationList: nil) + objects.add(object: target) + objects.add(object: dependency) + _ = try target.addDependency(target: dependency) + let targetDependency: PBXTargetDependency? = target.dependencyReferences.first?.getObject() + + XCTAssertEqual(targetDependency?.name, "Dependency") + XCTAssertEqual(targetDependency?.targetReference, dependency.reference) + let containerItemProxy: PBXContainerItemProxy? = targetDependency?.targetProxyReference?.getObject() + XCTAssertEqual(containerItemProxy?.containerPortalReference, project.reference) + XCTAssertEqual(containerItemProxy?.remoteGlobalID?.uuid, dependency.reference.value) + XCTAssertEqual(containerItemProxy?.proxyType, .nativeTarget) + XCTAssertEqual(containerItemProxy?.remoteInfo, "Dependency") + } } From 3b80ed8787f52eebeb9c638d34040b4ff80f1448 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Wed, 27 Apr 2022 13:03:51 -0700 Subject: [PATCH 084/143] Fix syntax error in docs (#679) use forEach over each --- Documentation/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/getting-started.md b/Documentation/getting-started.md index 26d6512e9..fd7975b54 100644 --- a/Documentation/getting-started.md +++ b/Documentation/getting-started.md @@ -68,7 +68,7 @@ We the project already in memory, we are going to output all the targets that ar ```swift let pbxproj = xcodeproj.pbxproj // Returns a PBXProj -pbxproj.nativeTargets.each { target in +pbxproj.nativeTargets.forEach { target in print(target.name) } ``` @@ -104,4 +104,4 @@ try xcodeproj.write(path: path) If something goes wrong during the project writing, `write` will throw an error. In most cases, writing issues are related to misconfigured projects. For that reason it's important that you understand the modifications that we are introducing to your projects. -**Bear in mind that xcodeproj makes the process of configuring Xcode project more convenient, but doesn't prevent you from having to read and understand the Xcode project structure** \ No newline at end of file +**Bear in mind that xcodeproj makes the process of configuring Xcode project more convenient, but doesn't prevent you from having to read and understand the Xcode project structure** From 8aa9591d2a1514c1f4fc79b0836b548bcc08ec5c Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Wed, 27 Apr 2022 23:49:45 -0700 Subject: [PATCH 085/143] Misspelling in comment (#680) --- Sources/XcodeProj/Project/XcodeProj.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/XcodeProj/Project/XcodeProj.swift b/Sources/XcodeProj/Project/XcodeProj.swift index 2f14c24f3..dcdd52411 100644 --- a/Sources/XcodeProj/Project/XcodeProj.swift +++ b/Sources/XcodeProj/Project/XcodeProj.swift @@ -8,7 +8,7 @@ public final class XcodeProj: Equatable { /// Project workspace public var workspace: XCWorkspace - /// .pbxproj representatino + /// .pbxproj representation public var pbxproj: PBXProj /// Shared data. From 92e43edf92548a3a72410e4a54d381a921c398a0 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Wed, 27 Apr 2022 23:50:10 -0700 Subject: [PATCH 086/143] Mispelling in comment (#681) --- Sources/XcodeProj/Objects/Targets/PBXNativeTarget.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/XcodeProj/Objects/Targets/PBXNativeTarget.swift b/Sources/XcodeProj/Objects/Targets/PBXNativeTarget.swift index 5b1296136..45c4bbcb3 100644 --- a/Sources/XcodeProj/Objects/Targets/PBXNativeTarget.swift +++ b/Sources/XcodeProj/Objects/Targets/PBXNativeTarget.swift @@ -9,7 +9,7 @@ public final class PBXNativeTarget: PBXTarget { /// /// - Parameters: /// - name: target name. - /// - buildConfigurationList: build configuratino list. + /// - buildConfigurationList: build configuration list. /// - buildPhases: build phases. /// - buildRules: build rules. /// - dependencies: dependencies. From 65ca255bfc9a20876f89380df7b30c1ef5e8ff34 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Sun, 8 May 2022 00:21:33 -0700 Subject: [PATCH 087/143] Allow for initializing a PBXProj via a direct path (#682) - Allows for a `PBXProj` to be initiated with a direct path - Moves some related code to the `PBXProj` class --- .../XcodeProj/Objects/Project/PBXProj.swift | 60 ++++++++++++++++++- Sources/XcodeProj/Project/XcodeProj.swift | 28 +-------- 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/Sources/XcodeProj/Objects/Project/PBXProj.swift b/Sources/XcodeProj/Objects/Project/PBXProj.swift index 32b199453..1319ac847 100644 --- a/Sources/XcodeProj/Objects/Project/PBXProj.swift +++ b/Sources/XcodeProj/Objects/Project/PBXProj.swift @@ -52,6 +52,35 @@ public final class PBXProj: Decodable { } } + /// Initializes the project with a path to the pbxproj file. + /// + /// - Parameters: + /// - path: Path to a pbxproj file. + public convenience init(path: Path) throws { + let pbxproj: PBXProj = try PBXProj.createPBXProj(path: path) + self.init( + rootObject: pbxproj.rootObject, + objectVersion: pbxproj.objectVersion, + archiveVersion: pbxproj.archiveVersion, + classes: pbxproj.classes, + objects: pbxproj.objects + ) + } + + private init( + rootObject: PBXProject? = nil, + objectVersion: UInt = Xcode.LastKnown.objectVersion, + archiveVersion: UInt = Xcode.LastKnown.archiveVersion, + classes: [String: Any] = [:], + objects: PBXObjects + ) { + self.archiveVersion = archiveVersion + self.objectVersion = objectVersion + self.classes = classes + rootObjectReference = rootObject?.reference + self.objects = objects + } + // MARK: - Decodable fileprivate enum CodingKeys: String, CodingKey { @@ -92,6 +121,35 @@ public final class PBXProj: Decodable { try rootGroup()?.assignParentToChildren() } + + // MARK: Static Methods + + private static func createPBXProj(path: Path) throws -> PBXProj { + let (pbxProjData, pbxProjDictionary) = try PBXProj.readPBXProj(path: path) + let context = ProjectDecodingContext( + pbxProjValueReader: { key in + pbxProjDictionary[key] + } + ) + + let plistDecoder = XcodeprojPropertyListDecoder(context: context) + let pbxproj: PBXProj = try plistDecoder.decode(PBXProj.self, from: pbxProjData) + try pbxproj.updateProjectName(path: path) + return pbxproj + } + + private static func readPBXProj(path: Path) throws -> (Data, [String: Any]) { + let plistXML = try Data(contentsOf: path.url) + var propertyListFormat = PropertyListSerialization.PropertyListFormat.xml + let serialized = try PropertyListSerialization.propertyList( + from: plistXML, + options: .mutableContainersAndLeaves, + format: &propertyListFormat + ) + // swiftlint:disable:next force_cast + let pbxProjDictionary = serialized as! [String: Any] + return (plistXML, pbxProjDictionary) + } } // MARK: - Public helpers @@ -198,7 +256,7 @@ public extension PBXProj { extension PBXProj { /// Infers project name from Path and sets it as project name /// - /// Project name is needed for certain comments when serialising PBXProj + /// Project name is needed for certain comments when serializing PBXProj /// /// - Parameters: /// - path: path to .xcodeproj directory. diff --git a/Sources/XcodeProj/Project/XcodeProj.swift b/Sources/XcodeProj/Project/XcodeProj.swift index dcdd52411..e373ce40c 100644 --- a/Sources/XcodeProj/Project/XcodeProj.swift +++ b/Sources/XcodeProj/Project/XcodeProj.swift @@ -25,16 +25,7 @@ public final class XcodeProj: Equatable { guard let pbxprojPath = path.glob("*.pbxproj").first else { throw XCodeProjError.pbxprojNotFound(path: path) } - let (pbxProjData, pbxProjDictionary) = try XcodeProj.readPBXProj(path: pbxprojPath) - let context = ProjectDecodingContext( - pbxProjValueReader: { key in - pbxProjDictionary[key] - } - ) - - let plistDecoder = XcodeprojPropertyListDecoder(context: context) - pbxproj = try plistDecoder.decode(PBXProj.self, from: pbxProjData) - try pbxproj.updateProjectName(path: pbxprojPath) + pbxproj = try PBXProj(path: pbxprojPath) let xcworkspacePaths = path.glob("*.xcworkspace") if xcworkspacePaths.isEmpty { workspace = XCWorkspace() @@ -71,21 +62,6 @@ public final class XcodeProj: Equatable { lhs.pbxproj == rhs.pbxproj && lhs.sharedData == rhs.sharedData } - - // MARK: - Private - - private static func readPBXProj(path: Path) throws -> (Data, [String: Any]) { - let plistXML = try Data(contentsOf: path.url) - var propertyListFormat = PropertyListSerialization.PropertyListFormat.xml - let serialized = try PropertyListSerialization.propertyList( - from: plistXML, - options: .mutableContainersAndLeaves, - format: &propertyListFormat - ) - // swiftlint:disable:next force_cast - let pbxProjDictionary = serialized as! [String: Any] - return (plistXML, pbxProjDictionary) - } } // MARK: - @@ -117,7 +93,7 @@ extension XcodeProj: Writable { /// Returns workspace file path relative to the given path. /// /// - Parameter path: `.xcodeproj` file path - /// - Returns: worspace file path relative to the given path. + /// - Returns: workspace file path relative to the given path. public static func workspacePath(_ path: Path) -> Path { path + "project.xcworkspace" } From 5a4ce5537db95403df7823886916aa879f7b724f Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Wed, 1 Jun 2022 22:24:24 -0700 Subject: [PATCH 088/143] Ensure correct `LaunchAction` scheme order Adds logic and tests to ensure that the XML ordering for `LaunchAction` matches what xcode expects --- .../Extensions/AEXML+XcodeFormat.swift | 1 + .../Extensions/AEXML+XcodeFormatTests.swift | 81 +++++++++++++++---- 2 files changed, 68 insertions(+), 14 deletions(-) diff --git a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift index f19dd2001..aa1161f3d 100644 --- a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift +++ b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift @@ -43,6 +43,7 @@ let attributesOrder: [String: [String]] = [ "buildConfiguration", "selectedDebuggerIdentifier", "selectedLauncherIdentifier", + "customLLDBInitFile", "language", "region", "launchStyle", diff --git a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift index 529a82c31..d16b61974 100644 --- a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift +++ b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift @@ -10,7 +10,7 @@ extension String { } class AEXML_XcodeFormatTests: XCTestCase { - private let expectedXml = + private let expecteBuildActionXml = """ """ + private let expectedLaunchActionXml = + """ + + + + """ + func test_BuildAction_attributes_sorted_when_original_sorted() { - validateAttributes(attributes: [ - "parallelizeBuildables": "YES", - "runPostActionsOnFailure": "YES", - "buildImplicitDependencies": "NO", - ]) + validateAttributes( + expectedXML: expecteBuildActionXml.cleaned, + childName: "BuildAction", + attributes: [ + "parallelizeBuildables": "YES", + "runPostActionsOnFailure": "YES", + "buildImplicitDependencies": "NO", + ] + ) } func test_BuildAction_attributes_sorted_when_original_unsorted() { - validateAttributes(attributes: [ - "buildImplicitDependencies": "NO", - "parallelizeBuildables": "YES", - "runPostActionsOnFailure": "YES", - ]) + validateAttributes( + expectedXML: expecteBuildActionXml.cleaned, + childName: "BuildAction", + attributes: [ + "buildImplicitDependencies": "NO", + "parallelizeBuildables": "YES", + "runPostActionsOnFailure": "YES", + ] + ) + } + + func test_LaunchAction_attributes_sorted_when_original_sorted() { + validateAttributes( + expectedXML: expectedLaunchActionXml.cleaned, + childName: "LaunchAction", + attributes: [ + "buildConfiguration": "Debug", + "selectedLauncherIdentifier": "Xcode.DebuggerFoundation.Launcher.LLDB", + "customLLDBInitFile": "$(BAZEL_LLDB_INIT)", + "launchStyle": "0", + "allowLocationSimulation": "YES" + ] + ) + } + + func test_LaunchAction_attributes_sorted_when_original_unsorted() { + validateAttributes( + expectedXML: expectedLaunchActionXml.cleaned, + childName: "LaunchAction", + attributes: [ + "customLLDBInitFile": "$(BAZEL_LLDB_INIT)", + "allowLocationSimulation": "YES", + "buildConfiguration": "Debug", + "selectedLauncherIdentifier": "Xcode.DebuggerFoundation.Launcher.LLDB", + "launchStyle": "0", + ] + ) } - func validateAttributes(attributes: [String: String], line: UInt = #line) { + func validateAttributes( + expectedXML: String, + childName: String, + attributes: [String: String], + line: UInt = #line + ) { let document = AEXMLDocument() - let child = document.addChild(name: "BuildAction") + let child = document.addChild(name: childName) child.attributes = attributes let result = document.xmlXcodeFormat - XCTAssertEqual(expectedXml.cleaned, result.cleaned, line: line) + XCTAssertEqual(expectedXML, result.cleaned, line: line) } } From e9803042c11e3607c2eb09ca9a1c164c3c0192f8 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Fri, 3 Jun 2022 13:23:42 -0700 Subject: [PATCH 089/143] spelling --- .../XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift index d16b61974..37d9fa17c 100644 --- a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift +++ b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift @@ -10,7 +10,7 @@ extension String { } class AEXML_XcodeFormatTests: XCTestCase { - private let expecteBuildActionXml = + private let expectedBuildActionXml = """ Date: Fri, 10 Jun 2022 22:27:15 -0700 Subject: [PATCH 090/143] Update Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift Co-authored-by: Daniele Formichelli --- Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift index 37d9fa17c..cb4ea0284 100644 --- a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift +++ b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift @@ -94,6 +94,6 @@ class AEXML_XcodeFormatTests: XCTestCase { let child = document.addChild(name: childName) child.attributes = attributes let result = document.xmlXcodeFormat - XCTAssertEqual(expectedXML, result.cleaned, line: line) + XCTAssertEqual(result.cleaned, expectedXML, line: line) } } From 4dccbc03047c1b82bb2091ac29df671d4d4994b8 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Thu, 16 Jun 2022 12:02:24 -0700 Subject: [PATCH 091/143] Fix TestAction scheme attribute ordering (#689) - The `customLLDBInitFile` attribute is now ordered correctly within the scheme's `TestAction` - This can be verified by manually adding a custom lldb init to a scheme's test action and inspecting the `.xcscheme` file --- .../Extensions/AEXML+XcodeFormat.swift | 1 + .../Extensions/AEXML+XcodeFormatTests.swift | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift index aa1161f3d..6ac2cbc08 100644 --- a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift +++ b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift @@ -33,6 +33,7 @@ let attributesOrder: [String: [String]] = [ "buildConfiguration", "selectedDebuggerIdentifier", "selectedLauncherIdentifier", + "customLLDBInitFile", "language", "region", "codeCoverageEnabled", diff --git a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift index cb4ea0284..c7abde562 100644 --- a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift +++ b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift @@ -32,6 +32,17 @@ class AEXML_XcodeFormatTests: XCTestCase { """ + private let expectedTestActionXml = + """ + + + + """ + func test_BuildAction_attributes_sorted_when_original_sorted() { validateAttributes( expectedXML: expectedBuildActionXml.cleaned, @@ -84,6 +95,32 @@ class AEXML_XcodeFormatTests: XCTestCase { ) } + func test_TestAction_attributes_sorted_when_original_sorted() { + validateAttributes( + expectedXML: expectedTestActionXml.cleaned, + childName: "TestAction", + attributes: [ + "buildConfiguration": "Debug", + "customLLDBInitFile": "$(BAZEL_LLDB_INIT)", + "selectedLauncherIdentifier": "Xcode.DebuggerFoundation.Launcher.LLDB", + "shouldUseLaunchSchemeArgsEnv": "YES" + ] + ) + } + + func test_TestAction_attributes_sorted_when_original_unsorted() { + validateAttributes( + expectedXML: expectedTestActionXml.cleaned, + childName: "TestAction", + attributes: [ + "shouldUseLaunchSchemeArgsEnv": "YES", + "buildConfiguration": "Debug", + "customLLDBInitFile": "$(BAZEL_LLDB_INIT)", + "selectedLauncherIdentifier": "Xcode.DebuggerFoundation.Launcher.LLDB" + ] + ) + } + func validateAttributes( expectedXML: String, childName: String, From de6f72269fe04274e6aac6dc4a4740dfa9a33f50 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 25 Jun 2022 15:33:45 +0200 Subject: [PATCH 092/143] docs: add mtj0928 as a contributor for code (#692) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index c0351ffdc..2c7ab1b24 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -166,6 +166,15 @@ "contributions": [ "code" ] + }, + { + "login": "mtj0928", + "name": "matsuji", + "avatar_url": "https://avatars.githubusercontent.com/u/12427733?v=4", + "profile": "https://github.com/mtj0928", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 72831c173..26d7647eb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-18-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-19-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -176,6 +176,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Kristopher Jackson

πŸ’»
Jake Prickett

πŸ’»
Jake Adams

πŸ’» +
matsuji

πŸ’» From 2fe19ca7d99a92e95bbbe95e6aa60f7b26860b66 Mon Sep 17 00:00:00 2001 From: matsuji Date: Wed, 29 Jun 2022 15:44:51 +0900 Subject: [PATCH 093/143] Add `.extensionKitExtension` as the new `PBXProductType` (#691) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: https://github.com/tuist/XcodeProj/issues/687 ### Short description πŸ“ From Xcode14 beta 1, `com.apple.product-type.extensionkit-extension` was introduced as the new productType. The new productType is used for a new app extension like AppIntents Extension. ### Solution πŸ“¦ Added `.extensionKitExtension` as the new case of `PBXProductType` in this PR, to support the new productType. ### Implementation πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» - [x] Added `.extensionKitExtension` as the new case of `PBXProductType` - [x] Added `fileExtension` of `.extensionKitExtension` - [x] Added a new UnitTest for `.extensionKitExtension` --- Sources/XcodeProj/Objects/Targets/PBXProductType.swift | 4 +++- .../XcodeProjTests/Objects/Targets/PBXProductTypeTests.swift | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/XcodeProj/Objects/Targets/PBXProductType.swift b/Sources/XcodeProj/Objects/Targets/PBXProductType.swift index 7ec12ffb1..21dbf8b78 100644 --- a/Sources/XcodeProj/Objects/Targets/PBXProductType.swift +++ b/Sources/XcodeProj/Objects/Targets/PBXProductType.swift @@ -12,6 +12,7 @@ public enum PBXProductType: String, Decodable { case unitTestBundle = "com.apple.product-type.bundle.unit-test" case uiTestBundle = "com.apple.product-type.bundle.ui-testing" case appExtension = "com.apple.product-type.app-extension" + case extensionKitExtension = "com.apple.product-type.extensionkit-extension" case commandLineTool = "com.apple.product-type.tool" case watchApp = "com.apple.product-type.application.watchapp" case watch2App = "com.apple.product-type.application.watchapp2" @@ -47,7 +48,8 @@ public enum PBXProductType: String, Decodable { return "bundle" case .unitTestBundle, .uiTestBundle: return "xctest" - case .appExtension, .tvExtension, .watchExtension, .watch2Extension, .messagesExtension, .stickerPack, .xcodeExtension, .intentsServiceExtension: + case .appExtension, .extensionKitExtension, .tvExtension, .watchExtension, .watch2Extension, .messagesExtension, .stickerPack, .xcodeExtension, + .intentsServiceExtension: return "appex" case .commandLineTool: return nil diff --git a/Tests/XcodeProjTests/Objects/Targets/PBXProductTypeTests.swift b/Tests/XcodeProjTests/Objects/Targets/PBXProductTypeTests.swift index f0c62e312..83d62f3d0 100644 --- a/Tests/XcodeProjTests/Objects/Targets/PBXProductTypeTests.swift +++ b/Tests/XcodeProjTests/Objects/Targets/PBXProductTypeTests.swift @@ -39,6 +39,10 @@ final class PBXProductTypeTests: XCTestCase { XCTAssertEqual(PBXProductType.appExtension.rawValue, "com.apple.product-type.app-extension") } + func test_extensionKitExtension_hasTheRightValue() { + XCTAssertEqual(PBXProductType.extensionKitExtension.rawValue, "com.apple.product-type.extensionkit-extension") + } + func test_commandLineTool_hasTheRightValue() { XCTAssertEqual(PBXProductType.commandLineTool.rawValue, "com.apple.product-type.tool") } From e02240fd29933c9fd24db9859659f44f4f45b3f2 Mon Sep 17 00:00:00 2001 From: Bogdan Belogurov Date: Thu, 30 Jun 2022 11:01:18 +0300 Subject: [PATCH 094/143] Add disablePerformanceAntipatternChecker to scheme (#694) * Add disablePerformanceAntipatternChecker to LaunchAction * Cover with tests disablePerformanceAntipatternChecker action * Update CHANGELOG.md - Add entry about adding `disablePerformanceAntipatternChecker` action --- CHANGELOG.md | 4 ++++ Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift | 8 ++++++++ Tests/XcodeProjTests/Scheme/XCSchemeTests.swift | 3 +++ 3 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3ec3b4b1..22d25cbae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Next +### Added + +- Added `disablePerformanceAntipatternChecker` to `XCScheme` [#693](https://github.com/tuist/XcodeProj/pull/603) by [@Bogdan-Belogurov](https://github.com/Bogdan-Belogurov) + ## 8.7.1 ### Changed diff --git a/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift b/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift index 28f794df5..10e2ca44a 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift @@ -57,6 +57,7 @@ extension XCScheme { public var enableUBSanitizer: Bool public var stopOnEveryUBSanitizerIssue: Bool public var disableMainThreadChecker: Bool + public var disablePerformanceAntipatternChecker: Bool public var stopOnEveryMainThreadCheckerIssue: Bool public var additionalOptions: [AdditionalOption] public var commandlineArguments: CommandLineArguments? @@ -96,6 +97,7 @@ extension XCScheme { enableUBSanitizer: Bool = false, stopOnEveryUBSanitizerIssue: Bool = false, disableMainThreadChecker: Bool = false, + disablePerformanceAntipatternChecker: Bool = false, stopOnEveryMainThreadCheckerIssue: Bool = false, additionalOptions: [AdditionalOption] = [], commandlineArguments: CommandLineArguments? = nil, @@ -129,6 +131,7 @@ extension XCScheme { self.enableUBSanitizer = enableUBSanitizer self.stopOnEveryUBSanitizerIssue = stopOnEveryUBSanitizerIssue self.disableMainThreadChecker = disableMainThreadChecker + self.disablePerformanceAntipatternChecker = disablePerformanceAntipatternChecker self.stopOnEveryMainThreadCheckerIssue = stopOnEveryMainThreadCheckerIssue self.additionalOptions = additionalOptions self.commandlineArguments = commandlineArguments @@ -191,6 +194,7 @@ extension XCScheme { enableUBSanitizer = element.attributes["enableUBSanitizer"] == "YES" stopOnEveryUBSanitizerIssue = element.attributes["stopOnEveryUBSanitizerIssue"] == "YES" disableMainThreadChecker = element.attributes["disableMainThreadChecker"] == "YES" + disablePerformanceAntipatternChecker = element.attributes["disablePerformanceAntipatternChecker"] == "YES" stopOnEveryMainThreadCheckerIssue = element.attributes["stopOnEveryMainThreadCheckerIssue"] == "YES" additionalOptions = try element["AdditionalOptions"]["AdditionalOption"] @@ -267,6 +271,9 @@ extension XCScheme { if disableMainThreadChecker { attributes["disableMainThreadChecker"] = disableMainThreadChecker.xmlString } + if disablePerformanceAntipatternChecker { + attributes["disablePerformanceAntipatternChecker"] = disablePerformanceAntipatternChecker.xmlString + } if stopOnEveryMainThreadCheckerIssue { attributes["stopOnEveryMainThreadCheckerIssue"] = stopOnEveryMainThreadCheckerIssue.xmlString } @@ -365,6 +372,7 @@ extension XCScheme { enableUBSanitizer == rhs.enableUBSanitizer && stopOnEveryUBSanitizerIssue == rhs.stopOnEveryUBSanitizerIssue && disableMainThreadChecker == rhs.disableMainThreadChecker && + disablePerformanceAntipatternChecker == rhs.disablePerformanceAntipatternChecker && stopOnEveryMainThreadCheckerIssue == rhs.stopOnEveryMainThreadCheckerIssue && additionalOptions == rhs.additionalOptions && commandlineArguments == rhs.commandlineArguments && diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift index 98fcc5190..f3eb64681 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift @@ -460,6 +460,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.launchAction?.enableUBSanitizer, false) XCTAssertEqual(scheme.launchAction?.stopOnEveryUBSanitizerIssue, false) XCTAssertEqual(scheme.launchAction?.disableMainThreadChecker, false) + XCTAssertEqual(scheme.launchAction?.disablePerformanceAntipatternChecker, false) XCTAssertEqual(scheme.launchAction?.stopOnEveryMainThreadCheckerIssue, false) XCTAssertEqual(scheme.launchAction?.additionalOptions.isEmpty, true) @@ -544,6 +545,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.launchAction?.enableUBSanitizer, false) XCTAssertEqual(scheme.launchAction?.stopOnEveryUBSanitizerIssue, false) XCTAssertEqual(scheme.launchAction?.disableMainThreadChecker, false) + XCTAssertEqual(scheme.launchAction?.disablePerformanceAntipatternChecker, false) XCTAssertEqual(scheme.launchAction?.stopOnEveryMainThreadCheckerIssue, false) XCTAssertEqual(scheme.launchAction?.additionalOptions.isEmpty, true) XCTAssertNil(scheme.launchAction?.storeKitConfigurationFileReference) @@ -636,6 +638,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.launchAction?.enableUBSanitizer, false) XCTAssertEqual(scheme.launchAction?.stopOnEveryUBSanitizerIssue, false) XCTAssertEqual(scheme.launchAction?.disableMainThreadChecker, false) + XCTAssertEqual(scheme.launchAction?.disablePerformanceAntipatternChecker, false) XCTAssertEqual(scheme.launchAction?.stopOnEveryMainThreadCheckerIssue, false) XCTAssertEqual(scheme.launchAction?.additionalOptions.isEmpty, true) XCTAssertNil(scheme.launchAction?.storeKitConfigurationFileReference) From 6b61781a5a96731a4051c59ed9c3b5a5566c77e9 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 30 Jun 2022 11:15:54 +0200 Subject: [PATCH 095/143] docs: add Bogdan-Belogurov as a contributor for code (#695) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 2c7ab1b24..971a24924 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -175,6 +175,15 @@ "contributions": [ "code" ] + }, + { + "login": "Bogdan-Belogurov", + "name": "Bogdan Belogurov", + "avatar_url": "https://avatars.githubusercontent.com/u/39379705?v=4", + "profile": "https://github.com/Bogdan-Belogurov", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 26d7647eb..890fe4647 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-19-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -177,6 +177,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Jake Prickett

πŸ’»
Jake Adams

πŸ’»
matsuji

πŸ’» +
Bogdan Belogurov

πŸ’» From 2fa16ab94fe8f615f21eb926f22d22b6194bebc6 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Thu, 7 Jul 2022 07:36:46 -0400 Subject: [PATCH 096/143] Fix `Testables` element ordering (#702) --- Sources/XcodeProj/Scheme/XCScheme+TestAction.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Sources/XcodeProj/Scheme/XCScheme+TestAction.swift b/Sources/XcodeProj/Scheme/XCScheme+TestAction.swift index 7c2d0cc47..d95caeb15 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+TestAction.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+TestAction.swift @@ -194,15 +194,16 @@ extension XCScheme { } } - let testablesElement = element.addChild(name: "Testables") - testables.forEach { testable in - testablesElement.addChild(testable.xmlElement()) - } if let macroExpansion = macroExpansion { let macro = element.addChild(name: "MacroExpansion") macro.addChild(macroExpansion.xmlElement()) } + let testablesElement = element.addChild(name: "Testables") + testables.forEach { testable in + testablesElement.addChild(testable.xmlElement()) + } + if let commandlineArguments = commandlineArguments { element.addChild(commandlineArguments.xmlElement()) } From b952b2e5d6488259ddbf70c4ff5a7a3d670a02d6 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Thu, 7 Jul 2022 07:36:58 -0400 Subject: [PATCH 097/143] Fix `RemoteRunnable` scheme attr order (#701) --- .../Extensions/AEXML+XcodeFormat.swift | 5 +++++ .../Extensions/AEXML+XcodeFormatTests.swift | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift index 6ac2cbc08..c9c04f8c2 100644 --- a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift +++ b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift @@ -92,6 +92,11 @@ let attributesOrder: [String: [String]] = [ "symbolName", "moduleName", ], + "RemoteRunnable": [ + "runnableDebuggingMode", + "BundleIdentifier", + "RemotePath" + ] ] extension AEXMLElement { diff --git a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift index c7abde562..638f4ffc9 100644 --- a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift +++ b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift @@ -43,6 +43,16 @@ class AEXML_XcodeFormatTests: XCTestCase { """ + private let expectedRemoteRunnableXml = + """ + + + + """ + func test_BuildAction_attributes_sorted_when_original_sorted() { validateAttributes( expectedXML: expectedBuildActionXml.cleaned, @@ -121,6 +131,18 @@ class AEXML_XcodeFormatTests: XCTestCase { ) } + func test_RemoteRunnable() { + validateAttributes( + expectedXML: expectedRemoteRunnableXml.cleaned, + childName: "RemoteRunnable", + attributes: [ + "BundleIdentifier": "BundleID", + "RemotePath": "REMOTE_PATH", + "runnableDebuggingMode": "2" + ] + ) + } + func validateAttributes( expectedXML: String, childName: String, From cb1a9683794492846293e5da2b7837e02b83ced2 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Thu, 7 Jul 2022 07:37:10 -0400 Subject: [PATCH 098/143] Missing `askForAppToLaunch` in `ProfileAction` (#700) --- Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme | 1 + Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift | 3 +++ Tests/XcodeProjTests/Scheme/XCSchemeTests.swift | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme b/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme index 669fdba94..600c7822a 100644 --- a/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme +++ b/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme @@ -72,6 +72,7 @@
Date: Thu, 7 Jul 2022 07:37:21 -0400 Subject: [PATCH 099/143] Add `launchAutomaticallySubstyle`->`ProfileAction` (#699) --- .../RunnableWithoutBuildableReference.xcscheme | 3 ++- .../XcodeProj/Scheme/XCScheme+ProfileAction.swift | 12 ++++++++++-- Tests/XcodeProjTests/Scheme/XCSchemeTests.swift | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme b/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme index 600c7822a..3849dcb0d 100644 --- a/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme +++ b/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme @@ -77,7 +77,8 @@ shouldUseLaunchSchemeArgsEnv = "YES" savedToolIdentifier = "" useCustomWorkingDirectory = "NO" - debugDocumentVersioning = "YES"> + debugDocumentVersioning = "YES" + launchAutomaticallySubstyle = "2"> Date: Sat, 9 Jul 2022 04:22:24 -0400 Subject: [PATCH 100/143] Fix ordering of Scheme toplevel attrs (#698) - Fix for incorrect ordering of `Scheme` attrs when using `wasCreatedForAppExtension` value --- .../Extensions/AEXML+XcodeFormat.swift | 5 +++ .../Extensions/AEXML+XcodeFormatTests.swift | 34 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift index c9c04f8c2..e51edd75c 100644 --- a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift +++ b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift @@ -96,6 +96,11 @@ let attributesOrder: [String: [String]] = [ "runnableDebuggingMode", "BundleIdentifier", "RemotePath" + ], + "Scheme": [ + "LastUpgradeVersion", + "wasCreatedForAppExtension", + "version" ] ] diff --git a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift index 638f4ffc9..7c86759fd 100644 --- a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift +++ b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift @@ -43,6 +43,16 @@ class AEXML_XcodeFormatTests: XCTestCase { """ + private let expectedSchemeXml = + """ + + + + """ + private let expectedRemoteRunnableXml = """ @@ -131,6 +141,30 @@ class AEXML_XcodeFormatTests: XCTestCase { ) } + func test_Scheme_attributes_sorted_when_original_sorted() { + validateAttributes( + expectedXML: expectedSchemeXml.cleaned, + childName: "Scheme", + attributes: [ + "LastUpgradeVersion": "1320", + "wasCreatedForAppExtension": "YES", + "version": "1.7" + ] + ) + } + + func test_Scheme_attributes_sorted_when_original_unsorted() { + validateAttributes( + expectedXML: expectedSchemeXml.cleaned, + childName: "Scheme", + attributes: [ + "wasCreatedForAppExtension": "YES", + "LastUpgradeVersion": "1320", + "version": "1.7" + ] + ) + } + func test_RemoteRunnable() { validateAttributes( expectedXML: expectedRemoteRunnableXml.cleaned, From 59779d24b3423d31cbd21a9d8ee18ad70cbe292b Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Sat, 9 Jul 2022 04:40:42 -0400 Subject: [PATCH 101/143] Use `Runnable` in `ProfileAction` (#703) - This is needed to support application extension schemes (like WidgetKit Extensions) - This matches the behavior of `LaunchAction` by accepting the more abstract `Runnable` type - To avoid breaking changes, conveinece init and public properties were added that proxy `buildableProductRunnable` to `runnable` --- .../Scheme/XCScheme+ProfileAction.swift | 60 ++++++++++++++++--- .../XcodeProjTests/Scheme/XCSchemeTests.swift | 42 ++++++------- 2 files changed, 73 insertions(+), 29 deletions(-) diff --git a/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift b/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift index fe2cd3137..c96a5d023 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift @@ -10,7 +10,11 @@ extension XCScheme { // MARK: - Attributes - public var buildableProductRunnable: BuildableProductRunnable? + public var runnable: Runnable? + public var buildableProductRunnable: BuildableProductRunnable? { + // For backwards compatibility - can be removed in the next major version + runnable as? BuildableProductRunnable + } public var buildConfiguration: String public var shouldUseLaunchSchemeArgsEnv: Bool public var savedToolIdentifier: String @@ -26,7 +30,7 @@ extension XCScheme { // MARK: - Init - public init(buildableProductRunnable: BuildableProductRunnable?, + public init(runnable: Runnable?, buildConfiguration: String, preActions: [ExecutionAction] = [], postActions: [ExecutionAction] = [], @@ -41,7 +45,7 @@ extension XCScheme { environmentVariables: [EnvironmentVariable]? = nil, enableTestabilityWhenProfilingTests: Bool = true, launchAutomaticallySubstyle: String? = nil) { - self.buildableProductRunnable = buildableProductRunnable + self.runnable = runnable self.buildConfiguration = buildConfiguration self.macroExpansion = macroExpansion self.shouldUseLaunchSchemeArgsEnv = shouldUseLaunchSchemeArgsEnv @@ -57,6 +61,41 @@ extension XCScheme { super.init(preActions, postActions) } + public convenience init( + buildableProductRunnable: Runnable?, + buildConfiguration: String, + preActions: [ExecutionAction] = [], + postActions: [ExecutionAction] = [], + macroExpansion: BuildableReference? = nil, + shouldUseLaunchSchemeArgsEnv: Bool = true, + savedToolIdentifier: String = "", + ignoresPersistentStateOnLaunch: Bool = false, + useCustomWorkingDirectory: Bool = false, + debugDocumentVersioning: Bool = true, + askForAppToLaunch: Bool? = nil, + commandlineArguments: CommandLineArguments? = nil, + environmentVariables: [EnvironmentVariable]? = nil, + enableTestabilityWhenProfilingTests: Bool = true, + launchAutomaticallySubstyle: String? = nil) + { + self.init( + runnable: buildableProductRunnable, + buildConfiguration: buildConfiguration, + preActions: preActions, + postActions: postActions, + macroExpansion: macroExpansion, + shouldUseLaunchSchemeArgsEnv: shouldUseLaunchSchemeArgsEnv, + savedToolIdentifier: savedToolIdentifier, + ignoresPersistentStateOnLaunch: ignoresPersistentStateOnLaunch, + useCustomWorkingDirectory: useCustomWorkingDirectory, + debugDocumentVersioning: debugDocumentVersioning, + askForAppToLaunch: askForAppToLaunch, + commandlineArguments: commandlineArguments, + environmentVariables: environmentVariables, + enableTestabilityWhenProfilingTests: enableTestabilityWhenProfilingTests, + launchAutomaticallySubstyle: launchAutomaticallySubstyle) + } + override init(element: AEXMLElement) throws { buildConfiguration = element.attributes["buildConfiguration"] ?? ProfileAction.defaultBuildConfiguration shouldUseLaunchSchemeArgsEnv = element.attributes["shouldUseLaunchSchemeArgsEnv"].map { $0 == "YES" } ?? true @@ -66,10 +105,15 @@ extension XCScheme { askForAppToLaunch = element.attributes["askForAppToLaunch"].map { $0 == "YES" || $0 == "Yes" } ignoresPersistentStateOnLaunch = element.attributes["ignoresPersistentStateOnLaunch"].map { $0 == "YES" } ?? false + // Runnable let buildableProductRunnableElement = element["BuildableProductRunnable"] + let remoteRunnableElement = element["RemoteRunnable"] if buildableProductRunnableElement.error == nil { - buildableProductRunnable = try BuildableProductRunnable(element: buildableProductRunnableElement) + runnable = try BuildableProductRunnable(element: buildableProductRunnableElement) + } else if remoteRunnableElement.error == nil { + runnable = try RemoteRunnable(element: remoteRunnableElement) } + let buildableReferenceElement = element["MacroExpansion"]["BuildableReference"] if buildableReferenceElement.error == nil { macroExpansion = try BuildableReference(element: buildableReferenceElement) @@ -100,6 +144,9 @@ extension XCScheme { "debugDocumentVersioning": debugDocumentVersioning.xmlString, ]) super.writeXML(parent: element) + if let runnable = runnable { + element.addChild(runnable.xmlElement()) + } if let askForAppToLaunch = askForAppToLaunch { element.attributes["askForAppToLaunch"] = askForAppToLaunch.xmlString } @@ -109,9 +156,6 @@ extension XCScheme { if !enableTestabilityWhenProfilingTests { element.attributes["enableTestabilityWhenProfilingTests"] = "No" } - if let buildableProductRunnable = buildableProductRunnable { - element.addChild(buildableProductRunnable.xmlElement()) - } if let commandlineArguments = commandlineArguments { element.addChild(commandlineArguments.xmlElement()) } @@ -135,7 +179,7 @@ extension XCScheme { override func isEqual(to: Any?) -> Bool { guard let rhs = to as? ProfileAction else { return false } return super.isEqual(to: to) && - buildableProductRunnable == rhs.buildableProductRunnable && + runnable == rhs.runnable && buildConfiguration == rhs.buildConfiguration && shouldUseLaunchSchemeArgsEnv == rhs.shouldUseLaunchSchemeArgsEnv && savedToolIdentifier == rhs.savedToolIdentifier && diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift index 9d232a010..2ec14710c 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift @@ -15,7 +15,7 @@ final class XCSchemeIntegrationTests: XCTestCase { modify: { $0 }, assertion: { assert(scheme: $1) }) } - + func test_read_runnableWithoutBuildableReferenceScheme() { let subject = try? XCScheme(path: runnableWithoutBuildableReferenceSchemePath) @@ -24,7 +24,7 @@ final class XCSchemeIntegrationTests: XCTestCase { assert(runnableWithoutBuildableReferenceScheme: subject) } } - + func test_remoteRunnable_runnableWithoutBuildableReferenceScheme() throws { // Given / When let subject = try XCScheme(path: runnableWithoutBuildableReferenceSchemePath) @@ -36,7 +36,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(remoteRunnable.runnableDebuggingMode, "1") XCTAssertEqual(remoteRunnable.remotePath, "/var/containers/Bundle/Application/018F0933-05E8-4359-9955-39E0523C4246/Ava.app") } - + func test_write_runnableWithoutBuildableReferenceScheme() { testWrite(from: runnableWithoutBuildableReferenceSchemePath, initModel: { try? XCScheme(path: $0) }, @@ -285,7 +285,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertNotNil(buildableXML.attributes["BlueprintName"]) XCTAssertNil(buildableXML.attributes["BlueprintIdentifier"]) } - + func test_buildAction_runPostActionsOnFailure() throws { // Given / When let subject = try XCScheme(path: runPostActionsOnFailureSchemePath) @@ -399,12 +399,12 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.profileAction?.useCustomWorkingDirectory, false) XCTAssertEqual(scheme.profileAction?.debugDocumentVersioning, true) XCTAssertNil(scheme.profileAction?.askForAppToLaunch) - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.runnableDebuggingMode, "0") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.buildableIdentifier, "primary") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.blueprintIdentifier, "23766C111EAA3484007A9026") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.buildableName, "iOS.app") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.blueprintName, "iOS") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.referencedContainer, "container:Project.xcodeproj") + XCTAssertEqual(scheme.profileAction?.runnable?.runnableDebuggingMode, "0") + XCTAssertEqual(scheme.profileAction?.runnable?.buildableReference?.buildableIdentifier, "primary") + XCTAssertEqual(scheme.profileAction?.runnable?.buildableReference?.blueprintIdentifier, "23766C111EAA3484007A9026") + XCTAssertEqual(scheme.profileAction?.runnable?.buildableReference?.buildableName, "iOS.app") + XCTAssertEqual(scheme.profileAction?.runnable?.buildableReference?.blueprintName, "iOS") + XCTAssertEqual(scheme.profileAction?.runnable?.buildableReference?.referencedContainer, "container:Project.xcodeproj") XCTAssertEqual(scheme.profileAction?.preActions.isEmpty, true) XCTAssertEqual(scheme.profileAction?.postActions.first?.title, "Run Script") XCTAssertEqual(scheme.profileAction?.postActions.first?.scriptText, "echo analysis done") @@ -476,7 +476,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertTrue(launchCLIArgs.arguments[0].enabled) XCTAssertNil(scheme.launchAction?.customLLDBInitFile) } - + private func assert(runnableWithoutBuildableReferenceScheme scheme: XCScheme) { XCTAssertEqual(scheme.version, "2.0") XCTAssertEqual(scheme.lastUpgradeVersion, "1230", "\(scheme.lastUpgradeVersion!) not equals 1230") @@ -496,7 +496,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.buildAction?.buildActionEntries[0].buildableReference.buildableName, "Ava.app") XCTAssertEqual(scheme.buildAction?.buildActionEntries[0].buildableReference.blueprintName, "core-ava") XCTAssertEqual(scheme.buildAction?.buildActionEntries[0].buildableReference.referencedContainer, "container:core-ava.xcodeproj") - + XCTAssertTrue(scheme.buildAction?.buildActionEntries[1].buildFor.contains(.testing) == true) XCTAssertTrue(scheme.buildAction?.buildActionEntries[1].buildFor.contains(.running) == false) XCTAssertTrue(scheme.buildAction?.buildActionEntries[1].buildFor.contains(.profiling) == false) @@ -555,14 +555,14 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.launchAction?.macroExpansion?.blueprintName, "core-ava") XCTAssertEqual(scheme.launchAction?.macroExpansion?.referencedContainer, "container:core-ava.xcodeproj") XCTAssertNil(scheme.launchAction?.environmentVariables) - + // Profile action - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.runnableDebuggingMode, "0") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.blueprintIdentifier, "FE7C11D21B6DB70D0041DF02") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.buildableIdentifier, "primary") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.blueprintName, "core-ava") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.buildableName, "Ava.app") - XCTAssertEqual(scheme.profileAction?.buildableProductRunnable?.buildableReference?.referencedContainer, "container:core-ava.xcodeproj") + XCTAssertEqual(scheme.profileAction?.runnable?.runnableDebuggingMode, "0") + XCTAssertEqual(scheme.profileAction?.runnable?.buildableReference?.blueprintIdentifier, "FE7C11D21B6DB70D0041DF02") + XCTAssertEqual(scheme.profileAction?.runnable?.buildableReference?.buildableIdentifier, "primary") + XCTAssertEqual(scheme.profileAction?.runnable?.buildableReference?.blueprintName, "core-ava") + XCTAssertEqual(scheme.profileAction?.runnable?.buildableReference?.buildableName, "Ava.app") + XCTAssertEqual(scheme.profileAction?.runnable?.buildableReference?.referencedContainer, "container:core-ava.xcodeproj") XCTAssertEqual(scheme.profileAction?.buildConfiguration, "Release") XCTAssertTrue(scheme.profileAction?.shouldUseLaunchSchemeArgsEnv == true) XCTAssertEqual(scheme.profileAction?.savedToolIdentifier, "") @@ -651,7 +651,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertTrue(launchEnvironmentVariables[0].enabled) // Profile action - XCTAssertNil(scheme.profileAction?.buildableProductRunnable) + XCTAssertNil(scheme.profileAction?.runnable) XCTAssertEqual(scheme.profileAction?.buildConfiguration, "Release") XCTAssertTrue(scheme.profileAction?.shouldUseLaunchSchemeArgsEnv == true) XCTAssertEqual(scheme.profileAction?.savedToolIdentifier, "") @@ -692,7 +692,7 @@ final class XCSchemeIntegrationTests: XCTestCase { // but minimal in the sense it doesn't have most of the standard elements and attributes. fixturesPath() + "Schemes/MinimalInformation.xcscheme" } - + private var runnableWithoutBuildableReferenceSchemePath: Path { fixturesPath() + "Schemes/RunnableWithoutBuildableReference.xcscheme" } From d8f4b0619c0260f3447f375cba3d5bd67f021314 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Sat, 9 Jul 2022 05:26:36 -0400 Subject: [PATCH 102/143] Fix order for `askForAppToLaunch` attr (#705) --- Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift | 1 + Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift index e51edd75c..837d3ef7b 100644 --- a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift +++ b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift @@ -48,6 +48,7 @@ let attributesOrder: [String: [String]] = [ "language", "region", "launchStyle", + "askForAppToLaunch", "useCustomWorkingDirectory", "ignoresPersistentStateOnLaunch", "debugDocumentVersioning", diff --git a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift index 7c86759fd..b9d369e96 100644 --- a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift +++ b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift @@ -28,6 +28,7 @@ class AEXML_XcodeFormatTests: XCTestCase { selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" customLLDBInitFile = "$(BAZEL_LLDB_INIT)" launchStyle = "0" + askForAppToLaunch = "YES" allowLocationSimulation = "YES"> """ @@ -96,6 +97,7 @@ class AEXML_XcodeFormatTests: XCTestCase { "selectedLauncherIdentifier": "Xcode.DebuggerFoundation.Launcher.LLDB", "customLLDBInitFile": "$(BAZEL_LLDB_INIT)", "launchStyle": "0", + "askForAppToLaunch": "YES", "allowLocationSimulation": "YES" ] ) @@ -111,6 +113,7 @@ class AEXML_XcodeFormatTests: XCTestCase { "buildConfiguration": "Debug", "selectedLauncherIdentifier": "Xcode.DebuggerFoundation.Launcher.LLDB", "launchStyle": "0", + "askForAppToLaunch": "YES" ] ) } From 490057ab6f8a29559648ad04d743900ac5cf234e Mon Sep 17 00:00:00 2001 From: Kas Date: Wed, 13 Jul 2022 21:12:39 +0100 Subject: [PATCH 103/143] Add `DEAD_CODE_STRIPPING` default project setting (#706) - As of Xcode 14, `DEAD_CODE_STRIPPING` is now a recommended setting for macOS or iOS with catalyst projects and targets - iOS already had `DEAD_CODE_STRIPPING` enabled as a default in prior Xcode versions, so explicitly setting shouldn't cause a change in behaviour https://github.com/tuist/tuist/discussions/4531 --- Sources/XcodeProj/Utils/BuildSettingsProvider.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/XcodeProj/Utils/BuildSettingsProvider.swift b/Sources/XcodeProj/Utils/BuildSettingsProvider.swift index b8c5514b6..ebafcf367 100644 --- a/Sources/XcodeProj/Utils/BuildSettingsProvider.swift +++ b/Sources/XcodeProj/Utils/BuildSettingsProvider.swift @@ -128,6 +128,7 @@ public class BuildSettingsProvider { "CLANG_WARN_UNGUARDED_AVAILABILITY": "YES_AGGRESSIVE", "CLANG_WARN_UNREACHABLE_CODE": "YES", "COPY_PHASE_STRIP": "NO", + "DEAD_CODE_STRIPPING": "YES", "ENABLE_STRICT_OBJC_MSGSEND": "YES", "GCC_C_LANGUAGE_STANDARD": "gnu11", "GCC_NO_COMMON_BLOCKS": "YES", From 099c64c7595541f62ec39b8749cff3ffe3088fdd Mon Sep 17 00:00:00 2001 From: Kas Date: Thu, 14 Jul 2022 07:57:05 +0100 Subject: [PATCH 104/143] Fix ordering of diagnostics scheme options (#704) - The ordering for the runtime checker (main thread, thread performance) were incorrect - This aligns the order with the order created by Xcode Test Plan: - Verify order matches that created by Xcode e.g. ```xml ``` --- .../XcodeProj/Extensions/AEXML+XcodeFormat.swift | 5 ++++- .../Extensions/AEXML+XcodeFormatTests.swift | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift index 837d3ef7b..3a0ab2ec2 100644 --- a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift +++ b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift @@ -35,16 +35,19 @@ let attributesOrder: [String: [String]] = [ "selectedLauncherIdentifier", "customLLDBInitFile", "language", + "shouldUseLaunchSchemeArgsEnv", + "disableMainThreadChecker", "region", "codeCoverageEnabled", "onlyGenerateCoverageForSpecifiedTargets", - "shouldUseLaunchSchemeArgsEnv", ], "LaunchAction": [ "buildConfiguration", "selectedDebuggerIdentifier", "selectedLauncherIdentifier", "customLLDBInitFile", + "disableMainThreadChecker", + "disablePerformanceAntipatternChecker", "language", "region", "launchStyle", diff --git a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift index b9d369e96..d56389809 100644 --- a/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift +++ b/Tests/XcodeProjTests/Extensions/AEXML+XcodeFormatTests.swift @@ -27,6 +27,8 @@ class AEXML_XcodeFormatTests: XCTestCase { buildConfiguration = "Debug" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" customLLDBInitFile = "$(BAZEL_LLDB_INIT)" + disableMainThreadChecker = "YES" + disablePerformanceAntipatternChecker = "YES" launchStyle = "0" askForAppToLaunch = "YES" allowLocationSimulation = "YES"> @@ -40,7 +42,8 @@ class AEXML_XcodeFormatTests: XCTestCase { buildConfiguration = "Debug" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" customLLDBInitFile = "$(BAZEL_LLDB_INIT)" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES" + disableMainThreadChecker = "YES"> """ @@ -98,7 +101,9 @@ class AEXML_XcodeFormatTests: XCTestCase { "customLLDBInitFile": "$(BAZEL_LLDB_INIT)", "launchStyle": "0", "askForAppToLaunch": "YES", - "allowLocationSimulation": "YES" + "allowLocationSimulation": "YES", + "disableMainThreadChecker": "YES", + "disablePerformanceAntipatternChecker": "YES", ] ) } @@ -108,6 +113,8 @@ class AEXML_XcodeFormatTests: XCTestCase { expectedXML: expectedLaunchActionXml.cleaned, childName: "LaunchAction", attributes: [ + "disableMainThreadChecker": "YES", + "disablePerformanceAntipatternChecker": "YES", "customLLDBInitFile": "$(BAZEL_LLDB_INIT)", "allowLocationSimulation": "YES", "buildConfiguration": "Debug", @@ -126,7 +133,8 @@ class AEXML_XcodeFormatTests: XCTestCase { "buildConfiguration": "Debug", "customLLDBInitFile": "$(BAZEL_LLDB_INIT)", "selectedLauncherIdentifier": "Xcode.DebuggerFoundation.Launcher.LLDB", - "shouldUseLaunchSchemeArgsEnv": "YES" + "shouldUseLaunchSchemeArgsEnv": "YES", + "disableMainThreadChecker": "YES", ] ) } @@ -136,6 +144,7 @@ class AEXML_XcodeFormatTests: XCTestCase { expectedXML: expectedTestActionXml.cleaned, childName: "TestAction", attributes: [ + "disableMainThreadChecker": "YES", "shouldUseLaunchSchemeArgsEnv": "YES", "buildConfiguration": "Debug", "customLLDBInitFile": "$(BAZEL_LLDB_INIT)", From de1496a030dddcbc831d835215e3d7a3e524798c Mon Sep 17 00:00:00 2001 From: Kas Date: Thu, 14 Jul 2022 17:40:42 +0100 Subject: [PATCH 105/143] Update changelog for the 8.8.0 release (#707) - To prepare for the 8.8.0 the changelog was updated Notes: - The auto-generate changelog feature of GitHub was used to create an curate this list (with some manualy re-formatting to match existing style) https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#about-automatically-generated-release-notes --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22d25cbae..33c42c9d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,37 @@ ## Next +## 8.8.0 + +### Fixed + +- Fix equality checking of dictionaries [#667](https://github.com/tuist/XcodeProj/pull/667) by [@brentleyjones](https://github.com/brentleyjones) +- Quiet new warnings from Xcode 13.3 [#673](https://github.com/tuist/XcodeProj/pull/673) by [@hisaac](https://github.com/hisaac) +- Fix typo in PBXOutputSettings.swift [#678](https://github.com/tuist/XcodeProj/pull/678) by [@eltociear](https://github.com/eltociear) +- Fix syntax error in docs [#679](https://github.com/tuist/XcodeProj/pull/679) by [@maxwellE](https://github.com/maxwellE) +- Misspelling in comment [#680](https://github.com/tuist/XcodeProj/pull/680) by [@maxwellE](https://github.com/maxwellE) +- Misspelling in comment [#681](https://github.com/tuist/XcodeProj/pull/681) by [@maxwellE](https://github.com/maxwellE) +- Ensure correct `LaunchAction` scheme order [#686](https://github.com/tuist/XcodeProj/pull/686) by [@maxwellE](https://github.com/maxwellE) +- Fix TestAction scheme attribute ordering [#689](https://github.com/tuist/XcodeProj/pull/689) by [@maxwellE](https://github.com/maxwellE) +- Fix `Testables` element ordering [#702](https://github.com/tuist/XcodeProj/pull/702) by [@maxwellE](https://github.com/maxwellE) +- Fix `RemoteRunnable` scheme attr order [#701](https://github.com/tuist/XcodeProj/pull/701) by [@maxwellE](https://github.com/maxwellE) +- Fix ordering of Scheme toplevel attrs [#698](https://github.com/tuist/XcodeProj/pull/698) by [@maxwellE](https://github.com/maxwellE) +- Fix order for `askForAppToLaunch` attr [#705](https://github.com/tuist/XcodeProj/pull/705) by [@maxwellE](https://github.com/maxwellE) +- Fix ordering of diagnostics scheme options [#704](https://github.com/tuist/XcodeProj/pull/704) by [@kwridan](https://github.com/kwridan) + ### Added +- Add `addDependency()` helper method to `PBXAggregateTarget` [#677](https://github.com/tuist/XcodeProj/pull/677) by [@brentleyjones](https://github.com/brentleyjones) +- Allow for initializing a PBXProj via a direct path [#682](https://github.com/tuist/XcodeProj/pull/682) by [@maxwellE](https://github.com/maxwellE) +- Add `.extensionKitExtension` as the new `PBXProductType` [#691](https://github.com/tuist/XcodeProj/pull/691) by [@mtj0928](https://github.com/mtj0928) - Added `disablePerformanceAntipatternChecker` to `XCScheme` [#693](https://github.com/tuist/XcodeProj/pull/603) by [@Bogdan-Belogurov](https://github.com/Bogdan-Belogurov) +- Added missing `askForAppToLaunch` in `ProfileAction` [#700](https://github.com/tuist/XcodeProj/pull/700) by [@maxwellE](https://github.com/maxwellE) +- Add `launchAutomaticallySubstyle`->`ProfileAction` [#699](https://github.com/tuist/XcodeProj/pull/699) by [@maxwellE](https://github.com/maxwellE) +- Add `DEAD_CODE_STRIPPING` default project setting [#706](https://github.com/tuist/XcodeProj/pull/706) by [@kwridan](https://github.com/kwridan) + +### Changed + +- Use `Runnable` in `ProfileAction` [#703](https://github.com/tuist/XcodeProj/pull/703) by [@maxwellE](https://github.com/maxwellE) ## 8.7.1 From 439e89e0e2ee555fc1f5b8f62b7e7f2185c65cf8 Mon Sep 17 00:00:00 2001 From: Kas Date: Thu, 14 Jul 2022 18:30:56 +0100 Subject: [PATCH 106/143] Fix Tuist generated project (for release) (#708) - Following `RELEASE.md` one of the steps is genreate a tuist project used for the Carthage integration - The Tuist config was out dated (generationOptions API has changed in Tuist 3.x) - The steps ordering was incorrect, to ensure a successful generation, the carthage dependency frameworks need to be built first Test Plan: - Run `bundle exec rake carthage_update_dependencies` - Run `tuist generate` - Verify the project successfully generates --- RELEASE.md | 4 ++-- Tuist/Config.swift | 5 +---- XcodeProj_Carthage.xcodeproj/project.pbxproj | 6 ++---- .../xcshareddata/xcschemes/XcodeProj.xcscheme | 3 ++- .../xcshareddata/WorkspaceSettings.xcsettings | 8 ++++++++ ...ect.xcscheme => XcodeProj_Carthage-Workspace.xcscheme} | 0 6 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 XcodeProj_Carthage.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings rename XcodeProj_Carthage.xcworkspace/xcshareddata/xcschemes/{XcodeProj_Carthage-Project.xcscheme => XcodeProj_Carthage-Workspace.xcscheme} (100%) diff --git a/RELEASE.md b/RELEASE.md index 198c6087d..352089c77 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -7,8 +7,8 @@ In this document you'll find all the necessary steps to release a new version of 3. Add the version section to the `CHANGELOG.md`, update the versions in the `README.md` and the `xcodeproj.podspec` file. 4. Commit the changes and tag them `git commit -m "Version x.y.z"` & `git tag x.y.z`. 5. Push the changes `git commit push origin main --tags` -6. Generate the project by running `tuist generate`. -7. Update Carthage dependencies by running `bundle exec rake carthage_update_dependencies`. +6. Update Carthage dependencies by running `bundle exec rake carthage_update_dependencies`. +7. Generate the project by running `tuist generate`. 8. Run the release checks by running `bundle exec rake release_check`. 9. Publish a new version of the Pod by running `bundle exec pod trunk push --allow-warnings --verbose`. 10. Archive the Carthage binary by running `bundle exec rake archive_carthage`. diff --git a/Tuist/Config.swift b/Tuist/Config.swift index c482b403c..4b9d60274 100644 --- a/Tuist/Config.swift +++ b/Tuist/Config.swift @@ -1,6 +1,3 @@ import ProjectDescription -let config = Config(generationOptions: [ - // If we generate the manifest target Carthage will attempt to compile it too. - // .generateManifest -]) +let config = Config(generationOptions: .options()) diff --git a/XcodeProj_Carthage.xcodeproj/project.pbxproj b/XcodeProj_Carthage.xcodeproj/project.pbxproj index d7ff76fe0..1d1804141 100644 --- a/XcodeProj_Carthage.xcodeproj/project.pbxproj +++ b/XcodeProj_Carthage.xcodeproj/project.pbxproj @@ -713,11 +713,10 @@ PRODUCT_NAME = XcodeProj; SDKROOT = macosx; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = macosx; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.5.1; + SWIFT_VERSION = 5.6.1; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -859,10 +858,9 @@ PRODUCT_NAME = XcodeProj; SDKROOT = macosx; SKIP_INSTALL = YES; - SUPPORTED_PLATFORMS = macosx; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 5.5.1; + SWIFT_VERSION = 5.6.1; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; diff --git a/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme b/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme index 066eafdeb..876464d1f 100644 --- a/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme +++ b/XcodeProj_Carthage.xcodeproj/xcshareddata/xcschemes/XcodeProj.xcscheme @@ -26,7 +26,8 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES" + disableMainThreadChecker = "YES"> diff --git a/XcodeProj_Carthage.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/XcodeProj_Carthage.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..08de0be8d --- /dev/null +++ b/XcodeProj_Carthage.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded + + + diff --git a/XcodeProj_Carthage.xcworkspace/xcshareddata/xcschemes/XcodeProj_Carthage-Project.xcscheme b/XcodeProj_Carthage.xcworkspace/xcshareddata/xcschemes/XcodeProj_Carthage-Workspace.xcscheme similarity index 100% rename from XcodeProj_Carthage.xcworkspace/xcshareddata/xcschemes/XcodeProj_Carthage-Project.xcscheme rename to XcodeProj_Carthage.xcworkspace/xcshareddata/xcschemes/XcodeProj_Carthage-Workspace.xcscheme From b6de1bfe021b861c94e7c83821b595083f74b997 Mon Sep 17 00:00:00 2001 From: Kassem Wridan Date: Thu, 14 Jul 2022 18:42:28 +0100 Subject: [PATCH 107/143] Version 8.8.0 --- README.md | 8 ++++---- xcodeproj.podspec | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 890fe4647..910e72ca2 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.7.1")), + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.8.0")), ], targets: [ .target( @@ -64,13 +64,13 @@ let package = Package( ```bash # Cartfile -github "tuist/xcodeproj" ~> 8.7.1 +github "tuist/xcodeproj" ~> 8.8.0 ``` ### CocoaPods ```ruby -pod 'xcodeproj', '~> 8.7.1 +pod 'xcodeproj', '~> 8.8.0 ``` ### Scripting @@ -82,7 +82,7 @@ git tag that represents the project’s version: ```swift #!/usr/bin/swift sh import Foundation -import XcodeProj // @tuist ~> 8.7.1 +import XcodeProj // @tuist ~> 8.8.0 import PathKit guard CommandLine.arguments.count == 3 else { diff --git a/xcodeproj.podspec b/xcodeproj.podspec index e063e07e6..405c05e22 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.7.1' + s.version = '8.8.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From 8f0f4b544b40f173a7847a163dfbfd03ec7a03d2 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Tue, 2 Aug 2022 11:25:18 -0400 Subject: [PATCH 108/143] Fix warning compiling for macOS 13 (#710) --- Sources/XcodeProj/Extensions/String+md5.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/XcodeProj/Extensions/String+md5.swift b/Sources/XcodeProj/Extensions/String+md5.swift index 5abdf59a7..8d470d110 100644 --- a/Sources/XcodeProj/Extensions/String+md5.swift +++ b/Sources/XcodeProj/Extensions/String+md5.swift @@ -50,6 +50,8 @@ private extension DataProtocol { var hexString: String { let hexLen = self.count * 2 let ptr = UnsafeMutablePointer.allocate(capacity: hexLen) + ptr.assign(repeating: 0, count: hexLen) + defer { ptr.deallocate() } var offset = 0 self.regions.forEach { (_) in @@ -60,7 +62,7 @@ private extension DataProtocol { } } - return String(bytesNoCopy: ptr, length: hexLen, encoding: .utf8, freeWhenDone: true)! + return String(cString: ptr) } func itoh(_ value: UInt8) -> UInt8 { From 3e3a2168019b2df4c11637277e7371a4d9e3428a Mon Sep 17 00:00:00 2001 From: Kas Date: Fri, 12 Aug 2022 15:49:13 +0100 Subject: [PATCH 109/143] Revert "Fix warning compiling for macOS 13 (#710)" (#715) Resolves: https://github.com/tuist/XcodeProj/issues/714 - Reverts tuist/XcodeProj#710 (8f0f4b544b40f173a7847a163dfbfd03ec7a03d2) - Sadly this commit made the references unstable, we can revert and reintroduce once the stability issues have been addressed - Running the tests repeatedly helps surface the issue --- Sources/XcodeProj/Extensions/String+md5.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Sources/XcodeProj/Extensions/String+md5.swift b/Sources/XcodeProj/Extensions/String+md5.swift index 8d470d110..5abdf59a7 100644 --- a/Sources/XcodeProj/Extensions/String+md5.swift +++ b/Sources/XcodeProj/Extensions/String+md5.swift @@ -50,8 +50,6 @@ private extension DataProtocol { var hexString: String { let hexLen = self.count * 2 let ptr = UnsafeMutablePointer.allocate(capacity: hexLen) - ptr.assign(repeating: 0, count: hexLen) - defer { ptr.deallocate() } var offset = 0 self.regions.forEach { (_) in @@ -62,7 +60,7 @@ private extension DataProtocol { } } - return String(cString: ptr) + return String(bytesNoCopy: ptr, length: hexLen, encoding: .utf8, freeWhenDone: true)! } func itoh(_ value: UInt8) -> UInt8 { From e6497b2f2619327090b8e5a6a9f6797549950d1d Mon Sep 17 00:00:00 2001 From: Chuck Grindel Date: Fri, 12 Aug 2022 13:45:58 -0600 Subject: [PATCH 110/143] Implement Hashable for XCScheme.BuildableReference (#712) --- .../Scheme/XCScheme+BuildableReference.swift | 11 ++++++++- .../XCScheme+BuildableReferenceTests.swift | 24 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Tests/XcodeProjTests/Scheme/XCScheme+BuildableReferenceTests.swift diff --git a/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift b/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift index 0a092295f..f35011ed7 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+BuildableReference.swift @@ -2,7 +2,7 @@ import AEXML import Foundation extension XCScheme { - public final class BuildableReference: Equatable { + public final class BuildableReference: Equatable, Hashable { // MARK: - Attributes public var referencedContainer: String @@ -105,5 +105,14 @@ extension XCScheme { lhs.blueprint == rhs.blueprint && lhs.blueprintName == rhs.blueprintName } + + // MARK: - Hashable + + public func hash(into hasher: inout Hasher) { + hasher.combine(referencedContainer) + hasher.combine(blueprintIdentifier) + hasher.combine(buildableName) + hasher.combine(blueprintName) + } } } diff --git a/Tests/XcodeProjTests/Scheme/XCScheme+BuildableReferenceTests.swift b/Tests/XcodeProjTests/Scheme/XCScheme+BuildableReferenceTests.swift new file mode 100644 index 000000000..d1ee337dc --- /dev/null +++ b/Tests/XcodeProjTests/Scheme/XCScheme+BuildableReferenceTests.swift @@ -0,0 +1,24 @@ +@testable import XcodeProj +import XCTest + +final class XCSchemeBuildableReferenceTests: XCTestCase { + func test_hash() throws { + // Values that are equal must generate the same hash value + let aBuildRef = XCScheme.BuildableReference( + referencedContainer: "container ref", + blueprint: nil, + buildableName: "buildable name", + blueprintName: "blueprint name" + ) + let bBuildRef = XCScheme.BuildableReference( + referencedContainer: "container ref", + blueprint: nil, + buildableName: "buildable name", + blueprintName: "blueprint name" + ) + XCTAssertEqual(aBuildRef, bBuildRef) + + let buildRefs: Set = [aBuildRef] + XCTAssertTrue(buildRefs.contains(bBuildRef)) + } +} From 2ad4d413f6f381b57001b77d64a41194481aa14d Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 12 Aug 2022 21:46:42 +0200 Subject: [PATCH 111/143] docs: add cgrindel as a contributor for code (#713) --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 971a24924..01de4c687 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -184,6 +184,15 @@ "contributions": [ "code" ] + }, + { + "login": "cgrindel", + "name": "Chuck Grindel", + "avatar_url": "https://avatars.githubusercontent.com/u/159968?v=4", + "profile": "https://chuckgrindel.com/", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 910e72ca2..af9f72034 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -178,6 +178,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Jake Adams

πŸ’»
matsuji

πŸ’»
Bogdan Belogurov

πŸ’» +
Chuck Grindel

πŸ’» From 13c235ab76922123780ff86259bac7aba31dc5c4 Mon Sep 17 00:00:00 2001 From: Michael McGuire Date: Tue, 30 Aug 2022 12:45:54 -0700 Subject: [PATCH 112/143] Add accessor for runScript Build Phases on PBXTarget. (#717) - Other accessors already exist for quickly accessing the other PBXBuildPhase types. --- .../XcodeProj/Objects/Targets/PBXTarget.swift | 9 ++++ .../Objects/Targets/PBXTargetTests.swift | 44 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/Sources/XcodeProj/Objects/Targets/PBXTarget.swift b/Sources/XcodeProj/Objects/Targets/PBXTarget.swift index 9e2213586..b5440059f 100644 --- a/Sources/XcodeProj/Objects/Targets/PBXTarget.swift +++ b/Sources/XcodeProj/Objects/Targets/PBXTarget.swift @@ -282,4 +282,13 @@ public extension PBXTarget { .compactMap { $0 as? PBXCopyFilesBuildPhase } .filter { $0.dstSubfolderSpec == .frameworks } } + + /// Returns the run script build phases. + /// + /// - Returns: Run script build phases. + func runScriptBuildPhases() -> [PBXShellScriptBuildPhase] { + buildPhases + .filter { $0.buildPhase == .runScript } + .compactMap { $0 as? PBXShellScriptBuildPhase } + } } diff --git a/Tests/XcodeProjTests/Objects/Targets/PBXTargetTests.swift b/Tests/XcodeProjTests/Objects/Targets/PBXTargetTests.swift index a0fe6b00e..a47242a3c 100644 --- a/Tests/XcodeProjTests/Objects/Targets/PBXTargetTests.swift +++ b/Tests/XcodeProjTests/Objects/Targets/PBXTargetTests.swift @@ -85,4 +85,48 @@ final class PBXTargetTests: XCTestCase { XCTAssertTrue(embedFrameworkBuildPhases.contains(embedFrameworkBuildPhase1)) XCTAssertTrue(embedFrameworkBuildPhases.contains(embedFrameworkBuildPhase2)) } + + func test_runScriptBuildPhases_returnsEmptyIfNoRunScriptBuildPhases() { + let notShellScriptBuildPhase1 = PBXFrameworksBuildPhase( + files: [], + inputFileListPaths: nil, + outputFileListPaths: nil, buildActionMask: PBXBuildPhase.defaultBuildActionMask, + runOnlyForDeploymentPostprocessing: true + ) + let notShellScriptBuildPhase2 = PBXCopyFilesBuildPhase( + dstPath: nil, + dstSubfolderSpec: .resources, + name: "Embed Frameworks", + buildActionMask: PBXBuildPhase.defaultBuildActionMask, + files: [], + runOnlyForDeploymentPostprocessing: true + ) + + subject.buildPhases.append(notShellScriptBuildPhase1) + subject.buildPhases.append(notShellScriptBuildPhase2) + + let runScriptBuildPhases = subject.runScriptBuildPhases() + XCTAssertTrue(runScriptBuildPhases.isEmpty) + } + + func test_runScriptBuildPhases_returnsRunScriptBuildPhasesIfPresent() { + let otherScriptBuildPhase1 = PBXFrameworksBuildPhase() + let runScriptBuildPhase1 = PBXShellScriptBuildPhase( + name: "Run Script 1" + ) + let runScriptBuildPhase2 = PBXShellScriptBuildPhase( + name: "Run Script 2" + ) + let otherScriptBuildPhase2 = PBXCopyFilesBuildPhase() + + subject.buildPhases.append(otherScriptBuildPhase1) + subject.buildPhases.append(runScriptBuildPhase1) + subject.buildPhases.append(runScriptBuildPhase2) + subject.buildPhases.append(otherScriptBuildPhase2) + + let runScriptBuildPhases = subject.runScriptBuildPhases() + XCTAssertEqual(runScriptBuildPhases.count, 2) + XCTAssertTrue(runScriptBuildPhases.contains(runScriptBuildPhase1)) + XCTAssertTrue(runScriptBuildPhases.contains(runScriptBuildPhase2)) + } } From bc78c5562e54ecb7b20c78da780b1c625326a808 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 30 Aug 2022 21:46:50 +0200 Subject: [PATCH 113/143] docs: add michaelmcguire as a contributor for code (#719) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 01de4c687..0d0f4cc5e 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -193,6 +193,15 @@ "contributions": [ "code" ] + }, + { + "login": "michaelmcguire", + "name": "Michael McGuire", + "avatar_url": "https://avatars.githubusercontent.com/u/429790?v=4", + "profile": "https://twitter.com/MonocularVision", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index af9f72034..9a8a2358f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-22-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -180,6 +180,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Bogdan Belogurov

πŸ’»
Chuck Grindel

πŸ’» + +
Michael McGuire

πŸ’» + From c36d3a8501588e280f4199b00c5cfc5a23b27dbf Mon Sep 17 00:00:00 2001 From: Michael McGuire Date: Tue, 30 Aug 2022 14:38:04 -0700 Subject: [PATCH 114/143] Update Contributing instructions to directly open Package.swift with Xcode instead of using deprecated SPM command. (#718) --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a8a2358f..8ca51e514 100644 --- a/README.md +++ b/README.md @@ -138,8 +138,7 @@ Want to start using XcodeProj? Start by digging into our [documentation](/Docume ## Contributing 1. Git clone the repository `git@github.com:tuist/xcodeproj.git`. -2. Generate xcodeproj with `swift package generate-xcodeproj`. -3. Open `XcodeProj.xcodeproj`. +2. Open `Package.swift` with Xcode. ## License From 4fdab090246666049cfbe86e407cb9d1c8696399 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 7 Sep 2022 10:12:31 -0400 Subject: [PATCH 115/143] docs: add CrazyFanFan as a contributor for code (#722) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 0d0f4cc5e..4210d4dcf 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -202,6 +202,15 @@ "contributions": [ "code" ] + }, + { + "login": "CrazyFanFan", + "name": "C-凑", + "avatar_url": "https://avatars.githubusercontent.com/u/15794964?v=4", + "profile": "https://github.com/CrazyFanFan", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 8ca51e514..0262ff7bb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-22-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-23-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -181,6 +181,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Michael McGuire

πŸ’» +
C-凑

πŸ’» From 1259fdc2df64fc6c062e8590ced4f26eaba010c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C-=E5=87=A1?= <827799383@qq.com> Date: Wed, 7 Sep 2022 22:17:14 +0800 Subject: [PATCH 116/143] Add shellToInvoke to XCScheme.ExecutionAction (#721) Co-authored-by: kongkaikai --- .../xcshareddata/xcschemes/iOS.xcscheme | 3 ++- .../Scheme/XCScheme+ExecutionAction.swift | 24 +++++++++++++++---- .../XcodeProjTests/Scheme/XCSchemeTests.swift | 2 ++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme b/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme index 119ecf609..441f0e3b2 100644 --- a/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme +++ b/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme @@ -19,7 +19,8 @@ ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction"> + scriptText = "echo postbuild" + shellToInvoke = "/bin/sh"> diff --git a/Sources/XcodeProj/Scheme/XCScheme+ExecutionAction.swift b/Sources/XcodeProj/Scheme/XCScheme+ExecutionAction.swift index 5dd3d7d21..484e99aaa 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+ExecutionAction.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+ExecutionAction.swift @@ -9,19 +9,29 @@ extension XCScheme { public var title: String public var scriptText: String + public var shellToInvoke: String? public var environmentBuildable: BuildableReference? // MARK: - Init - public init(scriptText: String, title: String = "Run Script", environmentBuildable: BuildableReference? = nil) { + public init( + scriptText: String, + title: String = "Run Script", + shellToInvoke: String? = nil, + environmentBuildable: BuildableReference? = nil + ) { self.scriptText = scriptText self.title = title + self.shellToInvoke = shellToInvoke self.environmentBuildable = environmentBuildable } init(element: AEXMLElement) throws { scriptText = element["ActionContent"].attributes["scriptText"] ?? "" title = element["ActionContent"].attributes["title"] ?? "Run Script" + if let shellToInvoke = element["ActionContent"].attributes["shellToInvoke"] { + self.shellToInvoke = shellToInvoke + } environmentBuildable = try? BuildableReference(element: element["ActionContent"]["EnvironmentBuildable"]["BuildableReference"]) } @@ -31,12 +41,16 @@ extension XCScheme { let element = AEXMLElement(name: "ExecutionAction", value: nil, attributes: ["ActionType": ExecutionAction.ActionType]) + var attributes = [ + "title": title, + "scriptText": scriptText, + ] + if let shellToInvoke = shellToInvoke { + attributes["shellToInvoke"] = shellToInvoke + } let content = AEXMLElement(name: "ActionContent", value: nil, - attributes: [ - "title": title, - "scriptText": scriptText, - ]) + attributes: attributes) element.addChild(content) if let environmentBuildable = environmentBuildable { let environment = content.addChild(name: "EnvironmentBuildable") diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift index 2ec14710c..678147597 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift @@ -329,8 +329,10 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.buildAction?.buildActionEntries.first?.buildableReference.referencedContainer, "container:Project.xcodeproj") XCTAssertEqual(scheme.buildAction?.preActions.first?.title, "Build Pre-action") XCTAssertEqual(scheme.buildAction?.preActions.first?.scriptText, "echo prebuild") + XCTAssertNil(scheme.buildAction?.preActions.first?.shellToInvoke) XCTAssertEqual(scheme.buildAction?.postActions.first?.title, "Build Post-action") XCTAssertEqual(scheme.buildAction?.postActions.first?.scriptText, "echo postbuild") + XCTAssertEqual(scheme.buildAction?.postActions.first?.shellToInvoke, "/bin/sh") // Test action XCTAssertEqual(scheme.testAction?.buildConfiguration, "Debug") XCTAssertEqual(scheme.testAction?.selectedDebuggerIdentifier, "Xcode.DebuggerFoundation.Debugger.LLDB") From d5f3532a36993a266cd227873ccefbb5d8e33e47 Mon Sep 17 00:00:00 2001 From: Kas Date: Wed, 7 Sep 2022 15:18:27 +0100 Subject: [PATCH 117/143] Update watchOS application default settings (#711) - Xcode 14 supports extensionless watchOS applications (that have the regular application product identifier) - Those target can now include source, resources and can link other frameworks like regular application targets - The default settings are being updated to accomodate this, more specifically the linker search paths Test Plan: - Verify tests pass References: - https://github.com/tuist/tuist/pull/4658 - https://github.com/tuist/tuist/issues/4572 --- Sources/XcodeProj/Utils/BuildSettingsProvider.swift | 1 + Tests/XcodeProjTests/Utils/BuildSettingsProviderTests.swift | 1 + 2 files changed, 2 insertions(+) diff --git a/Sources/XcodeProj/Utils/BuildSettingsProvider.swift b/Sources/XcodeProj/Utils/BuildSettingsProvider.swift index ebafcf367..f9040c5ee 100644 --- a/Sources/XcodeProj/Utils/BuildSettingsProvider.swift +++ b/Sources/XcodeProj/Utils/BuildSettingsProvider.swift @@ -241,6 +241,7 @@ public class BuildSettingsProvider { case (.watchOS, .application): return [ "SKIP_INSTALL": "YES", + "LD_RUNPATH_SEARCH_PATHS": ["$(inherited)", "@executable_path/Frameworks"], ] case (.iOS, .framework): return [ diff --git a/Tests/XcodeProjTests/Utils/BuildSettingsProviderTests.swift b/Tests/XcodeProjTests/Utils/BuildSettingsProviderTests.swift index 9e8e86de5..b7cad6cde 100644 --- a/Tests/XcodeProjTests/Utils/BuildSettingsProviderTests.swift +++ b/Tests/XcodeProjTests/Utils/BuildSettingsProviderTests.swift @@ -138,6 +138,7 @@ class BuildSettingProviderTests: XCTestCase { "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES": "YES", "ASSETCATALOG_COMPILER_APPICON_NAME": "AppIcon", "ENABLE_PREVIEWS": "YES", + "LD_RUNPATH_SEARCH_PATHS": ["$(inherited)", "@executable_path/Frameworks"], "SDKROOT": "watchos", "SKIP_INSTALL": "YES", "SWIFT_COMPILATION_MODE": "wholemodule", From b7e93122d08e59497211ea12f4da73e6a4d7d598 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Wed, 7 Sep 2022 10:19:19 -0400 Subject: [PATCH 118/143] Sets `customWorkingDirectory` for schemes (#720) * Sets `customWorkingDirectory` for schemes This attribute was missed in launch and profile schemes * remove debug * ensure correct attribute order * feedback --- .../RunnableWithoutBuildableReference.xcscheme | 1 + Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift | 2 ++ Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift | 10 ++++++++++ .../XcodeProj/Scheme/XCScheme+ProfileAction.swift | 12 ++++++++++++ Tests/XcodeProjTests/Scheme/XCSchemeTests.swift | 6 ++++++ 5 files changed, 31 insertions(+) diff --git a/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme b/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme index 3849dcb0d..edc29a307 100644 --- a/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme +++ b/Fixtures/Schemes/RunnableWithoutBuildableReference.xcscheme @@ -51,6 +51,7 @@ launchStyle = "0" askForAppToLaunch = "Yes" useCustomWorkingDirectory = "NO" + customWorkingDirectory = "/customWorkingDirectory" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" diff --git a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift index 3a0ab2ec2..33a5a9b65 100644 --- a/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift +++ b/Sources/XcodeProj/Extensions/AEXML+XcodeFormat.swift @@ -53,6 +53,7 @@ let attributesOrder: [String: [String]] = [ "launchStyle", "askForAppToLaunch", "useCustomWorkingDirectory", + "customWorkingDirectory", "ignoresPersistentStateOnLaunch", "debugDocumentVersioning", "debugServiceExtension", @@ -66,6 +67,7 @@ let attributesOrder: [String: [String]] = [ "shouldUseLaunchSchemeArgsEnv", "savedToolIdentifier", "useCustomWorkingDirectory", + "customWorkingDirectory", "ignoresPersistentStateOnLaunch", "debugDocumentVersioning", "enableTestabilityWhenProfilingTests", diff --git a/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift b/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift index 10e2ca44a..6f3461ee1 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+LaunchAction.swift @@ -42,6 +42,7 @@ extension XCScheme { public var launchStyle: Style public var askForAppToLaunch: Bool? public var pathRunnable: PathRunnable? + public var customWorkingDirectory: String? public var useCustomWorkingDirectory: Bool public var ignoresPersistentStateOnLaunch: Bool public var debugDocumentVersioning: Bool @@ -82,6 +83,7 @@ extension XCScheme { launchStyle: Style = .auto, askForAppToLaunch: Bool? = nil, pathRunnable: PathRunnable? = nil, + customWorkingDirectory: String? = nil, useCustomWorkingDirectory: Bool = false, ignoresPersistentStateOnLaunch: Bool = false, debugDocumentVersioning: Bool = true, @@ -116,6 +118,7 @@ extension XCScheme { self.selectedLauncherIdentifier = selectedLauncherIdentifier self.askForAppToLaunch = askForAppToLaunch self.pathRunnable = pathRunnable + self.customWorkingDirectory = customWorkingDirectory self.useCustomWorkingDirectory = useCustomWorkingDirectory self.ignoresPersistentStateOnLaunch = ignoresPersistentStateOnLaunch self.debugDocumentVersioning = debugDocumentVersioning @@ -222,6 +225,9 @@ extension XCScheme { } customLaunchCommand = element.attributes["customLaunchCommand"] customLLDBInitFile = element.attributes["customLLDBInitFile"] + if let elementCustomWorkingDirectory: String = element.attributes["customWorkingDirectory"] { + customWorkingDirectory = elementCustomWorkingDirectory + } try super.init(element: element) } @@ -277,6 +283,9 @@ extension XCScheme { if stopOnEveryMainThreadCheckerIssue { attributes["stopOnEveryMainThreadCheckerIssue"] = stopOnEveryMainThreadCheckerIssue.xmlString } + if let customWorkingDirectory = customWorkingDirectory { + attributes["customWorkingDirectory"] = customWorkingDirectory + } return attributes } @@ -357,6 +366,7 @@ extension XCScheme { launchStyle == rhs.launchStyle && askForAppToLaunch == rhs.askForAppToLaunch && pathRunnable == rhs.pathRunnable && + customWorkingDirectory == rhs.customWorkingDirectory && useCustomWorkingDirectory == rhs.useCustomWorkingDirectory && ignoresPersistentStateOnLaunch == rhs.ignoresPersistentStateOnLaunch && debugDocumentVersioning == rhs.debugDocumentVersioning && diff --git a/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift b/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift index c96a5d023..023b79576 100644 --- a/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift +++ b/Sources/XcodeProj/Scheme/XCScheme+ProfileAction.swift @@ -19,6 +19,7 @@ extension XCScheme { public var shouldUseLaunchSchemeArgsEnv: Bool public var savedToolIdentifier: String public var ignoresPersistentStateOnLaunch: Bool + public var customWorkingDirectory: String? public var useCustomWorkingDirectory: Bool public var debugDocumentVersioning: Bool public var askForAppToLaunch: Bool? @@ -38,6 +39,7 @@ extension XCScheme { shouldUseLaunchSchemeArgsEnv: Bool = true, savedToolIdentifier: String = "", ignoresPersistentStateOnLaunch: Bool = false, + customWorkingDirectory: String? = nil, useCustomWorkingDirectory: Bool = false, debugDocumentVersioning: Bool = true, askForAppToLaunch: Bool? = nil, @@ -50,6 +52,7 @@ extension XCScheme { self.macroExpansion = macroExpansion self.shouldUseLaunchSchemeArgsEnv = shouldUseLaunchSchemeArgsEnv self.savedToolIdentifier = savedToolIdentifier + self.customWorkingDirectory = customWorkingDirectory self.useCustomWorkingDirectory = useCustomWorkingDirectory self.debugDocumentVersioning = debugDocumentVersioning self.askForAppToLaunch = askForAppToLaunch @@ -70,6 +73,7 @@ extension XCScheme { shouldUseLaunchSchemeArgsEnv: Bool = true, savedToolIdentifier: String = "", ignoresPersistentStateOnLaunch: Bool = false, + customWorkingDirectory: String? = nil, useCustomWorkingDirectory: Bool = false, debugDocumentVersioning: Bool = true, askForAppToLaunch: Bool? = nil, @@ -87,6 +91,7 @@ extension XCScheme { shouldUseLaunchSchemeArgsEnv: shouldUseLaunchSchemeArgsEnv, savedToolIdentifier: savedToolIdentifier, ignoresPersistentStateOnLaunch: ignoresPersistentStateOnLaunch, + customWorkingDirectory: customWorkingDirectory, useCustomWorkingDirectory: useCustomWorkingDirectory, debugDocumentVersioning: debugDocumentVersioning, askForAppToLaunch: askForAppToLaunch, @@ -128,6 +133,9 @@ extension XCScheme { } enableTestabilityWhenProfilingTests = element.attributes["enableTestabilityWhenProfilingTests"].map { $0 != "No" } ?? true launchAutomaticallySubstyle = element.attributes["launchAutomaticallySubstyle"] + if let elementCustomWorkingDirectory: String = element.attributes["customWorkingDirectory"] { + customWorkingDirectory = elementCustomWorkingDirectory + } try super.init(element: element) } @@ -165,6 +173,9 @@ extension XCScheme { if let launchAutomaticallySubstyle = launchAutomaticallySubstyle { element.attributes["launchAutomaticallySubstyle"] = launchAutomaticallySubstyle } + if let customWorkingDirectory = customWorkingDirectory { + element.attributes["customWorkingDirectory"] = customWorkingDirectory + } if let macroExpansion = macroExpansion { let macro = element.addChild(name: "MacroExpansion") @@ -184,6 +195,7 @@ extension XCScheme { shouldUseLaunchSchemeArgsEnv == rhs.shouldUseLaunchSchemeArgsEnv && savedToolIdentifier == rhs.savedToolIdentifier && ignoresPersistentStateOnLaunch == rhs.ignoresPersistentStateOnLaunch && + customWorkingDirectory == rhs.customWorkingDirectory && useCustomWorkingDirectory == rhs.useCustomWorkingDirectory && debugDocumentVersioning == rhs.debugDocumentVersioning && askForAppToLaunch == rhs.askForAppToLaunch && diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift index 678147597..86680b14e 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift @@ -398,6 +398,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.profileAction?.buildConfiguration, "Release") XCTAssertEqual(scheme.profileAction?.shouldUseLaunchSchemeArgsEnv, true) XCTAssertEqual(scheme.profileAction?.savedToolIdentifier, "") + XCTAssertNil(scheme.profileAction?.customWorkingDirectory) XCTAssertEqual(scheme.profileAction?.useCustomWorkingDirectory, false) XCTAssertEqual(scheme.profileAction?.debugDocumentVersioning, true) XCTAssertNil(scheme.profileAction?.askForAppToLaunch) @@ -428,6 +429,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.launchAction?.selectedLauncherIdentifier, "Xcode.DebuggerFoundation.Launcher.LLDB") XCTAssertEqual(scheme.launchAction?.launchStyle, .custom) XCTAssertNil(scheme.launchAction?.askForAppToLaunch) + XCTAssertNil(scheme.launchAction?.customWorkingDirectory) XCTAssertEqual(scheme.launchAction?.useCustomWorkingDirectory, false) XCTAssertEqual(scheme.launchAction?.ignoresPersistentStateOnLaunch, false) XCTAssertEqual(scheme.launchAction?.debugDocumentVersioning, true) @@ -533,6 +535,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.launchAction?.buildConfiguration, "Staging") XCTAssertEqual(scheme.launchAction?.launchStyle, XCScheme.LaunchAction.Style.auto) XCTAssertTrue(scheme.launchAction?.askForAppToLaunch == true) + XCTAssertEqual(scheme.launchAction?.customWorkingDirectory, "/customWorkingDirectory") XCTAssertTrue(scheme.launchAction?.useCustomWorkingDirectory == false) XCTAssertTrue(scheme.launchAction?.ignoresPersistentStateOnLaunch == false) XCTAssertTrue(scheme.launchAction?.debugDocumentVersioning == true) @@ -568,6 +571,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.profileAction?.buildConfiguration, "Release") XCTAssertTrue(scheme.profileAction?.shouldUseLaunchSchemeArgsEnv == true) XCTAssertEqual(scheme.profileAction?.savedToolIdentifier, "") + XCTAssertNil(scheme.profileAction?.customWorkingDirectory) XCTAssertTrue(scheme.profileAction?.useCustomWorkingDirectory == false) XCTAssertTrue(scheme.profileAction?.debugDocumentVersioning == true) XCTAssertTrue(scheme.profileAction?.askForAppToLaunch == true) @@ -627,6 +631,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.launchAction?.buildConfiguration, "Debug") XCTAssertEqual(scheme.launchAction?.launchStyle, XCScheme.LaunchAction.Style.auto) XCTAssertNil(scheme.launchAction?.askForAppToLaunch) + XCTAssertNil(scheme.launchAction?.customWorkingDirectory) XCTAssertTrue(scheme.launchAction?.useCustomWorkingDirectory == false) XCTAssertTrue(scheme.launchAction?.ignoresPersistentStateOnLaunch == false) XCTAssertTrue(scheme.launchAction?.debugDocumentVersioning == true) @@ -657,6 +662,7 @@ final class XCSchemeIntegrationTests: XCTestCase { XCTAssertEqual(scheme.profileAction?.buildConfiguration, "Release") XCTAssertTrue(scheme.profileAction?.shouldUseLaunchSchemeArgsEnv == true) XCTAssertEqual(scheme.profileAction?.savedToolIdentifier, "") + XCTAssertNil(scheme.profileAction?.customWorkingDirectory) XCTAssertTrue(scheme.profileAction?.useCustomWorkingDirectory == false) XCTAssertTrue(scheme.profileAction?.debugDocumentVersioning == true) XCTAssertNil(scheme.profileAction?.askForAppToLaunch) From 3471fa50291a3b889e4c41c35a1f6955188b21f7 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 22:17:42 +0200 Subject: [PATCH 119/143] docs: add brentleyjones as a contributor for code (#726) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 4210d4dcf..449470941 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -211,6 +211,15 @@ "contributions": [ "code" ] + }, + { + "login": "brentleyjones", + "name": "Brentley Jones", + "avatar_url": "https://avatars.githubusercontent.com/u/158658?v=4", + "profile": "https://brentleyjones.com", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 0262ff7bb..871d4ea84 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-23-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-24-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -182,6 +182,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Michael McGuire

πŸ’»
C-凑

πŸ’» +
Brentley Jones

πŸ’» From 5a3c1185473733506165fba461305f06fcb7e0e3 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 22:19:24 +0200 Subject: [PATCH 120/143] docs: add maxwellE as a contributor for code (#727) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Marek FoΕ™t --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 449470941..d9c170812 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -212,6 +212,15 @@ "code" ] }, + { + "login": "maxwellE", + "name": "Maxwell Elliott", + "avatar_url": "https://avatars.githubusercontent.com/u/566328?v=4", + "profile": "http://www.tinder.com", + "contributions": [ + "code" + ] + }, { "login": "brentleyjones", "name": "Brentley Jones", diff --git a/README.md b/README.md index 871d4ea84..30b78020a 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Michael McGuire

πŸ’»
C-凑

πŸ’» +
Maxwell Elliott

πŸ’»
Brentley Jones

πŸ’» From d85034e0fbd179a64f61083c70158b2fa29f6c6a Mon Sep 17 00:00:00 2001 From: DevTchernov Date: Wed, 14 Sep 2022 03:21:32 +0700 Subject: [PATCH 121/143] Add Rugby tool in 'projects using' table (#723) There's package importing: https://github.com/swiftyfinch/Rugby/blob/21cd79fb2d8be25772c44c0b27fc8087ea8f9bed/Package.swift#L26 Examples of usage: https://github.com/swiftyfinch/Rugby/tree/main/Sources/Rugby/Common/XcodeProj --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 30b78020a..29abef1b6 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ XcodeProj is a library written in Swift for parsing and working with Xcode proje | ProjLint | [github.com/JamitLabs/ProjLint](https://github.com/JamitLabs/ProjLint) | | XcodeGen | [github.com/yonaskolb/XcodeGen](https://github.com/yonaskolb/XcodeGen) | | xspm | [gitlab.com/Pyroh/xspm](https://gitlab.com/Pyroh/xspm) | +| Rugby | [github.com/swiftyfinch/Rugby](https://github.com/swiftyfinch/Rugby) | If you are also leveraging XcodeProj in your project, feel free to open a PR to include it in the list above. From 61b9bc801d3866a78a2de532c1266841bc245f23 Mon Sep 17 00:00:00 2001 From: Blake McAnally Date: Sun, 16 Oct 2022 05:53:06 -0500 Subject: [PATCH 122/143] Have Xcode highlight Bazel file syntax in generated projects (#730) --- Sources/XcodeProj/Project/Xcode.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/XcodeProj/Project/Xcode.swift b/Sources/XcodeProj/Project/Xcode.swift index 2a990af2e..4d8a1d154 100644 --- a/Sources/XcodeProj/Project/Xcode.swift +++ b/Sources/XcodeProj/Project/Xcode.swift @@ -100,9 +100,11 @@ public struct Xcode { "atlas": "folder.skatlas", "au": "audio.au", "avi": "video.avi", + "bazel": "text.script.python", "bin": "archive.macbinary", "bmp": "image.bmp", "bundle": "wrapper.cfbundle", + "bzl": "text.script.python", "c": "sourcecode.c.c", "c++": "sourcecode.cpp.cpp", "cc": "sourcecode.cpp.cpp", From a448075d4e0f0f60d888f9394a6b38f8c90b7232 Mon Sep 17 00:00:00 2001 From: Brentley Jones Date: Sun, 16 Oct 2022 05:53:44 -0500 Subject: [PATCH 123/143] Add rules_xcodeproj to "projects using" table (#729) --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 29abef1b6..4ee167d8e 100644 --- a/README.md +++ b/README.md @@ -28,14 +28,15 @@ XcodeProj is a library written in Swift for parsing and working with Xcode proje ## Projects Using XcodeProj -| Project | Repository | -| -------- | -------------------------------------------------------------------------------------- | -| Tuist | [github.com/tuist/tuist](https://github.com/tuist/tuist) | -| Sourcery | [github.com/krzysztofzablocki/Sourcery](https://github.com/krzysztofzablocki/Sourcery) | -| ProjLint | [github.com/JamitLabs/ProjLint](https://github.com/JamitLabs/ProjLint) | -| XcodeGen | [github.com/yonaskolb/XcodeGen](https://github.com/yonaskolb/XcodeGen) | -| xspm | [gitlab.com/Pyroh/xspm](https://gitlab.com/Pyroh/xspm) | -| Rugby | [github.com/swiftyfinch/Rugby](https://github.com/swiftyfinch/Rugby) | +| Project | Repository | +| --------------- | -------------------------------------------------------------------------------------------- | +| ProjLint | [github.com/JamitLabs/ProjLint](https://github.com/JamitLabs/ProjLint) | +| rules_xcodeproj | [github.com/buildbuddy-io/rules_xcodeproj](https://github.com/buildbuddy-io/rules_xcodeproj) | +| Rugby | [github.com/swiftyfinch/Rugby](https://github.com/swiftyfinch/Rugby) | +| Sourcery | [github.com/krzysztofzablocki/Sourcery](https://github.com/krzysztofzablocki/Sourcery) | +| Tuist | [github.com/tuist/tuist](https://github.com/tuist/tuist) | +| XcodeGen | [github.com/yonaskolb/XcodeGen](https://github.com/yonaskolb/XcodeGen) | +| xspm | [gitlab.com/Pyroh/xspm](https://gitlab.com/Pyroh/xspm) | If you are also leveraging XcodeProj in your project, feel free to open a PR to include it in the list above. From e4d7ed11d0df98337fe6550de5f530ddcaf866b0 Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Tue, 6 Dec 2022 02:34:42 -0500 Subject: [PATCH 124/143] Allow specifying `platformFilter` in `PBXBuildFile` init - Add the ability to specify the platform filter in the init for `PBXBuildFile` for convenience. --- Sources/XcodeProj/Objects/BuildPhase/PBXBuildFile.swift | 4 +++- .../Objects/BuildPhase/PBXBuildFileTests.swift | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Sources/XcodeProj/Objects/BuildPhase/PBXBuildFile.swift b/Sources/XcodeProj/Objects/BuildPhase/PBXBuildFile.swift index 7982d6be5..5c5d45773 100644 --- a/Sources/XcodeProj/Objects/BuildPhase/PBXBuildFile.swift +++ b/Sources/XcodeProj/Objects/BuildPhase/PBXBuildFile.swift @@ -50,10 +50,12 @@ public final class PBXBuildFile: PBXObject { /// - settings: build file settings. public init(file: PBXFileElement? = nil, product: XCSwiftPackageProductDependency? = nil, - settings: [String: Any]? = nil) { + settings: [String: Any]? = nil, + platformFilter: String? = nil) { fileReference = file?.reference productReference = product?.reference self.settings = settings + self.platformFilter = platformFilter super.init() } diff --git a/Tests/XcodeProjTests/Objects/BuildPhase/PBXBuildFileTests.swift b/Tests/XcodeProjTests/Objects/BuildPhase/PBXBuildFileTests.swift index 517e2dec9..517dad192 100644 --- a/Tests/XcodeProjTests/Objects/BuildPhase/PBXBuildFileTests.swift +++ b/Tests/XcodeProjTests/Objects/BuildPhase/PBXBuildFileTests.swift @@ -6,4 +6,11 @@ final class PBXBuildFileTests: XCTestCase { func test_isa_returnsTheCorrectValue() { XCTAssertEqual(PBXBuildFile.isa, "PBXBuildFile") } + + func test_platformFilterIsSet() { + let pbxBuildFile: PBXBuildFile = PBXBuildFile( + platformFilter: "platformFilter" + ) + XCTAssertEqual(pbxBuildFile.platformFilter, "platformFilter") + } } From 6e96bdcd2a00edb4b3addc31aa30d97ce3b3280d Mon Sep 17 00:00:00 2001 From: Maxwell Elliott Date: Wed, 21 Dec 2022 06:04:18 -0500 Subject: [PATCH 125/143] Add `platformFilters` attribute (#737) - Add support for `platformFilters` (plural) attribute - When selecting multiple platform filters, Xcode uses a different attribute `platformFilters` (plural) vs when using a single one it uses `platformFilter` (singular) --- .../XcodeProj/Objects/BuildPhase/PBXBuildFile.swift | 12 +++++++++++- .../Objects/Targets/PBXTargetDependency.swift | 11 +++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Sources/XcodeProj/Objects/BuildPhase/PBXBuildFile.swift b/Sources/XcodeProj/Objects/BuildPhase/PBXBuildFile.swift index 5c5d45773..99e8c8445 100644 --- a/Sources/XcodeProj/Objects/BuildPhase/PBXBuildFile.swift +++ b/Sources/XcodeProj/Objects/BuildPhase/PBXBuildFile.swift @@ -37,6 +37,9 @@ public final class PBXBuildFile: PBXObject { /// Introduced in: Xcode 11 public var platformFilter: String? + /// Platform filters attribute. + public var platformFilters: [String]? + /// The cached build phase this build file belongs to weak var buildPhase: PBXBuildPhase? @@ -51,11 +54,13 @@ public final class PBXBuildFile: PBXObject { public init(file: PBXFileElement? = nil, product: XCSwiftPackageProductDependency? = nil, settings: [String: Any]? = nil, - platformFilter: String? = nil) { + platformFilter: String? = nil, + platformFilters: [String]? = nil) { fileReference = file?.reference productReference = product?.reference self.settings = settings self.platformFilter = platformFilter + self.platformFilters = platformFilters super.init() } @@ -66,6 +71,7 @@ public final class PBXBuildFile: PBXObject { case settings case productRef case platformFilter + case platformFilters } public required init(from decoder: Decoder) throws { @@ -80,6 +86,7 @@ public final class PBXBuildFile: PBXObject { } settings = try container.decodeIfPresent([String: Any].self, forKey: .settings) platformFilter = try container.decodeIfPresent(.platformFilter) + platformFilters = try container.decodeIfPresent([String].self, forKey: .platformFilters) try super.init(from: decoder) } @@ -176,6 +183,9 @@ final class PBXBuildPhaseFile: PlistSerializable, Equatable { if let platformFilter = buildFile.platformFilter { dictionary["platformFilter"] = .string(.init(platformFilter)) } + if let platformFilters = buildFile.platformFilters { + dictionary["platformFilters"] = .array(platformFilters.map { .string(.init($0)) }) + } let comment = try buildPhase.name().flatMap { "\(try buildFile.fileName() ?? "(null)") in \($0)" } return (key: CommentedString(reference, comment: comment), value: .dictionary(dictionary)) diff --git a/Sources/XcodeProj/Objects/Targets/PBXTargetDependency.swift b/Sources/XcodeProj/Objects/Targets/PBXTargetDependency.swift index bd3379ac0..22603e5b3 100644 --- a/Sources/XcodeProj/Objects/Targets/PBXTargetDependency.swift +++ b/Sources/XcodeProj/Objects/Targets/PBXTargetDependency.swift @@ -50,6 +50,9 @@ public final class PBXTargetDependency: PBXObject { /// Introduced in: Xcode 11 public var platformFilter: String? + /// Platform filters attribute. + public var platformFilters: [String]? + // MARK: - Init /// Initializes the target dependency with dependencies as objects. @@ -57,15 +60,18 @@ public final class PBXTargetDependency: PBXObject { /// - Parameters: /// - name: Dependency name. /// - platformFilter: Platform filter. + /// - platformFilters: Platform filters. /// - target: Target. /// - targetProxy: Target proxy. public init(name: String? = nil, platformFilter: String? = nil, + platformFilters: [String]? = nil, target: PBXTarget? = nil, targetProxy: PBXContainerItemProxy? = nil, product: XCSwiftPackageProductDependency? = nil) { self.name = name self.platformFilter = platformFilter + self.platformFilters = platformFilters targetReference = target?.reference targetProxyReference = targetProxy?.reference productReference = product?.reference @@ -77,6 +83,7 @@ public final class PBXTargetDependency: PBXObject { fileprivate enum CodingKeys: String, CodingKey { case name case platformFilter + case platformFilters case target case targetProxy case productRef @@ -88,6 +95,7 @@ public final class PBXTargetDependency: PBXObject { let objects = decoder.context.objects name = try container.decodeIfPresent(.name) platformFilter = try container.decodeIfPresent(.platformFilter) + platformFilters = try container.decodeIfPresent([String].self, forKey: .platformFilters) if let targetReference: String = try container.decodeIfPresent(.target) { self.targetReference = referenceRepository.getOrCreate(reference: targetReference, objects: objects) } @@ -118,6 +126,9 @@ extension PBXTargetDependency: PlistSerializable { if let platformFilter = platformFilter { dictionary["platformFilter"] = .string(CommentedString(platformFilter)) } + if let platformFilters = platformFilters { + dictionary["platformFilters"] = .array(platformFilters.map { .string(.init($0)) }) + } if let targetReference = targetReference { let targetObject: PBXTarget? = targetReference.getObject() dictionary["target"] = .string(CommentedString(targetReference.value, comment: targetObject?.name)) From cbf71c8d3d4a7e3c86f08285b8c94241d0567952 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 20 Jan 2023 18:33:19 +0000 Subject: [PATCH 126/143] docs: add teameh as a contributor for code (#741) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 12 +++++++- README.md | 71 +++++++++++++++++++++++---------------------- 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index d9c170812..152b10d00 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -229,6 +229,15 @@ "contributions": [ "code" ] + }, + { + "login": "teameh", + "name": "Teameh", + "avatar_url": "https://avatars.githubusercontent.com/u/1330668?v=4", + "profile": "https://www.linkedin.com/in/tiemevanveen", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, @@ -236,5 +245,6 @@ "projectOwner": "tuist", "repoType": "github", "repoHost": "https://github.com", - "skipCi": true + "skipCi": true, + "commitConvention": "angular" } diff --git a/README.md b/README.md index 4ee167d8e..ef35173c7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-24-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-26-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -154,39 +154,42 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Joseph Colicchio

πŸ€”

deatondg

πŸ€”

Dan Fleming

πŸ’»

Sascha Schwabbauer

πŸ€”

Marcin Iwanicki

🚧

Adam Khazi

🚧

Elliott Williams

πŸ’»

Muukii

πŸ–‹

Yuya Oka

πŸ’»

Keith Smiley

πŸ–‹

Ian Leitch

πŸ’»

Daniil Subbotin

πŸ’»

Florentin Bekier

πŸ’»

Vadim Smal

πŸ›

freddi(Yuki Aki)

πŸ’»

Kristopher Jackson

πŸ’»

Jake Prickett

πŸ’»

Jake Adams

πŸ’»

matsuji

πŸ’»

Bogdan Belogurov

πŸ’»

Chuck Grindel

πŸ’»

Michael McGuire

πŸ’»

C-凑

πŸ’»

Maxwell Elliott

πŸ’»

Brentley Jones

πŸ’»
Joseph Colicchio
Joseph Colicchio

πŸ€”
deatondg
deatondg

πŸ€”
Dan Fleming
Dan Fleming

πŸ’»
Sascha Schwabbauer
Sascha Schwabbauer

πŸ€”
Marcin Iwanicki
Marcin Iwanicki

🚧
Adam Khazi
Adam Khazi

🚧
Elliott Williams
Elliott Williams

πŸ’»
Muukii
Muukii

πŸ–‹
Yuya Oka
Yuya Oka

πŸ’»
Keith Smiley
Keith Smiley

πŸ–‹
Ian Leitch
Ian Leitch

πŸ’»
Daniil Subbotin
Daniil Subbotin

πŸ’»
Florentin Bekier
Florentin Bekier

πŸ’»
Vadim Smal
Vadim Smal

πŸ›
freddi(Yuki Aki)
freddi(Yuki Aki)

πŸ’»
Kristopher Jackson
Kristopher Jackson

πŸ’»
Jake Prickett
Jake Prickett

πŸ’»
Jake Adams
Jake Adams

πŸ’»
matsuji
matsuji

πŸ’»
Bogdan Belogurov
Bogdan Belogurov

πŸ’»
Chuck Grindel
Chuck Grindel

πŸ’»
Michael McGuire
Michael McGuire

πŸ’»
C-凑
C-凑

πŸ’»
Maxwell Elliott
Maxwell Elliott

πŸ’»
Brentley Jones
Brentley Jones

πŸ’»
Teameh
Teameh

πŸ’»
From 9227827beb1c8a1564c534b280a3948ee1602b17 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Fri, 20 Jan 2023 18:33:33 +0000 Subject: [PATCH 127/143] Update all of rails to version 6.1.7.1 (#742) Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> --- Gemfile.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5b62c4e92..0726db82b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ GEM specs: CFPropertyList (3.0.5) rexml - activesupport (6.1.5) + activesupport (6.1.7.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -55,7 +55,7 @@ GEM cocoapods-try (1.2.0) colored2 (3.1.2) colorize (0.8.1) - concurrent-ruby (1.1.9) + concurrent-ruby (1.1.10) escape (0.0.4) ethon (0.15.0) ffi (>= 1.15.0) @@ -64,7 +64,7 @@ GEM fuzzy_match (2.0.4) gh_inspector (1.1.3) httpclient (2.8.3) - i18n (1.10.0) + i18n (1.12.0) concurrent-ruby (~> 1.0) jazzy (0.14.2) cocoapods (~> 1.5) @@ -78,7 +78,7 @@ GEM xcinvoke (~> 0.3.0) json (2.6.1) liferaft (0.0.6) - minitest (5.15.0) + minitest (5.17.0) molinillo (0.8.0) mustache (1.1.1) nanaimo (0.3.0) @@ -96,7 +96,7 @@ GEM sqlite3 (1.4.2) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (2.0.4) + tzinfo (2.0.5) concurrent-ruby (~> 1.0) xcinvoke (0.3.0) liferaft (~> 0.0.6) @@ -107,7 +107,7 @@ GEM colored2 (~> 3.1) nanaimo (~> 0.3.0) rexml (~> 3.2.4) - zeitwerk (2.5.4) + zeitwerk (2.6.6) PLATFORMS ruby From 13705282e17ab2955790a204827f8827068a79f2 Mon Sep 17 00:00:00 2001 From: Teameh Date: Thu, 2 Feb 2023 15:23:26 +0100 Subject: [PATCH 128/143] Add support for xcuserdata (#739) - Added support for creating and reading `XCUserData` - Multiple `XCUserData` elements can be optionally added to generated projects - By default `XCUserData` and its nested elements are only replaced if explicitly specified, however if left unspecified any elements on disk are left as is - This was a conscious choice to support project generation workflows where users may have custom local schemes / breakpoints etc... which shouldn't get erased when projects are re-generated - Updated path handling for some of the common elements (e.e. breakpoints, schemes, etc...) to allow sharing logic between shared data and user data --- CHANGELOG.md | 2 + Fixtures/Schemes/xcschememanagement.plist | 4 +- .../xcdebugger/Breakpoints_v2.xcbkptlist | 8 ++ .../xcshareddata/xcschemes/iOS.xcscheme | 55 ++++---- .../xcdebugger/Breakpoints_v2.xcbkptlist | 41 ++++++ .../xcschemes/iOS-debug.xcscheme | 58 +++++++++ .../xcschemes/iOS-other.xcscheme | 58 +++++++++ .../xcschemes/iOS-release.xcscheme | 58 +++++++++ .../xcschemes/xcschememanagement.plist | 45 +++++++ .../xcschemes/iOSTests.xcscheme | 55 ++++++++ .../xcschemes/custom-scheme.xcscheme | 58 +++++++++ Sources/XcodeProj/Errors/Errors.swift | 16 +++ .../XcodeProj/Project/XCBreakpointList.swift | 10 ++ Sources/XcodeProj/Project/XCDebugger.swift | 13 ++ Sources/XcodeProj/Project/XCSharedData.swift | 52 +++++++- Sources/XcodeProj/Project/XCUserData.swift | 117 ++++++++++++++++++ Sources/XcodeProj/Project/XcodeProj.swift | 91 ++++++++++---- Sources/XcodeProj/Scheme/XCScheme.swift | 19 +++ .../XcodeProj/Scheme/XCSchemeManagement.swift | 25 +++- .../Project/XCUserDataTests.swift | 42 +++++++ .../Project/XcodeProjTests.swift | 60 +++++++++ .../Scheme/XCSchemeManagementTests.swift | 17 ++- .../XcodeProjTests/Scheme/XCSchemeTests.swift | 5 + Tests/XcodeProjTests/Tests/testWrite.swift | 30 +++++ 24 files changed, 871 insertions(+), 68 deletions(-) create mode 100644 Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist create mode 100644 Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-debug.xcscheme create mode 100644 Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-other.xcscheme create mode 100644 Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-release.xcscheme create mode 100644 Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 Fixtures/iOS/Project.xcodeproj/xcuserdata/username2.xcuserdatad/xcschemes/iOSTests.xcscheme create mode 100644 Fixtures/iOS/Project.xcodeproj/xcuserdata/username3.xcuserdatad/xcschemes/custom-scheme.xcscheme create mode 100644 Sources/XcodeProj/Project/XCDebugger.swift create mode 100644 Sources/XcodeProj/Project/XCUserData.swift create mode 100644 Tests/XcodeProjTests/Project/XCUserDataTests.swift create mode 100644 Tests/XcodeProjTests/Project/XcodeProjTests.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 33c42c9d7..f7591ba6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next +- Add XCUserData [#739](https://github.com/tuist/XcodeProj/pull/739) by [@teameh](https://github.com/teameh) + ## 8.8.0 ### Fixed diff --git a/Fixtures/Schemes/xcschememanagement.plist b/Fixtures/Schemes/xcschememanagement.plist index 7a0865f0c..44373b956 100644 --- a/Fixtures/Schemes/xcschememanagement.plist +++ b/Fixtures/Schemes/xcschememanagement.plist @@ -6,10 +6,10 @@ Tuist.xcscheme_^#shared#^_ + isShown + orderHint 0 - isShown - XcodeProj.xcscheme diff --git a/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcdebugger/Breakpoints_v2.xcbkptlist b/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcdebugger/Breakpoints_v2.xcbkptlist index a03326804..931805c0a 100644 --- a/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcdebugger/Breakpoints_v2.xcbkptlist @@ -17,6 +17,8 @@ + + + + + + + + diff --git a/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme b/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme index 441f0e3b2..fb8299e4a 100644 --- a/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme +++ b/Fixtures/iOS/Project.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme @@ -45,9 +45,9 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES" codeCoverageEnabled = "YES" - onlyGenerateCoverageForSpecifiedTargets = "YES" - shouldUseLaunchSchemeArgsEnv = "YES"> + onlyGenerateCoverageForSpecifiedTargets = "YES"> @@ -80,6 +80,12 @@ + + + + + + + + + + - - - - - - - - - - + allowLocationSimulation = "YES" + customLaunchCommand = "custom command"> @@ -178,6 +179,10 @@ ReferencedContainer = "container:Project.xcodeproj">
+ + - - + identifier = "../../Configuration.storekit"> + + + + + + + + + + + + + + + + + + + + diff --git a/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-debug.xcscheme b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-debug.xcscheme new file mode 100644 index 000000000..7cb38d44f --- /dev/null +++ b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-debug.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-other.xcscheme b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-other.xcscheme new file mode 100644 index 000000000..7cb38d44f --- /dev/null +++ b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-other.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-release.xcscheme b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-release.xcscheme new file mode 100644 index 000000000..3549252de --- /dev/null +++ b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/iOS-release.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/xcschememanagement.plist b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 000000000..0bcfc80ee --- /dev/null +++ b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,45 @@ + + + + + SchemeUserState + + Rx (Playground) 1.xcscheme + + isShown + + orderHint + 5 + + Rx (Playground) 2.xcscheme + + isShown + + orderHint + 6 + + Rx (Playground).xcscheme + + isShown + + orderHint + 4 + + iOS-debug.xcscheme + + orderHint + 0 + + iOS-release.xcscheme + + orderHint + 1 + + iOS.xcscheme_^#shared#^_ + + orderHint + 3 + + + + diff --git a/Fixtures/iOS/Project.xcodeproj/xcuserdata/username2.xcuserdatad/xcschemes/iOSTests.xcscheme b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username2.xcuserdatad/xcschemes/iOSTests.xcscheme new file mode 100644 index 000000000..972b4579e --- /dev/null +++ b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username2.xcuserdatad/xcschemes/iOSTests.xcscheme @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Fixtures/iOS/Project.xcodeproj/xcuserdata/username3.xcuserdatad/xcschemes/custom-scheme.xcscheme b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username3.xcuserdatad/xcschemes/custom-scheme.xcscheme new file mode 100644 index 000000000..7cb38d44f --- /dev/null +++ b/Fixtures/iOS/Project.xcodeproj/xcuserdata/username3.xcuserdatad/xcschemes/custom-scheme.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/XcodeProj/Errors/Errors.swift b/Sources/XcodeProj/Errors/Errors.swift index 1b781e8b4..6554f83fa 100644 --- a/Sources/XcodeProj/Errors/Errors.swift +++ b/Sources/XcodeProj/Errors/Errors.swift @@ -41,6 +41,22 @@ public enum XCSharedDataError: Error, CustomStringConvertible { } } +// MARK: - XCUserData + +/// XCUserData errors. +/// +/// - notFound: the user data hasn't been found. +public enum XCUserDataError: Error, CustomStringConvertible { + case notFound(path: Path) + + public var description: String { + switch self { + case let .notFound(path): + return "xcuserdata not found at path \(path.string)" + } + } +} + // MARK: - XCWorkspace /// XCWorkspace Errors diff --git a/Sources/XcodeProj/Project/XCBreakpointList.swift b/Sources/XcodeProj/Project/XCBreakpointList.swift index fb76ff74e..60b5b8ff7 100644 --- a/Sources/XcodeProj/Project/XCBreakpointList.swift +++ b/Sources/XcodeProj/Project/XCBreakpointList.swift @@ -426,3 +426,13 @@ public final class XCBreakpointList: Equatable, Writable { lhs.version == rhs.version } } + +extension XCBreakpointList { + /// Returns breakpoints plist path relative to the given path. + /// + /// - Parameter path: debugger folder + /// - Returns: breakpoints plist path relative to the given path. + public static func path(_ path: Path) -> Path { + path + "Breakpoints_v2.xcbkptlist" + } +} diff --git a/Sources/XcodeProj/Project/XCDebugger.swift b/Sources/XcodeProj/Project/XCDebugger.swift new file mode 100644 index 000000000..ce79058aa --- /dev/null +++ b/Sources/XcodeProj/Project/XCDebugger.swift @@ -0,0 +1,13 @@ +import AEXML +import Foundation +import PathKit + +enum XCDebugger { + /// Returns debugger folder path relative to the given path. + /// + /// - Parameter path: parent folder of debugger folder (xcshareddata or xcuserdata) + /// - Returns: debugger folder path relative to the given path. + public static func path(_ path: Path) -> Path { + path + "xcdebugger" + } +} diff --git a/Sources/XcodeProj/Project/XCSharedData.swift b/Sources/XcodeProj/Project/XCSharedData.swift index 18d788efd..ffc8ee4e7 100644 --- a/Sources/XcodeProj/Project/XCSharedData.swift +++ b/Sources/XcodeProj/Project/XCSharedData.swift @@ -1,7 +1,7 @@ import Foundation import PathKit -public final class XCSharedData: Equatable { +public final class XCSharedData: Equatable, Writable { // MARK: - Attributes /// Shared data schemes. @@ -36,9 +36,11 @@ public final class XCSharedData: Equatable { if !path.exists { throw XCSharedDataError.notFound(path: path) } - schemes = path.glob("xcschemes/*.xcscheme") + schemes = XCScheme.schemesPath(path) + .glob("*.xcscheme") .compactMap { try? XCScheme(path: $0) } - breakpoints = try? XCBreakpointList(path: path + "xcdebugger/Breakpoints_v2.xcbkptlist") + + breakpoints = try? XCBreakpointList(path: XCBreakpointList.path(XCDebugger.path(path))) let workspaceSettingsPath = path + "WorkspaceSettings.xcsettings" if workspaceSettingsPath.exists { @@ -55,4 +57,48 @@ public final class XCSharedData: Equatable { lhs.breakpoints == rhs.breakpoints && lhs.workspaceSettings == rhs.workspaceSettings } + + // MARK: - Writable + + public func write(path: Path, override: Bool) throws { + try writeSchemes(path: path, override: override) + try writeBreakpoints(path: path, override: override) + } + + func writeSchemes(path: Path, override: Bool) throws { + let schemesPath = XCScheme.schemesPath(path) + if override, schemesPath.exists { + try schemesPath.delete() + } + + guard !schemes.isEmpty else { return } + + try schemesPath.mkpath() + for scheme in schemes { + let schemePath = XCScheme.path(path, schemeName: scheme.name) + try scheme.write(path: schemePath, override: override) + } + } + + func writeBreakpoints(path: Path, override: Bool) throws { + let debuggerPath = XCDebugger.path(path) + if override, debuggerPath.exists { + try debuggerPath.delete() + } + + guard let breakpoints = breakpoints else { return } + + try debuggerPath.mkpath() + try breakpoints.write(path: XCBreakpointList.path(debuggerPath), override: override) + } +} + +extension XCSharedData { + /// Returns shared data path relative to the given path. + /// + /// - Parameter path: `.xcodeproj` file path + /// - Returns: shared data path relative to the given path. + public static func path(_ path: Path) -> Path { + path + "xcshareddata" + } } diff --git a/Sources/XcodeProj/Project/XCUserData.swift b/Sources/XcodeProj/Project/XCUserData.swift new file mode 100644 index 000000000..1d3bf328d --- /dev/null +++ b/Sources/XcodeProj/Project/XCUserData.swift @@ -0,0 +1,117 @@ +import Foundation +import PathKit +import AEXML + +public final class XCUserData: Equatable, Writable { + // MARK: - Attributes + + /// User name + public var userName: String + + /// User data schemes. + public var schemes: [XCScheme] + + /// Metdata for schemes + public var schemeManagement: XCSchemeManagement? + + /// User data breakpoints. + public var breakpoints: XCBreakpointList? + + // MARK: - Init + + /// Initializes the shared data with its properties. + /// + /// - Parameters: + /// - userName: User name + /// - schemes: User data schemes. + /// - breakpoints: User data breakpoints. + /// - schemeManagement: Metdata for schemes + public init(userName: String, + schemes: [XCScheme], + breakpoints: XCBreakpointList? = nil, + schemeManagement: XCSchemeManagement? = nil) { + self.userName = userName + self.schemes = schemes + self.breakpoints = breakpoints + self.schemeManagement = schemeManagement + } + + /// Initializes the XCUserData reading the content from the disk. + /// + /// - Parameter path: path where the .xcuserdatad is. + public init(path: Path) throws { + if !path.exists { + throw XCUserDataError.notFound(path: path) + } + userName = path.lastComponentWithoutExtension + + let schemesPath = XCScheme.schemesPath(path) + schemes = schemesPath + .glob("*.xcscheme") + .compactMap { try? XCScheme(path: $0) } + schemeManagement = try? XCSchemeManagement(path: XCSchemeManagement.path(schemesPath)) + + breakpoints = try? XCBreakpointList(path: XCBreakpointList.path(XCDebugger.path(path))) + } + + // MARK: - Equatable + + public static func == (lhs: XCUserData, rhs: XCUserData) -> Bool { + lhs.userName == rhs.userName && + lhs.schemes == rhs.schemes && + lhs.breakpoints == rhs.breakpoints && + lhs.schemeManagement == rhs.schemeManagement + } + + // MARK: - Writable + + public func write(path: Path, override: Bool) throws { + try writeSchemes(path: path, override: override) + try writeBreakpoints(path: path, override: override) + try writeSchemeManagement(path: path, override: override) + } + + func writeSchemes(path: Path, override: Bool) throws { + guard !schemes.isEmpty else { return } + + try XCScheme.schemesPath(path).mkpath() + for scheme in schemes { + let schemePath = XCScheme.path(path, schemeName: scheme.name) + try scheme.write(path: schemePath, override: override) + } + } + + func writeSchemeManagement(path: Path, override: Bool) throws { + guard let schemeManagement = schemeManagement else { return } + + let schemesPath = XCScheme.schemesPath(path) + try schemesPath.mkpath() + try schemeManagement.write(path: XCSchemeManagement.path(schemesPath), override: override) + } + + func writeBreakpoints(path: Path, override: Bool) throws { + guard let breakpoints = breakpoints else { return } + + let debuggerPath = XCDebugger.path(path) + try debuggerPath.mkpath() + try breakpoints.write(path: XCBreakpointList.path(debuggerPath), override: override) + } +} + +extension XCUserData { + /// Returns user data path relative to the given path. + /// + /// - Parameter path: `.xcodeproj` file path + /// - Returns: user data path relative to the given path. + public static func path(_ path: Path) -> Path { + path + "xcuserdata" + } + + /// Returns user data path for a specific user relative to the given path. + /// + /// - Parameter path: `.xcodeproj` file path + /// - Returns: user data path relative to the given path. + public static func path(_ path: Path, userName: String) -> Path { + XCUserData.path(path) + "\(userName).xcuserdatad" + } +} diff --git a/Sources/XcodeProj/Project/XcodeProj.swift b/Sources/XcodeProj/Project/XcodeProj.swift index e373ce40c..83734f246 100644 --- a/Sources/XcodeProj/Project/XcodeProj.swift +++ b/Sources/XcodeProj/Project/XcodeProj.swift @@ -14,12 +14,16 @@ public final class XcodeProj: Equatable { /// Shared data. public var sharedData: XCSharedData? + /// User data. + public var userData: [XCUserData] + // MARK: - Init public init(path: Path) throws { var pbxproj: PBXProj! var workspace: XCWorkspace! var sharedData: XCSharedData? + var userData: [XCUserData] if !path.exists { throw XCodeProjError.notFound(path: path) } guard let pbxprojPath = path.glob("*.pbxproj").first else { @@ -35,9 +39,14 @@ public final class XcodeProj: Equatable { let sharedDataPath = path + "xcshareddata" sharedData = try? XCSharedData(path: sharedDataPath) + userData = XCUserData.path(path) + .glob("*.xcuserdatad") + .compactMap { try? XCUserData(path: $0) } + self.pbxproj = pbxproj self.workspace = workspace self.sharedData = sharedData + self.userData = userData } public convenience init(pathString: String) throws { @@ -49,10 +58,16 @@ public final class XcodeProj: Equatable { /// - Parameters: /// - workspace: project internal workspace. /// - pbxproj: project .pbxproj. - public init(workspace: XCWorkspace, pbxproj: PBXProj, sharedData: XCSharedData? = nil) { + /// - sharedData: shared data + /// - userData: user data + public init(workspace: XCWorkspace, + pbxproj: PBXProj, + sharedData: XCSharedData? = nil, + userData: [XCUserData] = []) { self.workspace = workspace self.pbxproj = pbxproj self.sharedData = sharedData + self.userData = userData } // MARK: - Equatable @@ -60,7 +75,8 @@ public final class XcodeProj: Equatable { public static func == (lhs: XcodeProj, rhs: XcodeProj) -> Bool { lhs.workspace == rhs.workspace && lhs.pbxproj == rhs.pbxproj && - lhs.sharedData == rhs.sharedData + lhs.sharedData == rhs.sharedData && + lhs.userData == rhs.userData } } @@ -86,8 +102,8 @@ extension XcodeProj: Writable { try path.mkpath() try writeWorkspace(path: path, override: override) try writePBXProj(path: path, override: override, outputSettings: outputSettings) - try writeSchemes(path: path, override: override) - try writeBreakPoints(path: path, override: override) + try writeSharedData(path: path, override: override) + try writeUserData(path: path, override: override) } /// Returns workspace file path relative to the given path. @@ -130,24 +146,48 @@ extension XcodeProj: Writable { /// - Parameter path: `.xcodeproj` file path /// - Returns: shared data path relative to the given path. public static func sharedDataPath(_ path: Path) -> Path { - path + "xcshareddata" + XCSharedData.path(path) + } + + /// Writes shared data to the given path. + /// + /// - Parameter path: path to `.xcodeproj` file. + /// - Parameter override: if shared data should be overridden. Default is true. + /// - Parameter outputSettings: Controls the writing of various files. + /// If false will throw error if shared data already exists at the given path. + public func writeSharedData(path: Path, override: Bool = true) throws { + try sharedData?.write(path: XCSharedData.path(path), override: override) } - /// Returns schemes folder path relative to the given path. + /// Writes user data to the given path. + /// + /// - Parameter path: path to `.xcodeproj` file. + /// - Parameter override: if user data should be overridden. Default is true. + /// - Parameter outputSettings: Controls the writing of various files. + /// If false will throw error if user data already exists at the given path. + public func writeUserData(path: Path, override: Bool = true) throws { + for userData in userData { + try userData.write(path: XCUserData.path(path, userName: userData.userName), override: override) + } + } + + /// Returns shared schemes folder path relative to the given path. /// /// - Parameter path: `.xcodeproj` file path /// - Returns: schemes folder path relative to the given path. + @available(*, deprecated, message: "use XCScheme.schemesPath(path:)") public static func schemesPath(_ path: Path) -> Path { - XcodeProj.sharedDataPath(path) + "xcschemes" + XCScheme.schemesPath(sharedDataPath(path)) } - /// Returns scheme file path relative to the given path. + /// Returns shared scheme file path relative to the given path. /// /// - Parameter path: `.xcodeproj` file path /// - Parameter schemeName: scheme name /// - Returns: scheme file path relative to the given path. + @available(*, deprecated, message: "use XCScheme.path(path:schemeName)") public static func schemePath(_ path: Path, schemeName: String) -> Path { - XcodeProj.schemesPath(path) + "\(schemeName).xcscheme" + XCScheme.path(schemesPath(path), schemeName: schemeName) } /// Writes all project schemes to the given path. @@ -157,34 +197,32 @@ extension XcodeProj: Writable { /// If true will remove all existing schemes before writing. /// If false will throw error if scheme already exists at the given path. public func writeSchemes(path: Path, override: Bool = true) throws { - guard let sharedData = sharedData else { return } + try sharedData?.writeSchemes(path: XCSharedData.path(path), override: override) - let schemesPath = XcodeProj.schemesPath(path) - if override, schemesPath.exists { - try schemesPath.delete() - } - try schemesPath.mkpath() - for scheme in sharedData.schemes { - try scheme.write(path: XcodeProj.schemePath(path, schemeName: scheme.name), override: override) + for userData in userData { + let userDataPath = XCUserData.path(path, userName: userData.userName) + try userData.writeSchemes(path: userDataPath, override: override) } } - /// Returns debugger folder path relative to the given path. + /// Returns shared debugger folder path relative to the given path. /// /// - Parameter path: `.xcodeproj` file path /// - Parameter schemeName: scheme name /// - Returns: debugger folder path relative to the given path. + @available(*, deprecated, message: "use XCDebugger.path(path:)") public static func debuggerPath(_ path: Path) -> Path { - XcodeProj.sharedDataPath(path) + "xcdebugger" + XCDebugger.path(XCSharedData.path(path)) } - /// Returns breakpoints plist path relative to the given path. + /// Returns shared breakpoints plist path relative to the given path. /// /// - Parameter path: `.xcodeproj` file path /// - Parameter schemeName: scheme name /// - Returns: breakpoints plist path relative to the given path. + @available(*, deprecated, message: "use XCBreakpointList.path(path:)") public static func breakPointsPath(_ path: Path) -> Path { - XcodeProj.debuggerPath(path) + "Breakpoints_v2.xcbkptlist" + XCBreakpointList.path(debuggerPath(path)) } /// Writes all project breakpoints to the given path. @@ -194,13 +232,12 @@ extension XcodeProj: Writable { /// If true will remove all existing debugger data before writing. /// If false will throw error if breakpoints file exists at the given path. public func writeBreakPoints(path: Path, override: Bool = true) throws { - guard let sharedData = sharedData else { return } + let sharedDataPath = XcodeProj.sharedDataPath(path) + try sharedData?.writeBreakpoints(path: sharedDataPath, override: override) - let debuggerPath = XcodeProj.debuggerPath(path) - if override, debuggerPath.exists { - try debuggerPath.delete() + for userData in userData { + let userDataPath = XCUserData.path(path, userName: userData.userName) + try userData.writeBreakpoints(path: userDataPath, override: override) } - try debuggerPath.mkpath() - try sharedData.breakpoints?.write(path: XcodeProj.breakPointsPath(path), override: override) } } diff --git a/Sources/XcodeProj/Scheme/XCScheme.swift b/Sources/XcodeProj/Scheme/XCScheme.swift index 14f1989c5..c64a8e0fb 100644 --- a/Sources/XcodeProj/Scheme/XCScheme.swift +++ b/Sources/XcodeProj/Scheme/XCScheme.swift @@ -130,3 +130,22 @@ public final class XCScheme: Writable, Equatable { lhs.wasCreatedForAppExtension == rhs.wasCreatedForAppExtension } } + +extension XCScheme { + /// Returns schemes folder path relative to the given path. + /// + /// - Parameter path: parent folder of schemes folder (xcshareddata or xcuserdata) + /// - Returns: schemes folder path relative to the given path. + static func schemesPath(_ path: Path) -> Path { + path + "xcschemes" + } + + /// Returns scheme file path relative to the given path. + /// + /// - Parameter path: parent folder of schemes folder (xcshareddata or xcuserdata) + /// - Parameter schemeName: scheme name + /// - Returns: scheme file path relative to the given path. + static func path(_ path: Path, schemeName: String) -> Path { + XCScheme.schemesPath(path) + "\(schemeName).xcscheme" + } +} diff --git a/Sources/XcodeProj/Scheme/XCSchemeManagement.swift b/Sources/XcodeProj/Scheme/XCSchemeManagement.swift index 838bf4ab6..61bbe5c6b 100644 --- a/Sources/XcodeProj/Scheme/XCSchemeManagement.swift +++ b/Sources/XcodeProj/Scheme/XCSchemeManagement.swift @@ -20,8 +20,7 @@ public enum XCSchemeManagementError: Error, Equatable, LocalizedError, CustomStr /// This struct represents the xcschememanagement.plist file that is generated by Xcode /// to attach metdata to schemes such as the order of schemes orwhether a scheme is shared or no. /// The file is formatted as a property list file. -public struct XCSchemeManagement: Codable { - +public struct XCSchemeManagement: Codable, Equatable, Writable { public struct AutocreationBuildable: Equatable, Codable { var primary: Bool } @@ -95,7 +94,6 @@ public struct XCSchemeManagement: Codable { } } - /// Coding keys. public enum CodingKeys: String, CodingKey { case schemeUserState = "SchemeUserState" @@ -108,7 +106,6 @@ public struct XCSchemeManagement: Codable { /// A dictionary where the key is the object reference of the target, and the value the configuration for auto-creating schemes. public var suppressBuildableAutocreation: [String: XCSchemeManagement.AutocreationBuildable]? - /// Default constructor. /// - Parameters: /// - schemeUserState: An array that contains the configuration of the schemes. @@ -132,12 +129,20 @@ public struct XCSchemeManagement: Codable { /// Converts the object into a property list and writes it at the given path. /// - Parameter path: Path to the file where it should be written. + /// - Parameter override: if project should be overridden. Default is false. + /// If true will remove all existing data before writing. + /// If false will throw error iff file exists at the given path. /// - Throws: An error if the write fails. - public func write(path: Path) throws { + public func write(path: Path, override: Bool = false) throws { + if override, path.exists { + try path.delete() + } + let encoder = PropertyListEncoder() encoder.outputFormat = .xml try encoder.encode(self).write(to: path.url) } + // MARK: - Codable public init(from decoder: Decoder) throws { @@ -176,3 +181,13 @@ public struct XCSchemeManagement: Codable { } } } + +extension XCSchemeManagement { + /// Returns scheme management file path relative to the given path. + /// + /// - Parameter path: schemes folder + /// - Returns: scheme management plist path relative to the given path. + static func path(_ path: Path) -> Path { + path + "xcschememanagement.plist" + } +} diff --git a/Tests/XcodeProjTests/Project/XCUserDataTests.swift b/Tests/XcodeProjTests/Project/XCUserDataTests.swift new file mode 100644 index 000000000..36fb1ff36 --- /dev/null +++ b/Tests/XcodeProjTests/Project/XCUserDataTests.swift @@ -0,0 +1,42 @@ +import Foundation +import PathKit +import XCTest +@testable import XcodeProj + +final class XCUserDataTests: XCTestCase { + func test_read_userData() throws { + let subject = try XCUserData(path: userDataPath) + assert(userData: subject, userName: "username1") + } + + func test_write_userData() { + testWrite(from: userDataPath, + initModel: { try? XCUserData(path: $0) }, + modify: { userData in + // XCScheme's that are already in place (the removed element) should not be removed by a write + userData.schemes = userData.schemes.filter { $0.name != "iOS-other"} + return userData + }, + assertion: { + assert(userData: $1, userName: "copy") + }) + } + + func test_read_write_produces_no_diff() throws { + try testReadWriteProducesNoDiff(from: userDataPath, + initModel: XCUserData.init(path:)) + } + + // MARK: - Private + + private func assert(userData: XCUserData, userName: String) { + XCTAssertEqual(userData.userName, userName) + XCTAssertEqual(userData.schemes.count, 3) + XCTAssertEqual(userData.breakpoints?.breakpoints.count, 2) + XCTAssertEqual(userData.schemeManagement?.schemeUserState?.count, 6) + } + + private var userDataPath: Path { + fixturesPath() + "iOS/Project.xcodeproj/xcuserdata/username1.xcuserdatad" + } +} diff --git a/Tests/XcodeProjTests/Project/XcodeProjTests.swift b/Tests/XcodeProjTests/Project/XcodeProjTests.swift new file mode 100644 index 000000000..3c8507d3e --- /dev/null +++ b/Tests/XcodeProjTests/Project/XcodeProjTests.swift @@ -0,0 +1,60 @@ +import Foundation +import PathKit +import XCTest +@testable import XcodeProj + +final class XcodeProjIntegrationTests: XCTestCase { + func test_read_iosXcodeProj() throws { + let subject = try XcodeProj(path: iosProjectPath) + assert(project: subject) + } + + func test_write_iosXcodeProj() { + testWrite(from: iosProjectPath, + initModel: { try? XcodeProj(path: $0) }, + modify: { project in + // XCUserData that is already in place (the removed element) should not be removed by a write + _ = project.userData.removeLast() + return project + }, + assertion: { assert(project: $1) }) + } + + func test_read_write_produces_no_diff() throws { + try testReadWriteProducesNoDiff(from: iosProjectPath, + initModel: XcodeProj.init(path:)) + } + + // MARK: - Private + + private func assert(project: XcodeProj) { + // Workspace + XCTAssertEqual(project.workspace.data.children.count, 1) + + // Project + XCTAssertEqual(project.pbxproj.objects.buildFiles.count, 13) + + // Shared Data + XCTAssertNotNil(project.sharedData) + XCTAssertEqual(project.sharedData?.schemes.count, 1) + XCTAssertNotNil(project.sharedData?.breakpoints) + XCTAssertNil(project.sharedData?.workspaceSettings) + + // User Data + XCTAssertEqual(project.userData.count, 3) + + XCTAssertEqual(project.userData[0].userName, "username1") + XCTAssertEqual(project.userData[0].schemes.count, 3) + XCTAssertEqual(project.userData[0].breakpoints?.breakpoints.count, 2) + XCTAssertNotNil(project.userData[0].schemeManagement) + + XCTAssertEqual(project.userData[1].userName, "username2") + XCTAssertEqual(project.userData[1].schemes.count, 1) + XCTAssertNil(project.userData[1].breakpoints?.breakpoints) + XCTAssertNil(project.userData[1].schemeManagement) + } + + private var iosProjectPath: Path { + fixturesPath() + "iOS/Project.xcodeproj" + } +} diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift index 5b42b50de..06c93307c 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift @@ -7,7 +7,7 @@ import PathKit final class XCSchemeManagementTests: XCTestCase { func test_init_from_path() throws { // Given - let path = fixturesPath() + "Schemes/xcschememanagement.plist" + let path = xcschememanagementPath // When let got = try XCSchemeManagement.init(path: path) @@ -28,7 +28,12 @@ final class XCSchemeManagementTests: XCTestCase { XCTAssertNil(xcodeprojScheme.isShown) XCTAssertEqual(xcodeprojScheme.orderHint, 1) } - + + func test_read_write_produces_no_diff() throws { + try testReadWriteProducesNoDiff(from: xcschememanagementPath, + initModel: XCSchemeManagement.init(path:)) + } + func test_write_produces_no_diff() throws { let tmpDir = try Path.uniqueTemporary() defer { @@ -40,7 +45,7 @@ final class XCSchemeManagementTests: XCTestCase { let plistPath = tmpDir + "xcschememanagement.plist" let subject = XCSchemeManagement(schemeUserState: [.init(name: "Test.xcscheme", shared: true, orderHint: 0, isShown: true)], suppressBuildableAutocreation: ["E525238B16245A900012E2BA": .init(primary: true)]) - try subject.write(path: plistPath) + try subject.write(path: plistPath, override: true) // Create a commit try checkedOutput("git", ["init"]) @@ -48,10 +53,14 @@ final class XCSchemeManagementTests: XCTestCase { try checkedOutput("git", ["commit", "-m", "test"]) // Write again - try subject.write(path: plistPath) + try subject.write(path: plistPath, override: true) let got = try checkedOutput("git", ["status"]) XCTAssertTrue(got?.contains("nothing to commit") ?? false) } } + + private var xcschememanagementPath: Path { + fixturesPath() + "Schemes/xcschememanagement.plist" + } } diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift index 86680b14e..3d1f16112 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeTests.swift @@ -16,6 +16,11 @@ final class XCSchemeIntegrationTests: XCTestCase { assertion: { assert(scheme: $1) }) } + func test_read_write_produces_no_diff() throws { + try testReadWriteProducesNoDiff(from: iosSchemePath, + initModel: XCScheme.init(path:)) + } + func test_read_runnableWithoutBuildableReferenceScheme() { let subject = try? XCScheme(path: runnableWithoutBuildableReferenceSchemePath) diff --git a/Tests/XcodeProjTests/Tests/testWrite.swift b/Tests/XcodeProjTests/Tests/testWrite.swift index 47bb10142..01e8ebfc3 100644 --- a/Tests/XcodeProjTests/Tests/testWrite.swift +++ b/Tests/XcodeProjTests/Tests/testWrite.swift @@ -37,3 +37,33 @@ func testWrite(file: StaticString = #file, } try? copyPath.delete() } + +func testReadWriteProducesNoDiff(file: StaticString = #file, + line: UInt = #line, + from path: Path, + initModel: (Path) throws -> T) throws { + let tmpDir = try Path.uniqueTemporary() + defer { + try? tmpDir.delete() + } + + let fileName = path.lastComponent + let tmpPath = tmpDir + fileName + try path.copy(tmpPath) + + try tmpDir.chdir { + // Create a commit + try checkedOutput("git", ["init"]) + try checkedOutput("git", ["add", "."]) + try checkedOutput("git", [ + "-c", "user.email=test@example.com", "-c", "user.name=Test User", + "commit", "-m", "test" + ]) + + let object = try initModel(tmpPath) + try object.write(path: tmpPath, override: true) + + let diff = try XCTUnwrap(try checkedOutput("git", ["diff"])) + XCTAssertEqual(diff, "") + } +} From 8acb7fa0ccfc42fee60afb2b413411a4cba84b50 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:03:46 +0100 Subject: [PATCH 129/143] docs: add technocidal as a contributor for code (#735) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Kas --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 152b10d00..009cfbbf7 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -238,6 +238,15 @@ "contributions": [ "code" ] + }, + { + "login": "technocidal", + "name": "Johannes Ebeling", + "avatar_url": "https://avatars.githubusercontent.com/u/14994778?v=4", + "profile": "https://technocidal.com", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index ef35173c7..79b65ccc0 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d C-凑
C-凑

πŸ’» Maxwell Elliott
Maxwell Elliott

πŸ’» Brentley Jones
Brentley Jones

πŸ’» + Johannes Ebeling
Johannes Ebeling

πŸ’» Teameh
Teameh

πŸ’» From fae27b48bc14ff3fd9b02902e48c4665ce5a0793 Mon Sep 17 00:00:00 2001 From: Daniele Formichelli Date: Sat, 18 Feb 2023 13:50:08 +0100 Subject: [PATCH 130/143] Version 8.9.0 --- CHANGELOG.md | 11 +++++++++-- README.md | 2 +- xcodeproj.podspec | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7591ba6c..3b93fdb13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,15 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) -## Next +## 8.9.0 -- Add XCUserData [#739](https://github.com/tuist/XcodeProj/pull/739) by [@teameh](https://github.com/teameh) +### Added + +- Update watchOS application default settings for Xcode 14 [#711](https://github.com/tuist/XcodeProj/pull/711) by [@kwridan](https://github.com/kwridan) +- Implement `Hashable` for `XCScheme.BuildableReference` [#712](https://github.com/tuist/XcodeProj/pull/712) by [@cgrindel](https://github.com/cgrindel) +- Sets customWorkingDirectory for schemes [#720](https://github.com/tuist/XcodeProj/pull/720) by [@maxwellE](https://github.com/maxwellE) +- Add `XCScheme.ExecutionAction.shellToInvoke` [#721](https://github.com/tuist/XcodeProj/pull/721) by [@CrazyFanFan](https://github.com/CrazyFanFan) +- Add `platformFilters` attribute to `PBXBuildFile` and `PBXTargetDependency` [#737](https://github.com/tuist/XcodeProj/pull/737) by [@maxwellE](https://github.com/maxwellE) +- Add suppot for `XCUserData` [#739](https://github.com/tuist/XcodeProj/pull/739) by [@teameh](https://github.com/teameh) ## 8.8.0 diff --git a/README.md b/README.md index 79b65ccc0..5cbfac3ae 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Add the dependency in your `Package.swift` file: let package = Package( name: "myproject", dependencies: [ - .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.8.0")), + .package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.9.0")), ], targets: [ .target( diff --git a/xcodeproj.podspec b/xcodeproj.podspec index 405c05e22..e4b808233 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.8.0' + s.version = '8.9.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From b81dbc4a553e54037c3d77ef97c0ca189aeb3e7f Mon Sep 17 00:00:00 2001 From: Daniele Formichelli Date: Sat, 18 Feb 2023 13:55:06 +0100 Subject: [PATCH 131/143] fix RELEASE step --- RELEASE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE.md b/RELEASE.md index 352089c77..f8b829879 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -6,7 +6,7 @@ In this document you'll find all the necessary steps to release a new version of 2. Determine the next version based on the unreleased changes. 3. Add the version section to the `CHANGELOG.md`, update the versions in the `README.md` and the `xcodeproj.podspec` file. 4. Commit the changes and tag them `git commit -m "Version x.y.z"` & `git tag x.y.z`. -5. Push the changes `git commit push origin main --tags` +5. Push the changes `git push origin main --tags` 6. Update Carthage dependencies by running `bundle exec rake carthage_update_dependencies`. 7. Generate the project by running `tuist generate`. 8. Run the release checks by running `bundle exec rake release_check`. From 0008426de59474fe642236083eb75b4a64abb7c8 Mon Sep 17 00:00:00 2001 From: Daniele Formichelli Date: Sat, 18 Feb 2023 14:21:31 +0100 Subject: [PATCH 132/143] fix release steps --- .ruby-version | 2 +- RELEASE.md | 2 +- Tests/XcodeProjTests/Project/XCUserDataTests.swift | 3 +-- .../Scheme/XCSchemeManagementTests.swift | 3 +-- XcodeProj_Carthage.xcodeproj/project.pbxproj | 14 ++++++++++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.ruby-version b/.ruby-version index 57cf282eb..1f7da99d4 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.5 +2.7.7 diff --git a/RELEASE.md b/RELEASE.md index f8b829879..9e9c4e925 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -12,4 +12,4 @@ In this document you'll find all the necessary steps to release a new version of 8. Run the release checks by running `bundle exec rake release_check`. 9. Publish a new version of the Pod by running `bundle exec pod trunk push --allow-warnings --verbose`. 10. Archive the Carthage binary by running `bundle exec rake archive_carthage`. -11. Create the release on GitHub including the release notes from the `CHANGELOG.md` and attach the archive `XcodeProj.framework.zip` generated by Carthage. +11. Create the release on GitHub including the release notes from the `CHANGELOG.md` and attach the archive `xcodeproj.framework.zip` generated by Carthage. diff --git a/Tests/XcodeProjTests/Project/XCUserDataTests.swift b/Tests/XcodeProjTests/Project/XCUserDataTests.swift index 36fb1ff36..0f3b76d01 100644 --- a/Tests/XcodeProjTests/Project/XCUserDataTests.swift +++ b/Tests/XcodeProjTests/Project/XCUserDataTests.swift @@ -23,8 +23,7 @@ final class XCUserDataTests: XCTestCase { } func test_read_write_produces_no_diff() throws { - try testReadWriteProducesNoDiff(from: userDataPath, - initModel: XCUserData.init(path:)) + try testReadWriteProducesNoDiff(from: userDataPath, initModel: XCUserData.init(path:)) } // MARK: - Private diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift index 06c93307c..161609409 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift @@ -30,8 +30,7 @@ final class XCSchemeManagementTests: XCTestCase { } func test_read_write_produces_no_diff() throws { - try testReadWriteProducesNoDiff(from: xcschememanagementPath, - initModel: XCSchemeManagement.init(path:)) + try testReadWriteProducesNoDiff(from: xcschememanagementPath, initModel: XCSchemeManagement.init(path:)) } func test_write_produces_no_diff() throws { diff --git a/XcodeProj_Carthage.xcodeproj/project.pbxproj b/XcodeProj_Carthage.xcodeproj/project.pbxproj index 1d1804141..d63d3eac4 100644 --- a/XcodeProj_Carthage.xcodeproj/project.pbxproj +++ b/XcodeProj_Carthage.xcodeproj/project.pbxproj @@ -25,6 +25,7 @@ 33C049021FCA541192F40AD1 /* XCWorkspaceDataFileRef.swift in Sources */ = {isa = PBXBuildFile; fileRef = B92DC66EE80F3D7611319ACC /* XCWorkspaceDataFileRef.swift */; }; 364C132E6ABF980BF9E84649 /* XCScheme+ProfileAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2E17A977543393ED7B848A9 /* XCScheme+ProfileAction.swift */; }; 3A59F800668B0D6F550B9C09 /* PBXGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 249AAF8AE1978D1546C0ADB5 /* PBXGroup.swift */; }; + 3AF2A0A0965EB5EC74923244 /* XCDebugger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26A96BC0C027BB173BC23C8D /* XCDebugger.swift */; }; 3D5DBC9A4315D97D1B39CF19 /* PBXProjEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41A031713D5F31DDCC2D61EF /* PBXProjEncoder.swift */; }; 3E2EE77196F6B2BECE8DF3DB /* BuildSettingsProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1977C44246CCF9C13AB856C2 /* BuildSettingsProvider.swift */; }; 468F48B3D19F3D1611181A2E /* XCSchemeManagement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69BA327A9CAF3CCFF60AD469 /* XCSchemeManagement.swift */; }; @@ -61,6 +62,7 @@ 84C672F79741BBA0937580EA /* Sourcery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A33AF969BDFF0250420A5E8 /* Sourcery.swift */; }; 8EE72814658F0A23A01AD1E6 /* XCBreakpointList.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC0BF3D061052148207584A5 /* XCBreakpointList.swift */; }; 903A9EC1B895A4920A322898 /* XCScheme+ArchiveAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66F7E3085922F586144F562A /* XCScheme+ArchiveAction.swift */; }; + 9D3FF6643048C116F1881471 /* XCUserData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D25A0190B14740F9DDDB98B /* XCUserData.swift */; }; 9D897705DD334A50C4431887 /* PBXBuildRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CD65FDAA9B3F4269F4AAF /* PBXBuildRule.swift */; }; 9DBF777FEB60396E520D2595 /* KeyedDecodingContainer+Additions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCF05523B52C542BC48C31 /* KeyedDecodingContainer+Additions.swift */; }; 9F27802B144AFC7C1A739492 /* PBXObjects.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CC513CEDABAA9712FB4DC6 /* PBXObjects.swift */; }; @@ -137,6 +139,7 @@ 20B1225FED6E1D49EE385AA0 /* XCScheme+EnvironmentVariable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCScheme+EnvironmentVariable.swift"; sourceTree = ""; }; 2370B4E19828CEFC032511A1 /* PBXContainerItemProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBXContainerItemProxy.swift; sourceTree = ""; }; 249AAF8AE1978D1546C0ADB5 /* PBXGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBXGroup.swift; sourceTree = ""; }; + 26A96BC0C027BB173BC23C8D /* XCDebugger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCDebugger.swift; sourceTree = ""; }; 26EF076F4983A1ABBD3CC81B /* XCScheme+PathRunnable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCScheme+PathRunnable.swift"; sourceTree = ""; }; 2B928006AD1C96D4D8072BD9 /* XCConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCConfig.swift; sourceTree = ""; }; 2BD1A6E5AC6502EDE59541C8 /* PBXNativeTarget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBXNativeTarget.swift; sourceTree = ""; }; @@ -165,6 +168,7 @@ 59F2F50C66ADD5D0C12F3B70 /* XCWorkspaceData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCWorkspaceData.swift; sourceTree = ""; }; 5A4A785AD26E7657312118B9 /* Writable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Writable.swift; sourceTree = ""; }; 5D13E332186D46FFA83BBD50 /* XCScheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCScheme.swift; sourceTree = ""; }; + 5D25A0190B14740F9DDDB98B /* XCUserData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCUserData.swift; sourceTree = ""; }; 6023B10EB151C2FF48E53395 /* Array+Extras.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Extras.swift"; sourceTree = ""; }; 60E927F019715C98BA849930 /* PBXBuildPhase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PBXBuildPhase.swift; sourceTree = ""; }; 66F7E3085922F586144F562A /* XCScheme+ArchiveAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCScheme+ArchiveAction.swift"; sourceTree = ""; }; @@ -454,9 +458,11 @@ children = ( 3353E37D0FBA49BA04C82476 /* WorkspaceSettings.swift */, CC0BF3D061052148207584A5 /* XCBreakpointList.swift */, + 26A96BC0C027BB173BC23C8D /* XCDebugger.swift */, A7DAFF5CC89FBB59D02F72B9 /* Xcode.swift */, F8B667CA83B0BB0285F470F1 /* XcodeProj.swift */, AF73D1E4C0B20C16D61865F6 /* XCSharedData.swift */, + 5D25A0190B14740F9DDDB98B /* XCUserData.swift */, ); path = Project; sourceTree = ""; @@ -640,7 +646,9 @@ D5DB78ED46F818640BC41A9D /* PBXTargetDependency.swift in Sources */, ED4BFA372B68053D67F0E379 /* WorkspaceSettings.swift in Sources */, 8EE72814658F0A23A01AD1E6 /* XCBreakpointList.swift in Sources */, + 3AF2A0A0965EB5EC74923244 /* XCDebugger.swift in Sources */, BEBC1583A85423F1F1BF3E30 /* XCSharedData.swift in Sources */, + 9D3FF6643048C116F1881471 /* XCUserData.swift in Sources */, CE58E51C93B8A19FA4F79E22 /* Xcode.swift in Sources */, E82A4CE0E0E385A2DED27887 /* XcodeProj.swift in Sources */, C333BEA47F06D2357DE8B1EA /* Writable.swift in Sources */, @@ -716,7 +724,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_COMPILATION_MODE = singlefile; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.6.1; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -757,6 +765,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -809,6 +818,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -860,7 +870,7 @@ SKIP_INSTALL = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 5.6.1; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; From 1c8daed114934a46236409843717ecd415cf511e Mon Sep 17 00:00:00 2001 From: Dayton Bobbitt <12210193+dayton-bobbitt@users.noreply.github.com> Date: Mon, 6 Mar 2023 09:50:12 -0600 Subject: [PATCH 133/143] Update XCSharedData Writable conformance to include WorkspaceSettings (#743) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves https://github.com/tuist/XcodeProj/issues/738 ### Short description πŸ“ - Update `XCSharedData` `Writable` conformance so that `WorkspaceSettings` are written. ### Solution πŸ“¦ - There was already a pattern defined for writing `XCSharedData` properties (`schemes` and `breakpoints`), and so I followed the same pattern to write the `workspaceSettings` property. --- .../XcodeProj/Project/WorkspaceSettings.swift | 6 ++++++ Sources/XcodeProj/Project/XCSharedData.swift | 15 +++++++++++++++ .../Project/XcodeProjTests.swift | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/Sources/XcodeProj/Project/WorkspaceSettings.swift b/Sources/XcodeProj/Project/WorkspaceSettings.swift index 4cf306b57..c8f775735 100644 --- a/Sources/XcodeProj/Project/WorkspaceSettings.swift +++ b/Sources/XcodeProj/Project/WorkspaceSettings.swift @@ -153,3 +153,9 @@ public class WorkspaceSettings: Codable, Equatable, Writable { try path.write(data) } } + +extension WorkspaceSettings { + static func path(_ path: Path) -> Path { + path + "WorkspaceSettings.xcsettings" + } +} diff --git a/Sources/XcodeProj/Project/XCSharedData.swift b/Sources/XcodeProj/Project/XCSharedData.swift index ffc8ee4e7..9469970c9 100644 --- a/Sources/XcodeProj/Project/XCSharedData.swift +++ b/Sources/XcodeProj/Project/XCSharedData.swift @@ -63,6 +63,7 @@ public final class XCSharedData: Equatable, Writable { public func write(path: Path, override: Bool) throws { try writeSchemes(path: path, override: override) try writeBreakpoints(path: path, override: override) + try writeWorkspaceSettings(path: path, override: override) } func writeSchemes(path: Path, override: Bool) throws { @@ -91,6 +92,20 @@ public final class XCSharedData: Equatable, Writable { try debuggerPath.mkpath() try breakpoints.write(path: XCBreakpointList.path(debuggerPath), override: override) } + + func writeWorkspaceSettings(path: Path, override: Bool) throws { + /** + * We don't want to delete this path when `override` is `true` because + * that will delete everything in the folder, including schemes and breakpoints. + * Instead, just create the path if it doesn't exist and let the `write` method + * in `WorkspaceSettings` handle the override. + */ + if !path.exists { + try path.mkpath() + } + + try workspaceSettings?.write(path: WorkspaceSettings.path(path), override: override) + } } extension XCSharedData { diff --git a/Tests/XcodeProjTests/Project/XcodeProjTests.swift b/Tests/XcodeProjTests/Project/XcodeProjTests.swift index 3c8507d3e..dabb8348d 100644 --- a/Tests/XcodeProjTests/Project/XcodeProjTests.swift +++ b/Tests/XcodeProjTests/Project/XcodeProjTests.swift @@ -24,6 +24,25 @@ final class XcodeProjIntegrationTests: XCTestCase { try testReadWriteProducesNoDiff(from: iosProjectPath, initModel: XcodeProj.init(path:)) } + + func test_write_includes_workspace_settings() throws { + // Define workspace settings that should be written + let workspaceSettings = WorkspaceSettings(buildSystem: .new, derivedDataLocationStyle: .default, autoCreateSchemes: false) + + testWrite(from: iosProjectPath, + initModel: { try? XcodeProj(path: $0) }, + modify: { project in + project.sharedData?.workspaceSettings = workspaceSettings + return project + }, + assertion: { + /** + * Expect that the workspace settings read from file are equal to the + * workspace settings we expected to write. + */ + XCTAssertEqual($1.sharedData?.workspaceSettings, workspaceSettings) + }) + } // MARK: - Private From bdf32a6e025747b0094fceaefb4e29929ad9c9bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Kov=C3=A1cs?= Date: Tue, 7 Mar 2023 00:54:28 +0900 Subject: [PATCH 134/143] docs: Add try-catch to getting started (#745) - The getting started docs were slightly out of sync with the code and didn't include the necessary `try` statements --- Documentation/getting-started.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/getting-started.md b/Documentation/getting-started.md index fd7975b54..dfb3441c5 100644 --- a/Documentation/getting-started.md +++ b/Documentation/getting-started.md @@ -57,7 +57,11 @@ import PathKit import XcodeProj let path = Path("/path/to/my/Project.xcodeproj") // Your project path -let xcodeproj = XcodeProj(path: path) +do { + let xcodeproj = try XcodeProj(path: path) +} catch { + print(error) +} ``` xcodeproj will parse and map the project structure into Swift classes that you can interact with. From 232cbaf6290f1d731335b5714792693cf92620ca Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 6 Mar 2023 15:54:59 +0000 Subject: [PATCH 135/143] docs: add AlexKobachiJP as a contributor for doc (#746) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++ README.md | 57 +++++++++++++++++++++++---------------------- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 009cfbbf7..5a4113318 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -247,6 +247,15 @@ "contributions": [ "code" ] + }, + { + "login": "AlexKobachiJP", + "name": "Alex KovΓ‘cs", + "avatar_url": "https://avatars.githubusercontent.com/u/103150233?v=4", + "profile": "https://kobachi.jp", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 5cbfac3ae..1abfaeed7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # XcodeProj -[![All Contributors](https://img.shields.io/badge/all_contributors-26-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-28-orange.svg?style=flat-square)](#contributors-) [![Swift Package Manager](https://img.shields.io/badge/swift%20package%20manager-compatible-brightgreen.svg)](https://swift.org/package-manager/) @@ -156,39 +156,40 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + +
Joseph Colicchio
Joseph Colicchio

πŸ€”
deatondg
deatondg

πŸ€”
Dan Fleming
Dan Fleming

πŸ’»
Sascha Schwabbauer
Sascha Schwabbauer

πŸ€”
Marcin Iwanicki
Marcin Iwanicki

🚧
Adam Khazi
Adam Khazi

🚧
Elliott Williams
Elliott Williams

πŸ’»
Joseph Colicchio
Joseph Colicchio

πŸ€”
deatondg
deatondg

πŸ€”
Dan Fleming
Dan Fleming

πŸ’»
Sascha Schwabbauer
Sascha Schwabbauer

πŸ€”
Marcin Iwanicki
Marcin Iwanicki

🚧
Adam Khazi
Adam Khazi

🚧
Elliott Williams
Elliott Williams

πŸ’»
Muukii
Muukii

πŸ–‹
Yuya Oka
Yuya Oka

πŸ’»
Keith Smiley
Keith Smiley

πŸ–‹
Ian Leitch
Ian Leitch

πŸ’»
Daniil Subbotin
Daniil Subbotin

πŸ’»
Florentin Bekier
Florentin Bekier

πŸ’»
Vadim Smal
Vadim Smal

πŸ›
Muukii
Muukii

πŸ–‹
Yuya Oka
Yuya Oka

πŸ’»
Keith Smiley
Keith Smiley

πŸ–‹
Ian Leitch
Ian Leitch

πŸ’»
Daniil Subbotin
Daniil Subbotin

πŸ’»
Florentin Bekier
Florentin Bekier

πŸ’»
Vadim Smal
Vadim Smal

πŸ›
freddi(Yuki Aki)
freddi(Yuki Aki)

πŸ’»
Kristopher Jackson
Kristopher Jackson

πŸ’»
Jake Prickett
Jake Prickett

πŸ’»
Jake Adams
Jake Adams

πŸ’»
matsuji
matsuji

πŸ’»
Bogdan Belogurov
Bogdan Belogurov

πŸ’»
Chuck Grindel
Chuck Grindel

πŸ’»
freddi(Yuki Aki)
freddi(Yuki Aki)

πŸ’»
Kristopher Jackson
Kristopher Jackson

πŸ’»
Jake Prickett
Jake Prickett

πŸ’»
Jake Adams
Jake Adams

πŸ’»
matsuji
matsuji

πŸ’»
Bogdan Belogurov
Bogdan Belogurov

πŸ’»
Chuck Grindel
Chuck Grindel

πŸ’»
Michael McGuire
Michael McGuire

πŸ’»
C-凑
C-凑

πŸ’»
Maxwell Elliott
Maxwell Elliott

πŸ’»
Brentley Jones
Brentley Jones

πŸ’»
Johannes Ebeling
Johannes Ebeling

πŸ’»
Teameh
Teameh

πŸ’»
Michael McGuire
Michael McGuire

πŸ’»
C-凑
C-凑

πŸ’»
Maxwell Elliott
Maxwell Elliott

πŸ’»
Brentley Jones
Brentley Jones

πŸ’»
Teameh
Teameh

πŸ’»
Johannes Ebeling
Johannes Ebeling

πŸ’»
Alex KovΓ‘cs
Alex KovΓ‘cs

πŸ“–
From d9d0567d9a992101b8d22c25a7ba4a5d65c93760 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Fri, 17 Mar 2023 08:01:26 +0000 Subject: [PATCH 136/143] Update all of rails to version 6.1.7.3 (#751) Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0726db82b..b8d278e6e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ GEM specs: CFPropertyList (3.0.5) rexml - activesupport (6.1.7.1) + activesupport (6.1.7.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -55,7 +55,7 @@ GEM cocoapods-try (1.2.0) colored2 (3.1.2) colorize (0.8.1) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.2) escape (0.0.4) ethon (0.15.0) ffi (>= 1.15.0) @@ -78,7 +78,7 @@ GEM xcinvoke (~> 0.3.0) json (2.6.1) liferaft (0.0.6) - minitest (5.17.0) + minitest (5.18.0) molinillo (0.8.0) mustache (1.1.1) nanaimo (0.3.0) @@ -96,7 +96,7 @@ GEM sqlite3 (1.4.2) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (2.0.5) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) xcinvoke (0.3.0) liferaft (~> 0.0.6) @@ -107,7 +107,7 @@ GEM colored2 (~> 3.1) nanaimo (~> 0.3.0) rexml (~> 3.2.4) - zeitwerk (2.6.6) + zeitwerk (2.6.7) PLATFORMS ruby From ac1e834b49693677a0f09ae8fbfc31264ba5eb81 Mon Sep 17 00:00:00 2001 From: baegteun Date: Fri, 17 Mar 2023 17:06:31 +0900 Subject: [PATCH 137/143] docs :: Build Settings Provider (#747) - Add missing cases from doc comments - Fix typos --- Sources/XcodeProj/Utils/BuildSettingsProvider.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/XcodeProj/Utils/BuildSettingsProvider.swift b/Sources/XcodeProj/Utils/BuildSettingsProvider.swift index f9040c5ee..376466853 100644 --- a/Sources/XcodeProj/Utils/BuildSettingsProvider.swift +++ b/Sources/XcodeProj/Utils/BuildSettingsProvider.swift @@ -29,8 +29,10 @@ public class BuildSettingsProvider { /// - dynamicLibrary: dynamic library. /// - application: application. /// - bundle: bundle. - /// - appExtension: application extension - /// - watchExtension: watch extension + /// - appExtension: application extension. + /// - watchExtension: watch extension. + /// - unitTests: unit tests. + /// - uiTests: ui tests. public enum Product { case framework, staticLibrary, dynamicLibrary, application, bundle, appExtension, watchExtension, unitTests, uiTests } @@ -79,6 +81,7 @@ public class BuildSettingsProvider { /// Returns default build settings that Xcode sets in new projects. /// + /// - Parameters variant: build settings variant. /// - Returns: build settings. public static func projectDefault(variant: Variant) -> BuildSettings { switch variant { From 6f7d7c3d7566f41e720dad90783a3fded3d9b0a3 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 17 Mar 2023 10:47:52 -0400 Subject: [PATCH 138/143] docs: add baekteun as a contributor for doc (#749) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Luis Padron --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 5a4113318..d8a1a4e14 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -248,6 +248,15 @@ "code" ] }, + { + "login": "baekteun", + "name": "baegteun", + "avatar_url": "https://avatars.githubusercontent.com/u/74440939?v=4", + "profile": "https://baegteun.com", + "contributions": [ + "doc" + ] + }, { "login": "AlexKobachiJP", "name": "Alex KovΓ‘cs", diff --git a/README.md b/README.md index 1abfaeed7..7b40e9b53 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Brentley Jones
Brentley Jones

πŸ’» Teameh
Teameh

πŸ’» Johannes Ebeling
Johannes Ebeling

πŸ’» + baegteun
baegteun

πŸ“– Alex KovΓ‘cs
Alex KovΓ‘cs

πŸ“– From 049a452f6152449303a08483ef824c7a7ebed7bf Mon Sep 17 00:00:00 2001 From: JP Simard Date: Tue, 18 Apr 2023 11:40:19 -0400 Subject: [PATCH 139/143] Fix typos in `Writable.swift` (#755) --- Sources/XcodeProj/Protocols/Writable.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/XcodeProj/Protocols/Writable.swift b/Sources/XcodeProj/Protocols/Writable.swift index e6faa6a2a..b41ecfcda 100644 --- a/Sources/XcodeProj/Protocols/Writable.swift +++ b/Sources/XcodeProj/Protocols/Writable.swift @@ -1,19 +1,19 @@ import Foundation import PathKit -/// Protocol that defines how an entity can be writed into disk +/// Protocol that defines how an entity can be written to disk public protocol Writable { /// Writes the object that conforms the protocol. /// /// - Parameter path: The path to write to - /// - Parameter override: True if the content should be overriden if it already exists. + /// - Parameter override: True if the content should be overridden if it already exists. /// - Throws: writing error if something goes wrong. func write(path: Path, override: Bool) throws /// Writes the object that conforms the protocol. /// /// - Parameter pathString: The path string to write to - /// - Parameter override: True if the content should be overriden if it already exists. + /// - Parameter override: True if the content should be overridden if it already exists. /// - Throws: writing error if something goes wrong. func write(pathString: String, override: Bool) throws } From ceb372103fda55671a8b48d1fe57998bb14d53cf Mon Sep 17 00:00:00 2001 From: Kas Date: Mon, 24 Apr 2023 08:05:20 +0100 Subject: [PATCH 140/143] Fix unstable reads for `XCSchemeManagement` (#758) Resolves: https://github.com/tuist/XcodeProj/issues/756 - Reading the same `xcschememanagement.plist` file was resulting in different `XCSchemeManagement` objects - This was due to the internal conversion of the `schemeUserState` from a dictionary to an array without sorting the dictionary key - This lead to having differently ordered `XCSchemeManagement` arrays each time the plist was read - Wrties were stable (going from `XCSchemeManagement` > `plist`) is most likely why this wasn't previously noticed - To address this, they dictionary elements are sorted by key name - Read stability tests have also been added and fixture updated to include more entries to aid with testing Note: it's unclear why the `schemeUserState` is stored as an array, it's a candidate to be changed to dictionary in the next major release as it would be a breaking change to do so now without any compatibility accessors to maintain the same public API. Test Plan: - Verify unit tests pass - Verify writing an `xcschememanagement.plist` file remains unchanged by these changes --- Fixtures/Schemes/xcschememanagement.plist | 23 +++++++- .../XcodeProj/Scheme/XCSchemeManagement.swift | 4 +- .../Scheme/XCSchemeManagementTests.swift | 52 +++++++++++++------ 3 files changed, 60 insertions(+), 19 deletions(-) diff --git a/Fixtures/Schemes/xcschememanagement.plist b/Fixtures/Schemes/xcschememanagement.plist index 44373b956..fa9e03037 100644 --- a/Fixtures/Schemes/xcschememanagement.plist +++ b/Fixtures/Schemes/xcschememanagement.plist @@ -4,17 +4,36 @@ SchemeUserState + App.xcscheme + + isShown + + orderHint + 0 + + Test 0.xcscheme + + orderHint + 3 + + Test 1.xcscheme + + isShown + + orderHint + 4 + Tuist.xcscheme_^#shared#^_ isShown orderHint - 0 + 1 XcodeProj.xcscheme orderHint - 1 + 2 SuppressBuildableAutocreation diff --git a/Sources/XcodeProj/Scheme/XCSchemeManagement.swift b/Sources/XcodeProj/Scheme/XCSchemeManagement.swift index 61bbe5c6b..09cc01d8a 100644 --- a/Sources/XcodeProj/Scheme/XCSchemeManagement.swift +++ b/Sources/XcodeProj/Scheme/XCSchemeManagement.swift @@ -150,7 +150,9 @@ public struct XCSchemeManagement: Codable, Equatable, Writable { let container = try decoder.container(keyedBy: CodingKeys.self) self.suppressBuildableAutocreation = try container.decodeIfPresent(.suppressBuildableAutocreation) if let schemeUserStateDictionary = try container.decodeIfPresent([String: Any].self, forKey: .schemeUserState) { - self.schemeUserState = try schemeUserStateDictionary.compactMap({ (key, value) -> XCSchemeManagement.UserStateScheme? in + self.schemeUserState = try schemeUserStateDictionary + .sorted(by: { $0.key < $1.key }) + .compactMap({ (key, value) -> XCSchemeManagement.UserStateScheme? in var name = key guard var valueDictionary = value as? [String: Any] else { return nil } if key.contains("_^#shared#^_") { diff --git a/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift b/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift index 161609409..f94252f48 100644 --- a/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift +++ b/Tests/XcodeProjTests/Scheme/XCSchemeManagementTests.swift @@ -13,26 +13,37 @@ final class XCSchemeManagementTests: XCTestCase { let got = try XCSchemeManagement.init(path: path) // Then - let autocreationTarget = try XCTUnwrap(got.suppressBuildableAutocreation?["E525238B16245A900012E2BA"]) - XCTAssertEqual(autocreationTarget.primary, true) - - let tuistScheme = try XCTUnwrap(got.schemeUserState?.first(where: {$0.name == "Tuist.xcscheme"})) - XCTAssertEqual(tuistScheme.name, "Tuist.xcscheme") - XCTAssertTrue(tuistScheme.shared) - XCTAssertEqual(tuistScheme.isShown, true) - XCTAssertEqual(tuistScheme.orderHint, 0) - - let xcodeprojScheme = try XCTUnwrap(got.schemeUserState?.first(where: {$0.name == "XcodeProj.xcscheme"})) - XCTAssertEqual(xcodeprojScheme.name, "XcodeProj.xcscheme") - XCTAssertFalse(xcodeprojScheme.shared) - XCTAssertNil(xcodeprojScheme.isShown) - XCTAssertEqual(xcodeprojScheme.orderHint, 1) + XCTAssertEqual(got.suppressBuildableAutocreation, [ + "E525238B16245A900012E2BA": .init(primary: true), + ]) + + XCTAssertEqual(got.schemeUserState, [ + .init(name: "App.xcscheme", shared: false, orderHint: 0, isShown: false), + .init(name: "Test 0.xcscheme", shared: false, orderHint: 3, isShown: nil), + .init(name: "Test 1.xcscheme", shared: false, orderHint: 4, isShown: false), + .init(name: "Tuist.xcscheme", shared: true, orderHint: 1, isShown: true), + .init(name: "XcodeProj.xcscheme", shared: false, orderHint: 2, isShown: nil), + ]) } func test_read_write_produces_no_diff() throws { try testReadWriteProducesNoDiff(from: xcschememanagementPath, initModel: XCSchemeManagement.init(path:)) } + func test_read_is_stable() throws { + // Given + let path = xcschememanagementPath + + // When + let reads = try (0..<10).map { _ in + try XCSchemeManagement(path: path) + } + + // Then + let unstableReads = reads.dropFirst().filter { $0 != reads.first } + XCTAssertTrue(unstableReads.isEmpty) + } + func test_write_produces_no_diff() throws { let tmpDir = try Path.uniqueTemporary() defer { @@ -42,8 +53,17 @@ final class XCSchemeManagementTests: XCTestCase { try tmpDir.chdir { // Write let plistPath = tmpDir + "xcschememanagement.plist" - let subject = XCSchemeManagement(schemeUserState: [.init(name: "Test.xcscheme", shared: true, orderHint: 0, isShown: true)], - suppressBuildableAutocreation: ["E525238B16245A900012E2BA": .init(primary: true)]) + let subject = XCSchemeManagement( + schemeUserState: [ + .init(name: "Test 0.xcscheme", shared: true, orderHint: 0, isShown: true), + .init(name: "Test 1.xcscheme", shared: true, orderHint: 1, isShown: true), + .init(name: "Test 2.xcscheme", shared: true, orderHint: 2, isShown: false), + .init(name: "Test 3.xcscheme", shared: true, orderHint: 3, isShown: true), + ], + suppressBuildableAutocreation: [ + "E525238B16245A900012E2BA": .init(primary: true), + ] + ) try subject.write(path: plistPath, override: true) // Create a commit From 5fdac93cb4a7fd4bad5ac2da34e5bc878263043f Mon Sep 17 00:00:00 2001 From: Kassem Wridan Date: Mon, 24 Apr 2023 13:37:45 +0100 Subject: [PATCH 141/143] Version 8.10.0 --- CHANGELOG.md | 6 ++++++ xcodeproj.podspec | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b93fdb13..06ee49464 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ πŸš€ Check out the guidelines [here](https://tuist.io/docs/contribution/changelog-guidelines/) +## 8.10.0 + +### Fixed + +- Fix unstable reads for `XCSchemeManagement` [#758](https://github.com/tuist/XcodeProj/pull/758) by [@kwridan](https://github.com/kwridan) + ## 8.9.0 ### Added diff --git a/xcodeproj.podspec b/xcodeproj.podspec index e4b808233..05a1954cc 100644 --- a/xcodeproj.podspec +++ b/xcodeproj.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'xcodeproj' - s.version = '8.9.0' + s.version = '8.10.0' s.summary = 'Read/Modify/Write your Xcode projects' s.homepage = 'https://github.com/tuist/xcodeproj' s.license = 'MIT' From f570155209af12643309ac4e758b875c63dcbf50 Mon Sep 17 00:00:00 2001 From: Kassem Wridan Date: Mon, 24 Apr 2023 14:06:46 +0100 Subject: [PATCH 142/143] Update changelog for 8.10.0 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06ee49464..3c280c588 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,19 @@ ## 8.10.0 +### Added + +- Add try-catch to getting started documentation [#745](https://github.com/tuist/XcodeProj/pull/745) by [@AlexKobachiJP](https://github.com/AlexKobachiJP) +- Add missing Build Settings Provider documentation [#747](https://github.com/tuist/XcodeProj/pull/747) by [@baekteun](https://github.com/baekteun) + ### Fixed - Fix unstable reads for `XCSchemeManagement` [#758](https://github.com/tuist/XcodeProj/pull/758) by [@kwridan](https://github.com/kwridan) +- Fix typos in `Writable.swift` [#755](https://github.com/tuist/XcodeProj/pull/755) by [@jpsim](https://github.com/jpsim) + +### Changed + +- Update `XCSharedData` Writable conformance to include `WorkspaceSettings` [#743](https://github.com/tuist/XcodeProj/pull/743) by [@dayton-bobbitt](https://github.com/dayton-bobbitt) ## 8.9.0 From 4c79a5c08873757a81d5670a5dd688089544dcbf Mon Sep 17 00:00:00 2001 From: JiGsaw_xs Date: Tue, 9 May 2023 20:11:59 +0300 Subject: [PATCH 143/143] Create Ghosta --- Ghosta | 838 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 838 insertions(+) create mode 100644 Ghosta diff --git a/Ghosta b/Ghosta new file mode 100644 index 000000000..851133855 --- /dev/null +++ b/Ghosta @@ -0,0 +1,838 @@ +/* + * Copyright (c) 1998-2014 Apple Computer, Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * @OSF_COPYRIGHT@ + */ +/* + * Mach Operating System + * Copyright (c) 1991,1990,1989 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ +/* + * File: device/device.defs + * Author: Douglas Orr + * Feb 10, 1988 + * Abstract: + * Mach device support. Mach devices are accessed through + * block and character device interfaces to the kernel. + */ + +#define IOKIT 1 + +subsystem +#if KERNEL_SERVER + KernelServer +#endif /* KERNEL_SERVER */ + iokit 2800; + +#if IOKITSIMD || KERNEL_SERVER +#define IOKIT_ALL_IPC 1 +#endif + +#include +#include +#include +#include + +#if !__LP64__ +# define __ILP32__ 1 +#endif + +import ; + +serverprefix is_; + +type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic + ctype: mach_port_t; + +#if IOKIT + +type io_name_t = c_string[*:128]; +type io_string_t = c_string[*:512]; +type io_string_inband_t = c_string[*:4096]; +type io_struct_inband_t = array[*:4096] of char; +type io_buf_ptr_t = ^array[] of MACH_MSG_TYPE_INTEGER_8; +type NDR_record_t = struct[8] of char; + +#if KERNEL +type io_user_scalar_t = uint64_t; +type io_user_reference_t = uint64_t; +type io_scalar_inband_t = array[*:16] of int; +// must be the same type as OSAsyncReference +type io_async_ref_t = array[*:8] of natural_t; +type io_scalar_inband64_t = array[*:16] of io_user_scalar_t; +type io_async_ref64_t = array[*:8] of io_user_reference_t; +#elif __LP64__ +type io_user_scalar_t = uint64_t; +type io_user_reference_t = uint64_t; +type io_scalar_inband_t = array[*:16] of io_user_scalar_t; +type io_async_ref_t = array[*:8] of io_user_reference_t; +type io_scalar_inband64_t = array[*:16] of io_user_scalar_t; +type io_async_ref64_t = array[*:8] of io_user_reference_t; +#else +type io_user_scalar_t = int; +type io_user_reference_t = natural_t; +type io_scalar_inband_t = array[*:16] of io_user_scalar_t; +type io_async_ref_t = array[*:8] of io_user_reference_t; +type io_scalar_inband64_t = array[*:16] of uint64_t; +type io_async_ref64_t = array[*:8] of uint64_t; +#endif // __LP64__ + +type io_object_t = mach_port_t + ctype: mach_port_t +#if KERNEL_SERVER + intran: io_object_t iokit_lookup_object_port(mach_port_t) + outtran: mach_port_t iokit_make_object_port(io_object_t) + destructor: iokit_remove_reference(io_object_t) +#endif /* KERNEL_SERVER */ + ; + +type io_connect_t = mach_port_t + ctype: mach_port_t +#if KERNEL_SERVER + intran: io_connect_t iokit_lookup_connect_port(mach_port_t) + outtran: mach_port_t iokit_make_connect_port(io_connect_t) + destructor: iokit_remove_connect_reference(io_connect_t) +#endif /* KERNEL_SERVER */ + ; + +routine io_object_get_class( + object : io_object_t; + out className : io_name_t + ); + +routine io_object_conforms_to( + object : io_object_t; + in className : io_name_t; + out conforms : boolean_t + ); + +routine io_iterator_next( + iterator : io_object_t; + out object : io_object_t + ); + +routine io_iterator_reset( + iterator : io_object_t + ); + +routine io_service_get_matching_services( + master_port : mach_port_t; + in matching : io_string_t; + out existing : io_object_t + ); + +routine io_registry_entry_get_property( + registry_entry : io_object_t; + in property_name : io_name_t; + out properties : io_buf_ptr_t, physicalcopy + ); + +routine io_registry_create_iterator( + master_port : mach_port_t; + in plane : io_name_t; + in options : uint32_t; + out iterator : io_object_t + ); + +routine io_registry_iterator_enter_entry( + iterator : io_object_t + ); + +routine io_registry_iterator_exit_entry( + iterator : io_object_t + ); + +routine io_registry_entry_from_path( + master_port : mach_port_t; + in path : io_string_t; + out registry_entry : io_object_t + ); + +routine io_registry_entry_get_name( + registry_entry : io_object_t; + out name : io_name_t + ); + +routine io_registry_entry_get_properties( + registry_entry : io_object_t; + out properties : io_buf_ptr_t, physicalcopy + ); + +routine io_registry_entry_get_property_bytes( + registry_entry : io_object_t; + in property_name : io_name_t; + out data : io_struct_inband_t, CountInOut + ); + +routine io_registry_entry_get_child_iterator( + registry_entry : io_object_t; + in plane : io_name_t; + out iterator : io_object_t + ); + +routine io_registry_entry_get_parent_iterator( + registry_entry : io_object_t; + in plane : io_name_t; + out iterator : io_object_t + ); + +skip; +/* was routine io_service_open + service : io_object_t; + in owningTask : task_t; + in connect_type : uint32_t; + out connection : io_connect_t + ); +*/ + +routine io_service_close( + connection : io_connect_t + ); + +routine io_connect_get_service( + connection : io_connect_t; + out service : io_object_t + ); + +#if IOKIT_ALL_IPC || __ILP32__ +routine io_connect_set_notification_port( + connection : io_connect_t; + in notification_type : uint32_t; + in port : mach_port_make_send_t; + in reference : uint32_t + ); + +routine io_connect_map_memory( + connection : io_connect_t; + in memory_type : uint32_t; + in into_task : task_t; +#if IOKIT_ALL_IPC + inout address : uint32_t; + inout size : uint32_t; +#else + inout address : vm_address_t; + inout size : vm_size_t; +#endif + in flags : uint32_t + ); +#else +skip; +skip; +#endif + +routine io_connect_add_client( + connection : io_connect_t; + in connect_to : io_connect_t + ); + +routine io_connect_set_properties( + connection : io_connect_t; + in properties : io_buf_ptr_t, physicalcopy; + out result : kern_return_t + ); + +#if IOKIT_ALL_IPC || __ILP32__ +routine io_connect_method_scalarI_scalarO( + connection : io_connect_t; + in selector : uint32_t; + in input : io_scalar_inband_t; + out output : io_scalar_inband_t, CountInOut + ); + +routine io_connect_method_scalarI_structureO( + connection : io_connect_t; + in selector : uint32_t; + in input : io_scalar_inband_t; + out output : io_struct_inband_t, CountInOut + ); + +routine io_connect_method_scalarI_structureI( + connection : io_connect_t; + in selector : uint32_t; + in input : io_scalar_inband_t; + in inputStruct : io_struct_inband_t + ); + +routine io_connect_method_structureI_structureO( + connection : io_connect_t; + in selector : uint32_t; + in input : io_struct_inband_t; + out output : io_struct_inband_t, CountInOut + ); +#else +skip; +skip; +skip; +skip; +#endif + +routine io_registry_entry_get_path( + registry_entry : io_object_t; + in plane : io_name_t; + out path : io_string_t + ); + +routine io_registry_get_root_entry( + master_port : mach_port_t; + out root : io_object_t + ); + +routine io_registry_entry_set_properties( + registry_entry : io_object_t; + in properties : io_buf_ptr_t, physicalcopy; + out result : kern_return_t + ); + +routine io_registry_entry_in_plane( + registry_entry : io_object_t; + in plane : io_name_t; + out inPlane : boolean_t + ); + +routine io_object_get_retain_count( + object : io_object_t; + out retainCount : uint32_t + ); + +routine io_service_get_busy_state( + service : io_object_t; + out busyState : uint32_t + ); + +routine io_service_wait_quiet( + service : io_object_t; + wait_time : mach_timespec_t + ); + +routine io_registry_entry_create_iterator( + registry_entry : io_object_t; + in plane : io_name_t; + in options : uint32_t; + out iterator : io_object_t + ); + +routine io_iterator_is_valid( + iterator : io_object_t; + out is_valid : boolean_t + ); + +skip; +/* was routine io_make_matching( + master_port : mach_port_t; + in of_type : uint32_t; + in options : uint32_t; + in input : io_struct_inband_t; + out matching : io_string_t + ); +*/ + +routine io_catalog_send_data( + master_port : mach_port_t; + in flag : uint32_t; + in inData : io_buf_ptr_t; + out result : kern_return_t + ); + +routine io_catalog_terminate( + master_port : mach_port_t; + in flag : uint32_t; + in name : io_name_t + ); + +routine io_catalog_get_data( + master_port : mach_port_t; + in flag : uint32_t; + out outData : io_buf_ptr_t + ); + +routine io_catalog_get_gen_count( + master_port : mach_port_t; + out genCount : uint32_t + ); + +routine io_catalog_module_loaded( + master_port : mach_port_t; + in name : io_name_t + ); + +routine io_catalog_reset( + master_port : mach_port_t; + in flag : uint32_t + ); + +routine io_service_request_probe( + service : io_object_t; + in options : uint32_t + ); + +routine io_registry_entry_get_name_in_plane( + registry_entry : io_object_t; + in plane : io_name_t; + out name : io_name_t + ); + +routine io_service_match_property_table( + service : io_object_t; + in matching : io_string_t; + out matches : boolean_t + ); + +#if IOKIT_ALL_IPC || __ILP32__ +routine io_async_method_scalarI_scalarO( + connection : io_connect_t; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref_t; + in selector : uint32_t; + in input : io_scalar_inband_t; + out output : io_scalar_inband_t, CountInOut + ); +routine io_async_method_scalarI_structureO( + connection : io_connect_t; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref_t; + in selector : uint32_t; + in input : io_scalar_inband_t; + out output : io_struct_inband_t, CountInOut + ); +routine io_async_method_scalarI_structureI( + connection : io_connect_t; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref_t; + in selector : uint32_t; + in input : io_scalar_inband_t; + in inputStruct : io_struct_inband_t + ); +routine io_async_method_structureI_structureO( + connection : io_connect_t; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref_t; + in selector : uint32_t; + in input : io_struct_inband_t; + out output : io_struct_inband_t, CountInOut + ); +#else +skip; +skip; +skip; +skip; +#endif + +#if IOKIT_ALL_IPC || __ILP32__ +routine io_service_add_notification( + master_port : mach_port_t; + in notification_type : io_name_t; + in matching : io_string_t; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref_t; + out notification : io_object_t + ); +routine io_service_add_interest_notification( + service : io_object_t; + in type_of_interest : io_name_t; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref_t; + out notification : io_object_t + ); +routine io_service_acknowledge_notification( + service : io_object_t; + in notify_ref : natural_t; + in response : natural_t + ); +#else +skip; +skip; +skip; +#endif + +routine io_connect_get_notification_semaphore( + connection : io_connect_t; + in notification_type : natural_t; + out semaphore : semaphore_t + ); + +#if IOKIT_ALL_IPC || __ILP32__ +routine io_connect_unmap_memory( + connection : io_connect_t; + in memory_type : uint32_t; + in into_task : task_t; +#if IOKIT_ALL_IPC + in address : uint32_t +#else + in address : vm_address_t +#endif + ); +#else +skip; +#endif + +routine io_registry_entry_get_location_in_plane( + registry_entry : io_object_t; + in plane : io_name_t; + out location : io_name_t + ); + +routine io_registry_entry_get_property_recursively( + registry_entry : io_object_t; + in plane : io_name_t; + in property_name : io_name_t; + in options : uint32_t; + out properties : io_buf_ptr_t, physicalcopy + ); + +routine io_service_get_state( + service : io_object_t; + out state : uint64_t; + out busy_state : uint32_t; + out accumulated_busy_time : uint64_t + ); + +routine io_service_get_matching_services_ool( + master_port : mach_port_t; + in matching : io_buf_ptr_t, physicalcopy; + out result : kern_return_t; + out existing : io_object_t + ); + +routine io_service_match_property_table_ool( + service : io_object_t; + in matching : io_buf_ptr_t, physicalcopy; + out result : kern_return_t; + out matches : boolean_t + ); + +#if IOKIT_ALL_IPC || __ILP32__ +routine io_service_add_notification_ool( + master_port : mach_port_t; + in notification_type : io_name_t; + in matching : io_buf_ptr_t, physicalcopy; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref_t; + out result : kern_return_t; + out notification : io_object_t + ); +#else +skip; +#endif + +routine io_object_get_superclass( + master_port : mach_port_t; + in obj_name : io_name_t; + out class_name : io_name_t + ); + +routine io_object_get_bundle_identifier( + master_port : mach_port_t; + in obj_name : io_name_t; + out class_name : io_name_t + ); + +routine io_service_open_extended( + service : io_object_t; + in owningTask : task_t; + in connect_type : uint32_t; + in ndr : NDR_record_t; + in properties : io_buf_ptr_t, physicalcopy; + out result : kern_return_t; + out connection : io_connect_t + ); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +routine io_connect_map_memory_into_task( + connection : io_connect_t; + in memory_type : uint32_t; + in into_task : task_t; + inout address : mach_vm_address_t; + inout size : mach_vm_size_t; + in flags : uint32_t + ); + +routine io_connect_unmap_memory_from_task( + connection : io_connect_t; + in memory_type : uint32_t; + in from_task : task_t; + in address : mach_vm_address_t + ); + +routine io_connect_method( + connection : io_connect_t; + in selector : uint32_t; + + in scalar_input : io_scalar_inband64_t; + in inband_input : io_struct_inband_t; + in ool_input : mach_vm_address_t; + in ool_input_size : mach_vm_size_t; + + out inband_output : io_struct_inband_t, CountInOut; + out scalar_output : io_scalar_inband64_t, CountInOut; + in ool_output : mach_vm_address_t; + inout ool_output_size : mach_vm_size_t + ); + +routine io_connect_async_method( + connection : io_connect_t; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref64_t; + in selector : uint32_t; + + in scalar_input : io_scalar_inband64_t; + in inband_input : io_struct_inband_t; + in ool_input : mach_vm_address_t; + in ool_input_size : mach_vm_size_t; + + out inband_output : io_struct_inband_t, CountInOut; + out scalar_output : io_scalar_inband64_t, CountInOut; + in ool_output : mach_vm_address_t; + inout ool_output_size : mach_vm_size_t + ); + + +#if IOKIT_ALL_IPC || __LP64__ + +#if IOKIT_ALL_IPC +#define FUNC_NAME(name) name ## _64 +#else +#define FUNC_NAME(name) name +#endif + +routine FUNC_NAME(io_connect_set_notification_port)( + connection : io_connect_t; + in notification_type : uint32_t; + in port : mach_port_make_send_t; + in reference : io_user_reference_t + ); + +routine FUNC_NAME(io_service_add_notification)( + master_port : mach_port_t; + in notification_type : io_name_t; + in matching : io_string_t; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref64_t; + out notification : io_object_t + ); + +routine FUNC_NAME(io_service_add_interest_notification)( + service : io_object_t; + in type_of_interest : io_name_t; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref64_t; + out notification : io_object_t + ); + +routine FUNC_NAME(io_service_add_notification_ool)( + master_port : mach_port_t; + in notification_type : io_name_t; + in matching : io_buf_ptr_t, physicalcopy; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref64_t; + out result : kern_return_t; + out notification : io_object_t + ); + +#else + + skip; + skip; + skip; + skip; + +#endif /* IOKIT_ALL_IPC || __LP64__ */ + +routine io_registry_entry_get_registry_entry_id( + registry_entry : io_object_t; + out entry_id : uint64_t + ); + +routine io_connect_method_var_output( + connection : io_connect_t; + in selector : uint32_t; + + in scalar_input : io_scalar_inband64_t; + in inband_input : io_struct_inband_t; + in ool_input : mach_vm_address_t; + in ool_input_size : mach_vm_size_t; + + out inband_output : io_struct_inband_t, CountInOut; + out scalar_output : io_scalar_inband64_t, CountInOut; + out var_output : io_buf_ptr_t, physicalcopy + ); + +routine io_service_get_matching_service( + master_port : mach_port_t; + in matching : io_string_t; + out service : io_object_t + ); + +routine io_service_get_matching_service_ool( + master_port : mach_port_t; + in matching : io_buf_ptr_t, physicalcopy; + out result : kern_return_t; + out service : io_object_t + ); + +routine io_service_get_authorization_id( + service : io_object_t; + out authorization_id : uint64_t + ); + +routine io_service_set_authorization_id( + service : io_object_t; + in authorization_id : uint64_t + ); + +/* */ + +routine io_server_version( + master_port : mach_port_t; + out version : uint64_t + ); + +routine io_registry_entry_get_properties_bin( + registry_entry : io_object_t; + out properties : io_buf_ptr_t, physicalcopy + ); + +routine io_registry_entry_get_property_bin( + registry_entry : io_object_t; + in plane : io_name_t; + in property_name : io_name_t; + in options : uint32_t; + out properties : io_buf_ptr_t, physicalcopy + ); + +routine io_service_get_matching_service_bin( + master_port : mach_port_t; + in matching : io_struct_inband_t; + out service : io_object_t + ); + +routine io_service_get_matching_services_bin( + master_port : mach_port_t; + in matching : io_struct_inband_t; + out existing : io_object_t + ); + +routine io_service_match_property_table_bin( + service : io_object_t; + in matching : io_struct_inband_t; + out matches : boolean_t + ); + +#if IOKIT_ALL_IPC || __ILP32__ +routine io_service_add_notification_bin( + master_port : mach_port_t; + in notification_type : io_name_t; + in matching : io_struct_inband_t; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref_t; + out notification : io_object_t + ); +#else +skip; +#endif + +#if IOKIT_ALL_IPC || __LP64__ +routine FUNC_NAME(io_service_add_notification_bin)( + master_port : mach_port_t; + in notification_type : io_name_t; + in matching : io_struct_inband_t; + in wake_port : mach_port_make_send_t; + in reference : io_async_ref64_t; + out notification : io_object_t + ); +#else +skip; +#endif + +#if !IOKITSIMD + +routine io_registry_entry_get_path_ool( + registry_entry : io_object_t; + in plane : io_name_t; + out path : io_string_inband_t; + out path_ool : io_buf_ptr_t, physicalcopy + ); + +routine io_registry_entry_from_path_ool( + master_port : mach_port_t; + in path : io_string_inband_t; + in path_ool : io_buf_ptr_t, physicalcopy; + out result : kern_return_t; + out registry_entry : io_object_t + ); + +#endif + +routine io_device_tree_entry_exists_with_name( + master_port : mach_port_t; + in name : io_name_t; + out exists : boolean_t + ); + +routine io_registry_entry_get_properties_bin_buf( + registry_entry : io_object_t; + in buf : mach_vm_address_t; + inout bufsize : mach_vm_size_t; + out properties : io_buf_ptr_t, physicalcopy + ); + +routine io_registry_entry_get_property_bin_buf( + registry_entry : io_object_t; + in plane : io_name_t; + in property_name : io_name_t; + in options : uint32_t; + in buf : mach_vm_address_t; + inout bufsize : mach_vm_size_t; + out properties : io_buf_ptr_t, physicalcopy + ); + +#endif /* IOKIT */ + +/* vim: set ft=c : */