1
1
// swift-tools-version:6.0
2
2
3
+ import CompilerPluginSupport
3
4
import PackageDescription
4
5
5
6
// NOTE: needed for embedded customizations, ideally this will not be necessary at all in the future, or can be replaced with traits
@@ -9,12 +10,24 @@ let useLegacyResourceBundling =
9
10
10
11
let package = Package (
11
12
name: " JavaScriptKit " ,
13
+ platforms: [
14
+ . macOS( . v10_15) ,
15
+ . iOS( . v13) ,
16
+ . tvOS( . v13) ,
17
+ . watchOS( . v6) ,
18
+ . macCatalyst( . v13) ,
19
+ ] ,
12
20
products: [
13
21
. library( name: " JavaScriptKit " , targets: [ " JavaScriptKit " ] ) ,
14
22
. library( name: " JavaScriptEventLoop " , targets: [ " JavaScriptEventLoop " ] ) ,
15
23
. library( name: " JavaScriptBigIntSupport " , targets: [ " JavaScriptBigIntSupport " ] ) ,
16
24
. library( name: " JavaScriptEventLoopTestSupport " , targets: [ " JavaScriptEventLoopTestSupport " ] ) ,
17
25
. plugin( name: " PackageToJS " , targets: [ " PackageToJS " ] ) ,
26
+ . plugin( name: " BridgeJS " , targets: [ " BridgeJS " ] ) ,
27
+ . plugin( name: " BridgeJSCommandPlugin " , targets: [ " BridgeJSCommandPlugin " ] ) ,
28
+ ] ,
29
+ dependencies: [
30
+ . package ( url: " https://github.com/swiftlang/swift-syntax " , " 600.0.0 " ..< " 601.0.0 " )
18
31
] ,
19
32
targets: [
20
33
. target(
@@ -98,7 +111,40 @@ let package = Package(
98
111
capability: . command(
99
112
intent: . custom( verb: " js " , description: " Convert a Swift package to a JavaScript package " )
100
113
) ,
101
- sources: [ " Sources " ]
114
+ path: " Plugins/PackageToJS/Sources "
115
+ ) ,
116
+ . plugin(
117
+ name: " BridgeJS " ,
118
+ capability: . buildTool( ) ,
119
+ dependencies: [ " BridgeJSTool " ] ,
120
+ path: " Plugins/BridgeJS/Sources/BridgeJSBuildPlugin "
121
+ ) ,
122
+ . plugin(
123
+ name: " BridgeJSCommandPlugin " ,
124
+ capability: . command(
125
+ intent: . custom( verb: " bridge-js " , description: " Generate bridging code " ) ,
126
+ permissions: [ . writeToPackageDirectory( reason: " Generate bridging code " ) ]
127
+ ) ,
128
+ dependencies: [ " BridgeJSTool " ] ,
129
+ path: " Plugins/BridgeJS/Sources/BridgeJSCommandPlugin "
130
+ ) ,
131
+ . executableTarget(
132
+ name: " BridgeJSTool " ,
133
+ dependencies: [
134
+ . product( name: " SwiftParser " , package : " swift-syntax " ) ,
135
+ . product( name: " SwiftSyntax " , package : " swift-syntax " ) ,
136
+ . product( name: " SwiftBasicFormat " , package : " swift-syntax " ) ,
137
+ . product( name: " SwiftSyntaxBuilder " , package : " swift-syntax " ) ,
138
+ ] ,
139
+ path: " Plugins/BridgeJS/Sources/BridgeJSTool "
140
+ ) ,
141
+ . testTarget(
142
+ name: " BridgeJSRuntimeTests " ,
143
+ dependencies: [ " JavaScriptKit " ] ,
144
+ exclude: [ " Generated/JavaScript " ] ,
145
+ swiftSettings: [
146
+ . enableExperimentalFeature( " Extern " )
147
+ ]
102
148
) ,
103
149
]
104
150
)
0 commit comments