Skip to content

Commit

Permalink
Changes so make can be run with just make nightly for the nightly builds
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiemonge committed Apr 12, 2011
1 parent 38b8ee5 commit 96c1647
Showing 1 changed file with 44 additions and 21 deletions.
65 changes: 44 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# The system generated date in YYYYMMDD format
DATE = $(shell date "+%Y%m%d")

# The version according to the source file
# To use for the nightly build, pass in VER=nightly-$(date "+%Y%m%d") to the make file
# The version according to the source file. If this is the nightly build, use a different version
VER = $(shell cat version.txt)
nightly: VER = nightly

# The command to replace the @VERSION in the files with the actual version
SED_VER = sed "s/@VERSION/${VER}/"
nightly: SED_VER = sed "s/@VERSION/Nightly-${DATE}/"

# The version of jQuery core used
JQUERY = 1.5.2

# The directory to create the zipped files in and also serves as the filenames
DIR = jquery.mobile-${VER}
OUTPUT = dist
MAX = ${DIR}.js

# The output folder for the finished files
OUTPUT = compiled

# The filenames
JS = ${DIR}.js
MIN = ${DIR}.min.js
CSS = ${DIR}.css
CSSMIN = ${DIR}.min.css

FILES = js/jquery.ui.widget.js \
# The files to include when compiling the JS files
JSFILES = js/jquery.ui.widget.js \
js/jquery.mobile.widget.js \
js/jquery.mobile.media.js \
js/jquery.mobile.support.js \
Expand All @@ -42,6 +52,7 @@ FILES = js/jquery.ui.widget.js \
js/jquery.mobile.grid.js \
js/jquery.mobile.init.js

# The files to include when compiling the CSS files
CSSFILES = themes/default/jquery.mobile.theme.css \
themes/default/jquery.mobile.core.css \
themes/default/jquery.mobile.transitions.css \
Expand All @@ -59,50 +70,62 @@ CSSFILES = themes/default/jquery.mobile.theme.css \
themes/default/jquery.mobile.listview.css \
themes/default/jquery.mobile.forms.slider.css

all: init mobile min css cssmin
# By default, this is what get runs when make is called without any arguments.
# Min and un-min CSS and JS files are the only things built
all: init js min css cssmin notify

# Build the normal CSS file.
css: init
@@head -8 js/jquery.mobile.core.js | ${SED_VER} > ${OUTPUT}/${CSS}
@@cat ${CSSFILES} >> ${OUTPUT}/${CSS}

# Build the minified CSS file
cssmin: init css
@@head -8 js/jquery.mobile.core.js | ${SED_VER} > ${OUTPUT}/${CSSMIN}
@@java -jar build/yuicompressor-2.4.4.jar --type css ${OUTPUT}/${CSS} >> ${OUTPUT}/${CSSMIN}

mobile: init
@@head -8 js/jquery.mobile.core.js | ${SED_VER} > ${OUTPUT}/${MAX}
@@cat ${FILES} >> ${OUTPUT}/${MAX}
# Build the normal JS file
js: init
@@head -8 js/jquery.mobile.core.js | ${SED_VER} > ${OUTPUT}/${JS}
@@cat ${JSFILES} >> ${OUTPUT}/${JS}

min: init mobile
# Build the minified JS file
min: init js
@@head -8 js/jquery.mobile.core.js | ${SED_VER} > ${OUTPUT}/${MIN}
@@java -jar build/google-compiler-20100917.jar --js ${OUTPUT}/${MAX} --warning_level QUIET --js_output_file ${MIN}.tmp
@@java -jar build/google-compiler-20100917.jar --js ${OUTPUT}/${JS} --warning_level QUIET --js_output_file ${MIN}.tmp
@@cat ${MIN}.tmp >> ${OUTPUT}/${MIN}
@@rm -f ${MIN}.tmp

# Let the user know the files were built and where they are
notify:
@@echo "The files have been built and are in " $$(pwd)/${OUTPUT}

# Create the output directory. This is in a separate step so its not dependant on other targets
init:
@@rm -rf ${OUTPUT}
@@mkdir ${OUTPUT}

# Pull the latest commits. This is used for the nightly build but can be used to save some keystrokes
pull:
# Pull in the latest commits
@@git pull upstream master
@@git pull --quiet upstream master

zip: init mobile min css cssmin
# Zip up the files into an easily downloadable pacakge
# Zip the 4 files and the theme images into one convenient package
zip: init js min css cssmin
@@rm -rf ${DIR}
@@mkdir -p ${DIR}
@@cp ${OUTPUT}/${DIR}*.js ${DIR}/
@@cp ${OUTPUT}/${DIR}*.css ${DIR}/
@@cp -R themes/default/images ${DIR}/
@@zip -r ${OUTPUT}/${DIR}.zip ${DIR}
@@zip -rq ${OUTPUT}/${DIR}.zip ${DIR}
@@rm -fr ${DIR}


# Used by the jQuery team to make the nightly builds
nightly: pull zip
# Create a log that lists the current vrsion according to the code and the git information for the last commit
@@echo "Git Release Version: " >> ${OUTPUT}/log.txt
# Create a log that lists the current version according to the code and the git information for the last commit
@@echo $$"\nGit Release Version: " >> ${OUTPUT}/log.txt
@@cat version.txt >> ${OUTPUT}/log.txt
@@echo "Git Information for this build:" >> ${OUTPUT}/log.txt
@@echo $$"\nGit Information for this build:" >> ${OUTPUT}/log.txt
@@git log -1 --format=format:"SHA1: %H %nDate: %cd %nTitle: %s" >> ${OUTPUT}/log.txt

# Create the folder to hold the files for the demos
Expand All @@ -124,7 +147,7 @@ nightly: pull zip

# Change the empty paths to the location of this nightly file
@@find ${VER} -type f -name '*.html' -exec sed -i 's|href="themes/default/"|href="http://jquerymobile.com/nightlies/${DATE}/${DIR}.min.css"|g' {} \;
@@find ${VER} -type f -name '*.html' -exec sed -i 's|src="js/jquery.js"|src="http://code.jquery.com/jquery-1.5.min.js"|' {} \;
@@find ${VER} -type f -name '*.html' -exec sed -i 's|src="js/jquery.js"|src="http://code.jquery.com/jquery-${JQUERY}.min.js"|' {} \;
@@find ${VER} -type f -name '*.html' -exec sed -i 's|src="js/"|src="http://jquerymobile.com/nightlies/${DATE}/${DIR}.min.js"|g' {} \;

# Move the demos into the output folder
Expand Down Expand Up @@ -156,7 +179,7 @@ deploy: zip
@@find ${VER} -type f -name '*.html' -exec sed -i "" -e 's|rel="stylesheet" href="../|rel="stylesheet" href="|g' {} \;

@@find ${VER} -type f -name '*.html' -exec sed -i "" -e 's|href="themes/default/"|href="http://code.jquery.com/mobile/${VER}/${DIR}.min.css"|g' {} \;
@@find ${VER} -type f -name '*.html' -exec sed -i "" -e 's|src="js/jquery.js"|src="http://code.jquery.com/jquery-1.5.min.js"|' {} \;
@@find ${VER} -type f -name '*.html' -exec sed -i "" -e 's|src="js/jquery.js"|src="http://code.jquery.com/jquery-${JQUERY}.min.js"|' {} \;
@@find ${VER} -type f -name '*.html' -exec sed -i "" -e 's|src="js/"|src="http://code.jquery.com/mobile/${VER}/${DIR}.min.js"|g' {} \;

@@scp -r ${VER} [email protected]:/srv/jquerymobile.com/htdocs/demos/

0 comments on commit 96c1647

Please sign in to comment.