Merge lp:~teknico/juju-gui/improve-makefile into lp:juju-gui/experimental
- improve-makefile
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 281 | ||||
Proposed branch: | lp:~teknico/juju-gui/improve-makefile | ||||
Merge into: | lp:juju-gui/experimental | ||||
Diff against target: |
266 lines (+83/-74) 2 files modified
Makefile (+82/-73) lib/server.js (+1/-1) |
||||
To merge this branch: | bzr merge lp:~teknico/juju-gui/improve-makefile | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email: mp+139768@code.launchpad.net |
Commit message
Description of the change
Misc. improvements to Makefile.
Eliminate debug/prod link duplication, avoid unnecessary rebuilds, add version info to build.
Nicola Larosa (teknico) wrote : | # |
Gary Poster (gary) wrote : | # |
Thank you both for being willing to take the half-done branch I had and
run with it, both testing and improving it.
I think my review can count as a real review, even though I was the
source of some of these changes, since you reviewed my changes and I
reviewed yours. :-)
Gary
https:/
File Makefile (right):
https:/
Makefile:22: -o -wholename './yuidoc*' -prune \
Good, thank you
Francesco Banconi (frankban) wrote : | # |
Land as is.
Thanks for this clean up Nicola and Gary.
https:/
File Makefile (right):
https:/
Makefile:259: LINK_DEBUG_
Very nice.
Nicola Larosa (teknico) wrote : | # |
*** Submitted:
Misc. improvements to Makefile.
Eliminate debug/prod link duplication, avoid unnecessary rebuilds, add
version info to build.
R=gary.poster, frankban
CC=
https:/
Preview Diff
1 | === modified file 'Makefile' |
2 | --- Makefile 2012-12-13 17:36:37 +0000 |
3 | +++ Makefile 2012-12-13 18:52:25 +0000 |
4 | @@ -11,13 +11,15 @@ |
5 | # as needed through the -prune directive, and the grep command removes |
6 | # individual unwanted JavaScript and JSON files from the list. |
7 | # find(1) is used here to build a list of JavaScript targets rather than bzr |
8 | -# due to the speed of network access being unpredictable (bzr accesses the |
9 | +# due to the speed of network access being unpredictable (bzr accesses the |
10 | # parent branch, which may be lp:juju-gui, for any command relating to the |
11 | # branch or checkout). Additionally, working with the release or an export, |
12 | # a developer may not be working in a bzr repository. |
13 | JSFILES=$(shell find . -wholename './node_modules*' -prune \ |
14 | -o -wholename './build*' -prune \ |
15 | + -o -wholename './docs*' -prune \ |
16 | -o -wholename './test/assets*' -prune \ |
17 | + -o -wholename './yuidoc*' -prune \ |
18 | -o \( \ |
19 | -name '*.js' \ |
20 | -o -name '*.json' \ |
21 | @@ -111,6 +113,8 @@ |
22 | BUILD_FILES=build/juju-ui/assets/app.js \ |
23 | build/juju-ui/assets/all-yui.js \ |
24 | build/juju-ui/assets/combined-css/all-static.css |
25 | +JAVASCRIPT_LIBRARIES=app/assets/javascripts/d3.v2.js \ |
26 | + app/assets/javascripts/d3.v2.min.js app/assets/javascripts/ |
27 | DATE=$(shell date -u) |
28 | APPCACHE=build/juju-ui/assets/manifest.appcache |
29 | |
30 | @@ -138,7 +142,7 @@ |
31 | @echo " FIXME: currently yielding 78 failures" |
32 | @echo "test: same as the test-debug target" |
33 | @echo "prep: beautify and lint the source" |
34 | - @echo "doc: generate Sphinx and YuiDoc documentation" |
35 | + @echo "docs: generate Sphinx and YUIdoc documentation" |
36 | @echo "help: this description" |
37 | @echo "Other, less common targets are available, see Makefile." |
38 | |
39 | @@ -154,7 +158,7 @@ |
40 | |
41 | yuidoc: yuidoc/index.html |
42 | |
43 | -doc: sphinx yuidoc |
44 | +docs: sphinx yuidoc |
45 | |
46 | $(SPRITE_GENERATED_FILES): node_modules/grunt node_modules/node-spritesheet \ |
47 | $(SPRITE_SOURCE_FILES) |
48 | @@ -197,7 +201,7 @@ |
49 | echo $$FOUND_TARGETS; \ |
50 | fi |
51 | |
52 | -javascript-libraries: node_modules/yui node_modules/d3 |
53 | +$(JAVASCRIPT_LIBRARIES): | node_modules/yui node_modules/d3 |
54 | ln -sf "$(PWD)/node_modules/yui" app/assets/javascripts/ |
55 | ln -sf "$(PWD)/node_modules/d3/d3.v2.js" app/assets/javascripts/d3.v2.js |
56 | ln -sf "$(PWD)/node_modules/d3/d3.v2.min.js" \ |
57 | @@ -228,20 +232,71 @@ |
58 | |
59 | spritegen: $(SPRITE_GENERATED_FILES) |
60 | |
61 | -$(BUILD_FILES): javascript-libraries $(JSFILES) $(THIRD_PARTY_JS) \ |
62 | - bin/merge-files lib/merge-files.js |
63 | +$(BUILD_FILES): $(JSFILES) $(THIRD_PARTY_JS) build/juju-ui/templates.js \ |
64 | + bin/merge-files lib/merge-files.js | $(JAVASCRIPT_LIBRARIES) |
65 | rm -f $(BUILD_FILES) |
66 | mkdir -p build/juju-ui/assets/combined-css/ |
67 | bin/merge-files |
68 | |
69 | build-files: $(BUILD_FILES) |
70 | |
71 | -link-debug-files: |
72 | - mkdir -p build-debug/juju-ui/assets/combined-css |
73 | - ln -sf "$(PWD)/app/favicon.ico" build-debug/ |
74 | - ln -sf "$(PWD)/app/index.html" build-debug/ |
75 | - ln -sf "$(PWD)/app/config-debug.js" build-debug/juju-ui/assets/config.js |
76 | - ln -sf "$(PWD)/app/modules-debug.js" build-debug/juju-ui/assets/modules.js |
77 | +# This leaves out all of the individual YUI assets, because we can't have them |
78 | +# the first time the Makefile is run in a clean tree. |
79 | +shared-link-files-list=build-$(1)/juju-ui/assets/combined-css \ |
80 | + build-$(1)/favicon.ico build-$(1)/index.html \ |
81 | + build-$(1)/juju-ui/assets/config.js build-$(1)/juju-ui/assets/modules.js \ |
82 | + build-$(1)/juju-ui/assets/images build-$(1)/juju-ui/assets/svgs \ |
83 | + build-$(1)/juju-ui/assets/app.js build-$(1)/juju-ui/version.js \ |
84 | + build-$(1)/juju-ui/assets/manifest.appcache \ |
85 | + build-$(1)/juju-ui/assets/combined-css/all-static.css \ |
86 | + build-$(1)/juju-ui/assets/juju-gui.css \ |
87 | + build-$(1)/juju-ui/assets/sprite.css \ |
88 | + build-$(1)/juju-ui/assets/sprite.png \ |
89 | + build-$(1)/juju-ui/assets/combined-css/rail-x.png \ |
90 | + build-$(1)/juju-ui/assets/skins/night/ \ |
91 | + build-$(1)/juju-ui/assets/skins/sam/ build-$(1)/juju-ui/assets/all-yui.js |
92 | + |
93 | +LINK_DEBUG_FILES=$(call shared-link-files-list,debug) \ |
94 | + build-debug/juju-ui/app.js build-debug/juju-ui/models \ |
95 | + build-debug/juju-ui/store build-debug/juju-ui/views \ |
96 | + build-debug/juju-ui/widgets build-debug/juju-ui/assets/javascripts \ |
97 | + build-debug/juju-ui/templates.js |
98 | + |
99 | +LINK_PROD_FILES=$(call shared-link-files-list,prod) |
100 | + |
101 | +# These are shared instructions between link-debug-files and link-prod-files. |
102 | +define link-files |
103 | + mkdir -p build-$(1)/juju-ui/assets/combined-css |
104 | + ln -sf "$(PWD)/app/favicon.ico" build-$(1)/ |
105 | + ln -sf "$(PWD)/app/index.html" build-$(1)/ |
106 | + ln -sf "$(PWD)/app/config-$(1).js" build-$(1)/juju-ui/assets/config.js |
107 | + ln -sf "$(PWD)/app/modules-$(1).js" build-$(1)/juju-ui/assets/modules.js |
108 | + ln -sf "$(PWD)/app/assets/images" build-$(1)/juju-ui/assets/ |
109 | + ln -sf "$(PWD)/app/assets/svgs" build-$(1)/juju-ui/assets/ |
110 | + ln -sf "$(PWD)/build/juju-ui/version.js" build-$(1)/juju-ui/ |
111 | + ln -sf "$(PWD)/build/juju-ui/assets/app.js" build-$(1)/juju-ui/assets/ |
112 | + ln -sf "$(PWD)/build/juju-ui/assets/manifest.appcache" \ |
113 | + build-$(1)/juju-ui/assets/ |
114 | + ln -sf "$(PWD)/build/juju-ui/assets/combined-css/all-static.css" \ |
115 | + build-$(1)/juju-ui/assets/combined-css/ |
116 | + ln -sf "$(PWD)/build/juju-ui/assets/juju-gui.css" build-$(1)/juju-ui/assets/ |
117 | + ln -sf "$(PWD)/build/juju-ui/assets/sprite.css" build-$(1)/juju-ui/assets/ |
118 | + ln -sf "$(PWD)/build/juju-ui/assets/sprite.png" build-$(1)/juju-ui/assets/ |
119 | + ln -sf "$(PWD)/node_modules/yui/assets/skins/sam/rail-x.png" \ |
120 | + build-$(1)/juju-ui/assets/combined-css/rail-x.png |
121 | + # Link each YUI module's assets. |
122 | + mkdir -p build-$(1)/juju-ui/assets/skins/night/ \ |
123 | + build-$(1)/juju-ui/assets/skins/sam/ |
124 | + find node_modules/yui/ -path "*/skins/night/*" -type f \ |
125 | + -exec ln -sf "$(PWD)/{}" build-$(1)/juju-ui/assets/skins/night/ \; |
126 | + find node_modules/yui/ -path "*/skins/sam/*" -type f \ |
127 | + -exec ln -sf "$(PWD)/{}" build-$(1)/juju-ui/assets/skins/sam/ \; |
128 | + find node_modules/yui/ -path "*/assets/*" \! -path "*/skins/*" -type f \ |
129 | + -exec ln -sf "$(PWD)/{}" build-$(1)/juju-ui/assets/ \; |
130 | +endef |
131 | + |
132 | +$(LINK_DEBUG_FILES): |
133 | + $(call link-files,debug) |
134 | ln -sf "$(PWD)/app/app.js" build-debug/juju-ui/ |
135 | ln -sf "$(PWD)/app/models" build-debug/juju-ui/ |
136 | ln -sf "$(PWD)/app/store" build-debug/juju-ui/ |
137 | @@ -249,58 +304,12 @@ |
138 | ln -sf "$(PWD)/app/widgets" build-debug/juju-ui/ |
139 | ln -sf "$(PWD)/app/assets/javascripts/yui/yui/yui-debug.js" \ |
140 | build-debug/juju-ui/assets/all-yui.js |
141 | - ln -sf "$(PWD)/app/assets/images" build-debug/juju-ui/assets/ |
142 | ln -sf "$(PWD)/app/assets/javascripts" build-debug/juju-ui/assets/ |
143 | - ln -sf "$(PWD)/app/assets/svgs" build-debug/juju-ui/assets/ |
144 | ln -sf "$(PWD)/build/juju-ui/templates.js" build-debug/juju-ui/ |
145 | - ln -sf "$(PWD)/build/juju-ui/assets/app.js" build-debug/juju-ui/assets/ |
146 | - ln -sf "$(PWD)/build/juju-ui/assets/manifest.appcache" \ |
147 | - build-debug/juju-ui/assets/ |
148 | - ln -sf "$(PWD)/build/juju-ui/assets/combined-css/all-static.css" \ |
149 | - build-debug/juju-ui/assets/combined-css/ |
150 | - ln -sf "$(PWD)/build/juju-ui/assets/juju-gui.css" build-debug/juju-ui/assets/ |
151 | - ln -sf "$(PWD)/build/juju-ui/assets/sprite.css" build-debug/juju-ui/assets/ |
152 | - ln -sf "$(PWD)/build/juju-ui/assets/sprite.png" build-debug/juju-ui/assets/ |
153 | - ln -sf "$(PWD)/node_modules/yui/assets/skins/sam/rail-x.png" \ |
154 | - build-debug/juju-ui/assets/combined-css/rail-x.png |
155 | - # Link each YUI module's assets. |
156 | - mkdir -p build-debug/juju-ui/assets/skins/night/ \ |
157 | - build-debug/juju-ui/assets/skins/sam/ |
158 | - find node_modules/yui/ -path "*/skins/night/*" -type f \ |
159 | - -exec ln -sf "$(PWD)/{}" build-debug/juju-ui/assets/skins/night/ \; |
160 | - find node_modules/yui/ -path "*/skins/sam/*" -type f \ |
161 | - -exec ln -sf "$(PWD)/{}" build-debug/juju-ui/assets/skins/sam/ \; |
162 | - find node_modules/yui/ -path "*/assets/*" \! -path "*/skins/*" -type f \ |
163 | - -exec ln -sf "$(PWD)/{}" build-debug/juju-ui/assets/ \; |
164 | |
165 | -link-prod-files: |
166 | - mkdir -p build-prod/juju-ui/assets/combined-css |
167 | - ln -sf "$(PWD)/app/favicon.ico" build-prod/ |
168 | - ln -sf "$(PWD)/app/index.html" build-prod/ |
169 | - ln -sf "$(PWD)/app/config.js" build-prod/juju-ui/assets/config.js |
170 | - ln -sf "$(PWD)/app/modules.js" build-prod/juju-ui/assets/modules.js |
171 | - ln -sf "$(PWD)/app/assets/images" build-prod/juju-ui/assets/ |
172 | - ln -sf "$(PWD)/app/assets/svgs" build-prod/juju-ui/assets/ |
173 | +$(LINK_PROD_FILES): |
174 | + $(call link-files,prod) |
175 | ln -sf "$(PWD)/build/juju-ui/assets/all-yui.js" build-prod/juju-ui/assets/ |
176 | - ln -sf "$(PWD)/build/juju-ui/assets/app.js" build-prod/juju-ui/assets/ |
177 | - ln -sf "$(PWD)/build/juju-ui/assets/manifest.appcache" \ |
178 | - build-prod/juju-ui/assets/ |
179 | - ln -sf "$(PWD)/build/juju-ui/assets/combined-css/all-static.css" \ |
180 | - build-prod/juju-ui/assets/combined-css/ |
181 | - ln -sf "$(PWD)/build/juju-ui/assets/juju-gui.css" build-prod/juju-ui/assets/ |
182 | - ln -sf "$(PWD)/build/juju-ui/assets/sprite.css" build-prod/juju-ui/assets/ |
183 | - ln -sf "$(PWD)/build/juju-ui/assets/sprite.png" build-prod/juju-ui/assets/ |
184 | - ln -sf "$(PWD)/node_modules/yui/assets/skins/sam/rail-x.png" \ |
185 | - build-prod/juju-ui/assets/combined-css/rail-x.png |
186 | - # Link each YUI module's assets. |
187 | - mkdir -p build-prod/juju-ui/assets/skins/night/ \ |
188 | - build-prod/juju-ui/assets/skins/sam/ |
189 | - find node_modules/yui/ -path "*/skins/night/*" -type f \ |
190 | - -exec ln -sf "$(PWD)/{}" build-prod/juju-ui/assets/skins/night/ \; |
191 | - find node_modules/yui/ -path "*/skins/sam/*" -type f \ |
192 | - -exec ln -sf "$(PWD)/{}" build-prod/juju-ui/assets/skins/sam/ \; |
193 | - find node_modules/yui/ -path "*/assets/*" \! -path "*/skins/*" -type f \ |
194 | - -exec ln -sf "$(PWD)/{}" build-prod/juju-ui/assets/ \; |
195 | |
196 | prep: beautify lint |
197 | |
198 | @@ -340,15 +349,16 @@ |
199 | |
200 | clean-docs: |
201 | make -C docs clean |
202 | + rm -rf yuidoc |
203 | |
204 | clean-all: clean clean-deps clean-docs |
205 | |
206 | -build: appcache $(NODE_TARGETS) javascript-libraries \ |
207 | - build/juju-ui/templates.js spritegen |
208 | - |
209 | -build-debug: build build-files link-debug-files |
210 | - |
211 | -build-prod: build build-files link-prod-files |
212 | +build: $(APPCACHE) $(NODE_TARGETS) spritegen \ |
213 | + $(BUILD_FILES) build/juju-ui/version.js |
214 | + |
215 | +build-debug: build | $(LINK_DEBUG_FILES) |
216 | + |
217 | +build-prod: build | $(LINK_PROD_FILES) |
218 | |
219 | $(APPCACHE): manifest.appcache.in |
220 | mkdir -p build/juju-ui/assets |
221 | @@ -360,9 +370,9 @@ |
222 | # one by connecting it to our pertinent versioned files. The appcache target |
223 | # creates the third, and directories are a bit tricky with Makefiles so we are |
224 | # OK with that. |
225 | -build/juju-ui/version.js: appcache CHANGES.yaml $(JSFILES) $(TEMPLATE_TARGETS) \ |
226 | +build/juju-ui/version.js: $(APPCACHE) CHANGES.yaml $(JSFILES) $(TEMPLATE_TARGETS) \ |
227 | $(SPRITE_SOURCE_FILES) |
228 | - echo "var jujuGuiVersionName='$(RELEASE_VERSION)';" \ |
229 | + echo "var jujuGuiVersionInfo=['$(RELEASE_VERSION)', '$(BZR_REVNO)'];" \ |
230 | > build/juju-ui/version.js |
231 | |
232 | upload_release.py: |
233 | @@ -422,14 +432,13 @@ |
234 | |
235 | # This is the real target. appcache-touch needs to be executed before |
236 | # appcache, and this provides the correct order. |
237 | -appcache-force: appcache-touch appcache |
238 | +appcache-force: appcache-touch $(APPCACHE) |
239 | |
240 | # targets are alphabetically sorted, they like it that way :-) |
241 | -.PHONY: appcache appcache-force appcache-touch beautify build \ |
242 | +.PHONY: appcache-force appcache-touch beautify build \ |
243 | build-debug build-files build-prod clean clean clean-all \ |
244 | - clean-deps clean-docs debug devel doc dist gjslint help \ |
245 | - javascript-libraries jshint link-debug-files link-prod-files \ |
246 | - lint prep prod server spritegen test test-debug test-prod \ |
247 | + clean-deps clean-docs debug devel docs dist gjslint help \ |
248 | + jshint lint prep prod server spritegen test test-debug test-prod \ |
249 | undocumented yuidoc yuidoc-lint |
250 | |
251 | .DEFAULT_GOAL := all |
252 | |
253 | === renamed file 'app/config.js' => 'app/config-prod.js' |
254 | === renamed file 'app/modules.js' => 'app/modules-prod.js' |
255 | === modified file 'lib/server.js' |
256 | --- lib/server.js 2012-12-05 19:52:20 +0000 |
257 | +++ lib/server.js 2012-12-13 18:52:25 +0000 |
258 | @@ -54,7 +54,7 @@ |
259 | } else if ('modules.js' === fileName) { |
260 | res.sendfile('app/modules-debug.js'); |
261 | } else if ('config.js' === fileName) { |
262 | - res.sendfile('app/config.js'); |
263 | + res.sendfile('app/config-debug.js'); |
264 | } else { |
265 | res.sendfile('build/juju-ui/assets/' + fileName); |
266 | } |
Reviewers: mp+139768_ code.launchpad. net,
Message:
Please take a look.
Description:
Misc. improvements to Makefile.
Eliminate debug/prod link duplication, avoid unnecessary rebuilds, add
version info to build.
https:/ /code.launchpad .net/~teknico/ juju-gui/ improve- makefile/ +merge/ 139768
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6936045/
Affected files:
M Makefile
A [revision details]
M app/config-prod.js
M app/modules-prod.js
M lib/server.js