Debian Codegraph @

tools/internal/check_build_tool_output

raw symbols SCIP
1 #!/bin/bash
2 set -euo pipefail
3 IFS=$'\n\t'
4
5 # --------------------------------------------------------------------
6 # Test --output option of castle-engine (build tool).
7 # Assumes $CASTLE_ENGINE_PATH is set.
8 # Current directory doesn't matter.
9 # --------------------------------------------------------------------
10
11 # ----------------------------------------------------------------------------
12 # prepare output path
13
14 export OUTPUT_PATH="/tmp/castle-engine-test-build-tool-output-$$/"
15
16 mkdir "${OUTPUT_PATH}"
17 function finish {
18 rm -Rf "${OUTPUT_PATH}"
19 }
20 trap finish EXIT
21
22 # ----------------------------------------------------------------------------
23 # prepare build tool
24
25 cd "${CASTLE_ENGINE_PATH}"
26 ./tools/build-tool/castle-engine_compile.sh
27 BUILD_TOOL="${CASTLE_ENGINE_PATH}/tools/build-tool/castle-engine"
28
29 # ----------------------------------------------------------------------------
30 # compile play_animation to temporary output path
31
32 cd "${CASTLE_ENGINE_PATH}/examples/animations/play_animation/"
33 "${BUILD_TOOL}" clean
34 "${BUILD_TOOL}" compile --output="${OUTPUT_PATH}"
35 "${BUILD_TOOL}" package --output="${OUTPUT_PATH}" --os=linux --cpu=x86_64
36 "${BUILD_TOOL}" package --output="${OUTPUT_PATH}" --os=win64 --cpu=x86_64
37 "${BUILD_TOOL}" package --output="${OUTPUT_PATH}" --os=android --cpu=arm
38
39 # ----------------------------------------------------------------------------
40 # check stuff does/doesn't exist
41
42 check_file_exists ()
43 {
44 if [ ! -f "$1" ]; then
45 echo "Missing file: ${1}"
46 exit 1
47 fi
48 }
49
50 check_dir_exists ()
51 {
52 if [ ! -d "$1" ]; then
53 echo "Missing dir: ${1}"
54 exit 1
55 fi
56 }
57
58 check_file_not_exists ()
59 {
60 if [ -f "$1" ]; then
61 echo "File should not exist: ${1}"
62 exit 1
63 fi
64 }
65
66 check_dir_not_exists ()
67 {
68 if [ -d "$1" ]; then
69 echo "Dir should not exist: ${1}"
70 exit 1
71 fi
72 }
73
74 check_file_exists "${OUTPUT_PATH}"play_animation.exe
75 check_file_exists "${OUTPUT_PATH}"play_animation
76 check_file_exists "${OUTPUT_PATH}"play_animation-0.1-linux-x86_64.tar.gz
77 check_file_exists "${OUTPUT_PATH}"play_animation-0.1-win64-x86_64.zip
78 check_dir_exists "${OUTPUT_PATH}"castle-engine-output
79
80 check_file_not_exists play_animation.exe
81 check_file_not_exists play_animation
82 check_file_not_exists play_animation-0.1-linux-x86_64.tar.gz
83 check_file_not_exists play_animation-0.1-win64-x86_64.zip
84 check_dir_not_exists castle-engine-output