BlueGit

timfa raytracer

Files

raytracer / src / build.sh

build.sh

build.sh 1.2 KiB Download Raw
1#!/usr/bin/env bash
2set -euo pipefail
3ROOT="$(cd "$(dirname "$0")/.." && pwd)"
4BUILD_FILE="$ROOT/build/game.js"
5EDITOR_FILE="$ROOT/build/editor.js"
6SRC_DIR="$ROOT/src"
7
8printf "Build started, output file: %s\n" "$BUILD_FILE"
9rm -f "$BUILD_FILE"
10
11FILES=(
12 "$SRC_DIR/textureColumn.js"
13 "$SRC_DIR/ppda/depthDecode.js"
14 "$SRC_DIR/ppda/viewFrame.js"
15 "$SRC_DIR/ppda/compositor.js"
16 "$SRC_DIR/ppda/loadPpda.js"
17 "$SRC_DIR/ppda/atlasRuntime.js"
18 "$SRC_DIR/levelFormat.js"
19 "$SRC_DIR/floorCast.js"
20 "$SRC_DIR/levels.js"
21 "$SRC_DIR/tiles.js"
22 "$SRC_DIR/world.js"
23 "$SRC_DIR/player.js"
24 "$SRC_DIR/npc.js"
25 "$SRC_DIR/raycastScene.js"
26 "$SRC_DIR/main.js"
27)
28
29for file in "${FILES[@]}"
30do
31 if [[ ! -f "$file" ]]
32 then
33 printf "Missing source file: %s\n" "$file" >&2
34 exit 1
35 fi
36 printf "\n/*\n * Start File:\n * %s\n */ \n" "$file" >> "$BUILD_FILE"
37 printf "Building %s\n" "$file"
38 cat "$file" >> "$BUILD_FILE"
39 printf "\n/*\n * End File:\n * %s\n */ \n" "$file" >> "$BUILD_FILE"
40done
41
42printf "Building editor.js\n"
43rm -f "$EDITOR_FILE"
44for file in "$SRC_DIR/levelFormat.js" "$SRC_DIR/editorApp.js"
45do
46 printf "\n/* %s */\n" "$file" >> "$EDITOR_FILE"
47 cat "$file" >> "$EDITOR_FILE"
48done
49
50printf "DONE\n"