File tree Expand file tree Collapse file tree 2 files changed +44
-6
lines changed Expand file tree Collapse file tree 2 files changed +44
-6
lines changed Original file line number Diff line number Diff line change @@ -16,20 +16,28 @@ let package = Package(
16
16
targets: [ " YCatalogViewer " ]
17
17
)
18
18
] ,
19
- dependencies: [
20
- // Dependencies declare other packages that this package depends on.
21
- // .package(url: /* package url */, from: "1.0.0"),
22
- ] ,
23
19
targets: [
24
20
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
25
21
// Targets can depend on other targets in this package, and on products in packages this package depends on.
22
+ . binaryTarget(
23
+ name: " SwiftLintBinary " ,
24
+ url: " https://github.com/realm/SwiftLint/releases/download/0.47.1/SwiftLintBinary-macos.artifactbundle.zip " ,
25
+ checksum: " 82ef90b7d76b02e41edd73423687d9cedf0bb9849dcbedad8df3a461e5a7b555 "
26
+ ) ,
27
+ . plugin(
28
+ name: " SwiftLint " ,
29
+ capability: . buildTool( ) ,
30
+ dependencies: [ " SwiftLintBinary " ]
31
+ ) ,
26
32
. target(
27
33
name: " YCatalogViewer " ,
28
- dependencies: [ ]
34
+ dependencies: [ ] ,
35
+ plugins: [ " SwiftLint " ]
29
36
) ,
30
37
. testTarget(
31
38
name: " YCatalogViewerTests " ,
32
- dependencies: [ " YCatalogViewer " ]
39
+ dependencies: [ " YCatalogViewer " ] ,
40
+ plugins: [ " SwiftLint " ]
33
41
)
34
42
]
35
43
)
Original file line number Diff line number Diff line change
1
+ //
2
+ // main.swift
3
+ // YCatalogViewer
4
+ //
5
+ // Created by Tim Barett on 7/20/22.
6
+ // Copyright © 2021 Y Media Labs. All rights reserved.
7
+ //
8
+
9
+ import PackagePlugin
10
+
11
+ @main
12
+ struct SwiftLint : BuildToolPlugin {
13
+ func createBuildCommands( context: PluginContext , target: Target ) async throws -> [ Command ] {
14
+ [
15
+ . buildCommand(
16
+ displayName: " Linting \( target. name) ... " ,
17
+ executable: try context. tool ( named: " swiftlint " ) . path,
18
+ arguments: [
19
+ " lint " ,
20
+ " --in-process-sourcekit " ,
21
+ " --config " ,
22
+ " \( context. package . directory. string) /.swiftlint.yml " ,
23
+ " --path " ,
24
+ target. directory. string
25
+ ] ,
26
+ environment: [ : ]
27
+ )
28
+ ]
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments