Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 222 lines (197 sloc) 8.955 kb
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
1 # Helper Variables
2 # The command to replace the @VERSION in the files with the actual version
27a7095 @johnbender add commit sha to deployed js and css
johnbender authored
3 HEAD_SHA = $(shell git log -1 --format=format:"%H")
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
4 VER = sed "s/v@VERSION/$$(git log -1 --format=format:"Git Build: SHA1: %H <> Date: %cd")/"
5f2c402 @eddiemonge Add the current git version to the build process when its not a stable b...
eddiemonge authored
5 VER_MIN = "/*! jQuery Mobile v$$(git log -1 --format=format:"Git Build: SHA1: %H <> Date: %cd") jquerymobile.com | jquery.org/license */"
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
6 VER_OFFICIAL = $(shell cat version.txt)
ae62a51 @johnbender set version in the non concat js files for latest tests/unit/*
johnbender authored
7 SED_VER_REPLACE = 's/__version__/"${VER_OFFICIAL}"/g'
8 SED_VER_API = sed ${SED_VER_REPLACE}
9 SED_INPLACE_EXT = "whyunowork"
27a7095 @johnbender add commit sha to deployed js and css
johnbender authored
10 deploy: VER = sed "s/v@VERSION/${VER_OFFICIAL} ${HEAD_SHA}/"
11 deploy: VER_MIN = "/*! jQuery Mobile v${VER_OFFICIAL} ${HEAD_SHA} jquerymobile.com | jquery.org/license */"
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
12
13 # The output folder for the finished files
14 OUTPUT = compiled
96c1647 @eddiemonge Changes so make can be run with just make nightly for the nightly builds
eddiemonge authored
15
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
16 # The name of the files
17 NAME = jquery.mobile
d75be94 @johnbender alter version for rc and fix the makefile for deploy
johnbender authored
18 BASE_NAME = jquery.mobile
d4a842d @gseguin Generate a jquery.mobile.theme.css for theme roller
gseguin authored
19 THEME_FILENAME = jquery.mobile.theme
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
20 STRUCTURE = jquery.mobile.structure
21 deploy: NAME = jquery.mobile-${VER_OFFICIAL}
d4a842d @gseguin Generate a jquery.mobile.theme.css for theme roller
gseguin authored
22 deploy: THEME_FILENAME = jquery.mobile.theme-${VER_OFFICIAL}
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
23 deploy: STRUCTURE = jquery.mobile.structure-${VER_OFFICIAL}
38b8ee5 @eddiemonge Changed Makefile to include nightly build script and other misc fixes
eddiemonge authored
24
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
25 # The CSS theme being used
26 THEME = default
47a45f5 @jeresig Add deploy functionality to the build script.
jeresig authored
27
9f1bb77 @gseguin If node is available then use it to run r.js otherwise use java
gseguin authored
28 # If node is available then use node to run r.js
29 # otherwise use good old rhino/java
f8ebaf8 @gseguin Revert "Changed node path from absolute to `which node`"
gseguin authored
30 NODE = /usr/local/bin/node
9f1bb77 @gseguin If node is available then use it to run r.js otherwise use java
gseguin authored
31 HAS_NODE = $(shell if test -x ${NODE} ;then echo true; fi)
32
33 ifeq ($(HAS_NODE), true)
1d7aa76 @gseguin Use the variable for node path
gseguin authored
34 RUN_JS = @@${NODE}
9f1bb77 @gseguin If node is available then use it to run r.js otherwise use java
gseguin authored
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
38b8ee5 @eddiemonge Changed Makefile to include nightly build script and other misc fixes
eddiemonge authored
38
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
39 # Build Targets
38b8ee5 @eddiemonge Changed Makefile to include nightly build script and other misc fixes
eddiemonge authored
40
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
41 # When no build target is specified, all gets ran
e7ee7fe @gseguin More house cleaning
gseguin authored
42 all: css js zip notify
38b8ee5 @eddiemonge Changed Makefile to include nightly build script and other misc fixes
eddiemonge authored
43
1afbfc4 @johnbender fix for bsd/linux sed incompat
johnbender authored
44 clean:
de92360 @gseguin House cleaning: clean target cleans, init target inits
gseguin authored
45 # -------------------------------------------------
46 # Cleaning build output
47 @@rm -rf ${OUTPUT}
48 @@rm -rf tmp
49
1afbfc4 @johnbender fix for bsd/linux sed incompat
johnbender authored
50 # Create the output directory.
e7ee7fe @gseguin More house cleaning
gseguin authored
51 init:
de92360 @gseguin House cleaning: clean target cleans, init target inits
gseguin authored
52 @@mkdir -p ${OUTPUT}
38b8ee5 @eddiemonge Changed Makefile to include nightly build script and other misc fixes
eddiemonge authored
53
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
54 # Build and minify the CSS files
55 css: init
56 # Build the CSS file with the theme included
c5dd709 @gseguin Variableized the JavaScript runner
gseguin authored
57 ${RUN_JS} \
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
58 external/r.js/dist/r.js \
a19e5dd @gseguin Changed source CSS file for css bundle following bac53cf151ac052fba2b646...
gseguin authored
59 -o cssIn=css/themes/default/jquery.mobile.css \
52fa17a @gseguin Keep comments when generating the non-optimized css file
gseguin authored
60 optimizeCss=standard.keepComments.keepLines \
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
61 out=${OUTPUT}/${NAME}.compiled.css
8c6498f @eddiemonge Fix license version and zip folder
eddiemonge authored
62 @@cat LICENSE-INFO.txt | ${VER} > ${OUTPUT}/${NAME}.css
e2606bc @gseguin Re-introduced structure CSS files
gseguin authored
63 @@cat ${OUTPUT}/${NAME}.compiled.css >> ${OUTPUT}/${NAME}.css
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
64 @@echo ${VER_MIN} > ${OUTPUT}/${NAME}.min.css
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
65 @@java -XX:ReservedCodeCacheSize=64m \
66 -jar build/yuicompressor-2.4.6.jar \
67 --type css ${OUTPUT}/${NAME}.compiled.css >> ${OUTPUT}/${NAME}.min.css
e2606bc @gseguin Re-introduced structure CSS files
gseguin authored
68 @@rm ${OUTPUT}/${NAME}.compiled.css
69 # Build the CSS Structure-only file
e42c702 @gseguin Use jquery.mobile.structure.css instead of the list all the individual
gseguin authored
70 ${RUN_JS} \
71 external/r.js/dist/r.js \
1609ea1 @gseguin Changed input file for css structure to static string: jquery.mobile.str...
gseguin authored
72 -o cssIn=css/structure/jquery.mobile.structure.css \
e42c702 @gseguin Use jquery.mobile.structure.css instead of the list all the individual
gseguin authored
73 out=${OUTPUT}/${STRUCTURE}.compiled.css
e2606bc @gseguin Re-introduced structure CSS files
gseguin authored
74 @@cat LICENSE-INFO.txt | ${VER} > ${OUTPUT}/${STRUCTURE}.css
e42c702 @gseguin Use jquery.mobile.structure.css instead of the list all the individual
gseguin authored
75 @@cat ${OUTPUT}/${STRUCTURE}.compiled.css >> ${OUTPUT}/${STRUCTURE}.css
e2606bc @gseguin Re-introduced structure CSS files
gseguin authored
76 # ..... and then minify it
77 @@echo ${VER_MIN} > ${OUTPUT}/${STRUCTURE}.min.css
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
78 @@java -XX:ReservedCodeCacheSize=64m \
79 -jar build/yuicompressor-2.4.6.jar \
e42c702 @gseguin Use jquery.mobile.structure.css instead of the list all the individual
gseguin authored
80 --type css ${OUTPUT}/${STRUCTURE}.compiled.css >> ${OUTPUT}/${STRUCTURE}.min.css
81 @@rm ${OUTPUT}/${STRUCTURE}.compiled.css
d4a842d @gseguin Generate a jquery.mobile.theme.css for theme roller
gseguin authored
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
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
91 @@cp -R css/themes/${THEME}/images ${OUTPUT}/
92 # Css portion is complete.
93 # -------------------------------------------------
94
95
bf4c4c8 @gseguin docs are not using requireJS anymore so use generated js/css resulting f...
gseguin authored
96 docs: init js css
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
97 # Create the Demos/Docs/Tests/Tools
bf4c4c8 @gseguin docs are not using requireJS anymore so use generated js/css resulting f...
gseguin authored
98 # ... Create staging directories
99 @@mkdir -p tmp/demos/js
100 @@mkdir -p tmp/demos/css/themes/${THEME}
101 # ... Copy script files
102 @@cp compiled/*.js tmp/demos/js
103 @@cp js/jquery.js tmp/demos/js
104 # ... Copy html files
105 @@cp index.html tmp/demos
106 @@cp -r docs tmp/demos
107 # ... Copy css and images
108 @@cp compiled/*.css tmp/demos/css/themes/${THEME}
109 @@cp -r compiled/images tmp/demos/css/themes/${THEME}
b8459ff @gseguin Got rid of build step for jquery.mobile.docs.js since docs don't need it...
gseguin authored
110 # ... replace "js/" with "js/jquery.mobile.js"
48e8b1d @johnbender remove the version sed, keep the defines in the lib js (not compiled) fo...
johnbender authored
111 @@ # NOTE the deletion here is required by gnu/bsd sed differences
27e6790 @johnbender correct docs css/js refs for deploy
johnbender authored
112 @@find tmp/demos \( -name '*.html' -o -name '*.php' \) -exec sed -i${SED_INPLACE_EXT} -e 's@js/"@js/${NAME}.js"@' {} \;
113 @@find tmp/demos -name "*${SED_INPLACE_EXT}" -exec rm {} \;
114 @@ # make sure the docs reference the right css file names (for deploy)
115 @@find tmp/demos \( -name '*.html' -o -name '*.php' \) -exec sed -i${SED_INPLACE_EXT} -e 's@${BASE_NAME}.css"@${NAME}.css"@' {} \;
ae62a51 @johnbender set version in the non concat js files for latest tests/unit/*
johnbender authored
116 @@find tmp/demos -name "*${SED_INPLACE_EXT}" -exec rm {} \;
366d33e @eddiemonge Update Makefile to actually work on the server
eddiemonge authored
117 # ... Move and zip up the the whole folder
2ed3203 @johnbender make sure the zip is removed - second bug from name reference changes :(
johnbender authored
118 @@rm -f ${OUTPUT}/${BASE_NAME}.docs.zip
e7ee7fe @gseguin More house cleaning
gseguin authored
119 @@cd tmp/demos && zip -rq ../../${OUTPUT}/${NAME}.docs.zip *
120 @@rm -rf ${OUTPUT}/demos && mv -f tmp/demos ${OUTPUT}
366d33e @eddiemonge Update Makefile to actually work on the server
eddiemonge authored
121 # Finish by removing the temporary files
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
122 @@rm -rf tmp
123 # -------------------------------------------------
124
125 # Build and minify the JS files
126 js: init
127 # Build the JavaScript file
c5dd709 @gseguin Variableized the JavaScript runner
gseguin authored
128 ${RUN_JS} \
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
129 external/r.js/dist/r.js \
130 -o baseUrl="js" \
6eaa86b @gseguin Upgraded RequireJS and r.js to 1.0.6
gseguin authored
131 name=jquery.mobile \
68ad57f @gseguin Exclude depend! plugin from the built bundle
gseguin authored
132 exclude=jquery,../external/requirejs/order,../external/requirejs/depend,../external/requirejs/text,../external/requirejs/text!../version.txt \
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
133 out=${OUTPUT}/${NAME}.compiled.js \
134 pragmasOnSave.jqmBuildExclude=true \
c841078 @gseguin Fixes #3429
gseguin authored
135 wrap.startFile=build/wrap.start \
136 wrap.endFile=build/wrap.end \
2ba27e0 @gseguin Fixes #3394 - jquery.mobile.init was not being included in the built bun...
gseguin authored
137 findNestedDependencies=true \
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
138 skipModuleInsertion=true \
139 optimize=none
8c6498f @eddiemonge Fix license version and zip folder
eddiemonge authored
140 @@cat LICENSE-INFO.txt | ${VER} > ${OUTPUT}/${NAME}.js
5062e56 @gseguin Fixed version string in built bundles (docs and main)
gseguin authored
141 @@cat ${OUTPUT}/${NAME}.compiled.js | ${SED_VER_API} >> ${OUTPUT}/${NAME}.js
c8d88a2 @gseguin Renamed .tmp temp file to .compiled
gseguin authored
142 @@rm ${OUTPUT}/${NAME}.compiled.js
08b8955 @gseguin Use original r.js, externalized stripping of define/require to amd-strip...
gseguin authored
143 # ..... and then minify it
ca6fe9b @gseguin Changed js and css targets to use r.js and r-jqm.js
gseguin authored
144 @@echo ${VER_MIN} > ${OUTPUT}/${NAME}.min.js
08b8955 @gseguin Use original r.js, externalized stripping of define/require to amd-strip...
gseguin authored
145 @@java -XX:ReservedCodeCacheSize=64m \
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
146 -jar build/google-compiler-20111003.jar \
147 --js ${OUTPUT}/${NAME}.js \
148 --js_output_file ${OUTPUT}/${NAME}.compiled.js
c8d88a2 @gseguin Renamed .tmp temp file to .compiled
gseguin authored
149 @@cat ${OUTPUT}/${NAME}.compiled.js >> ${OUTPUT}/${NAME}.min.js
150 @@rm ${OUTPUT}/${NAME}.compiled.js
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
151 # -------------------------------------------------
152
153
154 # Output a message saying the process is complete
155 notify: init
156 @@echo "The files have been built and are in: " $$(pwd)/${OUTPUT}
157 # -------------------------------------------------
e2fa299 @jeresig Adjust sub-directory URLs before deploying the demos.
jeresig authored
158
159
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
160 # Zip up the jQm files without docs
45b71e1 @johnbender Makefile whitespace
johnbender authored
161 zip: init css js
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
162 # Packaging up the files into a zip archive
0d283cb @eddiemonge combine the css structure min and license files
eddiemonge authored
163 @@mkdir tmp
45b71e1 @johnbender Makefile whitespace
johnbender authored
164 @@cp -R ${OUTPUT} tmp/${NAME}
5acc18a @eddiemonge Add images to the docs, fix cp syntax, rearrange build dependencies to b...
eddiemonge authored
165 # ... And remove the Zipped docs so they aren't included twice (for deploy scripts)
68fc0d8 @johnbender address non docs zip build size issues
johnbender authored
166 @@rm -rf tmp/${NAME}/*.zip
8c6498f @eddiemonge Fix license version and zip folder
eddiemonge authored
167 @@cd tmp; zip -rq ../${OUTPUT}/${NAME}.zip ${NAME}
0d283cb @eddiemonge combine the css structure min and license files
eddiemonge authored
168 @@rm -rf tmp
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
169 # -------------------------------------------------
19c952a @eddiemonge For all versions of make except for deploy, the outputted scripts will h...
eddiemonge authored
170
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
171 # -------------------------------------------------
172 # -------------------------------------------------
173 # -------------------------------------------------
174 #
175 # For jQuery Team Use Only
176 #
177 # -------------------------------------------------
e7ee7fe @gseguin More house cleaning
gseguin authored
178 # NOTE the clean (which removes previous build output) has been removed to prevent a gap in service
84f6085 @johnbender remove init from latest build target
johnbender authored
179 build_latest: css docs js zip
23ee411 @johnbender less clever is more better
johnbender authored
180 # ... Copy over the lib js, avoid the compiled stuff, to get the defines for tests/unit/*
181 @@ # TODO centralize list of built files
182 @@find js -name "*.js" -not -name "*.docs.js" -not -name "*.mobile.js" | xargs -L1 -I FILENAME cp FILENAME ${OUTPUT}/demos/js/
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
183
48e8b1d @johnbender remove the version sed, keep the defines in the lib js (not compiled) fo...
johnbender authored
184 # Push the latest git version to the CDN. This is done on a post commit hook
0b858d2 @johnbender split up latest build and deploy
johnbender authored
185 deploy_latest:
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
186 # Time to put these on the CDN
4a1f4f8 @eddiemonge Add quiet option to scp
eddiemonge authored
187 @@scp -qr ${OUTPUT}/* jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/mobile/latest/
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
188 # -------------------------------------------------
189
0b858d2 @johnbender split up latest build and deploy
johnbender authored
190 # TODO target name preserved to avoid issues during refactor, latest -> deploy_latest
191 latest: build_latest deploy_latest
192
9dcc864 @johnbender push the latest build output as nightlies
johnbender authored
193 # Push the nightly backups. This is done on a server cronjob
194 deploy_nightlies:
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
195 # Time to put these on the CDN
9dcc864 @johnbender push the latest build output as nightlies
johnbender authored
196 @@scp -qr ${OUTPUT} jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/mobile/nightlies/$$(date "+%Y%m%d")
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
197 # -------------------------------------------------
198
199 # Deploy a finished release. This is manually done.
bc4b666 @johnbender bringing stable makefile up to date with master
johnbender authored
200 deploy: clean init css js docs zip
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
201 # Deploying all the files to the CDN
202 @@mkdir tmp
5acc18a @eddiemonge Add images to the docs, fix cp syntax, rearrange build dependencies to b...
eddiemonge authored
203 @@cp -R ${OUTPUT} tmp/${VER_OFFICIAL}
4a1f4f8 @eddiemonge Add quiet option to scp
eddiemonge authored
204 @@scp -qr tmp/* jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/mobile/
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
205 @@rm -rf tmp/${VER_OFFICIAL}
206 @@mv ${OUTPUT}/demos tmp/${VER_OFFICIAL}
4a1f4f8 @eddiemonge Add quiet option to scp
eddiemonge authored
207 # Create the Demos/Docs/Tests/Tools for jQueryMobile.com
ecf0b97 @eddiemonge Update the deployed files to use the CDN for the resources
eddiemonge authored
208 # ... By first replacing the paths
48e8b1d @johnbender remove the version sed, keep the defines in the lib js (not compiled) fo...
johnbender authored
209 @@ # TODO update jQuery Version replacement on deploy
ecf0b97 @eddiemonge Update the deployed files to use the CDN for the resources
eddiemonge authored
210 @@find tmp/${VER_OFFICIAL} -type f \
211 \( -name '*.html' -o -name '*.php' \) \
212 -exec perl -pi -e \
7fe46f0 @johnbender fixing up after changes to the docs target
johnbender authored
213 's|src="(.*)${BASE_NAME}.js"|src="//code.jquery.com/mobile/${VER_OFFICIAL}/${NAME}.min.js"|g;s|href="(.*)${BASE_NAME}.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' {} \;
ecf0b97 @eddiemonge Update the deployed files to use the CDN for the resources
eddiemonge authored
214 # ... So they can be copied to jquerymobile.com
45b71e1 @johnbender Makefile whitespace
johnbender authored
215 @@scp -qr tmp/* jqadmin@jquerymobile.com:/srv/jquerymobile.com/htdocs/demos/
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-frie...
eddiemonge authored
216 # Do some cleanup to wrap it up
217 @@rm -rf tmp
218 @@rm -rf ${OUTPUT}
219 # -------------------------------------------------
220
0d283cb @eddiemonge combine the css structure min and license files
eddiemonge authored
221
Something went wrong with that request. Please try again.