SPM plugin: Mac Catalyst build fails
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Describe the bug
My small lib PDefaults uses SwiftLint as a SPM plugin.
It won't build using XCode 14.3.1 with My Mac (Mac Catalyst) run destination.
It's in fact SourceKitten that's failing.
Complete output
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:80:25: error: 'executableURL' is unavailable in Mac Catalyst
process.executableURL = URL(fileURLWithPath: command)
^~~~~~~~~~~~~
Foundation.Process:5:14: note: 'executableURL' has been explicitly marked unavailable here
open var executableURL: URL? { get set }
^
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:81:25: error: 'currentDirectoryURL' is unavailable in Mac Catalyst
process.currentDirectoryURL = URL(fileURLWithPath: currentDirectory)
^~~~~~~~~~~~~~~~~~~
Foundation.Process:10:14: note: 'currentDirectoryURL' has been explicitly marked unavailable here
open var currentDirectoryURL: URL? { get set }
^
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:82:29: error: 'run()' is unavailable in Mac Catalyst
try process.run()
^~~
Foundation.Process:16:15: note: 'run()' has been explicitly marked unavailable here
open func run() throws
^
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:84:25: error: 'launchPath' is unavailable in Mac Catalyst
process.launchPath = command
^~~~~~~~~~
Foundation.Process:4:14: note: 'launchPath' has been explicitly marked unavailable here
open var launchPath: String? { get set }
^
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:85:25: error: 'currentDirectoryPath' is unavailable in Mac Catalyst
process.currentDirectoryPath = currentDirectory
^~~~~~~~~~~~~~~~~~~~
Foundation.Process:7:14: note: 'currentDirectoryPath' has been explicitly marked unavailable here
open var currentDirectoryPath: String { get set }
^
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:86:17: error: ambiguous use of 'launch()'
process.launch()
^
Foundation.Process:20:15: note: found this candidate
open func launch() throws
^
Foundation.Process:10:15: note: found this candidate
open func launch()
^
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:80:25: 'executableURL' is unavailable in Mac Catalyst
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:81:25: 'currentDirectoryURL' is unavailable in Mac Catalyst
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:82:29: 'run()' is unavailable in Mac Catalyst
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:84:25: 'launchPath' is unavailable in Mac Catalyst
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:85:25: 'currentDirectoryPath' is unavailable in Mac Catalyst
/Users/pierremardon/Library/Developer/Xcode/DerivedData/PDefaults-djcfgicqqjpoyxfbpddekwbrdfka/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:86:17: Ambiguous use of 'launch()'
caused by this snippet, the compiler considering canImport(Darwin) is true:
#if canImport(Darwin)
if #available(macOS 10.13, *) {
process.executableURL = URL(fileURLWithPath: command)
process.currentDirectoryURL = URL(fileURLWithPath: currentDirectory)
try process.run()
} else {
process.launchPath = command
process.currentDirectoryPath = currentDirectory
process.launch()
}
#else
process.executableURL = URL(fileURLWithPath: command)
process.currentDirectoryURL = URL(fileURLWithPath: currentDirectory)
try process.run()
#endif
Environment
- SwiftLint version (run
swiftlint versionto be sure)?0.52.3 - Installation method used (Homebrew, CocoaPods, building from source, etc)? SPM plugin
- Paste your configuration file: not relevant
- Are you using nested configurations? not relevant
- Which Xcode version are you using (check
xcodebuild -version)?14.3.1 - Do you have a sample that shows the issue?
- Create a dummy package with SwiftLint used as a plugin like this:
import PackageDescription
let package = Package(
name: "PDefaults",
platforms: [
.macOS(.v12),
.iOS(.v13)
],
products: [
.library(
name: "PDefaults",
targets: ["PDefaults"]
),
],
dependencies: [
.package(url: "https://github.com/realm/SwiftLint", exact: "0.52.3")
],
targets: [
.target(
name: "PDefaults",
dependencies: [],
plugins: [.plugin(name: "SwiftLintPlugin", package: "SwiftLint")]
),
]
)
- try to build it for Mac Catalyst with XCode 14.3.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with SourceKitten's Source/SourceKittenFramework/Exec.swift, especially the Process setup shown in the report, and reproduce the failure using the provided PDefaults package with SwiftLint 0.52.3 on a Mac Catalyst destination in Xcode 14.3.1. Done means the sample package builds for Mac Catalyst without the reported Process availability and ambiguous launch errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100