|
3 | 3 | import CompilerPluginSupport |
4 | 4 | import PackageDescription |
5 | 5 |
|
| 6 | +func envFlag(_ name: String) -> Bool { |
| 7 | + guard let value = Context.environment[name]?.lowercased() else { |
| 8 | + return false |
| 9 | + } |
| 10 | + return value == "1" || value == "true" || value == "yes" || value == "on" |
| 11 | +} |
| 12 | + |
6 | 13 | // NOTE: needed for embedded customizations, ideally this will not be necessary at all in the future, or can be replaced with traits |
7 | 14 | let shouldBuildForEmbedded = Context.environment["JAVASCRIPTKIT_EXPERIMENTAL_EMBEDDED_WASM"].flatMap(Bool.init) ?? false |
8 | 15 | let useLegacyResourceBundling = |
9 | 16 | Context.environment["JAVASCRIPTKIT_USE_LEGACY_RESOURCE_BUNDLING"].flatMap(Bool.init) ?? false |
10 | 17 | let enableTracingByEnv = Context.environment["JAVASCRIPTKIT_ENABLE_TRACING"].flatMap(Bool.init) ?? false |
| 18 | +let disableBridgeJSMacros = envFlag("JAVASCRIPTKIT_DISABLE_BRIDGEJS_MACROS") |
11 | 19 |
|
12 | 20 | let tracingTrait = Trait( |
13 | 21 | name: "Tracing", |
@@ -53,8 +61,10 @@ let package = Package( |
53 | 61 | targets: [ |
54 | 62 | .target( |
55 | 63 | name: "JavaScriptKit", |
56 | | - dependencies: ["_CJavaScriptKit", "BridgeJSMacros"], |
57 | | - exclude: useLegacyResourceBundling ? [] : ["Runtime"], |
| 64 | + dependencies: ["_CJavaScriptKit"] |
| 65 | + + (disableBridgeJSMacros ? [] : ["BridgeJSMacros"]), |
| 66 | + exclude: (useLegacyResourceBundling ? [] : ["Runtime"]) |
| 67 | + + (disableBridgeJSMacros ? ["Macros.swift"] : []), |
58 | 68 | resources: useLegacyResourceBundling ? [.copy("Runtime")] : [], |
59 | 69 | cSettings: shouldBuildForEmbedded |
60 | 70 | ? [ |
|
0 commit comments