`xtool dev` fails on macOS with packages using platform-conditional target dependencies (e.g. swift-crypto)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- swift
- Ambito
- build-system
Direzione di ricerca
Start with Sources/PackLib/Planner.swift around the dependency walk and Sources/PackLib/Packer.swift around bundle copying; reproduce with the provided swift-crypto package using xtool dev build. Check whether platform conditions are available from swift package dump-package and how the planner uses them. Done means the app packs successfully without attempting to copy bundles for targets SwiftPM excluded.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
On macOS, xtool dev build fails at the packing step for any app that depends on swift-crypto's Crypto product. SwiftPM builds successfully, then xtool tries to copy a resource bundle that was never built:
Build complete! (22.01s)
Error: The file “swift-crypto_CryptoBoringWrapper.bundle” couldn’t be opened because there is no such file.
Steps to reproduce
Package.swift:
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "repro",
platforms: [.iOS(.v17), .macOS(.v14)],
products: [.library(name: "repro", targets: ["repro"])],
dependencies: [
.package(url: "https://github.com/apple/swift-crypto", exact: "3.15.1"),
],
targets: [
.target(name: "repro", dependencies: [.product(name: "Crypto", package: "swift-crypto")]),
]
)
xtool.yml:
version: 1
bundleID: com.example.repro
Sources/repro/App.swift:
import Crypto
import SwiftUI
@main
struct ReproApp: App {
var body: some Scene {
WindowGroup { Text(SHA256.hash(data: Data()).description) }
}
}
Then run xtool dev build.
Expected: the app is packed, containing only the bundles SwiftPM built.
Actual: the build succeeds, packing fails with the error above, and swift-crypto_Crypto.bundle is the only bundle in .build/arm64-apple-ios/debug/.
Cause
swift-crypto declares the BoringSSL targets as dependencies of Crypto only on non-Apple platforms:
.target(name: "CryptoBoringWrapper", condition: .when(platforms: platforms)),
So SwiftPM correctly doesn't build those targets or their bundles for iOS. However, swift package describe lists these dependencies without their conditions:
Crypto ['CCryptoBoringSSL', 'CCryptoBoringSSLShims', 'CryptoBoringWrapper']
Planner.swift follows that list and plans a bundle for every target with resources. Packer.swift then copies each planned bundle unconditionally, which fails for swift-crypto_CCryptoBoringSSL, swift-crypto_CCryptoBoringSSLShims, and swift-crypto_CryptoBoringWrapper.
This appears to be specific to macOS hosts, because swift-crypto declares these resources only under #if canImport(Darwin). I haven't tested on Linux.
Possible fixes
I haven't tried either of these:
- Have the planner evaluate platform conditions, for example from
swift package dump-package, so that excluded targets are never walked. This also avoids following their dependencies. - Have the packer skip planned bundles that don't exist. This is smaller, but it could hide a bundle that is genuinely missing.
Workaround
After a failed build, copy each target's PrivacyInfo.xcprivacy into the bundle path SwiftPM would have used, then rerun. This has to be repeated whenever .build is deleted.
for t in CCryptoBoringSSL CCryptoBoringSSLShims CryptoBoringWrapper; do
d=.build/arm64-apple-ios/debug/swift-crypto_$t.bundle
mkdir -p "$d" && cp ".build/checkouts/swift-crypto/Sources/$t/PrivacyInfo.xcprivacy" "$d/"
done
Environment
- xtool 1.24.0
- Xcode 26.5, Swift 6.3.2
- macOS 26, Intel host
- swift-crypto 3.15.1
- Lingua principale
- Swift
- Stelle
- 5.5k
- Fork
- 163
- Merge medio
- 1g 12h
- PR unite (30g)
- 32
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di xtool-org/xtool
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
I maintainer di solito rispondono entro 1 giorno
-
Release build crashes the compiler on Linux since #389 (RCodesign)Forse già presa @c4software l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
xtool-org/xtool#431 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 50/100
xtool-org/xtool#414 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 46/100
xtool-org/xtool#407 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di xtool-org/xtool
Issue simili
-
🎉 Add WoundAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 77/100
jaywcjlove/awesome-mac#4357 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
Bug: on hover a tab's name in Cra stops ~16 pt short of Arc's, with 24 pt of air before the ✕Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
VictorKildahl/cra#243 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
OneBusAway/vehicle-positions#260 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
eliasstravik/herdr-projects#789 · 1 commento ·