Skip to content

Commit d9fedae

Browse files
Upgrade to Swift 6 toolchain (#19)
# Upgrade to Swift 6 toolchain ## ⚙️ Release Notes * Upgrade the package template to use the Swift 6 language mode by default. * Updates the default CI update to latest Xcode 16 release. ### Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
1 parent f24d296 commit d9fedae

File tree

6 files changed

+43
-35
lines changed

6 files changed

+43
-35
lines changed

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
name: Build and Test Swift Package visionOS
3838
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
3939
with:
40+
runsonlabels: '["macOS", "self-hosted"]'
4041
scheme: TemplatePackage
4142
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
4243
resultBundle: TemplatePackage-visionOS.xcresult
@@ -71,7 +72,7 @@ jobs:
7172
with:
7273
path: 'Tests/UITests'
7374
scheme: TestApp
74-
destination: 'platform=iOS Simulator,name=iPad Air (5th generation)'
75+
destination: 'platform=iOS Simulator,name=iPad Air 13-inch (M2)'
7576
resultBundle: TestApp-iPadOS.xcresult
7677
artifactname: TestApp-iPadOS.xcresult
7778
watchos:
@@ -103,16 +104,6 @@ jobs:
103104
destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)'
104105
resultBundle: TestApp-tvOS.xcresult
105106
artifactname: TestApp-tvOS.xcresult
106-
codeql:
107-
name: CodeQL
108-
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
109-
with:
110-
codeql: true
111-
test: false
112-
scheme: TemplatePackage
113-
permissions:
114-
security-events: write
115-
actions: read
116107
uploadcoveragereport:
117108
name: Upload Coverage Report
118109
needs: [packageios, packagewatchos, packagevisionos, packagetvos, packagemacos, ios, ipados, watchos, visionos, tvos]

Package.swift

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.9
1+
// swift-tools-version:6.0
22

33
//
44
// This source file is part of the TemplatePackage open source project
@@ -8,6 +8,7 @@
88
// SPDX-License-Identifier: MIT
99
//
1010

11+
import class Foundation.ProcessInfo
1112
import PackageDescription
1213

1314

@@ -23,15 +24,37 @@ let package = Package(
2324
products: [
2425
.library(name: "TemplatePackage", targets: ["TemplatePackage"])
2526
],
27+
dependencies: [
28+
] + swiftLintPackage(),
2629
targets: [
2730
.target(
28-
name: "TemplatePackage"
31+
name: "TemplatePackage",
32+
plugins: [] + swiftLintPlugin()
2933
),
3034
.testTarget(
3135
name: "TemplatePackageTests",
3236
dependencies: [
3337
.target(name: "TemplatePackage")
34-
]
38+
],
39+
plugins: [] + swiftLintPlugin()
3540
)
3641
]
3742
)
43+
44+
45+
func swiftLintPlugin() -> [Target.PluginUsage] {
46+
// Fully quit Xcode and open again with `open --env SPEZI_DEVELOPMENT_SWIFTLINT /Applications/Xcode.app`
47+
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
48+
[.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]
49+
} else {
50+
[]
51+
}
52+
}
53+
54+
func swiftLintPackage() -> [PackageDescription.Package.Dependency] {
55+
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
56+
[.package(url: "https://github.com/realm/SwiftLint.git", from: "0.55.1")]
57+
} else {
58+
[]
59+
}
60+
}

Sources/TemplatePackage/TemplatePackage.docc/TemplatePackage.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# ``TemplatePackage``
22

33
<!--
4-
#
5-
# This source file is part of the TemplatePackage open source project
6-
#
7-
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
8-
#
9-
# SPDX-License-Identifier: MIT
10-
#
4+
5+
This source file is part of the TemplatePackage open source project
6+
7+
SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
8+
9+
SPDX-License-Identifier: MIT
10+
1111
-->
1212

1313
The template repository contains a template Swift Package, including a continuous integration setup.

Tests/UITests/UITests.xcodeproj/project.pbxproj

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 56;
6+
objectVersion = 77;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -254,7 +254,7 @@
254254
attributes = {
255255
BuildIndependentTargetsInParallel = 1;
256256
LastSwiftUpdateCheck = 1500;
257-
LastUpgradeCheck = 1500;
257+
LastUpgradeCheck = 1600;
258258
TargetAttributes = {
259259
2F6D139128F5F384007C25D6 = {
260260
CreatedOnToolsVersion = 14.1;
@@ -273,14 +273,14 @@
273273
};
274274
};
275275
buildConfigurationList = 2F6D138D28F5F384007C25D6 /* Build configuration list for PBXProject "UITests" */;
276-
compatibilityVersion = "Xcode 14.0";
277276
developmentRegion = en;
278277
hasScannedForEncodings = 0;
279278
knownRegions = (
280279
en,
281280
Base,
282281
);
283282
mainGroup = 2F6D138928F5F384007C25D6;
283+
preferredProjectObjectVersion = 77;
284284
productRefGroup = 2F6D139328F5F384007C25D6 /* Products */;
285285
projectDirPath = "";
286286
projectRoot = "";
@@ -449,6 +449,7 @@
449449
SDKROOT = iphoneos;
450450
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
451451
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
452+
SWIFT_VERSION = 6.0;
452453
TVOS_DEPLOYMENT_TARGET = 17.0;
453454
WATCHOS_DEPLOYMENT_TARGET = 10.0;
454455
XROS_DEPLOYMENT_TARGET = 1.0;
@@ -507,6 +508,7 @@
507508
SDKROOT = iphoneos;
508509
SWIFT_COMPILATION_MODE = wholemodule;
509510
SWIFT_OPTIMIZATION_LEVEL = "-O";
511+
SWIFT_VERSION = 6.0;
510512
TVOS_DEPLOYMENT_TARGET = 17.0;
511513
VALIDATE_PRODUCT = YES;
512514
WATCHOS_DEPLOYMENT_TARGET = 10.0;
@@ -517,7 +519,6 @@
517519
2F6D13B728F5F386007C25D6 /* Debug */ = {
518520
isa = XCBuildConfiguration;
519521
buildSettings = {
520-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
521522
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
522523
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
523524
CODE_SIGN_STYLE = Automatic;
@@ -553,7 +554,6 @@
553554
2F6D13B828F5F386007C25D6 /* Release */ = {
554555
isa = XCBuildConfiguration;
555556
buildSettings = {
556-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
557557
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
558558
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
559559
CODE_SIGN_STYLE = Automatic;
@@ -589,7 +589,6 @@
589589
2F6D13BD28F5F386007C25D6 /* Debug */ = {
590590
isa = XCBuildConfiguration;
591591
buildSettings = {
592-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
593592
CODE_SIGN_STYLE = Automatic;
594593
CURRENT_PROJECT_VERSION = 1;
595594
DEVELOPMENT_TEAM = 637867499T;
@@ -612,7 +611,6 @@
612611
2F6D13BE28F5F386007C25D6 /* Release */ = {
613612
isa = XCBuildConfiguration;
614613
buildSettings = {
615-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
616614
CODE_SIGN_STYLE = Automatic;
617615
CURRENT_PROJECT_VERSION = 1;
618616
DEVELOPMENT_TEAM = 637867499T;
@@ -732,7 +730,6 @@
732730
2F9CBED42A76C412009818FF /* Debug */ = {
733731
isa = XCBuildConfiguration;
734732
buildSettings = {
735-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
736733
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
737734
CODE_SIGN_STYLE = Automatic;
738735
CURRENT_PROJECT_VERSION = 1;
@@ -756,7 +753,6 @@
756753
2F9CBED52A76C412009818FF /* Test */ = {
757754
isa = XCBuildConfiguration;
758755
buildSettings = {
759-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
760756
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
761757
CODE_SIGN_STYLE = Automatic;
762758
CURRENT_PROJECT_VERSION = 1;
@@ -779,7 +775,6 @@
779775
2F9CBED62A76C412009818FF /* Release */ = {
780776
isa = XCBuildConfiguration;
781777
buildSettings = {
782-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
783778
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
784779
CODE_SIGN_STYLE = Automatic;
785780
CURRENT_PROJECT_VERSION = 1;
@@ -858,6 +853,7 @@
858853
SDKROOT = iphoneos;
859854
SWIFT_ACTIVE_COMPILATION_CONDITIONS = TEST;
860855
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
856+
SWIFT_VERSION = 6.0;
861857
TVOS_DEPLOYMENT_TARGET = 17.0;
862858
WATCHOS_DEPLOYMENT_TARGET = 10.0;
863859
XROS_DEPLOYMENT_TARGET = 1.0;
@@ -867,7 +863,6 @@
867863
2FB07588299DDB6000C0B37F /* Test */ = {
868864
isa = XCBuildConfiguration;
869865
buildSettings = {
870-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
871866
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
872867
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
873868
CODE_SIGN_STYLE = Automatic;
@@ -903,7 +898,6 @@
903898
2FB07589299DDB6000C0B37F /* Test */ = {
904899
isa = XCBuildConfiguration;
905900
buildSettings = {
906-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
907901
CODE_SIGN_STYLE = Automatic;
908902
CURRENT_PROJECT_VERSION = 1;
909903
DEVELOPMENT_TEAM = 637867499T;

Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestApp.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1500"
3+
LastUpgradeVersion = "1600"
44
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"

Tests/UITests/UITests.xcodeproj/xcshareddata/xcschemes/TestAppWatchApp.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1500"
3+
LastUpgradeVersion = "1600"
44
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"

0 commit comments

Comments
 (0)