@@ -15,14 +15,6 @@ let package = Package(
1515 name: " WasmParser " ,
1616 targets: [ " WasmParser " ]
1717 ) ,
18- . library(
19- name: " WasmKitWASI " ,
20- targets: [ " WasmKitWASI " ]
21- ) ,
22- . library(
23- name: " WASI " ,
24- targets: [ " WASI " ]
25- ) ,
2618 . library(
2719 name: " WIT " , targets: [ " WIT " ]
2820 ) ,
@@ -31,15 +23,12 @@ let package = Package(
3123 targets: [ " CLI " ]
3224 ) ,
3325 . library( name: " _CabiShims " , targets: [ " _CabiShims " ] ) ,
34- . plugin( name: " WITOverlayPlugin " , targets: [ " WITOverlayPlugin " ] ) ,
35- . plugin( name: " WITExtractorPlugin " , targets: [ " WITExtractorPlugin " ] ) ,
3626 ] ,
3727 targets: [
3828 . executableTarget(
3929 name: " CLI " ,
4030 dependencies: [
4131 " WasmKit " ,
42- " WasmKitWASI " ,
4332 . product( name: " ArgumentParser " , package : " swift-argument-parser " ) ,
4433 . product( name: " SystemPackage " , package : " swift-system " ) ,
4534 ] ,
@@ -49,16 +38,10 @@ let package = Package(
4938 name: " WasmTypes " ,
5039 exclude: [ " CMakeLists.txt " ]
5140 ) ,
52- . target(
53- name: " WASI " ,
54- dependencies: [ " WasmTypes " , " SystemExtras " ] ,
55- exclude: [ " CMakeLists.txt " ]
56- ) ,
5741 . target(
5842 name: " WasmKit " ,
5943 dependencies: [
6044 " WasmParser " ,
61- " SystemExtras " ,
6245 " WasmTypes " ,
6346 . product( name: " SystemPackage " , package : " swift-system " ) ,
6447 ] ,
@@ -72,18 +55,6 @@ let package = Package(
7255 ] ,
7356 exclude: [ " CMakeLists.txt " ]
7457 ) ,
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- ) ,
8758 . executableTarget(
8859 name: " Spectest " ,
8960 dependencies: [
@@ -96,31 +67,11 @@ let package = Package(
9667 . testTarget( name: " WITTests " , dependencies: [ " WIT " ] ) ,
9768 . target( name: " WITOverlayGenerator " , dependencies: [ " WIT " ] ) ,
9869 . 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- ) ,
10770 . target( name: " WITExtractor " ) ,
10871 . testTarget(
10972 name: " WITExtractorTests " ,
11073 dependencies: [ " WITExtractor " , " WIT " ]
11174 ) ,
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- ) ,
12475 . executableTarget(
12576 name: " WITTool " ,
12677 dependencies: [
@@ -138,10 +89,6 @@ let package = Package(
13889 name: " WasmParserTests " ,
13990 dependencies: [ " WasmParser " ]
14091 ) ,
141- . testTarget(
142- name: " WASITests " ,
143- dependencies: [ " WASI " ]
144- ) ,
14592 ] ,
14693 swiftLanguageVersions: [ . v5]
14794)
@@ -159,3 +106,80 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
159106 . package ( path: " ../swift-system " ) ,
160107 ]
161108}
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