Skip to content

Commit

Permalink
Add bridge build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Aug 21, 2023
1 parent 68a5d48 commit 9326593
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
24 changes: 24 additions & 0 deletions bridge/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$current_location = Get-Location
$project_root = git rev-parse --show-toplevel
Set-Location $project_root/bridge

foreach ($opt in $args) {
switch ($opt) {
"--silent" { $silent = $true }
default {
Write-Host "Invalid option: $opt"
exit
}
}
}

if ($silent) { $log_level = "--log-level=warning" }

if (!$silent) { Write-Host "Transpile and bundle TS sources to webui.js" }
esbuild --bundle --target="chrome90,firefox90,safari15" --format=esm --tree-shaking=false --outdir=. ./webui_bridge.ts $log_level

if (!$silent) { Write-Host "Convert JS source to C header" }
python3 js2c.py

if (!$silent) { Write-Host "Done." }
Set-Location $current_location
28 changes: 28 additions & 0 deletions bridge/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

project_root=$(git rev-parse --show-toplevel)
cd $project_root/bridge

# Loop through all arguments
for opt in "$@"; do
case $opt in
--silent)
silent=true
;;
*)
echo "Invalid option: $opt"
exit 0
;;
esac
shift # Move to the next argument
done

if [ "$silent" = true ]; then log_level=--log-level=warning; fi

if [ "$silent" != true ]; then echo "Transpile and bundle TS sources to webui.js"; fi
esbuild --bundle --target="chrome90,firefox90,safari15" --format=esm --tree-shaking=false --outdir=. ./webui_bridge.ts $log_level

if [ "$silent" != true ]; then echo "Convert JS source to C header"; fi
python3 js2c.py

if [ "$silent" != true ]; then echo "Done."; fi

0 comments on commit 9326593

Please sign in to comment.