File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,15 @@ struct BridgeJSBuildPlugin: BuildToolPlugin {
3232 inputFiles. append ( configFile)
3333 }
3434
35+ // Include Swift files generated by other plugins applied to this
36+ // target (available in tools-version 6.0+). This lets BridgeJS
37+ // process @JS annotations in files produced by earlier plugins
38+ // without requiring any extra configuration.
39+ let pluginGeneratedSwiftFiles = target. pluginGeneratedSources. filter {
40+ $0. pathExtension == " swift "
41+ }
42+ inputFiles. append ( contentsOf: pluginGeneratedSwiftFiles)
43+
3544 let inputTSFile = target. directoryURL. appending ( path: " bridge-js.d.ts " )
3645 let tsconfigPath = context. package . directoryURL. appending ( path: " tsconfig.json " )
3746
@@ -47,15 +56,15 @@ struct BridgeJSBuildPlugin: BuildToolPlugin {
4756 ]
4857
4958 if FileManager . default. fileExists ( atPath: inputTSFile. path) {
50- // Add .d.ts file and tsconfig.json as inputs
5159 inputFiles. append ( contentsOf: [ inputTSFile, tsconfigPath] )
5260 arguments. append ( contentsOf: [
5361 " --project " ,
5462 tsconfigPath. path,
5563 ] )
5664 }
5765
58- arguments. append ( contentsOf: inputSwiftFiles. map ( \. path) )
66+ let allSwiftFiles = inputSwiftFiles + pluginGeneratedSwiftFiles
67+ arguments. append ( contentsOf: allSwiftFiles. map ( \. path) )
5968
6069 return . buildCommand(
6170 displayName: " Generate BridgeJS code " ,
Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ import BridgeJSUtilities
146146 var inputFiles = withSpan ( " Collecting Swift files " ) {
147147 return inputSwiftFiles ( targetDirectory: targetDirectory, positionalArguments: positionalArguments)
148148 }
149+
149150 // BridgeJS.Macros.swift contains imported declarations (@JSFunction, @JSClass, etc.) that need
150151 // to be processed by SwiftToSkeleton to populate the imported skeleton. The command plugin
151152 // filters out Generated/ files, so we explicitly add it here after generation.
You can’t perform that action at this time.
0 commit comments