Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BuildPluginCrashExample

Summary

SwiftPM's command plugin can build any target with the PackageManager API. However, when the executable target has an async main function, and the minimum deployment target is macOS 26, the latest main snapshot toolchain generates a broken executable that crashes on launch.

Executable Target:

@main
struct Foo {
    static func main() async {}
}

Command Plugin:

@main
struct BenchmarkCommandPlugin: CommandPlugin {
    func performCommand(context: PluginContext, arguments: [String]) throws {
        let result = try self.packageManager.build(.product("Foo"), parameters: .init(configuration: .release))
        guard result.succeeded else {
            preconditionFailure("build failure")
        }
    }
}

Steps to reproduce

swift package build
.build/release/Foo  # crash

Environment

$ sw_vers
ProductName:            macOS
ProductVersion:         26.2
BuildVersion:           25C56
$ swift --version
Apple Swift version 6.3-dev (LLVM d402ab9729f318e, Swift 2de856568572fc0)
Target: arm64-apple-macosx26.0
Build config: +assertions

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages