-
Notifications
You must be signed in to change notification settings - Fork 12
144 lines (117 loc) · 4.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// swift-tools-version:6.0
import PackageDescription
#if swift(>=5.10)
let settings = [ SwiftSetting.enableExperimentalFeature("StrictConcurrency") ]
#else
let settings = [ SwiftSetting ]()
#endif
var package = Package(
name: "Lighter",
platforms: [
.macOS(.v10_15), .iOS(.v13), .visionOS(.v1), .watchOS(.v7), .tvOS(.v12)
],
products: [
.library(name: "Lighter", targets: [ "Lighter" ]),
.library(name: "SQLite3Schema", targets: [ "SQLite3Schema" ]),
.executable(name: "sqlite2swift", targets: [ "sqlite2swift" ]),
.plugin(name: "Enlighter", targets: [ "Enlighter" ]),
.plugin(name: "Generate Code for SQLite",
targets: [ "Generate Code for SQLite" ])
],
targets: [
.systemLibrary(name: "SQLite3",
path: "Sources/SQLite3-Linux",
providers: [ .apt(["libsqlite3-dev"]) ]),
// A small library used to fetch schema information from SQLite3 databases.
.target(name: "SQLite3Schema",
dependencies: [
.target(name: "SQLite3",
condition: .when(platforms: [
.linux, .android, .windows, .openbsd
])),
],
exclude: [ "README.md" ]),
// Lighter is a shared lib providing common protocols used by Enlighter
// generated models and such.
// Note that Lighter isn't that useful w/o code generation (i.e. as a
// standalone lib).
.target(name: "Lighter",
dependencies: [
.target(name: "SQLite3",
condition: .when(platforms: [
.linux, .android, .windows, .openbsd
])),
],
swiftSettings: settings),
// MARK: - Plugin Support
// The CodeGenAST is a small and hacky helper lib that can format/render
// Swift source code.
.target(name : "LighterCodeGenAST",
path : "Plugins/Libraries/LighterCodeGenAST",
exclude : [ "README.md" ], swiftSettings: settings),
// This library contains all the code generation, to be used by different
// clients.
.target(name : "LighterGeneration",
dependencies : [ "LighterCodeGenAST", "SQLite3Schema" ],
path : "Plugins/Libraries/LighterGeneration",
exclude : [ "README.md", "LighterConfiguration/README.md" ],
swiftSettings: settings),
// MARK: - Tests
.testTarget(name: "CodeGenASTTests", dependencies: [ "LighterCodeGenAST" ]),
.testTarget(name: "EntityGenTests", dependencies: [ "LighterGeneration" ]),
.testTarget(name: "LighterOperationGenTests",
dependencies: [ "LighterGeneration" ]),
.testTarget(name: "ContactsDatabaseTests", dependencies: [ "Lighter" ],
exclude: [ "contacts-create.sql" ]),
// MARK: - Plugins and supporting Tools
.executableTarget(name : "sqlite2swift",
dependencies : [ "LighterGeneration" ],
path : "Plugins/Tools/sqlite2swift",
exclude : [ "README.md" ]),
.plugin(name: "Enlighter", capability: .buildTool(),
dependencies: [ "sqlite2swift" ]),
.plugin(
name: "Generate Code for SQLite",
capability: .command(
intent: .custom(
verb: "sqlite2swift",
description:
"Generate Swift code for SQLite DBs into the Sources directory."
),
permissions: [
.writeToPackageDirectory(reason:
"The plugin needs access to generate the source file.")
]
),
dependencies: [ "sqlite2swift" ],
path: "Plugins/GenerateCodeForSQLite"
),
// MARK: - Internal Plugin for Generating Variadics
.executableTarget(name : "GenerateInternalVariadics",
dependencies : [ "LighterCodeGenAST",
"LighterGeneration" ],
path : "Plugins/Tools/GenerateInternalVariadics",
exclude : [ "README.md" ]),
.plugin(
name: "Generate Variadics into Lighter (Internal)",
capability: .command(
intent: .custom(
verb: "write-internal-variadics",
description:
"Generate the variadic queries into the Sources/Lighter directory."
),
permissions: [
.writeToPackageDirectory(
reason: "The plugin needs access to generate the source file.")
]
),
dependencies: [ "GenerateInternalVariadics" ],
path: "Plugins/WriteInternalVariadics"
),
// MARK: - Environment specific tests
.testTarget(name: "FiveThirtyEightTests",
dependencies: [ "LighterGeneration" ]),
.testTarget(name: "NorthwindTests",
dependencies: [ "LighterGeneration" ])
]
)