Skip to content

Commit 5d3f895

Browse files
authored
Merge pull request #1 from tise/formatter-plugin
Create a build tool plugin to use for linting and formatting
2 parents d6ebf4c + 1ccb593 commit 5d3f895

File tree

12 files changed

+160
-464
lines changed

12 files changed

+160
-464
lines changed

CODE_OF_CONDUCT.md

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

CONTRIBUTING.md

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

PULL_REQUEST_TEMPLATE.md

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

Package.resolved

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

Package.swift

Lines changed: 30 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,33 @@
1-
// swift-tools-version: 5.6
1+
// swift-tools-version: 5.8
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
24
import PackageDescription
35

46
let package = Package(
5-
name: "AirbnbSwift",
6-
platforms: [.macOS(.v10_13)],
7-
products: [
8-
.plugin(name: "FormatSwift", targets: ["FormatSwift"]),
9-
],
10-
dependencies: [
11-
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.3"),
12-
],
13-
targets: [
14-
.plugin(
15-
name: "FormatSwift",
16-
capability: .command(
17-
intent: .custom(
18-
verb: "format",
19-
description: "Formats Swift source files according to the Airbnb Swift Style Guide"),
20-
permissions: [
21-
.writeToPackageDirectory(reason: "Format Swift source files"),
22-
]),
23-
dependencies: [
24-
"AirbnbSwiftFormatTool",
25-
"SwiftFormat",
26-
"SwiftLintBinary",
27-
]),
28-
29-
.executableTarget(
30-
name: "AirbnbSwiftFormatTool",
31-
dependencies: [
32-
.product(name: "ArgumentParser", package: "swift-argument-parser"),
33-
],
34-
resources: [
35-
.process("airbnb.swiftformat"),
36-
.process("swiftlint.yml"),
37-
]),
38-
39-
.binaryTarget(
40-
name: "SwiftFormat",
41-
url: "https://github.com/calda/SwiftFormat/releases/download/0.51-beta-6/SwiftFormat.artifactbundle.zip",
42-
checksum: "8583456d892c99f970787b4ed756a7e0c83a0d9645e923bb4dae10d581c59bc3"),
43-
44-
.binaryTarget(
45-
name: "SwiftLintBinary",
46-
url: "https://github.com/realm/SwiftLint/releases/download/0.48.0/SwiftLintBinary-macos.artifactbundle.zip",
47-
checksum: "9c255e797260054296f9e4e4cd7e1339a15093d75f7c4227b9568d63edddba50"),
48-
])
49-
50-
// Emit an error on Linux, so Swift Package Manager's platform support detection doesn't say this package supports Linux
51-
// https://github.com/airbnb/swift/discussions/197#discussioncomment-4055303
52-
#if os(Linux)
53-
#error("Linux is currently not supported")
54-
#endif
7+
name: "TiseFormatter",
8+
platforms: [.macOS(.v12)],
9+
products: [
10+
// Products define the executables and libraries a package produces, and make them visible to other packages.
11+
.plugin(name: "TiseFormatterPlugin", targets: ["TiseFormatterPlugin"]),
12+
],
13+
targets: [
14+
.plugin(
15+
name: "TiseFormatterPlugin",
16+
capability: .buildTool(),
17+
dependencies: [
18+
.target(name: "SwiftLintBinary", condition: .when(platforms: [.macOS])),
19+
.target(name: "SwiftFormatBinary", condition: .when(platforms: [.macOS])),
20+
]
21+
),
22+
.binaryTarget(
23+
name: "SwiftLintBinary",
24+
url: "https://github.com/realm/SwiftLint/releases/download/0.51.0/SwiftLintBinary-macos.artifactbundle.zip",
25+
checksum: "9fbfdf1c2a248469cfbe17a158c5fbf96ac1b606fbcfef4b800993e7accf43ae"
26+
),
27+
.binaryTarget(
28+
name: "SwiftFormatBinary",
29+
url: "https://github.com/nicklockwood/SwiftFormat/releases/download/0.51.7/swiftformat.artifactbundle.zip",
30+
checksum: "644d46307c87e516b38681b7ea986e09397ff11951ee4b76607bb8369bcbe438"
31+
)
32+
]
33+
)

Plugins/FormatSwift/CommandContext.swift

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

Plugins/FormatSwift/Plugin.swift

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

0 commit comments

Comments
 (0)