Skip to content

Commit 891b4db

Browse files
authored
feat: add freebsd platform to allow resolving more Swift packages (#1809)
Fixes the following error for some packages (like https://github.com/swiftlang/swift-subprocess) ``` ERROR: /private/var/tmp/_bazel_lpadron/9ae9416857eb79bb978de35a53d54970/external/rules_swift_package_manager+/config_settings/spm/platform/BUILD.bazel: no such target '@@rules_swift_package_manager+//config_settings/spm/platform:freebsd': target 'freebsd' not declared in package 'config_settings/spm/platform' defined by /private/var/tmp/_bazel_lpadron/9ae9416857eb79bb978de35a53d54970/external/rules_swift_package_manager+/config_settings/spm/platform/BUILD.bazel (did you mean openbsd?) ```
1 parent dd72213 commit 891b4db

File tree

6 files changed

+30
-1
lines changed

6 files changed

+30
-1
lines changed

config_settings/spm/platform/platforms.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ _NON_APPLE_PLATFORMS = [
3737
"android",
3838
"wasi",
3939
"openbsd",
40+
"freebsd",
4041
]
4142

4243
_PLATFORM_INFOS = [

examples/interesting_deps/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ swift_binary(
5454
"@swiftpkg_opencombine//:OpenCombine",
5555
"@swiftpkg_swift_log//:Logging",
5656
"@swiftpkg_swift_package_defines_example//:FooSwift",
57+
"@swiftpkg_swift_subprocess//:Subprocess",
5758
],
5859
)
5960

examples/interesting_deps/MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,6 @@ use_repo(
9292
"swiftpkg_opencombine",
9393
"swiftpkg_swift_log",
9494
"swiftpkg_swift_package_defines_example",
95+
"swiftpkg_swift_subprocess",
9596
"swiftpkg_yoti_doc_scan_ios",
9697
)

examples/interesting_deps/Package.resolved

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/interesting_deps/Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 5.7
1+
// swift-tools-version: 6.1
22

33
import Foundation
44
import PackageDescription
@@ -17,6 +17,7 @@ let dependencies: [Package.Dependency] = {
1717
.package(url: "https://github.com/erikdoe/ocmock", from: "3.9.4"),
1818
.package(url: "https://github.com/getyoti/yoti-doc-scan-ios.git", from: "7.0.0"),
1919
.package(url: "https://github.com/luispadron/swift-package-defines-example", from: "2.0.0"),
20+
.package(url: "https://github.com/swiftlang/swift-subprocess", from: "0.1.0"),
2021
]
2122
} else {
2223
return [

examples/interesting_deps/main.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import GEOSwift
55
import libwebp
66
import Logging
77
import OpenCombine
8+
import Subprocess
89

910
// Configure DDLog to be the backend for the swift-log.
1011
DDLog.add(DDTTYLogger.sharedInstance!)
@@ -17,3 +18,9 @@ let webpVersion = WebPGetDecoderVersion()
1718
logger.info("WebP version: \(webpVersion)")
1819

1920
fooSwift()
21+
22+
let result = try await run(.name("ls"), output: .string(limit: 4096))
23+
24+
print(result.processIdentifier)
25+
print(result.terminationStatus)
26+
print(result.standardOutput)

0 commit comments

Comments
 (0)