File tree Expand file tree Collapse file tree
PluginSDK/Examples/IBeacon Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Build the Battery Level plugin and install it into the app's bundled plugins.
2+ #
3+ # Requires the Embedded Swift WASM SDK:
4+ # swift sdk install <swift-<version>_wasm-embedded artifact bundle URL>
5+ # and binaryen for wasm-opt (brew install binaryen).
6+
7+ SWIFT_SDK ?= swift-6.3.3-RELEASE_wasm-embedded
8+ PRODUCT := IBeacon
9+ BUILT := .build/wasm32-unknown-wasip1/release/$(PRODUCT ) .wasm
10+ INSTALL := ../../../Sources/BluetoothExplorerPluginEngine/Plugins
11+ MODULE := ibeacon.wasm
12+ MANIFEST := $(INSTALL ) /ibeacon.bleplugin.json
13+
14+ .PHONY : build opt install clean
15+
16+ build :
17+ swift build -c release --swift-sdk $(SWIFT_SDK ) --product $(PRODUCT )
18+
19+ opt : build
20+ wasm-opt -Oz --enable-bulk-memory --enable-sign-ext $(BUILT ) -o $(MODULE )
21+
22+ # Install the optimized module and refresh the manifest's sha256.
23+ install : opt
24+ cp $(MODULE ) $(INSTALL ) /$(MODULE )
25+ @HASH=$$(shasum -a 256 $(INSTALL ) /$(MODULE ) | awk '{print $$1}' ) ; \
26+ /usr/bin/sed -i ' ' -E " s/\" sha256\" : \" [0-9a-f]*\" /\" sha256\" : \" $$ HASH\" /; s/\" sha256\" : \" [0-9a-f]*\" /\" sha256\" : \" $$ HASH\" /" $(MANIFEST ) ; \
27+ echo " installed $( MODULE) sha256=$$ HASH"
28+
29+ clean :
30+ rm -rf .build $(MODULE )
You can’t perform that action at this time.
0 commit comments