File: build.sh

package info (click to toggle)
aseba-plugin-blockly 20180211+git-2
  • links: PTS
  • area: non-free
  • in suites: bullseye, sid
  • size: 64,472 kB
  • sloc: xml: 7,976; python: 2,314; sh: 261; lisp: 24; makefile: 10
file content (55 lines) | stat: -rwxr-xr-x 1,116 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
set -e
set -x

SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD_DIR="$PWD"

TEMP_DIR=$(mktemp -d)

function atexit {
  rm -rf "$TEMP_DIR"
}

trap atexit EXIT

cp -r "$SRC_DIR"/{blockly,closure-library,thymio_blockly,index.html,media} "$TEMP_DIR"

ARCHIVE="$BUILD_DIR/blockly.zip"

if [ ! -z "$1" ]
then
ARCHIVE=$(realpath "$1")
fi

if [ -f $ARCHIVE ]
then
	rm $ARCHIVE
fi

pushd "$TEMP_DIR"
	pushd "blockly"
		echo "Compiling blockly"
		python2 "./build.py"
	popd

	pushd "thymio_blockly"
		for file in thymio_blockly.*.html
		do
			echo "Fixing javascript paths in $file"
			python "$SRC_DIR/convert_script_path.py" "$file"
		done
		echo "Copying Javascript files"
		cp ../blockly/{blockly,blocks,overrides,aesl}_compressed.js "js"
		mkdir -p js/i18n
		mv ../blockly/msg/js/{de,it,es,en,fr}.js js/i18n
		echo "Copying Blockly translations"
	popd
	mv thymio_blockly data
	mkdir thymio-blockly-standalone
	mv blockly/media thymio-blockly-standalone
	mv media/* thymio-blockly-standalone/media

	mv index.html data thymio-blockly-standalone
	zip -r $ARCHIVE thymio-blockly-standalone
popd