Skip to content

Commit 2da639f

Browse files
committed
Upgrade to Swift 6.1
1 parent 5095674 commit 2da639f

File tree

7 files changed

+27
-24
lines changed

7 files changed

+27
-24
lines changed

.devcontainer/Dockerfile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
ARG SWIFT_VERSION=5.9
1+
ARG SWIFT_VERSION=6.1
22
# Other ARG declarations must follow FROM
33
FROM swift:${SWIFT_VERSION}
44

55
ARG HYLO_LLVM_BUILD_TYPE=MinSizeRel
66
ARG HYLO_LLVM_BUILD_RELEASE=20240303-215025
77
ARG HYLO_LLVM_VERSION=17.0.6
8+
ARG CMAKE_VERSION=3.29.1
89

910
ENV HYLO_LLVM_DOWNLOAD_URL="https://github.com/hylo-lang/llvm-build/releases/download"
1011

11-
RUN apt install -y gnupg
12-
RUN apt update
13-
RUN apt install -y curl libzstd-dev libzstd1 lsb-release make ninja-build tar wget zstd software-properties-common python3-pip
14-
15-
# Get a recent cmake (https://www.kitware.com//cmake-python-wheels/)
16-
RUN if $(/usr/bin/which cmake) ; then apt purge --auto-remove cmake ; fi
17-
RUN pip3 install --upgrade cmake
12+
# Install the dependencies for the LLVM build.
13+
# Note that we do cleanup in the same layer to save disk space.
14+
RUN apt-get update && \
15+
apt-get install -y --no-install-recommends gnupg curl libzstd-dev libzstd1 lsb-release make \
16+
ninja-build tar wget zstd software-properties-common python3-pip cmake && \
17+
apt-get clean && \
18+
rm -rf /var/lib/apt/lists/*
1819

1920
# Get the LLVM builds for the host architecture
2021
RUN <<EOT bash -ex -o pipefail

.devcontainer/devcontainer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
"build": {
44
"dockerfile": "Dockerfile",
55
"args": {
6-
"SWIFT_VERSION" : "5.9",
6+
"SWIFT_VERSION" : "6.1",
77
"HYLO_LLVM_BUILD_TYPE": "${localEnv:HYLO_LLVM_BUILD_TYPE:MinSizeRel}"
8-
}
8+
}
99
},
1010
"features": {
1111
"ghcr.io/devcontainers/features/common-utils:2": {
1212
"installZsh": "false",
1313
"username": "vscode",
14-
"userUid": "1000",
15-
"userGid": "1000",
14+
"userUid": "1001", // 1000 is already taken by the default user in the container
15+
"userGid": "1001",
1616
"upgradePackages": "false"
1717
},
1818
"ghcr.io/devcontainers/features/git:1": {

.github/workflows/test.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
- ".editorconfig"
1919

2020
env:
21-
swift-version: '5.10'
21+
swift-version: '6.1'
2222

2323
jobs:
2424
dev-container:
@@ -122,12 +122,14 @@ jobs:
122122
with:
123123
xcode-version: latest-stable
124124

125+
- name: Import Swift GPG Key (Ubuntu Only) # until fix arrives for https://github.com/SwiftyLab/setup-swift/issues/388
126+
if: runner.os == 'Linux'
127+
run: gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys '52BB 7E3D E28A 71BE 22EC 05FF EF80 A866 B47A 981F'
125128
- name: 'Set up swift (non-Windows)'
126129
if: ${{ runner.os != 'Windows' }}
127130
uses: SwiftyLab/setup-swift@latest
128131
with:
129132
swift-version: ${{ env.swift-version }}
130-
cache-snapshot: false # Workaround for https://github.com/SwiftyLab/setup-swift/issues/315
131133

132134
- uses: compnerd/gha-setup-vsdevenv@main
133135
- name: Set up swift (Windows)
@@ -168,7 +170,7 @@ jobs:
168170
-DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }}
169171
-DBUILD_TESTING=YES
170172
-DLLVM_DIR=${{ github.workspace }}/${{ env.llvm_package_basename }}/lib/cmake/llvm
171-
${{ runner.os == 'macOS' && '-D CMAKE_Swift_COMPILER=swiftc' || '' }}
173+
${{ runner.os == 'macOS' && '-DCMAKE_Swift_COMPILER=swiftc -DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path)' || '' }}
172174
working-directory: Swifty-LLVM
173175

174176
- name: Build (CMake)
@@ -197,15 +199,14 @@ jobs:
197199
-DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }}
198200
-DBUILD_TESTING=YES
199201
-DLLVM_DIR=${{ github.workspace }}/${{ env.llvm_package_basename }}/lib/cmake/llvm
200-
${{ runner.os == 'macOS' && '-D CMAKE_Swift_COMPILER=swiftc' || '' }}
202+
${{ runner.os == 'macOS' && '-DCMAKE_Swift_COMPILER=swiftc -DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path)' || '' }}
201203
202204
cd .xcode-build
203205
204206
xcrun xcodebuild -configuration ${{ matrix.spm_configuration }} -scheme SwiftyLLVM -destination 'platform=macOS' test
205207
working-directory: Swifty-LLVM
206208

207209
- name: Build and Test via SPM
208-
if: ${{ runner.os != 'Windows' || env.swift-version != '5.10' }}
209210
run: swift test -v ${{ matrix.swift_test_options }} -c ${{ matrix.spm_configuration }}
210211
working-directory: Swifty-LLVM
211212

@@ -224,7 +225,7 @@ jobs:
224225
225226
- name: Upload coverage reports to Codecov
226227
if: ${{ contains(matrix.swift_test_options, '--enable-code-coverage') }}
227-
uses: codecov/codecov-action@v4
228+
uses: codecov/codecov-action@v5
228229
with:
229230
token: ${{ secrets.CODECOV_TOKEN }}
230231
fail_ci_if_error: true

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Standard project boilerplate
33
#
44
cmake_minimum_required(VERSION 3.26)
5+
set(CMAKE_OSX_DEPLOYMENT_TARGET 13.0)
56
project(Swifty-LLVM
67
VERSION 0.1.0
78
DESCRIPTION "A Swifty interface for the LLVM compiler infrastructure, currently wrapping LLVM's C API."

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 5.9
1+
// swift-tools-version: 6.1
22
import PackageDescription
33

44

@@ -24,7 +24,7 @@ func pseudoPkgConfigText(_ package: String) -> String? {
2424
guard let pcp = ProcessInfo.processInfo.environment["PKG_CONFIG_PATH"] else { return nil }
2525

2626
return pcp.split(separator: pathSeparator)
27-
.lazy.compactMap({ try? String(contentsOfFile: "\($0)/\(package).pc") }).first
27+
.lazy.compactMap({ try? String(contentsOfFile: "\($0)/\(package).pc", encoding: String.Encoding.utf8) }).first
2828
}
2929

3030
/// Returns the un-quoted, un-escaped elements in the remainder of the

Sources/SwiftyLLVM/AddressSpace.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// Properties of a pointer expressed through the data layout.
2-
public struct AddressSpace: Hashable {
2+
public struct AddressSpace: Hashable, Sendable {
33

44
/// The LLVM representation of this instance.
55
public let llvm: UInt32
@@ -10,6 +10,6 @@ public struct AddressSpace: Hashable {
1010
}
1111

1212
/// The default address space.
13-
public static var `default` = AddressSpace(0)
13+
public static let `default` = AddressSpace(0)
1414

1515
}

Sources/SwiftyLLVM/Values/Constants/Intrinsic.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extension Intrinsic {
3737

3838
/// The name of an intrinsic.
3939
@dynamicMemberLookup
40-
public struct Name {
40+
public struct Name : Sendable {
4141

4242
/// The value of this instance.
4343
public let value: String
@@ -55,6 +55,6 @@ extension Intrinsic {
5555
}
5656

5757
/// The prefix of all intrinsics.
58-
public static var llvm = Name("llvm")
58+
public static let llvm = Name("llvm")
5959

6060
}

0 commit comments

Comments
 (0)