Skip to content

Commit 3f79347

Browse files
authored
Updated to use rules_updatesrc for file updates (#23)
Replaced swiftformat_update and swiftformat_update_all with updatesrc_update and updatesrc_update_all from rules_updatesrc.
1 parent 4467d0a commit 3f79347

19 files changed

+82
-169
lines changed

BUILD.bazel

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
load(
2+
"@cgrindel_rules_updatesrc//updatesrc:updatesrc.bzl",
3+
"updatesrc_update_all",
4+
)
5+
6+
updatesrc_update_all(
7+
name = "update_all",
8+
targets_to_run = [
9+
"//doc:update",
10+
],
11+
)

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ swiftformat_rules_dependencies()
3333

3434
# Configure the dependencies for rules_swiftformat
3535

36+
load(
37+
"@cgrindel_rules_updatesrc//updatesrc:deps.bzl",
38+
"updatesrc_rules_dependencies",
39+
)
40+
41+
updatesrc_rules_dependencies()
42+
3643
load(
3744
"@cgrindel_rules_spm//spm:deps.bzl",
3845
"spm_rules_dependencies",
@@ -69,15 +76,15 @@ following:
6976

7077
```python
7178
load(
72-
"@cgrindel_rules_swiftformat//swiftformat:swiftformat.bzl",
73-
"swiftformat_update_all",
79+
"@cgrindel_rules_updatesrc//updatesrc:updatesrc.bzl",
80+
"updatesrc_update_all",
7481
)
7582

7683
# We export this file to make it available to other Bazel packages in the workspace.
7784
exports_files([".swiftformat"])
7885

7986
# Define a runnable target to copy all of the formatted files to the workspace directory.
80-
swiftformat_update_all(
87+
updatesrc_update_all(
8188
name = "update_all",
8289
)
8390
```

WORKSPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ load("//swiftformat:deps.bzl", "swiftformat_rules_dependencies")
44

55
swiftformat_rules_dependencies()
66

7+
load(
8+
"@cgrindel_rules_updatesrc//updatesrc:deps.bzl",
9+
"updatesrc_rules_dependencies",
10+
)
11+
12+
updatesrc_rules_dependencies()
13+
714
load(
815
"@cgrindel_rules_spm//spm:deps.bzl",
916
"spm_rules_dependencies",

doc/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ _RULES_AND_MACROS_DOC_PROVIDER = doc_providers.create(
2626
"swiftformat_library",
2727
"swiftformat_pkg",
2828
"swiftformat_test",
29-
"swiftformat_update",
30-
"swiftformat_update_all",
3129
],
3230
deps = ["//swiftformat"],
3331
)

doc/rules_and_macros_overview.md

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ On this page:
1111
* [swiftformat_library](#swiftformat_library)
1212
* [swiftformat_pkg](#swiftformat_pkg)
1313
* [swiftformat_test](#swiftformat_test)
14-
* [swiftformat_update](#swiftformat_update)
15-
* [swiftformat_update_all](#swiftformat_update_all)
1614

1715

1816
<a id="#swiftformat_format"></a>
@@ -37,25 +35,6 @@ Formats the Swift source files using `nicklockwood/SwiftFormat`.
3735
| <a id="swiftformat_format-swift_version"></a>swift_version | The Swift version to be used by <code>swiftformat</code>. You probably want to add this to your config file instead of adding it here. | String | optional | "" |
3836

3937

40-
<a id="#swiftformat_update"></a>
41-
42-
## swiftformat_update
43-
44-
<pre>
45-
swiftformat_update(<a href="#swiftformat_update-name">name</a>, <a href="#swiftformat_update-formats">formats</a>)
46-
</pre>
47-
48-
Copies the formatted Swift sources to the workspace directory.
49-
50-
**ATTRIBUTES**
51-
52-
53-
| Name | Description | Type | Mandatory | Default |
54-
| :------------- | :------------- | :------------- | :------------- | :------------- |
55-
| <a id="swiftformat_update-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
56-
| <a id="swiftformat_update-formats"></a>formats | The format build targets. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
57-
58-
5938
<a id="#swiftformat_binary"></a>
6039

6140
## swiftformat_binary
@@ -145,27 +124,3 @@ Defines a `swift_test` along with a `swiftformat_pkg`.
145124
| <a id="swiftformat_test-kwargs"></a>kwargs | The attributes for <code>swift_test</code>. | none |
146125

147126

148-
<a id="#swiftformat_update_all"></a>
149-
150-
## swiftformat_update_all
151-
152-
<pre>
153-
swiftformat_update_all(<a href="#swiftformat_update_all-name">name</a>)
154-
</pre>
155-
156-
Defines a runnable target that will copy the formatted Swift files to the source tree.
157-
158-
The utility queries for all of the swiftformat_update rules in the
159-
workspace and executes each one. Hence, only Swift source files that are
160-
referenced by a swiftformat_update will be copied to the workspace
161-
directory.
162-
163-
164-
**PARAMETERS**
165-
166-
167-
| Name | Description | Default Value |
168-
| :------------- | :------------- | :------------- |
169-
| <a id="swiftformat_update_all-name"></a>name | The name of the target. | none |
170-
171-

examples/exclude_files/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
load(
2-
"@cgrindel_rules_swiftformat//swiftformat:swiftformat.bzl",
3-
"swiftformat_update_all",
2+
"@cgrindel_rules_updatesrc//updatesrc:updatesrc.bzl",
3+
"updatesrc_update_all",
44
)
55

66
# MARK: - SwiftFormat Targets
@@ -11,6 +11,6 @@ exports_files([".swiftformat"])
1111

1212
# Defines a target that will copy all of the formatted Swift source files to
1313
# the workspace directory.
14-
swiftformat_update_all(
14+
updatesrc_update_all(
1515
name = "update_all",
1616
)

examples/exclude_files/WORKSPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ load("@cgrindel_rules_swiftformat//swiftformat:deps.bzl", "swiftformat_rules_dep
99

1010
swiftformat_rules_dependencies()
1111

12+
load(
13+
"@cgrindel_rules_updatesrc//updatesrc:deps.bzl",
14+
"updatesrc_rules_dependencies",
15+
)
16+
17+
updatesrc_rules_dependencies()
18+
1219
load(
1320
"@cgrindel_rules_spm//spm:deps.bzl",
1421
"spm_rules_dependencies",
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
load(
2-
"@cgrindel_rules_swiftformat//swiftformat:swiftformat.bzl",
3-
"swiftformat_update_all",
2+
"@cgrindel_rules_updatesrc//updatesrc:updatesrc.bzl",
3+
"updatesrc_update_all",
44
)
55

66
# MARK: - SwiftFormat Targets
@@ -11,6 +11,6 @@ exports_files([".swiftformat"])
1111

1212
# Defines a target that will copy all of the formatted Swift source files to
1313
# the workspace directory.
14-
swiftformat_update_all(
14+
updatesrc_update_all(
1515
name = "update_all",
1616
)

examples/rules_swift_helpers/WORKSPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ load("@cgrindel_rules_swiftformat//swiftformat:deps.bzl", "swiftformat_rules_dep
99

1010
swiftformat_rules_dependencies()
1111

12+
load(
13+
"@cgrindel_rules_updatesrc//updatesrc:deps.bzl",
14+
"updatesrc_rules_dependencies",
15+
)
16+
17+
updatesrc_rules_dependencies()
18+
1219
load(
1320
"@cgrindel_rules_spm//spm:deps.bzl",
1421
"spm_rules_dependencies",

examples/simple/BUILD.bazel

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ load("@build_bazel_rules_swift//swift:swift.bzl", "swift_binary")
22
load(
33
"@cgrindel_rules_swiftformat//swiftformat:swiftformat.bzl",
44
"swiftformat_pkg",
5-
"swiftformat_update_all",
5+
)
6+
load(
7+
"@cgrindel_rules_updatesrc//updatesrc:updatesrc.bzl",
8+
"updatesrc_update_all",
69
)
710

811
# MARK: - Swift Targets
@@ -31,7 +34,7 @@ exports_files([".swiftformat"])
3134

3235
# Defines a target that will copy all of the formatted Swift source files to
3336
# the workspace directory.
34-
swiftformat_update_all(
37+
updatesrc_update_all(
3538
name = "update_all",
3639
)
3740

0 commit comments

Comments
 (0)