#!/usr/bin/env elvish

use platform

var emsdk_pkg = "emscripten 3.1.25"
var pkg_info = (xrepo fetch --json $emsdk_pkg | from-json)
var emsdk_path = $pkg_info[0][artifacts][installdir]
set-env EMSDK $emsdk_path


if $platform:is-windows {
    set-env EMSDK_NODE $emsdk_path/node/14.18.2_64bit/bin/node.exe
} elif $platform:is-unix {
    set-env EMSDK_NODE $emsdk_path/node/14.18.2_64bit/bin/node
}


if (== (count $args) 0) {
    xmake test
} else {
    xmake test $args[0]
}
