From 15005f382d584253790b86be7b6bc8ac152032b6 Mon Sep 17 00:00:00 2001 From: bmxav <5422569+bmxav@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:58:28 -0400 Subject: [PATCH 1/3] Restore support for Xcode 14 --- PIF/Package.swift | 2 +- Sources/GenIR/Extensions/Process+Extension.swift | 12 ++++++------ Sources/GenIR/Target.swift | 8 ++++---- Tests/GenIRTests/WorkspaceTests.swift | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/PIF/Package.swift b/PIF/Package.swift index ff4790d..906e212 100644 --- a/PIF/Package.swift +++ b/PIF/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.10 +// swift-tools-version: 5.7 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/Sources/GenIR/Extensions/Process+Extension.swift b/Sources/GenIR/Extensions/Process+Extension.swift index c1d2c8e..b5b17a8 100644 --- a/Sources/GenIR/Extensions/Process+Extension.swift +++ b/Sources/GenIR/Extensions/Process+Extension.swift @@ -23,16 +23,16 @@ extension Process { /// - stderr: the standard error /// - code: the exit code init(stdout: String?, stderr: String?, code: Int32) { - self.stdout = if let stdout, stdout.isEmpty { - nil + if let stdout, stdout.isEmpty { + self.stdout = nil } else { - stdout + self.stdout = stdout } - self.stderr = if let stderr, stderr.isEmpty { - nil + if let stderr, stderr.isEmpty { + self.stderr = nil } else { - stderr + self.stderr = stderr } self.code = code diff --git a/Sources/GenIR/Target.swift b/Sources/GenIR/Target.swift index e609d46..0a23ba0 100644 --- a/Sources/GenIR/Target.swift +++ b/Sources/GenIR/Target.swift @@ -36,17 +36,17 @@ class Target { init(from baseTarget: PIF.BaseTarget) { guid = baseTarget.guid name = baseTarget.name - productName = if let target = baseTarget as? PIF.Target, !target.productName.isEmpty { - target.productName + if let target = baseTarget as? PIF.Target, !target.productName.isEmpty { + productName = target.productName } else if baseTarget.guid == "PACKAGE-PRODUCT:\(baseTarget.name)" { // The `PACKAGE-PRODUCT` for a package does not have a product reference name so // we do not have a proper extension. For now we assume it is a framework and add // the extension. A better way may be to follow the `dynamicTargetVariantGuid` of // the `PACKAGE-TARGET` as this appears to provide the correct name if available. - baseTarget.name.appending(".framework") + productName = baseTarget.name.appending(".framework") } else { // Fallback to the target's name if we are unable to determine a proper product name. - baseTarget.name + productName = baseTarget.name } isBuildable = guid == "PACKAGE-TARGET:\(name)" || !guid.hasPrefix("PACKAGE-") isPackageProduct = !guid.hasPrefix("PACKAGE-TARGET:") diff --git a/Tests/GenIRTests/WorkspaceTests.swift b/Tests/GenIRTests/WorkspaceTests.swift index d9f56d3..2ae6cfd 100644 --- a/Tests/GenIRTests/WorkspaceTests.swift +++ b/Tests/GenIRTests/WorkspaceTests.swift @@ -64,7 +64,7 @@ final class WorkspaceTests: XCTestCase { // Check dependencies made it to the right place. All dependencies should be statically // linked and appear under the .app directory. - let appIRPath = context.archive.appending(path: "IR/App.app/") + let appIRPath = context.archive.appendingPathComponent("IR/App.app/") let expectedIRFiles = Self.appIRFiles .union(Self.commonIRFiles) From 688d769c3b43f629e2df1948d134f7bca5e2ed68 Mon Sep 17 00:00:00 2001 From: NinjaLikesCheez Date: Tue, 17 Sep 2024 08:33:59 +0200 Subject: [PATCH 2/3] Add clarification to README around clean builds Fix up some of the markdown formatting and accessibility issues too. --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 733fac8..8913a3c 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@

- + Badge showing status of the build pipelines - + Badge showing the current release version of Gen IR

-This tool was heavily inspired by: https://blog.digitalrickshaw.com/2016/03/14/dumping-the-swift-ast-for-an-ios-project-part-2.html ❤️ +This tool was heavily inspired by [a DigitalRickshaw blog post](https://blog.digitalrickshaw.com/2016/03/14/dumping-the-swift-ast-for-an-ios-project-part-2.html) ❤️ ## Prerequisites @@ -41,7 +41,7 @@ brew install gen-ir brew upgrade gen-ir ``` -## 🎉 Done! +## 🎉 Done All installed! You can now use `gen-ir` on your system - be sure to run `gen-ir --help` to check the available commands and options. @@ -54,6 +54,8 @@ All installed! You can now use `gen-ir` on your system - be sure to run `gen-ir >**This means a clean, fresh build of a project.** > >The compiler will **not** make a call for an object that doesn't need to be rebuilt, and we will not be able to parse what doesn't exist. Ensure you do a clean before your build otherwise `gen-ir` may miss some modules. +> +> Due to a bug in Xcode you **must** run the clean and archive commands _separately_. This means you need to do a `xcodebuild clean` and _then_ an `xcodebuild archive` and not `xcodebuild clean archive`. `gen-ir` takes a Xcode build log by two means, a path to a file or stdin: @@ -71,7 +73,7 @@ xcodebuild archive -project TestProject.xcodeproj -scheme TestProject -configura ## Building -`gen-ir` is implemented as a Swift Package, so you can either open [`Package.swift`](Package.swift) in Xcode, or build via the command line: +`gen-ir` is implemented as a Swift Package, so you can either open [`Package.swift`](Package.swift) in an IDE or build via the command line: ```sh # Debug output: ./.build/debug/gen-ir From f59181d66ec073409f3bb7f91af18b61b77c3c5a Mon Sep 17 00:00:00 2001 From: bmxav <5422569+bmxav@users.noreply.github.com> Date: Tue, 17 Sep 2024 08:50:01 -0400 Subject: [PATCH 3/3] Update release version to 0.5.1 --- Sources/GenIR/Versions.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/GenIR/Versions.swift b/Sources/GenIR/Versions.swift index 485d724..bd00e4b 100644 --- a/Sources/GenIR/Versions.swift +++ b/Sources/GenIR/Versions.swift @@ -8,5 +8,5 @@ import Foundation enum Versions { - static let version = "0.5.0" + static let version = "0.5.1" }