-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·59 lines (45 loc) · 1.57 KB
/
build.sh
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
56
57
58
59
#!/bin/bash
cd "$(dirname "$0")"
list_js_files() {
find "src/js/openlayers" -type f -name "*.js" | sort_js_files
find "src/js/jquery" -type f -name "*.js" | sort_js_files
echo "src/js/base.js"
echo "src/js/classes/Util.js"
find "src/js/olfix" -type f -name "*.js" | sort_js_files
find "src/js/i18n" -type f -name "*.js" | sort_js_files
find "src/js/classes" -type f -name "*.js" | grep -vx src/js/classes/Util.js | sort_js_files
}
sort_js_files() {
sed -e 's/\.js$//' | sort | sed -e 's/$/.js/'
}
js_files="$(list_js_files)"
rev="$(date -u "+%FT%TZ")"
out_dir="builds/$rev"
mkdir -p "$out_dir"
rm -f builds/latest
ln -s "$rev" builds/latest
echo "$js_files" | while read fname; do
content="////////// $fname ///////////
$(cat "$fname")
"
echo "$content" >> "$out_dir/facilmap_ol_src.js"
if ! echo "$fname" | grep -qF openlayers; then
echo "$content" >> "$out_dir/facilmap_src.js"
fi
done
find src/css -name "*.css" | while read fname; do
content="/********* $fname **********/
$(cat "$fname")
"
echo "$content" >> "$out_dir/facilmap_ol_src.css"
if ! echo "$fname" | grep -qF openlayers; then
echo "$content" >> "$out_dir/facilmap_src.css"
fi
done
rsync -a src/resources/ "$out_dir/"
if [ -f yuicompressor-*.jar ]; then
java -jar yuicompressor-*.jar "$out_dir/facilmap_src.js" > "$out_dir/facilmap.js"
java -jar yuicompressor-*.jar "$out_dir/facilmap_ol_src.js" > "$out_dir/facilmap_ol.js"
java -jar yuicompressor-*.jar "$out_dir/facilmap_src.css" > "$out_dir/facilmap.css"
java -jar yuicompressor-*.jar "$out_dir/facilmap_ol_src.css" > "$out_dir/facilmap_ol.css"
fi