launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02924
[Merge] lp:~allenap/launchpad/alt-javascript-build into lp:launchpad
Gavin Panella has proposed merging lp:~allenap/launchpad/alt-javascript-build into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~allenap/launchpad/alt-javascript-build/+merge/53006
This changes the build process for most of the javascript in
Launchpad.
* utilities/lp-deps.py has been dropped, which means that
lazr.js.build.Builder is no longer used to generate the minified .js
files from the lib/lp tree. Obtaining the list of in-tree javascript
and minifying it is now done in just a few lines in Makefile.
* bin/jsbuild is still used to generate lazr.js, and to copy YUI into
the right place. However the call to do this now respects the
JS_BUILD variable. This can be set to "min" or "debug" to select the
type of file you want. It is set automatically to "debug" in
development and "min" everywhere else.
* utilities/yui-deps.py has been changed to (optionally) accept a
command line argument of "min" or "debug". This means we can select
a minified or debug version of YUI when building launchpad.js.
* The build targets have been set up such that conditional rebuilds of
launchpad.js work; if no javascript file in the tree has been
modified, launchpad.js will not be regenerated.
* Everything put together means that, by default, *nothing* in
launchpad.js will be minified in development, and everything will be
in other environments.
--
https://code.launchpad.net/~allenap/launchpad/alt-javascript-build/+merge/53006
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/alt-javascript-build into lp:launchpad.
=== modified file 'Makefile'
--- Makefile 2011-03-08 00:52:54 +0000
+++ Makefile 2011-03-11 12:09:15 +0000
@@ -16,11 +16,23 @@
LPCONFIG?=development
-JSFLAGS=
ICING=lib/canonical/launchpad/icing
LP_BUILT_JS_ROOT=${ICING}/build
LAZR_BUILT_JS_ROOT=lazr-js/build
+ifeq ($(LPCONFIG), development)
+JS_BUILD := debug
+else
+JS_BUILD := min
+endif
+
+JS_YUI := $(shell utilities/yui-deps.py $(JS_BUILD))
+JS_LAZR := $(LAZR_BUILT_JS_ROOT)/lazr.js
+JS_OTHER := $(wildcard lib/canonical/launchpad/javascript/*/*.js)
+JS_LP := $(shell find lib/lp/*/javascript ! -path '*/tests/*' -name '*.js')
+JS_ALL := $(JS_YUI) $(JS_LAZR) $(JS_OTHER) $(JS_LP)
+JS_OUT := $(LP_BUILT_JS_ROOT)/launchpad.js
+
MINS_TO_SHUTDOWN=15
CODEHOSTING_ROOT=/var/tmp/bazaar.launchpad.dev
@@ -155,18 +167,21 @@
# launchpad.js roll-up files. They fiddle with built-in functions!
# See Bug 482340.
jsbuild_lazr: bin/jsbuild
- ${SHHH} bin/jsbuild $(JSFLAGS) -b $(LAZR_BUILT_JS_ROOT) -x testing/ \
- -c $(LAZR_BUILT_JS_ROOT)/yui
-
-jsbuild: jsbuild_lazr bin/jsbuild bin/jssize $(BUILDOUT_BIN)
${SHHH} bin/jsbuild \
- $(JSFLAGS) \
- -n launchpad \
- -s lib/canonical/launchpad/javascript \
- -b $(LP_BUILT_JS_ROOT) \
- $(shell $(HERE)/utilities/yui-deps.py) \
- $(shell $(PY) $(HERE)/utilities/lp-deps.py) \
- lib/canonical/launchpad/icing/lazr/build/lazr.js
+ --builddir $(LAZR_BUILT_JS_ROOT) \
+ --exclude testing/ --filetype $(JS_BUILD) \
+ --copy-yui-to $(LAZR_BUILT_JS_ROOT)/yui
+
+$(JS_YUI) $(JS_LAZR): jsbuild_lazr
+
+$(JS_OUT): $(JS_ALL)
+ifeq ($(JS_BUILD), min)
+ cat $^ | $(PY) -m jsmin > $@
+else
+ cat $^ > $@
+endif
+
+jsbuild: $(JS_OUT)
eggs:
# Usually this is linked via link-external-sourcecode, but in
@@ -343,7 +358,7 @@
$(PY) database/schema/fti.py -d launchpad_dev --force
clean_js:
- $(RM) $(LP_BUILT_JS_ROOT)/launchpad.js
+ $(RM) $(JS_OUT)
$(RM) -r $(LAZR_BUILT_JS_ROOT)
clean_buildout:
@@ -372,7 +387,7 @@
-name '*.pt.py' \) \
-print0 | xargs -r0 $(RM)
$(RM) -r lib/mailman
- $(RM) -rf lib/canonical/launchpad/icing/build/*
+ $(RM) -rf $(LP_BUILT_JS_ROOT)/*
$(RM) -rf $(CODEHOSTING_ROOT)
$(RM) -rf $(APIDOC_DIR)
$(RM) -rf $(APIDOC_DIR).tmp
=== removed file 'utilities/lp-deps.py'
--- utilities/lp-deps.py 2011-02-14 20:14:47 +0000
+++ utilities/lp-deps.py 1970-01-01 00:00:00 +0000
@@ -1,61 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2010 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Print the Launchpad javascript files we are using.
-
-The output of this script is meant to be given to the jsbuild script so that
-they are included in the launchpad.js file.
-"""
-
-__metaclass__ = type
-
-import os
-
-from lazr.js.build import Builder
-
-TOP = os.path.abspath(
- os.path.join(os.path.dirname(__file__), '..'))
-# JS_DIRSET is a tuple of the dir where the code exists, and the name of the
-# symlink it should be linked as in the icing build directory.
-JS_DIRSET = [
- (os.path.join('lib', 'lp', 'app', 'javascript'), 'app'),
- (os.path.join('lib', 'lp', 'bugs', 'javascript'), 'bugs'),
- (os.path.join('lib', 'lp', 'code', 'javascript'), 'code'),
- (os.path.join('lib', 'lp', 'registry', 'javascript'), 'registry'),
- (os.path.join('lib', 'lp', 'translations', 'javascript'), 'translations'),
- (os.path.join('lib', 'lp', 'soyuz', 'javascript'), 'soyuz'),
- (os.path.join('lib', 'lp', 'contrib', 'javascript', 'yui3-gallery', 'gallery-accordion'), 'contrib'),
- ]
-ICING_ROOT = os.path.join(TOP, 'lib', 'canonical', 'launchpad', 'icing')
-ICING_BUILD = os.path.join(ICING_ROOT, 'build')
-
-# Builder has lots of logging, which might not
-# play well with printing filenames. Monkey patch
-# to disable it.
-def log_none(msg):
- return
-
-for DIRSET in JS_DIRSET:
- full_dir = os.path.join(TOP, DIRSET[0])
- module_name = DIRSET[1]
- BUILD_DIR = os.path.join(ICING_BUILD, module_name)
- if not os.path.exists(BUILD_DIR):
- os.mkdir(BUILD_DIR)
- builder = Builder(
- name=module_name, src_dir=full_dir, build_dir=ICING_BUILD)
- builder.log = log_none
- # We don't want the tests to be included. If we want to nest the files in
- # more folders though, this is where we change it.
- for filename in os.listdir(full_dir):
- # Some third-party JavaScript libraries may include pre-built -min and
- # -debug files. Skip those.
- if filename.endswith('-min.js') or filename.endswith('-debug.js'):
- continue
- if filename.endswith('.js'):
- basename, nothing = filename.split('.js')
- min_filename = basename + '-min.js'
- absolute_filename = os.path.join(full_dir, filename)
- builder.link_and_minify(builder.name, absolute_filename)
- print os.path.join(BUILD_DIR, min_filename)
=== modified file 'utilities/yui-deps.py'
--- utilities/yui-deps.py 2011-02-03 20:03:06 +0000
+++ utilities/yui-deps.py 2011-03-11 12:09:15 +0000
@@ -5,105 +5,114 @@
"""Print the YUI modules we are using."""
+from sys import argv
+
+
+yui_root = 'lib/canonical/launchpad/icing/yui'
yui_deps = [
- './lib/canonical/launchpad/icing/yui/yui/yui-min.js',
- './lib/canonical/launchpad/icing/yui/oop/oop-min.js',
- './lib/canonical/launchpad/icing/yui/dom/dom-min.js',
- './lib/canonical/launchpad/icing/yui/dom/dom-style-ie-min.js',
- './lib/canonical/launchpad/icing/yui/event-custom/event-custom-min.js',
- './lib/canonical/launchpad/icing/yui/event/event-min.js',
- './lib/canonical/launchpad/icing/yui/pluginhost/pluginhost-min.js',
- './lib/canonical/launchpad/icing/yui/node/node-min.js',
- './lib/canonical/launchpad/icing/yui/event/event-base-ie-min.js',
- './lib/canonical/launchpad/icing/yui/node/align-plugin-min.js',
- './lib/canonical/launchpad/icing/yui/attribute/attribute-min.js',
- './lib/canonical/launchpad/icing/yui/base/base-min.js',
- './lib/canonical/launchpad/icing/yui/anim/anim-min.js',
- './lib/canonical/launchpad/icing/yui/async-queue/async-queue-min.js',
- './lib/canonical/launchpad/icing/yui/json/json-min.js',
- './lib/canonical/launchpad/icing/yui/plugin/plugin-min.js',
- './lib/canonical/launchpad/icing/yui/cache/cache-min.js',
- './lib/canonical/launchpad/icing/yui/classnamemanager/classnamemanager-min.js',
- './lib/canonical/launchpad/icing/yui/collection/collection-min.js',
- './lib/canonical/launchpad/icing/yui/dump/dump-min.js',
- './lib/canonical/launchpad/icing/yui/intl/intl-min.js',
- './lib/canonical/launchpad/icing/yui/substitute/substitute-min.js',
- './lib/canonical/launchpad/icing/yui/widget/widget-min.js',
- './lib/canonical/launchpad/icing/yui/widget/widget-base-ie-min.js',
- './lib/canonical/launchpad/icing/yui/console/lang/console.js',
- './lib/canonical/launchpad/icing/yui/console/console-min.js',
- './lib/canonical/launchpad/icing/yui/console/console-filters-min.js',
- './lib/canonical/launchpad/icing/yui/cookie/cookie-min.js',
- './lib/canonical/launchpad/icing/yui/dataschema/dataschema-min.js',
- './lib/canonical/launchpad/icing/yui/datatype/lang/datatype.js',
- './lib/canonical/launchpad/icing/yui/datatype/datatype-min.js',
- './lib/canonical/launchpad/icing/yui/querystring/querystring-stringify-simple-min.js',
- './lib/canonical/launchpad/icing/yui/queue-promote/queue-promote-min.js',
- './lib/canonical/launchpad/icing/yui/io/io-min.js',
- './lib/canonical/launchpad/icing/yui/datasource/datasource-min.js',
- './lib/canonical/launchpad/icing/yui/dd/dd-min.js',
- './lib/canonical/launchpad/icing/yui/dd/dd-gestures-min.js',
- './lib/canonical/launchpad/icing/yui/dd/dd-drop-plugin-min.js',
- './lib/canonical/launchpad/icing/yui/event/event-touch-min.js',
- './lib/canonical/launchpad/icing/yui/event-gestures/event-gestures-min.js',
- './lib/canonical/launchpad/icing/yui/dd/dd-gestures-min.js',
- './lib/canonical/launchpad/icing/yui/dd/dd-plugin-min.js',
- './lib/canonical/launchpad/icing/yui/dom/dom-style-ie-min.js',
- './lib/canonical/launchpad/icing/yui/dom/selector-css3-min.js',
- './lib/canonical/launchpad/icing/yui/editor/editor-min.js',
- './lib/canonical/launchpad/icing/yui/event-simulate/event-simulate-min.js',
- './lib/canonical/launchpad/icing/yui/event-valuechange/event-valuechange-min.js',
- './lib/canonical/launchpad/icing/yui/escape/escape-min.js',
- './lib/canonical/launchpad/icing/yui/text/text-data-wordbreak-min.js',
- './lib/canonical/launchpad/icing/yui/text/text-wordbreak-min.js',
- './lib/canonical/launchpad/icing/yui/text/text-data-accentfold-min.js',
- './lib/canonical/launchpad/icing/yui/text/text-accentfold-min.js',
- './lib/canonical/launchpad/icing/yui/highlight/highlight-min.js',
- './lib/canonical/launchpad/icing/yui/history/history-min.js',
- './lib/canonical/launchpad/icing/yui/history/history-hash-ie-min.js',
- './lib/canonical/launchpad/icing/yui/history-deprecated/history-deprecated-min.js',
- './lib/canonical/launchpad/icing/yui/history/history-hash-ie-min.js',
- './lib/canonical/launchpad/icing/yui/imageloader/imageloader-min.js',
- './lib/canonical/launchpad/icing/yui/jsonp/jsonp-min.js',
- './lib/canonical/launchpad/icing/yui/jsonp/jsonp-url-min.js',
- './lib/canonical/launchpad/icing/yui/loader/loader-min.js',
- './lib/canonical/launchpad/icing/yui/node/node-event-simulate-min.js',
- './lib/canonical/launchpad/icing/yui/transition/transition-min.js',
- './lib/canonical/launchpad/icing/yui/node-flick/node-flick-min.js',
- './lib/canonical/launchpad/icing/yui/node-focusmanager/node-focusmanager-min.js',
- './lib/canonical/launchpad/icing/yui/node-menunav/node-menunav-min.js',
- './lib/canonical/launchpad/icing/yui/widget/widget-position-min.js',
- './lib/canonical/launchpad/icing/yui/widget/widget-position-align-min.js',
- './lib/canonical/launchpad/icing/yui/widget/widget-position-constrain-min.js',
- './lib/canonical/launchpad/icing/yui/widget/widget-stack-min.js',
- './lib/canonical/launchpad/icing/yui/widget/widget-stdmod-min.js',
- './lib/canonical/launchpad/icing/yui/overlay/overlay-min.js',
- './lib/canonical/launchpad/icing/yui/profiler/profiler-min.js',
- './lib/canonical/launchpad/icing/yui/querystring/querystring-min.js',
- './lib/canonical/launchpad/icing/yui/querystring/querystring-parse-simple-min.js',
- './lib/canonical/launchpad/icing/yui/scrollview/scrollview-base-min.js',
- './lib/canonical/launchpad/icing/yui/scrollview/scrollview-base-ie-min.js',
- './lib/canonical/launchpad/icing/yui/scrollview/scrollview-scrollbars-min.js',
- './lib/canonical/launchpad/icing/yui/scrollview/scrollview-min.js',
- './lib/canonical/launchpad/icing/yui/scrollview/scrollview-paginator-min.js',
- './lib/canonical/launchpad/icing/yui/node/shim-plugin-min.js',
- './lib/canonical/launchpad/icing/yui/slider/slider-min.js',
- './lib/canonical/launchpad/icing/yui/sortable/sortable-min.js',
- './lib/canonical/launchpad/icing/yui/sortable/sortable-scroll-min.js',
- './lib/canonical/launchpad/icing/yui/stylesheet/stylesheet-min.js',
- './lib/canonical/launchpad/icing/yui/swfdetect/swfdetect-min.js',
- './lib/canonical/launchpad/icing/yui/swf/swf-min.js',
- './lib/canonical/launchpad/icing/yui/tabview/tabview-base-min.js',
- './lib/canonical/launchpad/icing/yui/widget/widget-child-min.js',
- './lib/canonical/launchpad/icing/yui/widget/widget-parent-min.js',
- './lib/canonical/launchpad/icing/yui/tabview/tabview-min.js',
- './lib/canonical/launchpad/icing/yui/tabview/tabview-plugin-min.js',
- './lib/canonical/launchpad/icing/yui/test/test-min.js',
- './lib/canonical/launchpad/icing/yui/uploader/uploader-min.js',
- './lib/canonical/launchpad/icing/yui/widget-anim/widget-anim-min.js',
- './lib/canonical/launchpad/icing/yui/widget/widget-locale-min.js',
- './lib/canonical/launchpad/icing/yui/yql/yql-min.js',
+ 'yui/yui',
+ 'oop/oop',
+ 'dom/dom',
+ 'dom/dom-style-ie',
+ 'event-custom/event-custom',
+ 'event/event',
+ 'pluginhost/pluginhost',
+ 'node/node',
+ 'event/event-base-ie',
+ 'node/align-plugin',
+ 'attribute/attribute',
+ 'base/base',
+ 'anim/anim',
+ 'async-queue/async-queue',
+ 'json/json',
+ 'plugin/plugin',
+ 'cache/cache',
+ 'classnamemanager/classnamemanager',
+ 'collection/collection',
+ 'dump/dump',
+ 'intl/intl',
+ 'substitute/substitute',
+ 'widget/widget',
+ 'widget/widget-base-ie',
+ 'console/lang/console.js',
+ 'console/console',
+ 'console/console-filters',
+ 'cookie/cookie',
+ 'dataschema/dataschema',
+ 'datatype/lang/datatype.js',
+ 'datatype/datatype',
+ 'querystring/querystring-stringify-simple',
+ 'queue-promote/queue-promote',
+ 'io/io',
+ 'datasource/datasource',
+ 'dd/dd',
+ 'dd/dd-gestures',
+ 'dd/dd-drop-plugin',
+ 'event/event-touch',
+ 'event-gestures/event-gestures',
+ 'dd/dd-plugin',
+ 'dom/selector-css3',
+ 'editor/editor',
+ 'event-simulate/event-simulate',
+ 'event-valuechange/event-valuechange',
+ 'escape/escape',
+ 'text/text-data-wordbreak',
+ 'text/text-wordbreak',
+ 'text/text-data-accentfold',
+ 'text/text-accentfold',
+ 'highlight/highlight',
+ 'history/history',
+ 'history/history-hash-ie',
+ 'history-deprecated/history-deprecated',
+ 'imageloader/imageloader',
+ 'jsonp/jsonp',
+ 'jsonp/jsonp-url',
+ 'loader/loader',
+ 'node/node-event-simulate',
+ 'transition/transition',
+ 'node-flick/node-flick',
+ 'node-focusmanager/node-focusmanager',
+ 'node-menunav/node-menunav',
+ 'widget/widget-position',
+ 'widget/widget-position-align',
+ 'widget/widget-position-constrain',
+ 'widget/widget-stack',
+ 'widget/widget-stdmod',
+ 'overlay/overlay',
+ 'profiler/profiler',
+ 'querystring/querystring',
+ 'querystring/querystring-parse-simple',
+ 'scrollview/scrollview-base',
+ 'scrollview/scrollview-base-ie',
+ 'scrollview/scrollview-scrollbars',
+ 'scrollview/scrollview',
+ 'scrollview/scrollview-paginator',
+ 'node/shim-plugin',
+ 'slider/slider',
+ 'sortable/sortable',
+ 'sortable/sortable-scroll',
+ 'stylesheet/stylesheet',
+ 'swfdetect/swfdetect',
+ 'swf/swf',
+ 'tabview/tabview-base',
+ 'widget/widget-child',
+ 'widget/widget-parent',
+ 'tabview/tabview',
+ 'tabview/tabview-plugin',
+ 'test/test',
+ 'uploader/uploader',
+ 'widget-anim/widget-anim',
+ 'widget/widget-locale',
+ 'yql/yql',
]
-for line in yui_deps:
- print line
+
+if __name__ == '__main__':
+ ext = "-%s.js" % argv[1] if len(argv) >= 2 else ".js"
+ for yui_dep in yui_deps:
+ # If the yui_dep already has a .js suffix, don't add ext to it.
+ if yui_dep.endswith(".js"):
+ yui_dep_path = "%s/%s" % (yui_root, yui_dep)
+ else:
+ yui_dep_path = "%s/%s%s" % (yui_root, yui_dep, ext)
+ print yui_dep_path