Skip to content

Commit 2b29076

Browse files
committed
Fix: Ensure BridgeJS.Macros.swift is processed by SwiftToSkeleton
Regenerate BridgeJS files
1 parent d8b0e17 commit 2b29076

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ import BridgeJSUtilities
113113
let bridgeJsGlobalDtsPath = targetDirectory.appending(path: "bridge-js.global.d.ts")
114114
let hasDts = FileManager.default.fileExists(atPath: bridgeJsDtsPath.path)
115115
let hasGlobalDts = FileManager.default.fileExists(atPath: bridgeJsGlobalDtsPath.path)
116+
var generatedMacrosPath: String? = nil
116117
if hasDts || hasGlobalDts {
117118
guard let tsconfigPath = doubleDashOptions["project"] else {
118119
throw BridgeJSToolError("--project option is required when processing .d.ts files")
@@ -128,9 +129,19 @@ import BridgeJSUtilities
128129
progress: progress,
129130
outputPath: bridgeJSMacrosPath.path
130131
)
132+
generatedMacrosPath = bridgeJSMacrosPath.path
131133
}
132134

133-
let inputFiles = inputSwiftFiles(targetDirectory: targetDirectory, positionalArguments: positionalArguments)
135+
var inputFiles = inputSwiftFiles(targetDirectory: targetDirectory, positionalArguments: positionalArguments)
136+
// BridgeJS.Macros.swift contains imported declarations (@JSFunction, @JSClass, etc.) that need
137+
// to be processed by SwiftToSkeleton to populate the imported skeleton. The command plugin
138+
// filters out Generated/ files, so we explicitly add it here after generation.
139+
if let macrosPath = generatedMacrosPath, FileManager.default.fileExists(atPath: macrosPath) {
140+
// Only add if not already present (when running directly vs through plugin)
141+
if !inputFiles.contains(macrosPath) {
142+
inputFiles.append(macrosPath)
143+
}
144+
}
134145
let swiftToSkeleton = SwiftToSkeleton(
135146
progress: progress,
136147
moduleName: moduleName,

0 commit comments

Comments
 (0)