diff --git a/.github/workflows/ci-embedded.yaml b/.github/workflows/ci-embedded.yaml index b612554..8b4ec8e 100644 --- a/.github/workflows/ci-embedded.yaml +++ b/.github/workflows/ci-embedded.yaml @@ -26,10 +26,5 @@ jobs: - name: Build run: | - swift build -c release \ - --triple wasm32-unknown-none-wasm \ - -Xswiftc -enable-experimental-feature -Xswiftc Embedded \ - -Xswiftc -enable-experimental-feature -Xswiftc Extern \ - -Xswiftc -wmo -Xswiftc -disable-cmo \ - -Xswiftc -cxx-interoperability-mode=default \ - -Xcc -fdeclspec + JAVASCRIPTKIT_EXPERIMENTAL_EMBEDDED_WASM=true \ + swift build --triple wasm32-unknown-none-wasm diff --git a/Package@swift-6.swift b/Package@swift-6.swift index ac14e1c..72b0135 100644 --- a/Package@swift-6.swift +++ b/Package@swift-6.swift @@ -1,8 +1,7 @@ // swift-tools-version: 6.0 -import Foundation import PackageDescription -let shouldBuildForEmbedded = ProcessInfo.processInfo.environment["JAVASCRIPTKIT_EXPERIMENTAL_EMBEDDED_WASM"].flatMap(Bool.init) ?? false +let shouldBuildForEmbedded = Context.environment["JAVASCRIPTKIT_EXPERIMENTAL_EMBEDDED_WASM"].flatMap(Bool.init) ?? false var featureFlags: [SwiftSetting] = [ .enableUpcomingFeature("ExistentialAny"), @@ -11,11 +10,13 @@ var featureFlags: [SwiftSetting] = [ if shouldBuildForEmbedded { // currently this work-around only works for SwiftPM package dependencies on branches, not version tags // see https://github.com/swiftlang/swift-package-manager/issues/7612 - featureFlags.append( + featureFlags.append(contentsOf: [ + .enableExperimentalFeature("Embedded"), + .enableExperimentalFeature("Extern"), .unsafeFlags([ "-Xfrontend", "-emit-empty-object-file", - ]) - ) + ]), + ]) } let package = Package( @@ -35,6 +36,7 @@ let package = Package( targets: [ .target( name: "Elementary", + cSettings: shouldBuildForEmbedded ? [.unsafeFlags(["-fdeclspec"])] : nil, swiftSettings: featureFlags ), .testTarget(