Skip to content

Commit aeac83e

Browse files
authored
Merge pull request #424 from apple/revert-generate-pipeline-plugin
2 parents a8e6e6f + 2727183 commit aeac83e

File tree

11 files changed

+527
-273
lines changed

11 files changed

+527
-273
lines changed

Documentation/Development.md

+26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Developing `swift-format`
22

3+
## Keeping the Pipeline and Tests Updated
4+
5+
Since Swift does not yet have a runtime reflection system, we use code
6+
generation to keep the linting/formatting pipeline up-to-date. If you add or
7+
remove any rules from the `SwiftFormatRules` module, or if you add or remove
8+
any `visit` methods from an existing rule in that module, you must run the
9+
`generate-pipeline` tool update the pipeline and configuration sources.
10+
11+
The easiest way to do this is to run the following command in your terminal:
12+
13+
```shell
14+
swift run generate-pipeline
15+
```
16+
17+
If successful, this tool will update
18+
`Sources/SwiftFormatConfiguration/RuleRegistry+Generated.swift` and
19+
`Sources/SwiftFormat/Pipelines+Generated.swift`.
20+
21+
Likewise, you should keep the Linux XCTest manifests updated if you add or
22+
remove any tests from `swift-format` by running the following command in your
23+
terminal:
24+
25+
```shell
26+
swift test --generate-linuxmain
27+
```
28+
329
## Command Line Options for Debugging
430

531
`swift-format` provides some hidden command line options to facilitate

Package.swift

+5-15
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,10 @@ let package = Package(
4848
.product(name: "SwiftSyntax", package: "swift-syntax"),
4949
.product(name: "SwiftOperators", package: "swift-syntax"),
5050
.product(name: "SwiftParser", package: "swift-syntax"),
51-
],
52-
plugins: ["generate-pipeline-plugin"]
51+
]
5352
),
5453
.target(
55-
name: "SwiftFormatConfiguration",
56-
plugins: ["generate-pipeline-plugin"]
54+
name: "SwiftFormatConfiguration"
5755
),
5856
.target(
5957
name: "SwiftFormatCore",
@@ -65,8 +63,7 @@ let package = Package(
6563
),
6664
.target(
6765
name: "SwiftFormatRules",
68-
dependencies: ["SwiftFormatCore", "SwiftFormatConfiguration"],
69-
plugins: ["generate-pipeline-plugin"]
66+
dependencies: ["SwiftFormatCore", "SwiftFormatConfiguration"]
7067
),
7168
.target(
7269
name: "SwiftFormatPrettyPrint",
@@ -93,22 +90,15 @@ let package = Package(
9390
]
9491
),
9592

96-
.plugin(
97-
name: "generate-pipeline-plugin",
98-
capability: .buildTool(),
99-
dependencies: [
100-
"generate-pipeline"
101-
]
102-
),
10393
.executableTarget(
10494
name: "generate-pipeline",
10595
dependencies: [
106-
.product(name: "ArgumentParser", package: "swift-argument-parser"),
96+
"SwiftFormatCore",
97+
"SwiftFormatRules",
10798
.product(name: "SwiftSyntax", package: "swift-syntax"),
10899
.product(name: "SwiftParser", package: "swift-syntax"),
109100
]
110101
),
111-
112102
.executableTarget(
113103
name: "swift-format",
114104
dependencies: [

Plugins/generate-pipeline-plugin/GeneratePipelinePlugin.swift

-73
This file was deleted.

0 commit comments

Comments
 (0)