Avatar
宣言なしで使えるというかそもそも宣言したくてもできないです.conditional な依存関係やビルド設定のためにある Platform と,SupportedPlatform は別で,omochimetaru さんがおっしゃってる箇所は SupportedPlatform を記述するところなんですがそっちは linux が存在しないんですよね. https://developer.apple.com/documentation/packagedescription/platform https://developer.apple.com/documentation/packagedescription/supportedplatform
A platform supported by Swift Package Manager.
A platform that the Swift package supports.
12:55 AM
error: 'hoge': Invalid manifest (compiled with: ["/home/kebo/.local/share/swiftly/toolchains/main-snapshot-2024-03-01/usr/bin/swiftc", "-vfsoverlay", "/tmp/TemporaryDirectory.NMzSPB/vfs.yaml", "-L", "/home/kebo/.local/share/swiftly/toolchains/main-snapshot-2024-03-01/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/home/kebo/.local/share/swiftly/toolchains/main-snapshot-2024-03-01/usr/lib/swift/pm/ManifestAPI", "-swift-version", "5", "-I", "/home/kebo/.local/share/swiftly/toolchains/main-snapshot-2024-03-01/usr/lib/swift/pm/ManifestAPI", "-package-description-version", "6.0.0", "/home/kebo/hoge/Package.swift", "-Xfrontend", "-disable-implicit-concurrency-module-import", "-Xfrontend", "-disable-implicit-string-processing-module-import", "-o", "/tmp/TemporaryDirectory.OgHbDE/hoge-manifest"]) /home/kebo/hoge/Package.swift:8:18: error: type 'SupportedPlatform' has no member 'linux' 6 │ let package = Package( 7 │ name: "hoge", 8 │ platforms: [.linux], │ ╰─ error: type 'SupportedPlatform' has no member 'linux' 9 │ targets: [ 10 │ // Targets are the basic building blocks of a package, defining a module or a test suite.
12:57 AM
SupportedPlatform はドキュメント見るとわかるとおり Apple プラットフォームしか存在してないです.