-
Notifications
You must be signed in to change notification settings - Fork 36
/
build.sh
executable file
·131 lines (107 loc) · 7.56 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/sh
# The location of your yuidoc install
yuidoc_home=$1
#Location of project
project=$2
#Location of Google Clojure Compiler
googleClojure=$3
#Location of Node.js
nodejs=$4
version=0_3_1
# The location of the files to parse. Parses subdirectories, but will fail if
# there are duplicate file names in these directories. You can specify multiple
# source trees:
parser_in=$project/src/js
# The location to output the parser data. This output is a file containing a
# json string, and copies of the parsed files.
parser_out=$project/API/parser
# The directory to put the html file outputted by the generator
generator_out=$project/API/generator
# The location of the template files. Any subdirectories here will be copied
# verbatim to the destination directory.
template=$project/build-asset/doc-template
# The version of your project to display within the documentation.
version=0.3.1
# The version of YUI the project is using. This effects the output for
# YUI configuration attributes. This should start with '2' or '3'.
yuiversion=3
projecturl=http://www.kickjs.org/
projectname="KickJS"
#####
echo "Clean"
rm -rf $parser_out
rm -rf $generator_out
##############################################################################
echo "Include GLSL files as constants"
$nodejs $project/preprocessor/include_glsl_files $project/src/glsl/ $project/src/js/glslconstants.js
##############################################################################
echo "Running Precompiler dev"
mkdir $project/build
rm -rf $project/build/pre
mkdir $project/build/pre
$nodejs $project/preprocessor/preprocessor $project/src/js/math.js $project/build/pre/math.js $version true true
$nodejs $project/preprocessor/preprocessor $project/src/js/core.js $project/build/pre/core.js $version true true
$nodejs $project/preprocessor/preprocessor $project/src/js/chunk.js $project/build/pre/chunk.js $version true true
$nodejs $project/preprocessor/preprocessor $project/src/js/scene.js $project/build/pre/scene.js $version true true
$nodejs $project/preprocessor/preprocessor $project/src/js/mesh.js $project/build/pre/mesh.js $version true true
$nodejs $project/preprocessor/preprocessor $project/src/js/material.js $project/build/pre/material.js $version true true
$nodejs $project/preprocessor/preprocessor $project/src/js/meshfactory.js $project/build/pre/meshfactory.js $version true true
$nodejs $project/preprocessor/preprocessor $project/src/js/texture.js $project/build/pre/texture.js $version true true
$nodejs $project/preprocessor/preprocessor $project/src/js/collada.js $project/build/pre/collada.js $version true true
$nodejs $project/preprocessor/preprocessor $project/src/js/obj.js $project/build/pre/obj.js $version true true
$nodejs $project/preprocessor/preprocessor $project/src/js/resource.js $project/build/pre/resource.js $version true true
cp $project/src/js/constants.js $project/build/pre/constants.js
cp $project/src/js/glslconstants.js $project/build/pre/glslconstants.js
echo "Creating kick-debug.js"
cat "$project/license.txt" $project/build/pre/constants.js $project/build/pre/glslconstants.js $project/build/pre/math.js $project/build/pre/core.js $project/build/pre/chunk.js $project/build/pre/mesh.js $project/build/pre/scene.js $project/build/pre/texture.js $project/build/pre/material.js $project/build/pre/meshfactory.js $project/build/pre/collada.js $project/build/pre/obj.js $project/build/pre/resource.js > $project/build/kick-debug-$version.js
##############################################################################
echo "Generating documentation (YUI Doc)"
echo $yuidoc_home/bin/yuidoc.py $parser_in -p $parser_out -o $generator_out -t $template -v $version -Y $yuiversion -m "$projectname" -u $projecturl
$yuidoc_home/bin/yuidoc.py $parser_in -p $parser_out -o $generator_out -t $template -v $version -Y $yuiversion -m "$projectname" -u $projecturl
##############################################################################
echo "Running Precompiler release"
mkdir $project/build
rm -rf $project/build/pre
mkdir $project/build/pre
$nodejs $project/preprocessor/preprocessor $project/src/js/math.js $project/build/pre/math.js $version false false
$nodejs $project/preprocessor/preprocessor $project/src/js/core.js $project/build/pre/core.js $version false false
$nodejs $project/preprocessor/preprocessor $project/src/js/chunk.js $project/build/pre/chunk.js $version false false
$nodejs $project/preprocessor/preprocessor $project/src/js/scene.js $project/build/pre/scene.js $version false false
$nodejs $project/preprocessor/preprocessor $project/src/js/mesh.js $project/build/pre/mesh.js $version false false
$nodejs $project/preprocessor/preprocessor $project/src/js/material.js $project/build/pre/material.js $version false false
$nodejs $project/preprocessor/preprocessor $project/src/js/meshfactory.js $project/build/pre/meshfactory.js $version false false
$nodejs $project/preprocessor/preprocessor $project/src/js/texture.js $project/build/pre/texture.js $version false false
$nodejs $project/preprocessor/preprocessor $project/src/js/collada.js $project/build/pre/collada.js $version false false
$nodejs $project/preprocessor/preprocessor $project/src/js/obj.js $project/build/pre/obj.js $version false false
$nodejs $project/preprocessor/preprocessor $project/src/js/resource.js $project/build/pre/resource.js $version false false
cp $project/src/js/constants.js $project/build/pre/constants.js
cp $project/src/js/glslconstants.js $project/build/pre/glslconstants.js
## For debugging purpose only - skip preprocessor
## cp $project/src/js/math.js $project/build/pre/math.js
## cp $project/src/js/core.js $project/build/pre/core.js
## cp $project/src/js/chunk.js $project/build/pre/chunk.js
## cp $project/src/js/scene.js $project/build/pre/scene.js
## cp $project/src/js/mesh.js $project/build/pre/mesh.js
## cp $project/src/js/material.js $project/build/pre/material.js
## cp $project/src/js/meshfactory.js $project/build/pre/meshfactory.js
## cp $project/src/js/texture.js $project/build/pre/texture.js
## cp $project/src/js/collada.js $project/build/pre/collada.js
## cp $project/src/js/obj.js $project/build/pre/obj.js
## cp $project/src/js/resource.js $project/build/pre/resource.js
##############################################################################
## http://code.google.com/closure/compiler/
##############################################################################
echo "Running Google Clojure compiler"
java -jar $googleClojure --js_output_file "$project/build/kick-min.js.tmp" --js $project/build/pre/constants.js --js $project/build/pre/glslconstants.js --js $project/build/pre/math.js --js $project/build/pre/core.js --js $project/build/pre/chunk.js --js $project/build/pre/texture.js --js $project/build/pre/scene.js --js $project/build/pre/mesh.js --js $project/build/pre/material.js --js $project/build/pre/meshfactory.js --js $project/build/pre/collada.js --js $project/build/pre/obj.js --js $project/build/pre/resource.js --language_in ECMASCRIPT5_STRICT
##############################################################################
echo "Adding license info compiler"
cat "$project/license.txt" "$project/build/kick-min.js.tmp" > "$project/build/kick-min-$version.js"
rm "$project/build/kick-min.js.tmp"
##############################################################################
echo "Copy kickjs to examples"
mkdir "$project/example/js/"
cp "$project/build/kick-min-$version.js" "$project/example/js/kick-min-$version.js"
cp "$project/build/kick-debug-$version.js" "$project/example/js/kick-debug-$version.js"
cp "$project/src/js-dependencies/webgl-debug.js" "$project/example/js/webgl-debug.js"
echo "Build finished"
date