Skip to content

Commit 2dcf5c4

Browse files
Merge branch 'main' into louis/update-check
2 parents 134eded + df0e91c commit 2dcf5c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2935
-1270
lines changed

.github/workflows/pull_request.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ jobs:
3737
- name: Prepare the action
3838
run: ./scripts/prep-gh-action.sh --install-swiftly
3939
- name: Build and Test
40-
run: swift test
40+
# UBI 9 and Ubuntu 20.04 - See https://github.com/swiftlang/swift/issues/80908
41+
# UBI 9 - See https://github.com/swiftlang/swift/issues/80909
42+
run: bash -c 'if [[ "${{ matrix.container }}" == "redhat/ubi9" ]]; then swift build --build-tests; elif [[ "${{ matrix.container }}" == "ubuntu:20.04" ]]; then swift build --build-tests; else swift test; fi'
4143

4244
releasebuildcheck:
4345
name: Release Build Check
@@ -94,6 +96,26 @@ jobs:
9496
- name: Extract and Run Workflow Tests
9597
run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly-*.tar.gz && ./test-swiftly -y ./swiftly.tar.gz
9698

99+
release-custom-install-test:
100+
name: Test Release - Custom Install Location
101+
needs: releasebuildcheck
102+
runs-on: ubuntu-latest
103+
container:
104+
image: "ubuntu:24.04"
105+
steps:
106+
- name: Prepare System
107+
run: apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install ca-certificates gpg tzdata
108+
- name: Download Release
109+
uses: actions/download-artifact@v4
110+
with:
111+
name: swiftly-release-x86_64
112+
- name: Download Tests
113+
uses: actions/download-artifact@v4
114+
with:
115+
name: swiftly-tests-x86_64
116+
- name: Extract and Run Workflow Tests
117+
run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly-*.tar.gz && ./test-swiftly -y --custom-location ./swiftly.tar.gz
118+
97119
formatcheck:
98120
name: Format Check
99121
runs-on: ubuntu-latest

Package.swift

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
// swift-tools-version:5.10
1+
// swift-tools-version:6.0
22

33
import PackageDescription
44

5+
let swiftSettings = [
6+
SwiftSetting.enableUpcomingFeature("MemberImportVisibility"),
7+
]
8+
59
let package = Package(
610
name: "swiftly",
711
platforms: [
@@ -26,6 +30,7 @@ let package = Package(
2630
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
2731
.package(url: "https://github.com/apple/swift-openapi-generator", from: "1.6.0"),
2832
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.7.0"),
33+
.package(url: "https://github.com/apple/swift-system", from: "1.4.2"),
2934
// This dependency provides the correct version of the formatter so that you can run `swift run swiftformat Package.swift Plugins/ Sources/ Tests/`
3035
.package(url: "https://github.com/nicklockwood/SwiftFormat", exact: "0.49.18"),
3136
],
@@ -38,7 +43,9 @@ let package = Package(
3843
.target(name: "LinuxPlatform", condition: .when(platforms: [.linux])),
3944
.target(name: "MacOSPlatform", condition: .when(platforms: [.macOS])),
4045
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
41-
]
46+
.product(name: "SystemPackage", package: "swift-system"),
47+
],
48+
swiftSettings: swiftSettings
4249
),
4350
.executableTarget(
4451
name: "TestSwiftly",
@@ -47,16 +54,38 @@ let package = Package(
4754
.target(name: "SwiftlyCore"),
4855
.target(name: "LinuxPlatform", condition: .when(platforms: [.linux])),
4956
.target(name: "MacOSPlatform", condition: .when(platforms: [.macOS])),
50-
]
57+
],
58+
swiftSettings: swiftSettings
5159
),
5260
.target(
5361
name: "SwiftlyCore",
5462
dependencies: [
63+
"SwiftlyDownloadAPI",
64+
"SwiftlyWebsiteAPI",
5565
.product(name: "AsyncHTTPClient", package: "async-http-client"),
5666
.product(name: "NIOFoundationCompat", package: "swift-nio"),
5767
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
5868
.product(name: "OpenAPIAsyncHTTPClient", package: "swift-openapi-async-http-client"),
69+
.product(name: "SystemPackage", package: "swift-system"),
70+
],
71+
swiftSettings: swiftSettings
72+
),
73+
.target(
74+
name: "SwiftlyDownloadAPI",
75+
dependencies: [
76+
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
5977
],
78+
swiftSettings: swiftSettings,
79+
plugins: [
80+
.plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator"),
81+
]
82+
),
83+
.target(
84+
name: "SwiftlyWebsiteAPI",
85+
dependencies: [
86+
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
87+
],
88+
swiftSettings: swiftSettings,
6089
plugins: [
6190
.plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator"),
6291
]
@@ -88,6 +117,9 @@ let package = Package(
88117
.executableTarget(
89118
name: "build-swiftly-release",
90119
dependencies: [
120+
.target(name: "SwiftlyCore"),
121+
.target(name: "LinuxPlatform", condition: .when(platforms: [.linux])),
122+
.target(name: "MacOSPlatform", condition: .when(platforms: [.macOS])),
91123
.product(name: "ArgumentParser", package: "swift-argument-parser"),
92124
],
93125
path: "Tools/build-swiftly-release"
@@ -97,7 +129,9 @@ let package = Package(
97129
dependencies: [
98130
"SwiftlyCore",
99131
"CLibArchive",
132+
.product(name: "SystemPackage", package: "swift-system"),
100133
],
134+
swiftSettings: swiftSettings,
101135
linkerSettings: [
102136
.linkedLibrary("z"),
103137
]
@@ -106,7 +140,9 @@ let package = Package(
106140
name: "MacOSPlatform",
107141
dependencies: [
108142
"SwiftlyCore",
109-
]
143+
.product(name: "SystemPackage", package: "swift-system"),
144+
],
145+
swiftSettings: swiftSettings
110146
),
111147
.systemLibrary(
112148
name: "CLibArchive",
@@ -117,10 +153,14 @@ let package = Package(
117153
),
118154
.testTarget(
119155
name: "SwiftlyTests",
120-
dependencies: ["Swiftly"],
156+
dependencies: [
157+
"Swiftly",
158+
.product(name: "SystemPackage", package: "swift-system"),
159+
],
121160
resources: [
122161
.embedInCode("mock-signing-key-private.pgp"),
123-
]
162+
],
163+
swiftSettings: swiftSettings
124164
),
125165
]
126166
)

Plugins/GenerateDocsReference/GenerateDocsReferenceError.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Foundation
2-
import PackagePlugin
2+
@preconcurrency import PackagePlugin
33

4+
@preconcurrency
45
enum GenerateDocsReferencePluginError: Error {
56
case unknownBuildConfiguration(String)
67
case buildFailed(String)

Sources/LinuxPlatform/Extract.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import CLibArchive
22
import Foundation
3+
import SystemPackage
34

45
// The code in this file consists mainly of a Swift port of the "Complete Extractor" example included in the libarchive
56
// documentation: https://github.com/libarchive/libarchive/wiki/Examples#a-complete-extractor
@@ -44,7 +45,7 @@ func copyData(readArchive: OpaquePointer?, writeArchive: OpaquePointer?) throws
4445
/// the provided closure which will return the path the file will be written to.
4546
///
4647
/// This uses libarchive under the hood, so a wide variety of archive formats are supported (e.g. .tar.gz).
47-
func extractArchive(atPath archivePath: URL, transform: (String) -> URL) throws {
48+
func extractArchive(atPath archivePath: FilePath, transform: (String) -> FilePath) throws {
4849
var flags = Int32(0)
4950
flags = ARCHIVE_EXTRACT_TIME
5051
flags |= ARCHIVE_EXTRACT_PERM
@@ -66,8 +67,8 @@ func extractArchive(atPath archivePath: URL, transform: (String) -> URL) throws
6667
archive_write_free(ext)
6768
}
6869

69-
if archive_read_open_filename(a, archivePath.path, 10240) != 0 {
70-
throw ExtractError(message: "Failed to open \"\(archivePath.path)\"")
70+
if archive_read_open_filename(a, archivePath.string, 10240) != 0 {
71+
throw ExtractError(message: "Failed to open \"\(archivePath)\"")
7172
}
7273

7374
while true {
@@ -82,7 +83,7 @@ func extractArchive(atPath archivePath: URL, transform: (String) -> URL) throws
8283
}
8384

8485
let currentPath = String(cString: archive_entry_pathname(entry))
85-
archive_entry_set_pathname(entry, transform(currentPath).path)
86+
archive_entry_set_pathname(entry, transform(currentPath).string)
8687
r = archive_write_header(ext, entry)
8788
guard r == ARCHIVE_OK else {
8889
throw ExtractError(archive: ext)

0 commit comments

Comments
 (0)