Skip to content

Commit c4bd6dd

Browse files
Apply standard Swift package configuration (#917)
1 parent 73254bc commit c4bd6dd

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

.github/workflows/swift.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
- name: Checkout source
2020
uses: actions/checkout@v6
2121
- name: Build
22-
run: swift build -v
22+
run: swift build -v -Xswiftc -warnings-as-errors
2323
- name: Test
2424
run: swift test -v

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ docs:
6161
-scheme "$(target)" \
6262
-destination "$(destination)" \
6363
-derivedDataPath "$(DERIVED_DATA_PATH)" \
64-
-skipPackagePluginValidation
64+
-skipPackagePluginValidation \
65+
$(if $(filter $(open),OPEN),OTHER_DOCC_FLAGS="--warnings-as-errors",)
6566
@find "$(DERIVED_DATA_PATH)" \
6667
-type d \
6768
-name "$(target).doccarchive" \
6869
-exec cp -R {} "$(ARCHIVE_PATH)/" \;
69-
$(if $(filter $(open),OPEN),@open "$(ARCHIVE_PATH)/$(target).doccarchive",)
70+
@$(if $(filter $(open),OPEN),open "$(ARCHIVE_PATH)/$(target).doccarchive",:)
7071

7172
.PHONY: site
7273
site: target ?= Nodes

Package.swift

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,23 @@ let package = Package(
123123

124124
package.targets.forEach { target in
125125

126-
// TODO: Remove upon enabling Swift 6 language mode:
126+
let types: [Target.TargetType] = [
127+
.regular,
128+
.test,
129+
.executable,
130+
]
131+
132+
guard types.contains(target.type)
133+
else { return }
134+
127135
target.swiftSettings = (target.swiftSettings ?? []) + [.enableExperimentalFeature("StrictConcurrency")]
128136

129-
if treatWarningsAsErrors {
130-
target.swiftSettings = (target.swiftSettings ?? []) + [
131-
// TODO: Remove unsafe flag upon upgrading to Swift tools v6.2 and uncomment subsequent settings:
132-
.unsafeFlags(["-warnings-as-errors"]),
137+
// if treatWarningsAsErrors {
138+
// target.swiftSettings = (target.swiftSettings ?? []) + [
133139
// .treatAllWarnings(as: .error),
134140
// .treatWarning("DeprecatedDeclaration", as: .warning),
135-
]
136-
}
141+
// ]
142+
// }
137143

138144
if enableSwiftLintBuildToolPlugin {
139145
target.plugins = (target.plugins ?? []) + [

0 commit comments

Comments
 (0)