Always include Unicode charinfo, so tar made in csc mode works in mcs mode (#19813)
[mono-project.git] / sdks / wasm / build.sh
blob63a338689468b98ea86cba0684d1fbecda2ed25b
1 #!/usr/bin/env bash
3 # Stop script if unbound variable found (use ${var:-} if intentional)
4 set -u
6 # Stop script if command returns non-zero exit code.
7 # Prevents hidden errors caused by missing error code propagation.
8 set -e
10 usage()
12 echo "Common settings:"
13 echo " --configuration <value> Build configuration: 'Debug' or 'Release' (short: -c)"
14 echo " --help Print help and exit (short: -h)"
15 echo ""
17 echo "Actions:"
18 echo " --clean Clean up the clean targets"
19 echo " --cxx Enable CXX"
20 echo " --reconfigure Force provision and configure"
21 echo " --test Run all tests (short: -t)"
22 echo " --thread Enable WASM threads"
23 echo " --win Enable Windows cross build"
24 echo ""
26 echo "Command line arguments starting with '/p:' are passed through to MSBuild."
27 echo "Arguments can also be passed in with a single hyphen."
30 cleanall=false
31 cxx=false
32 configuration='Release'
33 force_reconfigure=false
34 test=false
35 thread=false
36 win=false
38 while [[ $# > 0 ]]; do
39 opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
40 case "$opt" in
41 -help|-h)
42 usage
43 exit 0
45 -clean)
46 cleanall=true
48 -cxx)
49 cxx=true
51 -configuration|-c)
52 configuration=$2
53 shift
55 -reconfigure)
56 force_reconfigure=true
58 -test|-t)
59 test=true
61 -thread)
62 thread=true
64 -win)
65 win=true
68 echo "Invalid argument: $1"
69 usage
70 exit 1
72 esac
74 shift
75 done
77 CPU_COUNT=$(getconf _NPROCESSORS_ONLN || echo 4)
79 # clean all
80 if [ "$cleanall" = "true" ]; then
81 make clean
82 exit 0;
85 # provision and configuration
86 if [[ "$force_reconfigure" == "true" || ! -f .configured ]]; then
87 # re-create Make.config
88 echo "ENABLE_WASM=1" > ../Make.config
90 if [ "$win" == "true" ]; then
91 echo "ENABLE_WINDOWS=1" >> ../Make.config
94 if [ "$cxx" == "true" ]; then
95 echo "ENABLE_CXX=1" >> ../Make.config
98 if [ "$thread" == "true" ]; then
99 echo "ENABLE_WASM_THREADS=1" >> ../Make.config
102 if [[ "$configuration" == "Debug" ]]; then
103 echo "CONFIGURATION=debug" >> ../Make.config
106 make -C ../builds provision-wasm
107 make -j ${CPU_COUNT} -C ../builds configure-wasm NINJA=
108 touch .configured
111 make -j ${CPU_COUNT} -C ../builds archive-wasm NINJA=
112 make -C ../wasm runtime
114 # run all tests
115 if [ "$test" = "true" ]; then
116 export aot_test_suites="System.Core"
117 export mixed_test_suites="System.Core"
118 export xunit_test_suites="System.Core corlib"
120 make -j ${CPU_COUNT} build
121 make run-all-mini
122 make run-all-corlib
123 #The following tests are not passing yet, so enabling them would make us perma-red
124 #make run-all-System
125 make run-all-System.Core
126 for suite in ${xunit_test_suites}; do make run-${suite}-xunit; done
127 # disable for now until https://github.com/mono/mono/pull/13622 goes in
128 #make run-debugger-tests
129 make run-browser-tests
130 #make run-browser-threads-tests
131 make -j ${CPU_COUNT} run-aot-mini
132 make -j ${CPU_COUNT} build-aot-all
133 for suite in ${aot_test_suites}; do make run-aot-${suite}; done
134 for suite in ${mixed_test_suites}; do make run-aot-mixed-${suite}; done
135 #make check-aot
136 make package
139 exit 0