Fork of daniellemaywood.uk/gleam — Wasm codegen work
1.2 kB
45 lines
1# SPDX-License-Identifier: Apache-2.0
2# SPDX-FileCopyrightText: 2024 The Gleam contributors
3
4#!/bin/sh
5
6set -eu
7
8GLEAM_COMMAND=${GLEAM_COMMAND:-"cargo run --quiet --"}
9
10g() {
11 echo "Running: $GLEAM_COMMAND $@"
12 $GLEAM_COMMAND "$@"
13}
14
15echo Resetting the build directory to get to a known state
16rm -fr build
17
18echo This should succeed regardless of target as it is a dependency module
19g run --module=hello_joe
20g run --module=hello_joe --target=erlang
21g run --module=hello_joe --target=javascript
22
23echo Building and running for Erlang should succeed
24g build --target=erlang
25g run --target=erlang
26
27echo Building for JavaScript should fail, even if previously a JavaScript dependency was built
28if g build --target=javascript; then
29 echo "Expected build to fail"
30 exit 1
31fi
32
33echo Running for JavaScript should fail, even if previously a JavaScript dependency was built
34if g run --target=javascript; then
35 echo "Expected run to fail"
36 exit 1
37fi
38
39echo Running erlang shipment should succeed
40g export erlang-shipment
41grep "external_only_erlang_ffi" "build/erlang-shipment/external_only_erlang/ebin/external_only_erlang.app"
42
43echo
44echo Success! 💖
45echo