Merge lp:~stevenk/launchpad/silence-yui-build into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 16554
Proposed branch: lp:~stevenk/launchpad/silence-yui-build
Merge into: lp:launchpad
Diff against target: 425 lines (+33/-265)
5 files modified
Makefile (+31/-64)
buildout-templates/bin/combo-rootdir.in (+0/-42)
lib/lp/app/templates/base-layout-macros.pt (+1/-20)
lib/lp/services/features/flags.py (+1/-7)
utilities/yui-deps.py (+0/-132)
To merge this branch: bzr merge lp:~stevenk/launchpad/silence-yui-build
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+157272@code.launchpad.net

Commit message

Stop building launchpad.js and silence YUI copying warnings. Good riddance.

Description of the change

Destroy launchpad.js, and the feature flag used for enabling combo loading. This also means we stop building YUI 3.3.0, and I have taken this opportunity to shift all of combo-rootdir's responsibilities into the Makefile itself. This also neatly silences the YUI copying warnings during a build in a already built tree.

Correct the yui_version feature flag in the flag documentation as a drive-by.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2013-01-03 17:17:29 +0000
3+++ Makefile 2013-04-08 04:51:20 +0000
4@@ -22,26 +22,13 @@
5 ICING=lib/canonical/launchpad/icing
6 LP_BUILT_JS_ROOT=${ICING}/build
7
8-ifeq ($(LPCONFIG), development)
9-JS_BUILD := raw
10-else
11-JS_BUILD := min
12-endif
13-
14-define JS_LP_PATHS
15-lib -path 'lib/lp/*/javascript/*' \
16-! -path '*/tests/*' ! -path '*/testing/*' \
17-! -path 'lib/lp/services/*'
18-endef
19-
20 JS_BUILD_DIR := build/js
21-YUI_VERSIONS := 3.3.0 3.5.1
22+YUI_VERSIONS := 3.5.1
23 YUI_BUILDS := $(patsubst %,$(JS_BUILD_DIR)/yui-%, $(YUI_VERSIONS))
24-YUI_DEFAULT := $(JS_BUILD_DIR)/yui-3.5.1
25-JS_YUI := $(shell utilities/yui-deps.py $(JS_BUILD:raw=))
26-JS_LP := $(shell find -L $(JS_LP_PATHS) -name '*.js' ! -name '.*.js')
27-JS_ALL := $(JS_YUI) $(JS_LP)
28-JS_OUT := $(LP_BUILT_JS_ROOT)/launchpad.js
29+YUI2_BUILD:= $(JS_BUILD_DIR)/yui2
30+YUI_DEFAULT := yui-3.5.1
31+YUI_DEFAULT_SYMLINK := $(JS_BUILD_DIR)/yui
32+LP_JS_BUILD := $(JS_BUILD_DIR)/lp
33
34 MINS_TO_SHUTDOWN=15
35
36@@ -159,9 +146,10 @@
37 @exit 1
38 endif
39
40-css_combine:
41+css_combine: jsbuild_widget_css
42 ${SHHH} bin/sprite-util create-image
43 ${SHHH} bin/sprite-util create-css
44+ ln -sfn ../../../../build/js/$(YUI_DEFAULT) $(ICING)/yui
45 ${SHHH} bin/combine-css
46
47 jsbuild_widget_css: bin/jsbuild
48@@ -175,37 +163,34 @@
49 $(JS_BUILD_DIR):
50 mkdir -p $@
51
52-$(YUI_BUILDS): $(JS_BUILD_DIR)
53- for V in $(YUI_VERSIONS); do \
54- mkdir $(JS_BUILD_DIR)/yui-$$V $(JS_BUILD_DIR)/yui-$$V-tmp; \
55- unzip -q download-cache/dist/yui_$$V.zip -d $(JS_BUILD_DIR)/yui-$$V-tmp; \
56- mv $(JS_BUILD_DIR)/yui-$$V-tmp/yui/build/* $(JS_BUILD_DIR)/yui-$$V/; \
57- rm -rf $(JS_BUILD_DIR)/yui-$$V-tmp; \
58+$(YUI_BUILDS): | $(JS_BUILD_DIR)
59+ mkdir -p $@/tmp
60+ unzip -q download-cache/dist/yui_$(subst build/js/yui-,,$@).zip -d $@/tmp 'yui/build/*'
61+ mv $@/tmp/yui/build/* $@
62+ $(RM) -r $@/tmp
63+
64+$(YUI_DEFAULT_SYMLINK): $(YUI_BUILDS)
65+ ln -sfn $(YUI_DEFAULT) $@
66+
67+$(LP_JS_BUILD): | $(JS_BUILD_DIR)
68+ mkdir $@
69+ for jsdir in lib/lp/*/javascript; do \
70+ app=$$(echo $$jsdir | sed -e 's,lib/lp/\(.*\)/javascript,\1,'); \
71+ cp -a $$jsdir $@/$$app; \
72 done
73-
74-$(JS_LP): jsbuild_widget_css
75-
76-build/js/yui2/%: lib/canonical/launchpad/icing/yui_2.7.0b/build/%
77- mkdir -p `dirname $@`
78- cp -a $< $@
79-
80-# YUI_DEFAULT is one of the targets in YUI_BUILDS which expands all of our YUI
81-# versions for us.
82-$(JS_ALL): $(YUI_DEFAULT)
83-$(JS_OUT): $(JS_ALL)
84-ifeq ($(JS_BUILD), min)
85- cat $^ | bin/lpjsmin > $@
86-else
87- awk 'FNR == 1 {print "/* " FILENAME " */"} {print}' $^ > $@
88-endif
89+ find $@ -name 'tests' -type d | xargs rm -rf
90+ bin/lpjsmin -p $@
91+
92+$(YUI2_BUILD): lib/canonical/launchpad/icing/yui_2.7.0b/build
93+ mkdir -p $@
94+ cp -a $</* $@
95
96 combobuild:
97 utilities/js-deps -n LP_MODULES -s build/js/lp -x '-min.js' -o \
98 build/js/lp/meta.js >/dev/null
99 utilities/check-js-deps
100
101-jsbuild: $(PY) $(JS_OUT)
102- bin/combo-rootdir build/js $(YUI_DEFAULT)
103+jsbuild: $(LP_JS_BUILD) $(YUI_DEFAULT_SYMLINK) $(YUI2_BUILD)
104
105 eggs:
106 # Usually this is linked via link-external-sourcecode, but in
107@@ -261,7 +246,6 @@
108 ${SHHH} $(MAKE) -C sourcecode build PYTHON=${PYTHON} \
109 LPCONFIG=${LPCONFIG}
110 ${SHHH} LPCONFIG=${LPCONFIG} ${PY} -t buildmailman.py
111- ln -sf ../../../../build/js/yui-3.3.0 $(ICING)/yui
112
113 test_build: build
114 bin/test $(TESTFLAGS) $(TESTOPTS)
115@@ -275,10 +259,6 @@
116 ftest_inplace: inplace
117 bin/test -f $(TESTFLAGS) $(TESTOPTS)
118
119-merge-proposal-jobs:
120- # Handle merge proposal email jobs.
121- $(PY) cronscripts/merge-proposal-jobs.py -v
122-
123 run: build inplace stop
124 bin/run -r librarian,google-webservice,memcached,rabbitmq,txlongpoll \
125 -i $(LPCONFIG)
126@@ -319,15 +299,6 @@
127 stop_librarian:
128 bin/killservice librarian
129
130-pull_branches: support_files
131- $(PY) cronscripts/supermirror-pull.py
132-
133-scan_branches:
134- # Scan branches from the filesystem into the database.
135- $(PY) cronscripts/scan_branches.py
136-
137-sync_branches: pull_branches scan_branches merge-proposal-jobs
138-
139 $(BZR_VERSION_INFO):
140 scripts/update-bzr-version-info.sh
141
142@@ -375,7 +346,6 @@
143 $(PY) database/schema/fti.py -d launchpad_dev --force
144
145 clean_js:
146- $(RM) $(JS_OUT)
147 $(RM) -r $(ICING)/yui
148
149 clean_buildout:
150@@ -393,9 +363,7 @@
151 $(RM) logs/thread*.request
152
153 clean_mailman:
154- $(RM) -r \
155- /var/tmp/mailman \
156- /var/tmp/mailman-xmlrpc.test
157+ $(RM) -r /var/tmp/mailman /var/tmp/mailman-xmlrpc.test
158 ifdef LP_MAKE_KEEP_MAILMAN
159 @echo "Keeping previously built mailman."
160 else
161@@ -430,8 +398,7 @@
162 $(RM) -r build
163 $(RM) $(BZR_VERSION_INFO)
164 $(RM) +config-overrides.zcml
165- $(RM) -r \
166- /var/tmp/builddmaster \
167+ $(RM) -r /var/tmp/builddmaster \
168 /var/tmp/bzrsync \
169 /var/tmp/codehosting.test \
170 /var/tmp/codeimport \
171@@ -517,7 +484,7 @@
172 --docformat restructuredtext --verbose-about epytext-summary \
173 $(PYDOCTOR_OPTIONS)
174
175-.PHONY: apidoc build_eggs buildonce_eggs buildout_bin check check \
176+.PHONY: apidoc build_eggs buildonce_eggs buildout_bin check \
177 check_config check_mailman clean clean_buildout clean_js \
178 clean_logs compile css_combine debug default doc ftest_build \
179 ftest_inplace hosted_branches jsbuild jsbuild_widget_css \
180
181=== removed file 'buildout-templates/bin/combo-rootdir.in'
182--- buildout-templates/bin/combo-rootdir.in 2012-08-13 18:27:18 +0000
183+++ buildout-templates/bin/combo-rootdir.in 1970-01-01 00:00:00 +0000
184@@ -1,42 +0,0 @@
185-#!/bin/sh
186-
187-# Copyright 2012 Canonical Ltd. This software is licensed under the
188-# GNU Affero General Public License version 3 (see the file LICENSE).
189-
190-set -e
191-
192-if [ -z "$1" ]; then
193- echo "$0: Need root combo loader directory as an argument."
194- exit 1
195-fi
196-
197-if [ -z "$2" ]; then
198- echo "$0: Need yui build version to use as default as second argument"
199- exit 1
200-fi
201-
202-BUILD_DIR=$1
203-YUI_VERSION=$2
204-
205-# Populate YUI.
206-if [ ! -h $BUILD_DIR/yui ]; then
207- ln -sf `basename $YUI_VERSION` $BUILD_DIR/yui
208-fi
209-
210-# And YUI 2, for now.
211-if [ ! -d $BUILD_DIR/yui2 ]; then
212- cp -a lib/canonical/launchpad/icing/yui_2.7.0b/build $BUILD_DIR/yui2
213-fi
214-
215-# Copy in our modules.
216-rm -rf $BUILD_DIR/lp
217-mkdir $BUILD_DIR/lp
218-for jsdir in lib/lp/*/javascript ; do
219- app=$(echo $jsdir | sed -e 's,lib/lp/\(.*\)/javascript,\1,')
220- cp -a $jsdir $BUILD_DIR/lp/$app
221-done
222-# ... and delete tests.
223-find $BUILD_DIR/lp -name 'tests' -type d | xargs rm -rf
224-
225-# Minify our JS.
226-bin/lpjsmin -p $BUILD_DIR/lp
227
228=== modified file 'lib/lp/app/templates/base-layout-macros.pt'
229--- lib/lp/app/templates/base-layout-macros.pt 2013-01-01 12:56:03 +0000
230+++ lib/lp/app/templates/base-layout-macros.pt 2013-04-08 04:51:20 +0000
231@@ -67,27 +67,9 @@
232 LP.devmode = true;
233 </script>
234
235- <tal:js-legacy condition="not: request/features/js.combo_loader.enabled">
236- <script type="text/javascript"
237- tal:attributes="src string:${icingroot}/build/launchpad.js"></script>
238- <script type="text/javascript" tal:content="string:
239- YUI.GlobalConfig = {
240- debug: ${yui_console_debug},
241- fetchCSS: false,
242- timeout: 50,
243- ignore: [
244- 'yui2-yahoo', 'yui2-event', 'yui2-dom',
245- 'yui2-calendar','yui2-dom-event'
246- ]
247- }
248- ">
249- </script>
250- </tal:js-legacy>
251-
252 <script type="text/javascript"
253 tal:content="string:var cookie_scope = '${request/lp:cookie_scope}';"></script>
254
255- <tal:js-loader condition="request/features/js.combo_loader.enabled">
256 <script type="text/javascript" tal:attributes="src string:${combo_url}/?${yui_version}/yui/yui-min.js&amp;lp/meta.js&amp;${yui_version}/loader/loader-min.js"></script>
257 <script type="text/javascript" tal:content="string:
258 var raw = null;
259@@ -138,9 +120,8 @@
260 }
261 }
262 }">
263- </script>
264+ </script>
265
266- </tal:js-loader>
267 <script type="text/javascript">
268 // we need this to create a single YUI instance all events and code
269 // talks across. All instances of YUI().use should be based off of
270
271=== modified file 'lib/lp/services/features/flags.py'
272--- lib/lp/services/features/flags.py 2013-02-14 02:02:58 +0000
273+++ lib/lp/services/features/flags.py 2013-04-08 04:51:20 +0000
274@@ -112,13 +112,7 @@
275 'No jobs run via celery',
276 'Celery-enabled job classes',
277 'https://dev.launchpad.net/CeleryJobRunner'),
278- ('js.combo_loader.enabled',
279- 'boolean',
280- 'Determines if we use a js combo loader or not.',
281- '',
282- '',
283- ''),
284- ('js.yui-version',
285+ ('js.yui_version',
286 'space delimited',
287 'Allows us to change the YUI version we run against, e.g. yui-3.4.',
288 'As speficied in versions.cfg',
289
290=== removed file 'utilities/yui-deps.py'
291--- utilities/yui-deps.py 2012-09-28 06:15:58 +0000
292+++ utilities/yui-deps.py 1970-01-01 00:00:00 +0000
293@@ -1,132 +0,0 @@
294-#!/usr/bin/python
295-#
296-# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
297-# GNU Affero General Public License version 3 (see the file LICENSE).
298-
299-"""Print the YUI modules we are using."""
300-
301-from sys import argv
302-
303-
304-yui_roots = {
305- 3: 'build/js/yui-3.3.0',
306- 2: 'build/js/yui2',
307-}
308-yui_deps = {
309- 3: [
310- 'yui/yui',
311- 'oop/oop',
312- 'dom/dom',
313- 'dom/dom-style-ie',
314- 'event-custom/event-custom',
315- 'event/event',
316- 'pluginhost/pluginhost',
317- 'node/node',
318- 'event/event-base-ie',
319- 'node/align-plugin',
320- 'attribute/attribute',
321- 'base/base',
322- 'anim/anim',
323- 'async-queue/async-queue',
324- 'json/json',
325- 'plugin/plugin',
326- 'cache/cache',
327- 'classnamemanager/classnamemanager',
328- 'collection/collection',
329- 'dump/dump',
330- 'intl/intl',
331- 'substitute/substitute',
332- 'widget/widget',
333- 'widget/widget-base-ie',
334- 'console/lang/console.js',
335- 'console/console',
336- 'console/console-filters',
337- 'cookie/cookie',
338- 'dataschema/dataschema',
339- 'datatype/lang/datatype.js',
340- 'datatype/datatype',
341- 'querystring/querystring-stringify-simple',
342- 'queue-promote/queue-promote',
343- 'io/io',
344- 'datasource/datasource',
345- 'dd/dd',
346- 'dd/dd-gestures',
347- 'dd/dd-drop-plugin',
348- 'event/event-touch',
349- 'event-gestures/event-gestures',
350- 'dd/dd-plugin',
351- 'dom/selector-css3',
352- 'editor/editor',
353- 'event-simulate/event-simulate',
354- 'event-valuechange/event-valuechange',
355- 'escape/escape',
356- 'text/text-data-wordbreak',
357- 'text/text-wordbreak',
358- 'text/text-data-accentfold',
359- 'text/text-accentfold',
360- 'highlight/highlight',
361- 'history/history',
362- 'history/history-hash-ie',
363- 'history-deprecated/history-deprecated',
364- 'imageloader/imageloader',
365- 'jsonp/jsonp',
366- 'jsonp/jsonp-url',
367- 'loader/loader',
368- 'node/node-event-simulate',
369- 'transition/transition',
370- 'node-flick/node-flick',
371- 'node-focusmanager/node-focusmanager',
372- 'node-menunav/node-menunav',
373- 'widget/widget-position',
374- 'widget/widget-position-align',
375- 'widget/widget-position-constrain',
376- 'widget/widget-stack',
377- 'widget/widget-stdmod',
378- 'overlay/overlay',
379- 'profiler/profiler',
380- 'querystring/querystring',
381- 'querystring/querystring-parse-simple',
382- 'scrollview/scrollview-base',
383- 'scrollview/scrollview-base-ie',
384- 'scrollview/scrollview-scrollbars',
385- 'scrollview/scrollview',
386- 'scrollview/scrollview-paginator',
387- 'node/shim-plugin',
388- 'slider/slider',
389- 'sortable/sortable',
390- 'sortable/sortable-scroll',
391- 'stylesheet/stylesheet',
392- 'swfdetect/swfdetect',
393- 'swf/swf',
394- 'tabview/tabview-base',
395- 'widget/widget-child',
396- 'widget/widget-parent',
397- 'tabview/tabview',
398- 'tabview/tabview-plugin',
399- 'test/test',
400- 'uploader/uploader',
401- 'widget-anim/widget-anim',
402- 'widget/widget-locale',
403- 'yql/yql',
404- ],
405- 2: [
406- 'yahoo/yahoo.js',
407- 'dom/dom.js',
408- 'event/event.js',
409- 'yahoo-dom-event/yahoo-dom-event.js',
410- 'calendar/calendar.js',
411- ]
412-}
413-
414-
415-if __name__ == '__main__':
416- ext = "-%s.js" % argv[1] if len(argv) >= 2 else ".js"
417- for version, yui_deps in yui_deps.iteritems():
418- yui_root = yui_roots[version]
419- for yui_dep in yui_deps:
420- # If the yui_dep already has a .js suffix, don't add ext to it.
421- if yui_dep.endswith(".js"):
422- yui_dep_path = "%s/%s" % (yui_root, yui_dep)
423- else:
424- yui_dep_path = "%s/%s%s" % (yui_root, yui_dep, ext)
425- print yui_dep_path