Hive Hive
Sign in

[swift_package] .defaultIsolation in swiftSettings is not passed to swiftc

GitHub issue · Open

Metadata
Source
tuist/once #283
Updated
Sep 16, 2026
Details

Hi! I’m trying out Once on a Swift 6 project and ran into an issue with actor isolation settings.

When a Swift package target defines .defaultIsolation(MainActor.self) in its swiftSettings, the setting doesn’t seem to be forwarded to swiftc (the -default-isolation MainActor flag is missing). As a result, the build fails under Swift 6 with concurrency errors on global or static variables that rely on default isolation.

Environment: Xcode 27, Swift 6.4, Once 0.56.0.

Reproduction

Package.swift:

// swift-tools-version: 6.2
import PackageDescription
let package = Package(
name: "DefaultIsolationRepro",
platforms: [.macOS(.v14)],
targets: [
.target(
name: "DefaultIsolation",
swiftSettings: [
.defaultIsolation(MainActor.self)
]
)
]
)

Sources/DefaultIsolation/DefaultIsolation.swift:

public final class MutableBox {
public var value: Int
public init(value: Int = 0) {
self.value = value
}
}
public enum GlobalState {
public static let shared = MutableBox()
}

Steps

Native SwiftPM builds fine:

swift build

Building the same target with Once:

once query targets
once build SwiftPackage_DefaultIsolationRepro_DefaultIsolation

Fails with:

Sources/DefaultIsolation/DefaultIsolation.swift:10:21: error: static property 'shared' is not concurrency-safe because non-'Sendable' type 'MutableBox' may have shared mutable state [#MutableGlobalVariable]
public static let shared = MutableBox()
^
swift_module_compile_DefaultIsolation (2) failed for SwiftPackage_DefaultIsolationRepro_DefaultIsolation with exit code 1

When checking the swiftc command:

  • Native swift build passes -default-isolation MainActor
  • once build passes -swift-version 6, but -default-isolation MainActor is missing
Flights

Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.

New Flights are paused Configure model inference, GitHub, and a sandbox provider to start another Flight. Existing results remain available below.
No Flights yet

Start a Flight and preserve its objective, outcome, and session here.

Comments

No GitHub comments yet.