Skip to content

Commit 3e3deff

Browse files
Merge pull request #364 from swiftwasm/yt/diag-extern-feature
PackageToJS: Add hint for missing `.enableExperimentalFeature("Extern")` setting
2 parents 42ead29 + bf5b1e0 commit 3e3deff

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Plugins/PackageToJS/Sources/PackageToJSPlugin.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,27 @@ struct PackageToJSPlugin: CommandPlugin {
7171
See https://book.swiftwasm.org/getting-started/setup.html for more information.
7272
"""
7373
}),
74+
(
75+
// In case the SwiftPM target using BridgeJS didn't specify `.enableExperimentalFeature("Extern")`
76+
{ build, arguments in
77+
guard
78+
build.logText.contains("@_extern requires '-enable-experimental-feature Extern'")
79+
else {
80+
return nil
81+
}
82+
return """
83+
The SwiftPM target using BridgeJS didn't specify `.enableExperimentalFeature("Extern")`.
84+
Please add it to the target's `swiftSettings` configuration.
85+
86+
For example:
87+
```swift
88+
dependencies: [...],
89+
swiftSettings: [
90+
.enableExperimentalFeature("Extern"),
91+
]
92+
```
93+
"""
94+
}),
7495
]
7596

7697
private func emitHintMessage(_ message: String) {

0 commit comments

Comments
 (0)