2011-11-09 09:39:25 +00:00
|
|
|
# Helper Variables
|
|
|
|
|
# The command to replace the @VERSION in the files with the actual version
|
|
|
|
|
VER = sed "s/v@VERSION/$$(git log -1 --format=format:"Git Build: SHA1: %H <> Date: %cd")/"
|
2011-11-17 23:53:32 +00:00
|
|
|
VER_MIN = "/*! jQuery Mobile v$$(git log -1 --format=format:"Git Build: SHA1: %H <> Date: %cd") jquerymobile.com | jquery.org/license */"
|
2011-11-09 09:39:25 +00:00
|
|
|
VER_OFFICIAL = $(shell cat version.txt)
|
2012-01-26 00:52:16 +00:00
|
|
|
SED_VER_API = sed 's/__version__/"${VER_OFFICIAL}"/g'
|
2011-11-17 19:47:03 +00:00
|
|
|
deploy: VER = sed "s/v@VERSION/${VER_OFFICIAL}/"
|
2011-11-17 23:53:32 +00:00
|
|
|
deploy: VER_MIN = "/*! jQuery Mobile v${VER_OFFICIAL} jquerymobile.com | jquery.org/license */"
|
2011-11-09 09:39:25 +00:00
|
|
|
|
|
|
|
|
# The output folder for the finished files
|
|
|
|
|
OUTPUT = compiled
|
2011-04-12 01:18:19 +00:00
|
|
|
|
2011-11-09 09:39:25 +00:00
|
|
|
# The name of the files
|
|
|
|
|
NAME = jquery.mobile
|
|
|
|
|
STRUCTURE = jquery.mobile.structure
|
|
|
|
|
deploy: NAME = jquery.mobile-${VER_OFFICIAL}
|
|
|
|
|
deploy: STRUCTURE = jquery.mobile.structure-${VER_OFFICIAL}
|
2011-04-11 22:57:02 +00:00
|
|
|
|
2011-11-09 09:39:25 +00:00
|
|
|
# The CSS theme being used
|
|
|
|
|
THEME = default
|
2010-10-15 19:33:57 +00:00
|
|
|
|
2012-01-26 00:34:35 +00:00
|
|
|
RUN_JS = @@java -XX:ReservedCodeCacheSize=64m -classpath build/js.jar:build/google-compiler-20111003.jar org.mozilla.javascript.tools.shell.Main
|
2011-04-11 22:57:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-09 09:39:25 +00:00
|
|
|
# Build Targets
|
2011-04-11 22:57:02 +00:00
|
|
|
|
2011-11-09 09:39:25 +00:00
|
|
|
# When no build target is specified, all gets ran
|
|
|
|
|
all: init css js zip notify
|
2011-04-11 22:57:02 +00:00
|
|
|
|
|
|
|
|
|
2011-11-09 09:39:25 +00:00
|
|
|
# Build and minify the CSS files
|
|
|
|
|
css: init
|
|
|
|
|
# Build the CSS file with the theme included
|
2012-01-21 06:04:40 +00:00
|
|
|
${RUN_JS} \
|
2012-01-05 19:55:34 +00:00
|
|
|
external/r.js/dist/r.js \
|
2012-01-10 21:50:58 +00:00
|
|
|
-o cssIn=css/themes/default/jquery.mobile.css \
|
2012-01-05 19:55:34 +00:00
|
|
|
out=${OUTPUT}/${NAME}.compiled.css
|
2011-11-17 19:47:03 +00:00
|
|
|
@@cat LICENSE-INFO.txt | ${VER} > ${OUTPUT}/${NAME}.css
|
2011-12-08 22:22:23 +00:00
|
|
|
@@cat ${OUTPUT}/${NAME}.compiled.css >> ${OUTPUT}/${NAME}.css
|
2011-11-09 09:39:25 +00:00
|
|
|
@@echo ${VER_MIN} > ${OUTPUT}/${NAME}.min.css
|
2012-01-05 19:55:34 +00:00
|
|
|
@@java -XX:ReservedCodeCacheSize=64m \
|
|
|
|
|
-jar build/yuicompressor-2.4.6.jar \
|
|
|
|
|
--type css ${OUTPUT}/${NAME}.compiled.css >> ${OUTPUT}/${NAME}.min.css
|
2011-12-08 22:22:23 +00:00
|
|
|
@@rm ${OUTPUT}/${NAME}.compiled.css
|
|
|
|
|
# Build the CSS Structure-only file
|
2012-01-21 07:03:39 +00:00
|
|
|
${RUN_JS} \
|
|
|
|
|
external/r.js/dist/r.js \
|
2012-01-23 19:04:12 +00:00
|
|
|
-o cssIn=css/structure/jquery.mobile.structure.css \
|
2012-01-21 07:03:39 +00:00
|
|
|
out=${OUTPUT}/${STRUCTURE}.compiled.css
|
2011-12-08 22:22:23 +00:00
|
|
|
@@cat LICENSE-INFO.txt | ${VER} > ${OUTPUT}/${STRUCTURE}.css
|
2012-01-21 07:03:39 +00:00
|
|
|
@@cat ${OUTPUT}/${STRUCTURE}.compiled.css >> ${OUTPUT}/${STRUCTURE}.css
|
2011-12-08 22:22:23 +00:00
|
|
|
# ..... and then minify it
|
|
|
|
|
@@echo ${VER_MIN} > ${OUTPUT}/${STRUCTURE}.min.css
|
2012-01-05 19:55:34 +00:00
|
|
|
@@java -XX:ReservedCodeCacheSize=64m \
|
|
|
|
|
-jar build/yuicompressor-2.4.6.jar \
|
2012-01-21 07:03:39 +00:00
|
|
|
--type css ${OUTPUT}/${STRUCTURE}.compiled.css >> ${OUTPUT}/${STRUCTURE}.min.css
|
|
|
|
|
@@rm ${OUTPUT}/${STRUCTURE}.compiled.css
|
2011-11-09 09:39:25 +00:00
|
|
|
# ..... and then copy in the images
|
|
|
|
|
@@cp -R css/themes/${THEME}/images ${OUTPUT}/
|
|
|
|
|
# Css portion is complete.
|
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
2012-01-12 23:32:20 +00:00
|
|
|
docs: init
|
2011-11-09 09:39:25 +00:00
|
|
|
# Create the Demos/Docs/Tests/Tools
|
2012-01-12 23:32:20 +00:00
|
|
|
# ... Build the docs bundle
|
2012-01-21 06:04:40 +00:00
|
|
|
${RUN_JS} \
|
2012-01-12 23:32:20 +00:00
|
|
|
external/r.js/dist/r.js \
|
|
|
|
|
-o build/docs.build.js \
|
|
|
|
|
dir=../tmp/${NAME}
|
2012-01-13 00:57:35 +00:00
|
|
|
# ... Prepend versioned license
|
|
|
|
|
@@cat LICENSE-INFO.txt | ${VER} > tmp/${NAME}/LICENSE-INFO.txt
|
|
|
|
|
@@cat tmp/${NAME}/LICENSE-INFO.txt | cat - tmp/${NAME}/js/jquery.mobile.docs.js > tmp/${NAME}/js/jquery.mobile.docs.js.tmp
|
2012-01-26 00:52:16 +00:00
|
|
|
@@cat tmp/${NAME}/js/jquery.mobile.docs.js.tmp | ${SED_VER_API} > tmp/${NAME}/js/jquery.mobile.docs.js
|
2012-01-13 00:57:35 +00:00
|
|
|
@@cat tmp/${NAME}/LICENSE-INFO.txt | cat - tmp/${NAME}/css/themes/default/${NAME}.css > tmp/${NAME}/css/themes/default/${NAME}.css.tmp
|
|
|
|
|
@@mv tmp/${NAME}/css/themes/default/${NAME}.css.tmp tmp/${NAME}/css/themes/default/${NAME}.css
|
2011-11-10 01:43:37 +00:00
|
|
|
# ... Move and zip up the the whole folder
|
2011-11-17 19:47:03 +00:00
|
|
|
@@cd tmp; zip -rq ../${OUTPUT}/${NAME}.docs.zip ${NAME}
|
2011-11-10 01:57:50 +00:00
|
|
|
@@mv tmp/${NAME} ${OUTPUT}/demos
|
2011-11-10 01:43:37 +00:00
|
|
|
# Finish by removing the temporary files
|
2011-11-09 09:39:25 +00:00
|
|
|
@@rm -rf tmp
|
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
2011-04-12 19:00:05 +00:00
|
|
|
|
2011-11-09 09:39:25 +00:00
|
|
|
# Create the output directory. This is in a separate step so its not dependant on other targets
|
|
|
|
|
init:
|
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
# Building jQuery Mobile in the "${OUTPUT}" folder
|
2011-04-13 17:47:21 +00:00
|
|
|
@@rm -rf ${OUTPUT}
|
2011-11-09 09:39:25 +00:00
|
|
|
@@rm -rf tmp
|
|
|
|
|
@@mkdir -p ${OUTPUT}
|
|
|
|
|
# -------------------------------------------------
|
2011-04-11 22:57:02 +00:00
|
|
|
|
2010-10-15 20:49:40 +00:00
|
|
|
|
2011-11-09 09:39:25 +00:00
|
|
|
# Build and minify the JS files
|
|
|
|
|
js: init
|
|
|
|
|
# Build the JavaScript file
|
2012-01-21 06:04:40 +00:00
|
|
|
${RUN_JS} \
|
2012-01-05 19:55:34 +00:00
|
|
|
external/r.js/dist/r.js \
|
|
|
|
|
-o baseUrl="js" \
|
2012-01-25 23:20:44 +00:00
|
|
|
include=jquery.mobile \
|
2012-01-28 07:36:42 +00:00
|
|
|
exclude=jquery,../external/requirejs/order,../external/requirejs/text,../external/requirejs/text!../version.txt \
|
2012-01-05 19:55:34 +00:00
|
|
|
out=${OUTPUT}/${NAME}.compiled.js \
|
|
|
|
|
pragmasOnSave.jqmBuildExclude=true \
|
2012-01-13 16:12:35 +00:00
|
|
|
wrap.startFile=build/wrap.start \
|
|
|
|
|
wrap.endFile=build/wrap.end \
|
2012-01-09 19:01:07 +00:00
|
|
|
findNestedDependencies=true \
|
2012-01-05 19:55:34 +00:00
|
|
|
skipModuleInsertion=true \
|
|
|
|
|
optimize=none
|
2011-11-17 19:47:03 +00:00
|
|
|
@@cat LICENSE-INFO.txt | ${VER} > ${OUTPUT}/${NAME}.js
|
2012-01-26 00:52:16 +00:00
|
|
|
@@cat ${OUTPUT}/${NAME}.compiled.js | ${SED_VER_API} >> ${OUTPUT}/${NAME}.js
|
2011-12-25 04:06:54 +00:00
|
|
|
@@rm ${OUTPUT}/${NAME}.compiled.js
|
2011-12-14 23:08:25 +00:00
|
|
|
# ..... and then minify it
|
2011-12-08 21:48:39 +00:00
|
|
|
@@echo ${VER_MIN} > ${OUTPUT}/${NAME}.min.js
|
2011-12-14 23:08:25 +00:00
|
|
|
@@java -XX:ReservedCodeCacheSize=64m \
|
2012-01-05 19:55:34 +00:00
|
|
|
-jar build/google-compiler-20111003.jar \
|
|
|
|
|
--js ${OUTPUT}/${NAME}.js \
|
|
|
|
|
--js_output_file ${OUTPUT}/${NAME}.compiled.js
|
2011-12-25 04:06:54 +00:00
|
|
|
@@cat ${OUTPUT}/${NAME}.compiled.js >> ${OUTPUT}/${NAME}.min.js
|
|
|
|
|
@@rm ${OUTPUT}/${NAME}.compiled.js
|
2011-11-09 09:39:25 +00:00
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Output a message saying the process is complete
|
|
|
|
|
notify: init
|
|
|
|
|
@@echo "The files have been built and are in: " $$(pwd)/${OUTPUT}
|
|
|
|
|
# -------------------------------------------------
|
2010-10-15 22:00:49 +00:00
|
|
|
|
|
|
|
|
|
2011-11-09 09:39:25 +00:00
|
|
|
# Zip up the jQm files without docs
|
2012-01-26 20:37:56 +00:00
|
|
|
zip: init css js
|
2011-11-09 09:39:25 +00:00
|
|
|
# Packaging up the files into a zip archive
|
2011-11-15 17:04:16 +00:00
|
|
|
@@mkdir tmp
|
2012-01-26 20:37:56 +00:00
|
|
|
@@cp -R ${OUTPUT} tmp/${NAME}
|
2011-11-19 03:01:04 +00:00
|
|
|
# ... And remove the Zipped docs so they aren't included twice (for deploy scripts)
|
2012-01-26 20:37:56 +00:00
|
|
|
@@rm -rf tmp/${NAME}/${NAME}.docs.zip
|
2011-11-17 19:47:03 +00:00
|
|
|
@@cd tmp; zip -rq ../${OUTPUT}/${NAME}.zip ${NAME}
|
2011-11-15 17:04:16 +00:00
|
|
|
@@rm -rf tmp
|
2011-11-09 09:39:25 +00:00
|
|
|
# -------------------------------------------------
|
2011-05-13 23:01:31 +00:00
|
|
|
|
2011-11-09 09:39:25 +00:00
|
|
|
# -------------------------------------------------
|
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# For jQuery Team Use Only
|
|
|
|
|
#
|
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Push the latest git version to the CDN. This is done on a post commit hook
|
2012-01-12 22:19:31 +00:00
|
|
|
latest: init css docs js zip
|
2011-11-09 09:39:25 +00:00
|
|
|
# Time to put these on the CDN
|
2011-11-17 01:35:25 +00:00
|
|
|
@@scp -qr ${OUTPUT}/* jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/mobile/latest/
|
2011-11-09 09:39:25 +00:00
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Build the nightly backups. This is done on a server cronjob
|
2012-01-26 20:37:56 +00:00
|
|
|
nightlies: init css js docs zip
|
2011-11-09 09:39:25 +00:00
|
|
|
# Time to put these on the CDN
|
|
|
|
|
@@mkdir -p tmp/nightlies
|
|
|
|
|
@@mv ${OUTPUT} tmp/nightlies/$$(date "+%Y%m%d")
|
2011-11-17 01:35:25 +00:00
|
|
|
@@scp -qr tmp/nightlies/* jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/mobile/nightlies/
|
2011-11-09 09:39:25 +00:00
|
|
|
# Do some cleanup to wrap it up
|
|
|
|
|
@@rm -rf tmp
|
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Deploy a finished release. This is manually done.
|
2011-11-19 03:01:04 +00:00
|
|
|
deploy: init css js docs zip
|
2011-11-09 09:39:25 +00:00
|
|
|
# Deploying all the files to the CDN
|
|
|
|
|
@@mkdir tmp
|
2011-11-19 03:01:04 +00:00
|
|
|
@@cp -R ${OUTPUT} tmp/${VER_OFFICIAL}
|
2011-11-17 01:35:25 +00:00
|
|
|
@@scp -qr tmp/* jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/mobile/
|
2011-11-09 09:39:25 +00:00
|
|
|
@@rm -rf tmp/${VER_OFFICIAL}
|
|
|
|
|
@@mv ${OUTPUT}/demos tmp/${VER_OFFICIAL}
|
2011-11-17 01:35:25 +00:00
|
|
|
# Create the Demos/Docs/Tests/Tools for jQueryMobile.com
|
2011-11-17 01:04:22 +00:00
|
|
|
# ... By first replacing the paths
|
2012-01-26 16:20:16 +00:00
|
|
|
# TODO update jQuery Version replacement on deploy
|
2011-11-17 01:04:22 +00:00
|
|
|
@@find tmp/${VER_OFFICIAL} -type f \
|
|
|
|
|
\( -name '*.html' -o -name '*.php' \) \
|
|
|
|
|
-exec perl -pi -e \
|
2012-01-26 20:47:01 +00:00
|
|
|
's|src="(.*)${NAME}.min.js"|src="//code.jquery.com/mobile/${VER_OFFICIAL}/${NAME}.min.js"|g;s|href="(.*)${NAME}.min.css"|href="//code.jquery.com/mobile/${VER_OFFICIAL}/${NAME}.min.css"|g;s|src="(.*)jquery.js"|src="//code.jquery.com/jquery-1.7.1.min.js"|g' {} \;
|
2011-11-17 01:04:22 +00:00
|
|
|
# ... So they can be copied to jquerymobile.com
|
2012-01-26 20:37:56 +00:00
|
|
|
@@scp -qr tmp/* jqadmin@jquerymobile.com:/srv/jquerymobile.com/htdocs/demos/
|
2011-11-09 09:39:25 +00:00
|
|
|
# Do some cleanup to wrap it up
|
|
|
|
|
@@rm -rf tmp
|
|
|
|
|
@@rm -rf ${OUTPUT}
|
|
|
|
|
# -------------------------------------------------
|
|
|
|
|
|
2011-11-15 17:04:16 +00:00
|
|
|
|