@@ -15,14 +15,6 @@ let package = Package(
15
15
name: " WasmParser " ,
16
16
targets: [ " WasmParser " ]
17
17
) ,
18
- . library(
19
- name: " WasmKitWASI " ,
20
- targets: [ " WasmKitWASI " ]
21
- ) ,
22
- . library(
23
- name: " WASI " ,
24
- targets: [ " WASI " ]
25
- ) ,
26
18
. library(
27
19
name: " WIT " , targets: [ " WIT " ]
28
20
) ,
@@ -31,15 +23,12 @@ let package = Package(
31
23
targets: [ " CLI " ]
32
24
) ,
33
25
. library( name: " _CabiShims " , targets: [ " _CabiShims " ] ) ,
34
- . plugin( name: " WITOverlayPlugin " , targets: [ " WITOverlayPlugin " ] ) ,
35
- . plugin( name: " WITExtractorPlugin " , targets: [ " WITExtractorPlugin " ] ) ,
36
26
] ,
37
27
targets: [
38
28
. executableTarget(
39
29
name: " CLI " ,
40
30
dependencies: [
41
31
" WasmKit " ,
42
- " WasmKitWASI " ,
43
32
. product( name: " ArgumentParser " , package : " swift-argument-parser " ) ,
44
33
. product( name: " SystemPackage " , package : " swift-system " ) ,
45
34
] ,
@@ -49,16 +38,10 @@ let package = Package(
49
38
name: " WasmTypes " ,
50
39
exclude: [ " CMakeLists.txt " ]
51
40
) ,
52
- . target(
53
- name: " WASI " ,
54
- dependencies: [ " WasmTypes " , " SystemExtras " ] ,
55
- exclude: [ " CMakeLists.txt " ]
56
- ) ,
57
41
. target(
58
42
name: " WasmKit " ,
59
43
dependencies: [
60
44
" WasmParser " ,
61
- " SystemExtras " ,
62
45
" WasmTypes " ,
63
46
. product( name: " SystemPackage " , package : " swift-system " ) ,
64
47
] ,
@@ -72,18 +55,6 @@ let package = Package(
72
55
] ,
73
56
exclude: [ " CMakeLists.txt " ]
74
57
) ,
75
- . target(
76
- name: " WasmKitWASI " ,
77
- dependencies: [ " WasmKit " , " WASI " ] ,
78
- exclude: [ " CMakeLists.txt " ]
79
- ) ,
80
- . target(
81
- name: " SystemExtras " ,
82
- dependencies: [
83
- . product( name: " SystemPackage " , package : " swift-system " )
84
- ] ,
85
- exclude: [ " CMakeLists.txt " ]
86
- ) ,
87
58
. executableTarget(
88
59
name: " Spectest " ,
89
60
dependencies: [
@@ -96,31 +67,11 @@ let package = Package(
96
67
. testTarget( name: " WITTests " , dependencies: [ " WIT " ] ) ,
97
68
. target( name: " WITOverlayGenerator " , dependencies: [ " WIT " ] ) ,
98
69
. target( name: " _CabiShims " ) ,
99
- . plugin( name: " WITOverlayPlugin " , capability: . buildTool( ) , dependencies: [ " WITTool " ] ) ,
100
- . plugin( name: " GenerateOverlayForTesting " , capability: . buildTool( ) , dependencies: [ " WITTool " ] ) ,
101
- . testTarget(
102
- name: " WITOverlayGeneratorTests " ,
103
- dependencies: [ " WITOverlayGenerator " , " WasmKit " , " WasmKitWASI " ] ,
104
- exclude: [ " Fixtures " , " Compiled " , " Generated " ] ,
105
- plugins: [ . plugin( name: " GenerateOverlayForTesting " ) ]
106
- ) ,
107
70
. target( name: " WITExtractor " ) ,
108
71
. testTarget(
109
72
name: " WITExtractorTests " ,
110
73
dependencies: [ " WITExtractor " , " WIT " ]
111
74
) ,
112
- . plugin(
113
- name: " WITExtractorPlugin " ,
114
- capability: . command(
115
- intent: . custom( verb: " extract-wit " , description: " Extract WIT definition from Swift module " ) ,
116
- permissions: [ ]
117
- ) ,
118
- dependencies: [ " WITTool " ]
119
- ) ,
120
- . testTarget(
121
- name: " WITExtractorPluginTests " ,
122
- exclude: [ " Fixtures " ]
123
- ) ,
124
75
. executableTarget(
125
76
name: " WITTool " ,
126
77
dependencies: [
@@ -138,10 +89,6 @@ let package = Package(
138
89
name: " WasmParserTests " ,
139
90
dependencies: [ " WasmParser " ]
140
91
) ,
141
- . testTarget(
142
- name: " WASITests " ,
143
- dependencies: [ " WASI " ]
144
- ) ,
145
92
] ,
146
93
swiftLanguageVersions: [ . v5]
147
94
)
@@ -159,3 +106,80 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
159
106
. package ( path: " ../swift-system " ) ,
160
107
]
161
108
}
109
+
110
+ #if !os(Windows)
111
+ // Add WASI-related products and targets
112
+ package . products. append ( contentsOf: [
113
+ . library(
114
+ name: " WasmKitWASI " ,
115
+ targets: [ " WasmKitWASI " ]
116
+ ) ,
117
+ . library(
118
+ name: " WASI " ,
119
+ targets: [ " WASI " ]
120
+ ) ,
121
+ ] )
122
+ package . targets. append ( contentsOf: [
123
+ . target(
124
+ name: " WASI " ,
125
+ dependencies: [ " WasmTypes " , " SystemExtras " ] ,
126
+ exclude: [ " CMakeLists.txt " ]
127
+ ) ,
128
+ . target(
129
+ name: " WasmKitWASI " ,
130
+ dependencies: [ " WasmKit " , " WASI " ] ,
131
+ exclude: [ " CMakeLists.txt " ]
132
+ ) ,
133
+ . target(
134
+ name: " SystemExtras " ,
135
+ dependencies: [
136
+ . product( name: " SystemPackage " , package : " swift-system " )
137
+ ] ,
138
+ exclude: [ " CMakeLists.txt " ]
139
+ ) ,
140
+ . testTarget(
141
+ name: " WASITests " ,
142
+ dependencies: [ " WASI " ]
143
+ ) ,
144
+ ] )
145
+ let targetDependenciesToAdd = [
146
+ " CLI " : [ " WasmKitWASI " ] ,
147
+ " WasmKit " : [ " SystemExtras " ] ,
148
+ ]
149
+ for (targetName, dependencies) in targetDependenciesToAdd {
150
+ if let target = package . targets. first ( where: { $0. name == targetName } ) {
151
+ target. dependencies += dependencies. map { . target( name: $0) }
152
+ } else {
153
+ fatalError ( " Target \( targetName) not found!? " )
154
+ }
155
+ }
156
+
157
+ // Add build tool plugins only for non-Windows platforms
158
+ package . products. append ( contentsOf: [
159
+ . plugin( name: " WITOverlayPlugin " , targets: [ " WITOverlayPlugin " ] ) ,
160
+ . plugin( name: " WITExtractorPlugin " , targets: [ " WITExtractorPlugin " ] ) ,
161
+ ] )
162
+
163
+ package . targets. append ( contentsOf: [
164
+ . plugin( name: " WITOverlayPlugin " , capability: . buildTool( ) , dependencies: [ " WITTool " ] ) ,
165
+ . plugin( name: " GenerateOverlayForTesting " , capability: . buildTool( ) , dependencies: [ " WITTool " ] ) ,
166
+ . testTarget(
167
+ name: " WITOverlayGeneratorTests " ,
168
+ dependencies: [ " WITOverlayGenerator " , " WasmKit " , " WasmKitWASI " ] ,
169
+ exclude: [ " Fixtures " , " Compiled " , " Generated " ] ,
170
+ plugins: [ . plugin( name: " GenerateOverlayForTesting " ) ]
171
+ ) ,
172
+ . plugin(
173
+ name: " WITExtractorPlugin " ,
174
+ capability: . command(
175
+ intent: . custom( verb: " extract-wit " , description: " Extract WIT definition from Swift module " ) ,
176
+ permissions: [ ]
177
+ ) ,
178
+ dependencies: [ " WITTool " ]
179
+ ) ,
180
+ . testTarget(
181
+ name: " WITExtractorPluginTests " ,
182
+ exclude: [ " Fixtures " ]
183
+ ) ,
184
+ ] )
185
+ #endif
0 commit comments