|
4 | 4 | import CompilerPluginSupport
|
5 | 5 | import PackageDescription
|
6 | 6 |
|
| 7 | +let name = "Columnifier" |
| 8 | + |
7 | 9 | let package = Package(
|
8 |
| - name: "Columnifier", |
| 10 | + name: name, |
9 | 11 | platforms: [.macOS(.v12), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .macCatalyst(.v13)],
|
10 | 12 | products: [
|
11 | 13 | // Products define the executables and libraries a package produces, making them visible to other packages.
|
12 | 14 | .library(
|
13 |
| - name: "Columnifier", |
14 |
| - targets: ["Columnifier"] |
15 |
| - ), |
16 |
| - .executable( |
17 |
| - name: "ColumnifierClient", |
18 |
| - targets: ["ColumnifierClient"] |
| 15 | + name: name, |
| 16 | + targets: [name] |
19 | 17 | )
|
20 | 18 | ],
|
21 | 19 | dependencies: [
|
22 |
| - .package(path: "../MacroTester"), |
| 20 | + .package(url: "git@github.com:num42/swift-macrotester.git",from: "1.0.0"), |
23 | 21 | // Depend on the Swift 5.9 release of SwiftSyntax
|
24 | 22 | .package(url: "https://github.com/apple/swift-syntax.git", from: "509.0.0"),
|
25 |
| - .package(url: "https://github.com/groue/GRDB.swift.git", from: "6.18.0") |
26 |
| -// .package( |
27 |
| -// url: "https://github.com/realm/SwiftLint", |
28 |
| -// from: "0.53.0" |
29 |
| -// ) |
| 23 | + .package(url: "https://github.com/groue/GRDB.swift.git", from: "6.18.0"), |
| 24 | + .package(url: "https://github.com/realm/SwiftLint", from: "0.54.0") |
30 | 25 | ],
|
31 | 26 | targets: [
|
32 | 27 | // Targets are the basic building blocks of a package, defining a module or a test suite.
|
33 | 28 | // Targets can depend on other targets in this package and products from dependencies.
|
34 | 29 | // Macro implementation that performs the source transformation of a macro.
|
35 | 30 | .macro(
|
36 |
| - name: "ColumnifierMacros", |
| 31 | + name: "\(name)Macros", |
37 | 32 | dependencies: [
|
38 | 33 | .product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
|
39 | 34 | .product(name: "SwiftCompilerPlugin", package: "swift-syntax")
|
40 | 35 | ]
|
41 | 36 | ),
|
42 |
| - |
43 | 37 | // Library that exposes a macro as part of its API, which is used in client programs.
|
44 | 38 | .target(
|
45 |
| - name: "Columnifier", |
| 39 | + name: name, |
46 | 40 | dependencies: [
|
47 |
| - "ColumnifierMacros", |
| 41 | + .target(name: "\(name)Macros"), |
48 | 42 | .product(name: "GRDB", package: "GRDB.swift"),
|
49 | 43 | .product(name: "CSQLite", package: "GRDB.swift")
|
50 | 44 | ]
|
51 | 45 | ),
|
52 |
| - |
53 |
| - // A client of the library, which is able to use the macro in its own code. |
54 |
| - .executableTarget( |
55 |
| - name: "ColumnifierClient", |
56 |
| - dependencies: [ |
57 |
| - "Columnifier", |
58 |
| - .product(name: "GRDB", package: "GRDB.swift") |
59 |
| - ] |
60 |
| - ) // , |
61 |
| - |
62 | 46 | // A test target used to develop the macro implementation.
|
63 |
| -// .testTarget( |
64 |
| -// name: "ColumnifierTests", |
65 |
| -// dependencies: [ |
66 |
| -// "ColumnifierMacros", |
67 |
| -// .product(name: "MacroTester", package: "MacroTester"), |
68 |
| -// .product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax") |
69 |
| -// ] |
| 47 | + .testTarget( |
| 48 | + name: "\(name)Tests", |
| 49 | + dependencies: [ |
| 50 | + .target(name: "\(name)Macros"), |
| 51 | + .product(name: "MacroTester", package: "swift-macrotester"), |
| 52 | + .product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax") |
| 53 | + ], |
70 | 54 | // Copying Resources somehow breaks codesigning
|
71 |
| -// resources: [ |
72 |
| -// // Copy Tests/ExampleTests/Resources directories as-is. |
73 |
| -// // Use to retain directory structure. |
74 |
| -// // Will be at top level in bundle. |
75 |
| -// .copy("Resources") |
76 |
| -// ] |
77 |
| -// ) |
| 55 | + resources: [ |
| 56 | + // Copy Tests/ExampleTests/Resources directories as-is. |
| 57 | + // Use to retain directory structure. |
| 58 | + // Will be at top level in bundle. |
| 59 | + .copy("Resources") |
| 60 | + ] |
| 61 | + ) |
78 | 62 | ]
|
79 | 63 | )
|
0 commit comments