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] 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)