diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e9c226f..f38a4b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,10 +10,6 @@ jobs: build: runs-on: macos-latest steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '16.4.0' # Specify the desired Xcode version - - uses: actions/checkout@v4 - name: 🔨 Build diff --git a/PIF/Sources/PIFSupport/PIF.swift b/PIF/Sources/PIFSupport/PIF.swift index e2e27c1..a92ac43 100644 --- a/PIF/Sources/PIFSupport/PIF.swift +++ b/PIF/Sources/PIFSupport/PIF.swift @@ -2,7 +2,7 @@ // // This source file contains derivative work from the Swift Open Source Project // -// Copyright (c) 2014-2020 Apple Inc. and the Swift project authors +// Copyright (c) 2014-2023 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information @@ -483,35 +483,59 @@ public enum PIF { /// An Xcode target, representing a single entity to build. public final class Target: BaseTarget { public enum ProductType: String, Decodable { - case appExtension = "com.apple.product-type.app-extension" - case appExtensionMessages = "com.apple.product-type.app-extension.messages" - case stickerPackExtension = "com.apple.product-type.app-extension.messages-sticker-pack" - case application = "com.apple.product-type.application" - case applicationMessages = "com.apple.product-type.application.messages" - case appClip = "com.apple.product-type.application.on-demand-install-capable" - case bundle = "com.apple.product-type.bundle" - case externalTest = "com.apple.product-type.bundle.external-test" - case ocUnitTest = "com.apple.product-type.bundle.ocunit-test" - case uiTesting = "com.apple.product-type.bundle.ui-testing" - case unitTest = "com.apple.product-type.bundle.unit-test" - case extensionKitExtension = "com.apple.product-type.extensionkit-extension" - case framework = "com.apple.product-type.framework" - case staticFramework = "com.apple.product-type.framework.static" - case instrumentsPackage = "com.apple.product-type.instruments-package" - case kernelExtension = "com.apple.product-type.kernel-extension" - case ioKitKernelExtension = "com.apple.product-type.kernel-extension.iokit" - case dynamicLibrary = "com.apple.product-type.library.dynamic" - case staticLibrary = "com.apple.product-type.library.static" - case objectFile = "com.apple.product-type.objfile" - case pluginKitPlugin = "com.apple.product-type.pluginkit-plugin" + case appExtension = "product-type.app-extension" + case appExtensionMessages = "product-type.app-extension.messages" + case stickerPackExtension = "product-type.app-extension.messages-sticker-pack" + case application = "product-type.application" + case applicationMessages = "product-type.application.messages" + case appClip = "product-type.application.on-demand-install-capable" + case bundle = "product-type.bundle" + case externalTest = "product-type.bundle.external-test" + case ocUnitTest = "product-type.bundle.ocunit-test" + case uiTesting = "product-type.bundle.ui-testing" + case unitTest = "product-type.bundle.unit-test" + case extensionKitExtension = "product-type.extensionkit-extension" + case framework = "product-type.framework" + case staticFramework = "product-type.framework.static" + case instrumentsPackage = "product-type.instruments-package" + case kernelExtension = "product-type.kernel-extension" + case ioKitKernelExtension = "product-type.kernel-extension.iokit" + case dynamicLibrary = "product-type.library.dynamic" + case staticLibrary = "product-type.library.static" + case objectFile = "product-type.objfile" + case pluginKitPlugin = "product-type.pluginkit-plugin" case packageProduct = "packageProduct" - case systemExtension = "com.apple.product-type.system-extension" - case tool = "com.apple.product-type.tool" - case hostBuild = "com.apple.product-type.tool.host-build" - case xpcService = "com.apple.product-type.xpc-service" - case watchApp2 = "com.apple.product-type.application.watchapp2" - case watchApp2Container = "com.apple.product-type.application.watchapp2-container" - case watchKit2Extension = "com.apple.product-type.watchkit2-extension" + case systemExtension = "product-type.system-extension" + case tool = "product-type.tool" + case hostBuild = "product-type.tool.host-build" + case xpcService = "product-type.xpc-service" + case watchApp2 = "product-type.application.watchapp2" + case watchApp2Container = "product-type.application.watchapp2-container" + case watchKit2Extension = "product-type.watchkit2-extension" + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + let fullValue = try container.decode(String.self) + + let normalizedValue: String + if fullValue.hasPrefix("com.apple.") { + normalizedValue = String(fullValue.dropFirst("com.apple.".count)) + } else if fullValue.hasPrefix("org.swift.") { + normalizedValue = String(fullValue.dropFirst("org.swift.".count)) + } else { + normalizedValue = fullValue + } + + guard let decodedCase = ProductType(rawValue: normalizedValue) else { + throw DecodingError.dataCorrupted( + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Cannot initialize ProductType from invalid String value \(fullValue)" + ) + ) + } + self = decodedCase + } } public let productName: String diff --git a/Package.resolved b/Package.resolved index 5a1963f..bd40bc5 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-argument-parser", "state" : { - "revision" : "41982a3656a71c768319979febd796c6fd111d5c", - "version" : "1.5.0" + "revision" : "6a52f3251125d74daf04fcbd5e6f08a75d074382", + "version" : "1.8.2" } }, { diff --git a/Package.swift b/Package.swift index 49ff6d5..f7d9fa4 100644 --- a/Package.swift +++ b/Package.swift @@ -16,7 +16,7 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), - .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"), + .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.7.0"), .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"), .package(path: "PIF") diff --git a/Sources/GenIR/GenIR.swift b/Sources/GenIR/GenIR.swift index fc3cdbd..47f6ec6 100644 --- a/Sources/GenIR/GenIR.swift +++ b/Sources/GenIR/GenIR.swift @@ -17,13 +17,13 @@ struct DeprecatedOptions: ParsableArguments { struct DebuggingOptions: ParsableArguments { - @Option(help: ArgumentHelp("Path to PIF cache. Use this in place of what is in the Xcode build log", visibility: .hidden)) + @Option(help: ArgumentHelp("Path to PIF cache. Use this in place of what is in the Xcode build log", visibility: .default)) var pifCachePath: URL? - @Option(help: ArgumentHelp("Specifiy a logging level. The --debug flag will override this", visibility: .hidden)) + @Option(help: ArgumentHelp("Specifiy a logging level. The --debug flag will override this", visibility: .default)) var logLevel: LogLevelArgument? - @Flag(help: ArgumentHelp("If true, add captured debug data to the xcarchive.", visibility: .hidden)) + @Flag(help: ArgumentHelp("If true, add captured debug data to the xcarchive.", visibility: .default)) var capture: Bool = false } @@ -53,6 +53,11 @@ struct DebuggingOptions: ParsableArguments { $ xcodebuild clean && xcodebuild build -project MyProject.xcodeproj \\\n\t\t-configuration Debug \\\n\t\t-scheme MyScheme \ \\\n\t\tDEBUG_INFOMATION_FORMAT=dwarf-with-dsym \\\n\t\tENABLE_BITCODE=NO \\\n\t\t2>&1 | \(programName) - x.xcarchive + Optionally: + If using precompilation on your Xcode build, it maybe necessary to turn that off to avoid module cache path errors. + GCC_PRECOMPILE_PREFIX_HEADER=NO + ENABLE_MODULE_PRECOMPILATION=NO + """, version: "v\(Versions.version)" ) @@ -85,7 +90,6 @@ struct DebuggingOptions: ParsableArguments { // Drop this in release 0.6 or greater @OptionGroup var deprecatedOptions: DeprecatedOptions - // These options are hidden and will not be shown in the help text @OptionGroup var debuggingOptions: DebuggingOptions mutating func validate() throws { diff --git a/Sources/GenIR/Versions.swift b/Sources/GenIR/Versions.swift index 5165470..5966b16 100644 --- a/Sources/GenIR/Versions.swift +++ b/Sources/GenIR/Versions.swift @@ -5,6 +5,7 @@ // Created by Thomas Hedderwick on 12/09/2022. // // History: +// 2026-nn-nn - 1.0.3 -- SSAST-15959, SSAST-16090 - product type org.swift...; help text update // 2026-nn-nn - 1.0.2 -- SSAST-11722 don't fail on TargetDependency decode failure. // 2026-01-08 - 1.0.1 -- Use info logging to allow user to monitor progress. // 2025-12-01 - 1.0.0 -- Don't chase through Dynamic Dependencies @@ -16,5 +17,5 @@ import Foundation enum Versions { - static let version = "1.0.2" + static let version = "1.0.3" } diff --git a/TestAssets/Umbrella/Umbrella.xcodeproj/project.pbxproj b/TestAssets/Umbrella/Umbrella.xcodeproj/project.pbxproj index 6e9df0c..b6b87d1 100644 --- a/TestAssets/Umbrella/Umbrella.xcodeproj/project.pbxproj +++ b/TestAssets/Umbrella/Umbrella.xcodeproj/project.pbxproj @@ -112,7 +112,6 @@ CEC11E5C29F6BF4900F16A2E /* Sources */, CEC11E5D29F6BF4900F16A2E /* Frameworks */, CEC11E5E29F6BF4900F16A2E /* Resources */, - CEC11E7329F6C29D00F16A2E /* ShellScript */, ); buildRules = ( ); @@ -189,23 +188,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - CEC11E7329F6C29D00F16A2E /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 8; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 1; - shellPath = /bin/sh; - shellScript = "# All other frameworks are a by-product of building this framework, but this is just an empty framework, we don't need it so we can remove it.\nrm -rf \"$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.framework\"\nrm -rf \"$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME\"\n"; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/Tests/GenIRTests/UmbrellaTests.swift b/Tests/GenIRTests/UmbrellaTests.swift index 2b86381..59c94e1 100644 --- a/Tests/GenIRTests/UmbrellaTests.swift +++ b/Tests/GenIRTests/UmbrellaTests.swift @@ -34,7 +34,7 @@ final class UmbrellaTests: XCTestCase { func testSkipInstallNo() throws { let context = TestContext() - try context.build(test: testPath, scheme: scheme, additionalArguments: ["SKIP_INSTALL=NO"]) + try context.build(test: testPath, scheme: scheme, additionalArguments: ["SKIP_INSTALL=NO", "ENABLE_USER_SCRIPT_SANDBOXING=YES"]) let output = context.archive.appendingPathComponent("IR") @@ -63,7 +63,7 @@ final class UmbrellaTests: XCTestCase { func testCustomDerivedDataAndSkipInstallNo() throws { let context = TestContext() - try context.build(test: testPath, scheme: scheme, additionalArguments: ["SKIP_INSTALL=NO", "-derivedDataPath", "_build"]) + try context.build(test: testPath, scheme: scheme, additionalArguments: ["SKIP_INSTALL=NO", "ENABLE_USER_SCRIPT_SANDBOXING=YES", "-derivedDataPath", "_build"]) let output = context.archive.appendingPathComponent("IR")