Skip to content

Commit 0b370de

Browse files
Apply standard Swift package configuration
1 parent 2f36ba1 commit 0b370de

File tree

15 files changed

+179
-348
lines changed

15 files changed

+179
-348
lines changed

.bazelversion

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/bazel.yml

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

.github/workflows/docc.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: DocC
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
11+
12+
jobs:
13+
docc:
14+
name: DocC
15+
runs-on: macos-latest
16+
steps:
17+
- name: Checkout source
18+
uses: actions/checkout@v4
19+
- name: Build
20+
run: make docs open="no" DERIVED_DATA_PATH="$(mktemp -d)"

.github/workflows/swift.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,22 @@ on:
77
branches: [ main ]
88

99
env:
10-
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
10+
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
1111

1212
jobs:
1313
swift:
1414
name: Swift
15-
runs-on: macos-13
15+
runs-on: macos-latest
1616
env:
1717
SIMULATOR: iPhone 14
1818
steps:
1919
- name: Checkout source
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121
- name: Download swiftlint binary
2222
run: swift package resolve
2323
- name: Lint
24-
run: |
25-
DIRECTORY_NAME=$(echo "${PWD##*/}" | tr '[:upper:]' '[:lower:]')
26-
"$(find ".build/artifacts/${DIRECTORY_NAME}" -type f -name swiftlint -perm +111 -print -quit)" \
24+
run: >
25+
"$(find ".build/artifacts/swiftlint" -type f -name swiftlint -perm +111 -print -quit)"
2726
lint --strict --reporter github-actions-logging
2827
- name: Resolve package dependencies
2928
run: xcodebuild -resolvePackageDependencies
@@ -33,6 +32,7 @@ jobs:
3332
build-for-testing
3433
-scheme "CollectionBuilders"
3534
-destination "name=$SIMULATOR,OS=latest"
35+
-skipPackagePluginValidation
3636
SWIFT_TREAT_WARNINGS_AS_ERRORS=YES
3737
- name: Test
3838
run: >

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,3 @@
88
# Xcode
99
*.xcworkspace/
1010
*.xcodeproj/
11-
12-
# Bazel
13-
bazel-*

.swiftlint-rules.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ only_rules:
3333
- contains_over_filter_is_empty
3434
- contains_over_first_not_nil
3535
- contains_over_range_nil_comparison
36+
# - contrasted_opening_brace
3637
- control_statement
3738
- convenience_type
3839
- custom_rules
@@ -73,6 +74,7 @@ only_rules:
7374
- file_name
7475
- file_name_no_space
7576
- file_types_order
77+
- final_test_case
7678
- first_where
7779
- flatmap_over_map_reduce
7880
- for_where
@@ -124,11 +126,13 @@ only_rules:
124126
- multiple_closures_with_trailing_closure
125127
- nesting
126128
- nimble_operator
129+
# - no_empty_block
127130
- no_extension_access_modifier
128131
- no_fallthrough_only
129132
- no_grouping_extension
130133
# - no_magic_numbers
131134
- no_space_in_method_call
135+
- non_optional_string_data_conversion
132136
- non_overridable_class_declaration
133137
- notification_center_detachment
134138
- ns_number_init_as_function_reference
@@ -137,6 +141,7 @@ only_rules:
137141
- nsobject_prefer_isequal
138142
- number_separator
139143
# - object_literal
144+
# - one_declaration_per_file
140145
- opening_brace
141146
- operator_usage_whitespace
142147
- operator_whitespace
@@ -146,6 +151,7 @@ only_rules:
146151
- override_in_extension
147152
- pattern_matching_keywords
148153
- period_spacing
154+
- prefer_key_path
149155
- prefer_nimble
150156
- prefer_self_in_static_references
151157
- prefer_self_type_over_type_of_self
@@ -181,6 +187,7 @@ only_rules:
181187
# - return_value_from_void_function
182188
- self_binding
183189
- self_in_property_initialization
190+
# - shorthand_argument
184191
- shorthand_operator
185192
- shorthand_optional_binding
186193
- single_test_class
@@ -189,6 +196,7 @@ only_rules:
189196
- sorted_imports
190197
- statement_position
191198
- static_operator
199+
- static_over_final_class
192200
- strict_fileprivate
193201
- strong_iboutlet
194202
- superfluous_disable_command
@@ -221,6 +229,7 @@ only_rules:
221229
- unused_control_flow_label
222230
- unused_enumerated
223231
- unused_optional_binding
232+
- unused_parameter
224233
- unused_setter_value
225234
- valid_ibinspectable
226235
- vertical_parameter_alignment

.swiftlint.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
included:
2-
- Plugins
32
- Sources
43
- Tests
54

BUILD.bazel

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

CONTRIBUTING.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
11
# Contributing to CollectionBuilders
22

3-
- [Dependencies](#dependencies)
4-
- [Open Package in Xcode](#open-package-in-xcode)
5-
- [Static Analysis](#static-analysis)
6-
- [Testing](#testing)
3+
- [Open Package](#open-package)
4+
- [Lint Package](#lint-package)
5+
- [Creating Releases](#creating-releases)
76

8-
## Dependencies
9-
10-
Follow the [Swift Package Resources installation instructions](https://github.com/TinderApp/Swift-Package-Resources) to install tooling dependencies.
11-
12-
## Open Package in Xcode
7+
## Open Package
138

149
> The file header comment template will also be installed.
1510
1611
```
1712
make open
1813
```
1914

20-
## Static Analysis
15+
## Lint Package
2116

2217
> SwiftLint violations are visible in Xcode as well.
2318
24-
Package dependencies must be resolved to download the SwiftLint binary.
25-
26-
```
27-
swift package resolve
28-
```
29-
3019
To run SwiftLint from the command line:
3120

3221
```
@@ -39,8 +28,16 @@ To run analysis rules:
3928
make analyze
4029
```
4130

42-
To enable new rules whenever SwiftLint is upgraded to a new version:
31+
## Creating Releases
4332

44-
```
45-
make rules
46-
```
33+
Releases are made [on the GitHub website](https://github.com/Tinder/CollectionBuilders/releases/new).
34+
35+
In all of the following steps, `X.X.X` is a placeholder to be substituted with the actual semantic version for the release.
36+
37+
- Enter a semantic version as the new tag (__WITHOUT__ `v` prefix)
38+
- Set the `main` branch as the target (it should be the default)
39+
- Enter the release title formatted as `CollectionBuilders vX.X.X` (__WITH__ `v` prefix)
40+
- Click on `Generate release notes`
41+
- Leave `Set as a pre-release` unchecked
42+
- Leave `Set as the latest release` checked
43+
- Click `Publish release`

Makefile

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#
2-
# The SwiftLint recipes require the Swift Package Resources scripts to be installed.
3-
#
4-
# https://github.com/TinderApp/Swift-Package-Resources#installation
5-
#
6-
71
.PHONY: open
82
open: fix
93
open:
@@ -24,7 +18,8 @@ fix:
2418
.PHONY: lint
2519
lint: format ?= emoji
2620
lint:
27-
@swiftlint lint --strict --progress --reporter "$(format)"
21+
@swift package plugin \
22+
swiftlint lint --strict --progress --reporter "$(format)"
2823

2924
.PHONY: analyze
3025
analyze: target ?= CollectionBuilders
@@ -38,10 +33,28 @@ analyze:
3833
-destination "$(destination)" \
3934
-derivedDataPath "$$DERIVED_DATA" \
4035
-configuration "Debug" \
36+
-skipPackagePluginValidation \
4137
CODE_SIGNING_ALLOWED="NO" \
4238
> "$$XCODEBUILD_LOG"; \
43-
swiftlint analyze --strict --progress --reporter "$(format)" --compiler-log-path "$$XCODEBUILD_LOG"
39+
swift package plugin \
40+
swiftlint analyze --strict --progress --reporter "$(format)" --compiler-log-path "$$XCODEBUILD_LOG"
4441

45-
.PHONY: rules
46-
rules:
47-
@swiftlint rules | lint-rules
42+
.PHONY: docs
43+
docs: target ?= CollectionBuilders
44+
docs: destination ?= generic/platform=macOS
45+
docs: open ?= OPEN
46+
docs: DERIVED_DATA_PATH = .build/documentation/data
47+
docs: ARCHIVE_PATH = .build/documentation/archive
48+
docs:
49+
@mkdir -p "$(DERIVED_DATA_PATH)" "$(ARCHIVE_PATH)"
50+
xcodebuild docbuild \
51+
-scheme "$(target)" \
52+
-destination "$(destination)" \
53+
-derivedDataPath "$(DERIVED_DATA_PATH)" \
54+
-skipPackagePluginValidation \
55+
OTHER_DOCC_FLAGS="--warnings-as-errors"
56+
@find "$(DERIVED_DATA_PATH)" \
57+
-type d \
58+
-name "$(target).doccarchive" \
59+
-exec cp -R {} "$(ARCHIVE_PATH)/" \;
60+
$(if $(filter $(open),OPEN),@open "$(ARCHIVE_PATH)/$(target).doccarchive",)

Package.resolved

Lines changed: 83 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)