Skip to content
Newer
Older
100644 219 lines (194 sloc) 8.47 KB
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
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-f…
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 stabl…
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-f…
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-f…
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-f…
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-f…
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-f…
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-f…
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-f…
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-f…
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-f…
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 bac53cf
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-f…
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.…
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-f…
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 resultin…
gseguin authored
96 docs: init js css
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
eddiemonge authored
97 # Create the Demos/Docs/Tests/Tools
bf4c4c8 @gseguin docs are not using requireJS anymore so use generated js/css resultin…
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…
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)…
johnbender authored
111 @@ # NOTE the deletion here is required by gnu/bsd sed differences
b8459ff @gseguin Got rid of build step for jquery.mobile.docs.js since docs don't need…
gseguin authored
112 @@find tmp/demos -name "*.html" -exec sed -i${SED_INPLACE_EXT} -e 's@js/"@js/jquery.mobile.js"@' {} \;
ae62a51 @johnbender set version in the non concat js files for latest tests/unit/*
johnbender authored
113 @@find tmp/demos -name "*${SED_INPLACE_EXT}" -exec rm {} \;
366d33e @eddiemonge Update Makefile to actually work on the server
eddiemonge authored
114 # ... Move and zip up the the whole folder
e7ee7fe @gseguin More house cleaning
gseguin authored
115 @@rm -f ${OUTPUT}/${NAME}.docs.zip
116 @@cd tmp/demos && zip -rq ../../${OUTPUT}/${NAME}.docs.zip *
117 @@rm -rf ${OUTPUT}/demos && mv -f tmp/demos ${OUTPUT}
366d33e @eddiemonge Update Makefile to actually work on the server
eddiemonge authored
118 # Finish by removing the temporary files
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
eddiemonge authored
119 @@rm -rf tmp
120 # -------------------------------------------------
121
122 # Build and minify the JS files
123 js: init
124 # Build the JavaScript file
c5dd709 @gseguin Variableized the JavaScript runner
gseguin authored
125 ${RUN_JS} \
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
126 external/r.js/dist/r.js \
127 -o baseUrl="js" \
6eaa86b @gseguin Upgraded RequireJS and r.js to 1.0.6
gseguin authored
128 name=jquery.mobile \
68ad57f @gseguin Exclude depend! plugin from the built bundle
gseguin authored
129 exclude=jquery,../external/requirejs/order,../external/requirejs/depend,../external/requirejs/text,../external/requirejs/text!../version.txt \
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
130 out=${OUTPUT}/${NAME}.compiled.js \
131 pragmasOnSave.jqmBuildExclude=true \
c841078 @gseguin Fixes #3429
gseguin authored
132 wrap.startFile=build/wrap.start \
133 wrap.endFile=build/wrap.end \
2ba27e0 @gseguin Fixes #3394 - jquery.mobile.init was not being included in the built …
gseguin authored
134 findNestedDependencies=true \
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
135 skipModuleInsertion=true \
136 optimize=none
8c6498f @eddiemonge Fix license version and zip folder
eddiemonge authored
137 @@cat LICENSE-INFO.txt | ${VER} > ${OUTPUT}/${NAME}.js
5062e56 @gseguin Fixed version string in built bundles (docs and main)
gseguin authored
138 @@cat ${OUTPUT}/${NAME}.compiled.js | ${SED_VER_API} >> ${OUTPUT}/${NAME}.js
c8d88a2 @gseguin Renamed .tmp temp file to .compiled
gseguin authored
139 @@rm ${OUTPUT}/${NAME}.compiled.js
08b8955 @gseguin Use original r.js, externalized stripping of define/require to amd-st…
gseguin authored
140 # ..... and then minify it
ca6fe9b @gseguin Changed js and css targets to use r.js and r-jqm.js
gseguin authored
141 @@echo ${VER_MIN} > ${OUTPUT}/${NAME}.min.js
08b8955 @gseguin Use original r.js, externalized stripping of define/require to amd-st…
gseguin authored
142 @@java -XX:ReservedCodeCacheSize=64m \
23b2d7f @eddiemonge increase java cache size
eddiemonge authored
143 -jar build/google-compiler-20111003.jar \
144 --js ${OUTPUT}/${NAME}.js \
145 --js_output_file ${OUTPUT}/${NAME}.compiled.js
c8d88a2 @gseguin Renamed .tmp temp file to .compiled
gseguin authored
146 @@cat ${OUTPUT}/${NAME}.compiled.js >> ${OUTPUT}/${NAME}.min.js
147 @@rm ${OUTPUT}/${NAME}.compiled.js
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
eddiemonge authored
148 # -------------------------------------------------
149
150
151 # Output a message saying the process is complete
152 notify: init
153 @@echo "The files have been built and are in: " $$(pwd)/${OUTPUT}
154 # -------------------------------------------------
e2fa299 @jeresig Adjust sub-directory URLs before deploying the demos.
jeresig authored
155
156
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
eddiemonge authored
157 # Zip up the jQm files without docs
45b71e1 @johnbender Makefile whitespace
johnbender authored
158 zip: init css js
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
eddiemonge authored
159 # Packaging up the files into a zip archive
0d283cb @eddiemonge combine the css structure min and license files
eddiemonge authored
160 @@mkdir tmp
45b71e1 @johnbender Makefile whitespace
johnbender authored
161 @@cp -R ${OUTPUT} tmp/${NAME}
5acc18a @eddiemonge Add images to the docs, fix cp syntax, rearrange build dependencies t…
eddiemonge authored
162 # ... And remove the Zipped docs so they aren't included twice (for deploy scripts)
45b71e1 @johnbender Makefile whitespace
johnbender authored
163 @@rm -rf tmp/${NAME}/${NAME}.docs.zip
8c6498f @eddiemonge Fix license version and zip folder
eddiemonge authored
164 @@cd tmp; zip -rq ../${OUTPUT}/${NAME}.zip ${NAME}
0d283cb @eddiemonge combine the css structure min and license files
eddiemonge authored
165 @@rm -rf tmp
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
eddiemonge authored
166 # -------------------------------------------------
19c952a @eddiemonge For all versions of make except for deploy, the outputted scripts wil…
eddiemonge authored
167
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
eddiemonge authored
168 # -------------------------------------------------
169 # -------------------------------------------------
170 # -------------------------------------------------
171 #
172 # For jQuery Team Use Only
173 #
174 # -------------------------------------------------
e7ee7fe @gseguin More house cleaning
gseguin authored
175 # 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
176 build_latest: css docs js zip
23ee411 @johnbender less clever is more better
johnbender authored
177 # ... Copy over the lib js, avoid the compiled stuff, to get the defines for tests/unit/*
178 @@ # TODO centralize list of built files
179 @@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-f…
eddiemonge authored
180
48e8b1d @johnbender remove the version sed, keep the defines in the lib js (not compiled)…
johnbender authored
181 # 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
182 deploy_latest:
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
eddiemonge authored
183 # Time to put these on the CDN
4a1f4f8 @eddiemonge Add quiet option to scp
eddiemonge authored
184 @@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-f…
eddiemonge authored
185 # -------------------------------------------------
186
0b858d2 @johnbender split up latest build and deploy
johnbender authored
187 # TODO target name preserved to avoid issues during refactor, latest -> deploy_latest
188 latest: build_latest deploy_latest
189
9dcc864 @johnbender push the latest build output as nightlies
johnbender authored
190 # Push the nightly backups. This is done on a server cronjob
191 deploy_nightlies:
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
eddiemonge authored
192 # Time to put these on the CDN
9dcc864 @johnbender push the latest build output as nightlies
johnbender authored
193 @@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-f…
eddiemonge authored
194 # -------------------------------------------------
195
196 # Deploy a finished release. This is manually done.
5acc18a @eddiemonge Add images to the docs, fix cp syntax, rearrange build dependencies t…
eddiemonge authored
197 deploy: init css js docs zip
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
eddiemonge authored
198 # Deploying all the files to the CDN
199 @@mkdir tmp
5acc18a @eddiemonge Add images to the docs, fix cp syntax, rearrange build dependencies t…
eddiemonge authored
200 @@cp -R ${OUTPUT} tmp/${VER_OFFICIAL}
4a1f4f8 @eddiemonge Add quiet option to scp
eddiemonge authored
201 @@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-f…
eddiemonge authored
202 @@rm -rf tmp/${VER_OFFICIAL}
203 @@mv ${OUTPUT}/demos tmp/${VER_OFFICIAL}
4a1f4f8 @eddiemonge Add quiet option to scp
eddiemonge authored
204 # Create the Demos/Docs/Tests/Tools for jQueryMobile.com
ecf0b97 @eddiemonge Update the deployed files to use the CDN for the resources
eddiemonge authored
205 # ... By first replacing the paths
48e8b1d @johnbender remove the version sed, keep the defines in the lib js (not compiled)…
johnbender authored
206 @@ # TODO update jQuery Version replacement on deploy
ecf0b97 @eddiemonge Update the deployed files to use the CDN for the resources
eddiemonge authored
207 @@find tmp/${VER_OFFICIAL} -type f \
208 \( -name '*.html' -o -name '*.php' \) \
209 -exec perl -pi -e \
e74eeda @johnbender default to core 1.7.1 in the deploy of the demo
johnbender authored
210 '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' {} \;
ecf0b97 @eddiemonge Update the deployed files to use the CDN for the resources
eddiemonge authored
211 # ... So they can be copied to jquerymobile.com
45b71e1 @johnbender Makefile whitespace
johnbender authored
212 @@scp -qr tmp/* jqadmin@jquerymobile.com:/srv/jquerymobile.com/htdocs/demos/
a213cfa @eddiemonge Complete overhaul of Make process to be cleaner, clearer and server-f…
eddiemonge authored
213 # Do some cleanup to wrap it up
214 @@rm -rf tmp
215 @@rm -rf ${OUTPUT}
216 # -------------------------------------------------
217
0d283cb @eddiemonge combine the css structure min and license files
eddiemonge authored
218
Something went wrong with that request. Please try again.