Skip to content

Commit c8c4629

Browse files
committed
moved css and js build targets out to shell scripts, first step in grunt migration
1 parent 091b407 commit c8c4629

File tree

4 files changed

+105
-79
lines changed

4 files changed

+105
-79
lines changed

Makefile

Lines changed: 4 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,7 @@ deploy: STRUCTURE = jquery.mobile.structure-${VER_OFFICIAL}
2525
# The CSS theme being used
2626
THEME = default
2727

28-
# If node is available then use node to run r.js
29-
# otherwise use good old rhino/java
30-
NODE = /usr/local/bin/node
31-
HAS_NODE = $(shell if test -x ${NODE} ;then echo true; fi)
32-
33-
ifeq ($(HAS_NODE), true)
34-
RUN_JS = @@${NODE}
35-
else
36-
RUN_JS = @@java -XX:ReservedCodeCacheSize=64m -classpath build/js.jar:build/google-compiler-20111003.jar org.mozilla.javascript.tools.shell.Main
37-
endif
38-
3928
# Build Targets
40-
4129
# When no build target is specified, all gets ran
4230
all: css js zip notify
4331

@@ -53,45 +41,11 @@ init:
5341

5442
# Build and minify the CSS files
5543
css: init
56-
# Build the CSS file with the theme included
57-
${RUN_JS} \
58-
external/r.js/dist/r.js \
59-
-o cssIn=css/themes/default/jquery.mobile.css \
60-
optimizeCss=standard.keepComments.keepLines \
61-
out=${OUTPUT}/${NAME}.compiled.css
62-
@@cat LICENSE-INFO.txt | ${VER} > ${OUTPUT}/${NAME}.css
63-
@@cat ${OUTPUT}/${NAME}.compiled.css >> ${OUTPUT}/${NAME}.css
64-
@@echo ${VER_MIN} > ${OUTPUT}/${NAME}.min.css
65-
@@java -XX:ReservedCodeCacheSize=64m \
66-
-jar build/yuicompressor-2.4.6.jar \
67-
--type css ${OUTPUT}/${NAME}.compiled.css >> ${OUTPUT}/${NAME}.min.css
68-
@@rm ${OUTPUT}/${NAME}.compiled.css
69-
# Build the CSS Structure-only file
70-
${RUN_JS} \
71-
external/r.js/dist/r.js \
72-
-o cssIn=css/structure/jquery.mobile.structure.css \
73-
out=${OUTPUT}/${STRUCTURE}.compiled.css
74-
@@cat LICENSE-INFO.txt | ${VER} > ${OUTPUT}/${STRUCTURE}.css
75-
@@cat ${OUTPUT}/${STRUCTURE}.compiled.css >> ${OUTPUT}/${STRUCTURE}.css
76-
# ..... and then minify it
77-
@@echo ${VER_MIN} > ${OUTPUT}/${STRUCTURE}.min.css
78-
@@java -XX:ReservedCodeCacheSize=64m \
79-
-jar build/yuicompressor-2.4.6.jar \
80-
--type css ${OUTPUT}/${STRUCTURE}.compiled.css >> ${OUTPUT}/${STRUCTURE}.min.css
81-
@@rm ${OUTPUT}/${STRUCTURE}.compiled.css
82-
# Build the theme only file
83-
@@cat LICENSE-INFO.txt | ${VER} > ${OUTPUT}/${THEME_FILENAME}.css
84-
@@cat css/themes/default/jquery.mobile.theme.css >> ${OUTPUT}/${THEME_FILENAME}.css
85-
# ..... and then minify it
86-
@@echo ${VER_MIN} > ${OUTPUT}/${THEME_FILENAME}.min.css
87-
@@java -XX:ReservedCodeCacheSize=64m \
88-
-jar build/yuicompressor-2.4.6.jar \
89-
--type css ${OUTPUT}/${THEME_FILENAME}.css >> ${OUTPUT}/${THEME_FILENAME}.min.css
90-
# Copy in the images
91-
@@cp -R css/themes/${THEME}/images ${OUTPUT}/
92-
# Css portion is complete.
93-
# -------------------------------------------------
44+
@@bash build/bin/css.sh
9445

46+
# Build and minify the JS files
47+
js: init
48+
@@bash build/bin/js.sh
9549

9650
docs: init js css
9751
# Create the Demos/Docs/Tests/Tools
@@ -119,35 +73,6 @@ docs: init js css
11973
@@rm -rf tmp
12074
# -------------------------------------------------
12175

122-
# Build and minify the JS files
123-
js: init
124-
# Build the JavaScript file
125-
${RUN_JS} \
126-
external/r.js/dist/r.js \
127-
-o baseUrl="js" \
128-
name=jquery.mobile \
129-
exclude=jquery,../external/requirejs/order,../external/requirejs/depend,../external/requirejs/text,../external/requirejs/text!../version.txt \
130-
out=${OUTPUT}/${NAME}.compiled.js \
131-
pragmasOnSave.jqmBuildExclude=true \
132-
wrap.startFile=build/wrap.start \
133-
wrap.endFile=build/wrap.end \
134-
findNestedDependencies=true \
135-
skipModuleInsertion=true \
136-
optimize=none
137-
@@cat LICENSE-INFO.txt | ${VER} > ${OUTPUT}/${NAME}.js
138-
@@cat ${OUTPUT}/${NAME}.compiled.js | ${SED_VER_API} >> ${OUTPUT}/${NAME}.js
139-
@@rm ${OUTPUT}/${NAME}.compiled.js
140-
# ..... and then minify it
141-
@@echo ${VER_MIN} > ${OUTPUT}/${NAME}.min.js
142-
@@java -XX:ReservedCodeCacheSize=64m \
143-
-jar build/google-compiler-20111003.jar \
144-
--js ${OUTPUT}/${NAME}.js \
145-
--js_output_file ${OUTPUT}/${NAME}.compiled.js
146-
@@cat ${OUTPUT}/${NAME}.compiled.js >> ${OUTPUT}/${NAME}.min.js
147-
@@rm ${OUTPUT}/${NAME}.compiled.js
148-
# -------------------------------------------------
149-
150-
15176
# Output a message saying the process is complete
15277
notify: init
15378
@@echo "The files have been built and are in: " $$(pwd)/${OUTPUT}

build/bin/config.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Helper Variables
2+
# The command to replace the @VERSION in the files with the actual version
3+
HEAD_SHA=$(git log -1 --format=format:"%H")
4+
VER='sed "s/v@VERSION/$$(git log -1 --format=format:"Git Build: SHA1: %H <> Date: %cd")/")'
5+
VER_MIN="/*! jQuery Mobile v$$(git log -1 --format=format:"Git Build: SHA1: %H <> Date: %cd") jquerymobile.com | jquery.org/license */"
6+
VER_OFFICIAL=$(cat version.txt)
7+
SED_VER_REPLACE='s/__version__/"$VER_OFFICIAL"/g'
8+
SED_INPLACE_EXT="whyunowork"
9+
10+
function sed_ver_api {
11+
sed "$SED_VER_REPLACE"
12+
}
13+
14+
function ver {
15+
sed "s/v@VERSION/$VER_OFFICIAL $HEAD_SHA/"
16+
}
17+
18+
VER_MIN="/*! jQuery Mobile v$VER_OFFICIAL $HEAD_SHA jquerymobile.com | jquery.org/license */"
19+
20+
# The output folder for the finished files
21+
OUTPUT="compiled"
22+
23+
# The name of the files
24+
NAME="jquery.mobile"
25+
BASE_NAME="jquery.mobile"
26+
THEME_FILENAME="jquery.mobile.theme"
27+
STRUCTURE="jquery.mobile.structure"
28+
29+
# The CSS theme being used
30+
THEME="default"
31+
32+
# If node is available then use node to run r.js
33+
# otherwise use good old rhino/java
34+
NODE=/usr/local/bin/node
35+
36+
RUN_JS='java -XX:ReservedCodeCacheSize=64m -classpath build/js.jar:build/google-compiler-20111003.jar org.mozilla.javascript.tools.shell.Main'
37+
38+
if [ -x $NODE ]; then
39+
RUN_JS=${NODE}
40+
fi

build/bin/css.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
source build/bin/config.sh
2+
3+
# Build the CSS file with the theme included
4+
$RUN_JS \
5+
external/r.js/dist/r.js \
6+
-o cssIn=css/themes/default/jquery.mobile.css \
7+
optimizeCss=standard.keepComments.keepLines \
8+
out=$OUTPUT/$NAME.compiled.css
9+
cat LICENSE-INFO.txt | ver > $OUTPUT/$NAME.css
10+
cat $OUTPUT/$NAME.compiled.css >> $OUTPUT/$NAME.css
11+
echo $VER_MIN > $OUTPUT/$NAME.min.css
12+
java -XX:ReservedCodeCacheSize=64m -jar build/yuicompressor-2.4.6.jar --type css $OUTPUT/$NAME.compiled.css >> $OUTPUT/$NAME.min.css
13+
rm $OUTPUT/$NAME.compiled.css
14+
# Build the CSS Structure-only file
15+
$RUN_JS external/r.js/dist/r.js \
16+
-o cssIn=css/structure/jquery.mobile.structure.css \
17+
out=$OUTPUT/$STRUCTURE.compiled.css
18+
cat LICENSE-INFO.txt | ver > $OUTPUT/$STRUCTURE.css
19+
cat $OUTPUT/$STRUCTURE.compiled.css >> $OUTPUT/$STRUCTURE.css
20+
# ..... and then minify it
21+
echo $VER_MIN > $OUTPUT/$STRUCTURE.min.css
22+
java -XX:ReservedCodeCacheSize=64m \
23+
-jar build/yuicompressor-2.4.6.jar \
24+
--type css $OUTPUT/$STRUCTURE.compiled.css >> $OUTPUT/$STRUCTURE.min.css
25+
rm $OUTPUT/$STRUCTURE.compiled.css
26+
# Build the theme only file
27+
cat LICENSE-INFO.txt | ver > $OUTPUT/$THEME_FILENAME.css
28+
cat css/themes/default/jquery.mobile.theme.css >> $OUTPUT/$THEME_FILENAME.css
29+
# ..... and then minify it
30+
echo $VER_MIN > $OUTPUT/$THEME_FILENAME.min.css
31+
java -XX:ReservedCodeCacheSize=64m \
32+
-jar build/yuicompressor-2.4.6.jar \
33+
--type css $OUTPUT/$THEME_FILENAME.css >> $OUTPUT/$THEME_FILENAME.min.css
34+
# Copy in the images
35+
cp -R css/themes/$THEME/images $OUTPUT/

build/bin/js.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
source build/bin/config.sh
2+
3+
# Build the JavaScript file
4+
$RUN_JS \
5+
external/r.js/dist/r.js \
6+
-o baseUrl="js" \
7+
name=jquery.mobile \
8+
exclude=jquery,../external/requirejs/order,../external/requirejs/depend,../external/requirejs/text,../external/requirejs/text!../version.txt \
9+
out=$OUTPUT/$NAME.compiled.js \
10+
pragmasOnSave.jqmBuildExclude=true \
11+
wrap.startFile=build/wrap.start \
12+
wrap.endFile=build/wrap.end \
13+
findNestedDependencies=true \
14+
skipModuleInsertion=true \
15+
optimize=none
16+
cat LICENSE-INFO.txt | ver > $OUTPUT/$NAME.js
17+
cat $OUTPUT/$NAME.compiled.js | sed_ver_api >> $OUTPUT/$NAME.js
18+
rm $OUTPUT/$NAME.compiled.js
19+
echo $VER_MIN > $OUTPUT/$NAME.min.js
20+
java -XX:ReservedCodeCacheSize=64m \
21+
-jar build/google-compiler-20111003.jar \
22+
--js $OUTPUT/$NAME.js \
23+
--js_output_file $OUTPUT/$NAME.compiled.js
24+
cat $OUTPUT/$NAME.compiled.js >> $OUTPUT/$NAME.min.js
25+
rm $OUTPUT/$NAME.compiled.js
26+

0 commit comments

Comments
 (0)