Skip to content

Commit 4908dbc

Browse files
committed
Use the vendored and SwiftPM support libarchive for swiftly
1 parent 83661a4 commit 4908dbc

File tree

8 files changed

+42
-59
lines changed

8 files changed

+42
-59
lines changed

Package.swift

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

3+
import Foundation
34
import PackageDescription
45

6+
let swiftlyTarget: Target = .executableTarget(
7+
name: "Swiftly",
8+
dependencies: [
9+
.product(name: "ArgumentParser", package: "swift-argument-parser"),
10+
.target(name: "SwiftlyCore"),
11+
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
12+
]
13+
)
14+
515
let ghApiCacheResources = (1...16).map { Resource.embedInCode("gh-api-cache/swift-tags-page\($0).json") }
616
let ghApiCacheExcludedResources = (17...27).map { "gh-api-cache/swift-tags-page\($0).json" }
717

@@ -24,16 +34,7 @@ let package = Package(
2434
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
2535
],
2636
targets: [
27-
.executableTarget(
28-
name: "Swiftly",
29-
dependencies: [
30-
.product(name: "ArgumentParser", package: "swift-argument-parser"),
31-
.target(name: "SwiftlyCore"),
32-
.target(name: "LinuxPlatform", condition: .when(platforms: [.linux])),
33-
.target(name: "MacOSPlatform", condition: .when(platforms: [.macOS])),
34-
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
35-
]
36-
),
37+
swiftlyTarget,
3738
.target(
3839
name: "SwiftlyCore",
3940
dependencies: [
@@ -65,29 +66,6 @@ let package = Package(
6566
],
6667
path: "Tools/generate-docs-reference"
6768
),
68-
.target(
69-
name: "LinuxPlatform",
70-
dependencies: [
71-
"SwiftlyCore",
72-
"CLibArchive",
73-
],
74-
linkerSettings: [
75-
.linkedLibrary("z"),
76-
]
77-
),
78-
.target(
79-
name: "MacOSPlatform",
80-
dependencies: [
81-
"SwiftlyCore",
82-
]
83-
),
84-
.systemLibrary(
85-
name: "CLibArchive",
86-
pkgConfig: "libarchive",
87-
providers: [
88-
.apt(["libarchive-dev"]),
89-
]
90-
),
9169
.testTarget(
9270
name: "SwiftlyTests",
9371
dependencies: ["Swiftly"],
@@ -99,3 +77,31 @@ let package = Package(
9977
),
10078
]
10179
)
80+
81+
#if os(Linux)
82+
83+
package.dependencies.append(.package(path: "libarchive"))
84+
package.targets.append(
85+
.target(
86+
name: "LinuxPlatform",
87+
dependencies: [
88+
.target(name: "SwiftlyCore"),
89+
.product(name: "archive-devel", package: "libarchive"),
90+
]
91+
)
92+
)
93+
swiftlyTarget.dependencies.append(.target(name: "LinuxPlatform"))
94+
95+
#elseif os(macOS)
96+
97+
package.targets.append(
98+
.target(
99+
name: "MacOSPlatform",
100+
dependencies: [
101+
"SwiftlyCore",
102+
]
103+
)
104+
)
105+
swiftlyTarget.dependencies.append(.target(name: "MacOSPlatform"))
106+
107+
#endif

Sources/CLibArchive/module.modulemap

Lines changed: 0 additions & 5 deletions
This file was deleted.

Sources/CLibArchive/shim.h

Lines changed: 0 additions & 2 deletions
This file was deleted.

docker/install-test-ubi9.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG base_image=redhat/ubi9:latest
22
FROM $base_image
33

4-
RUN yum install --allowerasing -y curl gcc-c++ gpg
4+
RUN yum install --allowerasing -y curl gpg
55
RUN echo 'export PATH="$HOME/.local/bin:$PATH"' >> $HOME/.profile

docker/test-amazonlinux2.dockerfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@ ARG ubuntu_version
77
# dependencies
88
RUN yum install -y \
99
curl \
10-
gcc \
11-
gcc-c++ \
12-
make \
1310
gpg
14-
COPY ./scripts/install-libarchive.sh /
15-
RUN /install-libarchive.sh
1611

1712
RUN curl -L https://swift.org/keys/all-keys.asc | gpg --import
1813

docker/test-ubi9.dockerfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@ ARG ubuntu_version
77
# dependencies
88
RUN yum install -y --allowerasing \
99
curl \
10-
gcc \
11-
gcc-c++ \
12-
make \
1310
gpg
14-
COPY ./scripts/install-libarchive.sh /
15-
RUN /install-libarchive.sh
1611

1712
RUN curl -L https://swift.org/keys/all-keys.asc | gpg --import
1813

docker/test.dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ ENV LANG en_US.UTF-8
1313
ENV LANGUAGE en_US.UTF-8
1414

1515
# dependencies
16-
RUN apt-get update --fix-missing && apt-get install -y curl build-essential gpg
17-
COPY ./scripts/install-libarchive.sh /
18-
RUN /install-libarchive.sh
16+
RUN apt-get update --fix-missing && apt-get install -y gpg curl
1917

2018
RUN curl -L https://swift.org/keys/all-keys.asc | gpg --import
2119

scripts/build.dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@ FROM swift:5.10-amazonlinux2
55

66
# swiftly build depdenencies
77
RUN yum install -y \
8-
curl \
9-
gcc \
10-
make
8+
curl
119

1210
COPY . /tmp/swiftly
1311
WORKDIR /tmp/swiftly
1412

15-
RUN ./scripts/install-libarchive.sh
16-
1713
RUN swift build \
1814
--static-swift-stdlib \
1915
--configuration release

0 commit comments

Comments
 (0)