Bug 1350646: Part 1 - Remove addon-sdk moz.build generation gunk. r=Mossop
☠☠ backed out by 9f7d0c809762 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Wed, 02 Aug 2017 13:51:40 -0700
changeset 373630 67c251e2c9db1d42a8de6d09a44e9e2f7be084a4
parent 373629 eefbc4d0360e2e439d9c5c93cff981bd04171642
child 373631 8d4c2f001354b186da9e411d2ff1def458d00efc
push id93571
push usermaglione.k@gmail.com
push dateWed, 09 Aug 2017 22:31:31 +0000
treeherdermozilla-inbound@c3108aebee35 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop
bugs1350646
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1350646: Part 1 - Remove addon-sdk moz.build generation gunk. r=Mossop MozReview-Commit-ID: GMlOFoosVQZ
addon-sdk/mach_commands.py
addon-sdk/moz.build
addon-sdk/mozbuild.template
build/mach_bootstrap.py
deleted file mode 100644
--- a/addon-sdk/mach_commands.py
+++ /dev/null
@@ -1,107 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# Integrates the xpcshell test runner with mach.
-
-from __future__ import absolute_import
-
-import os
-
-import mozpack.path as mozpath
-
-from mozbuild.base import (
-    MachCommandBase,
-)
-
-from mach.decorators import (
-    CommandArgument,
-    CommandProvider,
-    Command,
-)
-
-@CommandProvider
-class MachCommands(MachCommandBase):
-    @Command('generate-addon-sdk-moz-build', category='misc',
-        description='Generates the moz.build file for the addon-sdk/ directory.')
-    def run_addon_sdk_moz_build(self, **params):
-        addon_sdk_dir = mozpath.join(self.topsrcdir, 'addon-sdk')
-        js_src_dir = mozpath.join(addon_sdk_dir, 'source/lib')
-        dirs_to_files = {}
-
-        for path, dirs, files in os.walk(js_src_dir):
-            js_files = [f for f in files if f.endswith(('.js', '.jsm', '.html'))]
-            if not js_files:
-                continue
-
-            relative = mozpath.relpath(path, js_src_dir)
-            dirs_to_files[relative] = js_files
-
-        moz_build = """# AUTOMATICALLY GENERATED FROM mozbuild.template AND mach.  DO NOT EDIT.
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-%(moz-build-template)s
-if CONFIG['MOZ_WIDGET_TOOLKIT'] != "gonk":
-%(non-b2g-modules)s
-%(always-on-modules)s"""
-
-        non_b2g_paths = [
-            'method/test',
-            'sdk/ui',
-            'sdk/ui/button',
-            'sdk/ui/sidebar',
-            'sdk/places',
-            'sdk/places/host',
-            'sdk/tabs',
-            'sdk/panel',
-            'sdk/frame',
-            'sdk/test',
-            'sdk/window',
-            'sdk/windows',
-            'sdk/deprecated',
-        ]
-
-        non_b2g_modules = []
-        always_on_modules = []
-
-        for d, files in sorted(dirs_to_files.items()):
-            if d in non_b2g_paths:
-                non_b2g_modules.append((d, files))
-            else:
-                always_on_modules.append((d, files))
-
-        def list_to_js_modules(l, indent=''):
-            js_modules = []
-            for d, files in l:
-                if d == '':
-                    module_path = ''
-                    dir_path = ''
-                else:
-                    # Ensure that we don't have things like:
-                    #   EXTRA_JS_MODULES.commonjs.sdk.private-browsing
-                    # which would be a Python syntax error.
-                    path = d.split('/')
-                    module_path = ''.join('.' + p if p.find('-') == -1 else "['%s']" % p for p in path)
-                    dir_path = d + '/'
-                filelist = ["'source/lib/%s%s'" % (dir_path, f)
-                            for f in sorted(files, key=lambda x: x.lower())]
-                js_modules.append("EXTRA_JS_MODULES.commonjs%s += [\n    %s,\n]\n"
-                                  % (module_path, ',\n    '.join(filelist)))
-            stringified = '\n'.join(js_modules)
-            # This isn't the same thing as |js_modules|, since |js_modules| had
-            # embedded newlines.
-            lines = stringified.split('\n')
-            # Indent lines while avoiding trailing whitespace.
-            lines = [indent + line if line else line for line in lines]
-            return '\n'.join(lines)
-
-        moz_build_output = mozpath.join(addon_sdk_dir, 'moz.build')
-        moz_build_template = mozpath.join(addon_sdk_dir, 'mozbuild.template')
-        with open(moz_build_output, 'w') as f, open(moz_build_template, 'r') as t:
-            substs = { 'moz-build-template': t.read(),
-                       'non-b2g-modules': list_to_js_modules(non_b2g_modules,
-                                                             indent='    '),
-                       'always-on-modules': list_to_js_modules(always_on_modules) }
-            f.write(moz_build % substs)
--- a/addon-sdk/moz.build
+++ b/addon-sdk/moz.build
@@ -15,477 +15,285 @@ DIRS += ['source/test/fixtures']
 EXTRA_JS_MODULES.sdk += [
     'source/app-extension/bootstrap.js',
 ]
 
 EXTRA_JS_MODULES.sdk.system += [
     'source/modules/system/Startup.js',
 ]
 
-EXTRA_JS_MODULES.commonjs.method.test += [
-    'source/lib/method/test/browser.js',
-    'source/lib/method/test/common.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.deprecated += [
-    'source/lib/sdk/deprecated/api-utils.js',
-    'source/lib/sdk/deprecated/sync-worker.js',
-    'source/lib/sdk/deprecated/unit-test-finder.js',
-    'source/lib/sdk/deprecated/unit-test.js',
-    'source/lib/sdk/deprecated/window-utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.frame += [
-    'source/lib/sdk/frame/hidden-frame.js',
-    'source/lib/sdk/frame/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.panel += [
-    'source/lib/sdk/panel/events.js',
-    'source/lib/sdk/panel/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.places += [
-    'source/lib/sdk/places/bookmarks.js',
-    'source/lib/sdk/places/contract.js',
-    'source/lib/sdk/places/events.js',
-    'source/lib/sdk/places/favicon.js',
-    'source/lib/sdk/places/history.js',
-    'source/lib/sdk/places/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.places.host += [
-    'source/lib/sdk/places/host/host-bookmarks.js',
-    'source/lib/sdk/places/host/host-query.js',
-    'source/lib/sdk/places/host/host-tags.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.tabs += [
-    'source/lib/sdk/tabs/common.js',
-    'source/lib/sdk/tabs/events.js',
-    'source/lib/sdk/tabs/helpers.js',
-    'source/lib/sdk/tabs/namespace.js',
-    'source/lib/sdk/tabs/observer.js',
-    'source/lib/sdk/tabs/tab-fennec.js',
-    'source/lib/sdk/tabs/tab-firefox.js',
-    'source/lib/sdk/tabs/tab.js',
-    'source/lib/sdk/tabs/tabs-firefox.js',
-    'source/lib/sdk/tabs/utils.js',
-    'source/lib/sdk/tabs/worker.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.test += [
-    'source/lib/sdk/test/assert.js',
-    'source/lib/sdk/test/harness.js',
-    'source/lib/sdk/test/httpd.js',
-    'source/lib/sdk/test/loader.js',
-    'source/lib/sdk/test/memory.js',
-    'source/lib/sdk/test/options.js',
-    'source/lib/sdk/test/runner.js',
-    'source/lib/sdk/test/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.ui += [
-    'source/lib/sdk/ui/component.js',
-    'source/lib/sdk/ui/frame.js',
-    'source/lib/sdk/ui/id.js',
-    'source/lib/sdk/ui/sidebar.js',
-    'source/lib/sdk/ui/state.js',
-    'source/lib/sdk/ui/toolbar.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.ui.button += [
-    'source/lib/sdk/ui/button/action.js',
-    'source/lib/sdk/ui/button/contract.js',
-    'source/lib/sdk/ui/button/toggle.js',
-    'source/lib/sdk/ui/button/view.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.ui.sidebar += [
-    'source/lib/sdk/ui/sidebar/actions.js',
-    'source/lib/sdk/ui/sidebar/contract.js',
-    'source/lib/sdk/ui/sidebar/namespace.js',
-    'source/lib/sdk/ui/sidebar/utils.js',
-    'source/lib/sdk/ui/sidebar/view.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.window += [
-    'source/lib/sdk/window/browser.js',
-    'source/lib/sdk/window/events.js',
-    'source/lib/sdk/window/helpers.js',
-    'source/lib/sdk/window/namespace.js',
-    'source/lib/sdk/window/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.windows += [
-    'source/lib/sdk/windows/fennec.js',
-    'source/lib/sdk/windows/firefox.js',
-    'source/lib/sdk/windows/observer.js',
-    'source/lib/sdk/windows/tabs-fennec.js',
-]
-
-EXTRA_JS_MODULES.commonjs += [
-    'source/lib/index.js',
-    'source/lib/test.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk += [
-    'source/lib/sdk/webextension.js',
-]
-
-EXTRA_JS_MODULES.commonjs.dev += [
-    'source/lib/dev/debuggee.js',
-    'source/lib/dev/frame-script.js',
-    'source/lib/dev/panel.js',
-    'source/lib/dev/ports.js',
-    'source/lib/dev/theme.js',
-    'source/lib/dev/toolbox.js',
-    'source/lib/dev/utils.js',
-    'source/lib/dev/volcan.js',
-]
-
-EXTRA_JS_MODULES.commonjs.dev.panel += [
-    'source/lib/dev/panel/view.js',
-]
-
-EXTRA_JS_MODULES.commonjs.dev.theme += [
-    'source/lib/dev/theme/hooks.js',
-]
-
-EXTRA_JS_MODULES.commonjs.diffpatcher += [
-    'source/lib/diffpatcher/diff.js',
-    'source/lib/diffpatcher/index.js',
-    'source/lib/diffpatcher/patch.js',
-    'source/lib/diffpatcher/rebase.js',
-]
-
-EXTRA_JS_MODULES.commonjs.diffpatcher.test += [
-    'source/lib/diffpatcher/test/common.js',
-    'source/lib/diffpatcher/test/diff.js',
-    'source/lib/diffpatcher/test/index.js',
-    'source/lib/diffpatcher/test/patch.js',
-    'source/lib/diffpatcher/test/tap.js',
-]
-
-EXTRA_JS_MODULES.commonjs.framescript += [
-    'source/lib/framescript/content.jsm',
-    'source/lib/framescript/context-menu.js',
-    'source/lib/framescript/FrameScriptManager.jsm',
-    'source/lib/framescript/manager.js',
-    'source/lib/framescript/util.js',
-]
-
-EXTRA_JS_MODULES.commonjs['jetpack-id'] += [
-    'source/lib/jetpack-id/index.js',
-]
-
-EXTRA_JS_MODULES.commonjs.method += [
-    'source/lib/method/core.js',
-]
-
-EXTRA_JS_MODULES.commonjs['mozilla-toolkit-versioning'] += [
-    'source/lib/mozilla-toolkit-versioning/index.js',
-]
-
-EXTRA_JS_MODULES.commonjs['mozilla-toolkit-versioning'].lib += [
-    'source/lib/mozilla-toolkit-versioning/lib/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.node += [
-    'source/lib/node/os.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk += [
-    'source/lib/sdk/base64.js',
-    'source/lib/sdk/clipboard.js',
-    'source/lib/sdk/context-menu.js',
-    'source/lib/sdk/context-menu@2.js',
-    'source/lib/sdk/hotkeys.js',
-    'source/lib/sdk/indexed-db.js',
-    'source/lib/sdk/l10n.js',
-    'source/lib/sdk/messaging.js',
-    'source/lib/sdk/notifications.js',
-    'source/lib/sdk/page-mod.js',
-    'source/lib/sdk/page-worker.js',
-    'source/lib/sdk/panel.js',
-    'source/lib/sdk/passwords.js',
-    'source/lib/sdk/private-browsing.js',
-    'source/lib/sdk/querystring.js',
-    'source/lib/sdk/request.js',
-    'source/lib/sdk/selection.js',
-    'source/lib/sdk/self.js',
-    'source/lib/sdk/simple-prefs.js',
-    'source/lib/sdk/simple-storage.js',
-    'source/lib/sdk/system.js',
-    'source/lib/sdk/tabs.js',
-    'source/lib/sdk/test.js',
-    'source/lib/sdk/timers.js',
-    'source/lib/sdk/ui.js',
-    'source/lib/sdk/url.js',
-    'source/lib/sdk/windows.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.addon += [
-    'source/lib/sdk/addon/bootstrap.js',
-    'source/lib/sdk/addon/events.js',
-    'source/lib/sdk/addon/host.js',
-    'source/lib/sdk/addon/installer.js',
-    'source/lib/sdk/addon/manager.js',
-    'source/lib/sdk/addon/runner.js',
-    'source/lib/sdk/addon/window.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.browser += [
-    'source/lib/sdk/browser/events.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.console += [
-    'source/lib/sdk/console/plain-text.js',
-    'source/lib/sdk/console/traceback.js',
+modules = [
+    'method/test/browser.js',
+    'method/test/common.js',
+    'sdk/deprecated/api-utils.js',
+    'sdk/deprecated/sync-worker.js',
+    'sdk/deprecated/unit-test-finder.js',
+    'sdk/deprecated/unit-test.js',
+    'sdk/deprecated/window-utils.js',
+    'sdk/frame/hidden-frame.js',
+    'sdk/frame/utils.js',
+    'sdk/panel/events.js',
+    'sdk/panel/utils.js',
+    'sdk/places/bookmarks.js',
+    'sdk/places/contract.js',
+    'sdk/places/events.js',
+    'sdk/places/favicon.js',
+    'sdk/places/history.js',
+    'sdk/places/utils.js',
+    'sdk/places/host/host-bookmarks.js',
+    'sdk/places/host/host-query.js',
+    'sdk/places/host/host-tags.js',
+    'sdk/tabs/common.js',
+    'sdk/tabs/events.js',
+    'sdk/tabs/helpers.js',
+    'sdk/tabs/namespace.js',
+    'sdk/tabs/observer.js',
+    'sdk/tabs/tab-fennec.js',
+    'sdk/tabs/tab-firefox.js',
+    'sdk/tabs/tab.js',
+    'sdk/tabs/tabs-firefox.js',
+    'sdk/tabs/utils.js',
+    'sdk/tabs/worker.js',
+    'sdk/test/assert.js',
+    'sdk/test/harness.js',
+    'sdk/test/httpd.js',
+    'sdk/test/loader.js',
+    'sdk/test/memory.js',
+    'sdk/test/options.js',
+    'sdk/test/runner.js',
+    'sdk/test/utils.js',
+    'sdk/ui/component.js',
+    'sdk/ui/frame.js',
+    'sdk/ui/id.js',
+    'sdk/ui/sidebar.js',
+    'sdk/ui/state.js',
+    'sdk/ui/toolbar.js',
+    'sdk/ui/button/action.js',
+    'sdk/ui/button/contract.js',
+    'sdk/ui/button/toggle.js',
+    'sdk/ui/button/view.js',
+    'sdk/ui/sidebar/actions.js',
+    'sdk/ui/sidebar/contract.js',
+    'sdk/ui/sidebar/namespace.js',
+    'sdk/ui/sidebar/utils.js',
+    'sdk/ui/sidebar/view.js',
+    'sdk/window/browser.js',
+    'sdk/window/events.js',
+    'sdk/window/helpers.js',
+    'sdk/window/namespace.js',
+    'sdk/window/utils.js',
+    'sdk/windows/fennec.js',
+    'sdk/windows/firefox.js',
+    'sdk/windows/observer.js',
+    'sdk/windows/tabs-fennec.js',
+    'index.js',
+    'test.js',
+    'sdk/webextension.js',
+    'dev/debuggee.js',
+    'dev/frame-script.js',
+    'dev/panel.js',
+    'dev/ports.js',
+    'dev/theme.js',
+    'dev/toolbox.js',
+    'dev/utils.js',
+    'dev/volcan.js',
+    'dev/panel/view.js',
+    'dev/theme/hooks.js',
+    'diffpatcher/diff.js',
+    'diffpatcher/index.js',
+    'diffpatcher/patch.js',
+    'diffpatcher/rebase.js',
+    'diffpatcher/test/common.js',
+    'diffpatcher/test/diff.js',
+    'diffpatcher/test/index.js',
+    'diffpatcher/test/patch.js',
+    'diffpatcher/test/tap.js',
+    'framescript/content.jsm',
+    'framescript/context-menu.js',
+    'framescript/FrameScriptManager.jsm',
+    'framescript/manager.js',
+    'framescript/util.js',
+    'jetpack-id/index.js',
+    'method/core.js',
+    'mozilla-toolkit-versioning/index.js',
+    'mozilla-toolkit-versioning/lib/utils.js',
+    'node/os.js',
+    'sdk/base64.js',
+    'sdk/clipboard.js',
+    'sdk/context-menu.js',
+    'sdk/context-menu@2.js',
+    'sdk/hotkeys.js',
+    'sdk/indexed-db.js',
+    'sdk/l10n.js',
+    'sdk/messaging.js',
+    'sdk/notifications.js',
+    'sdk/page-mod.js',
+    'sdk/page-worker.js',
+    'sdk/panel.js',
+    'sdk/passwords.js',
+    'sdk/private-browsing.js',
+    'sdk/querystring.js',
+    'sdk/request.js',
+    'sdk/selection.js',
+    'sdk/self.js',
+    'sdk/simple-prefs.js',
+    'sdk/simple-storage.js',
+    'sdk/system.js',
+    'sdk/tabs.js',
+    'sdk/test.js',
+    'sdk/timers.js',
+    'sdk/ui.js',
+    'sdk/url.js',
+    'sdk/windows.js',
+    'sdk/addon/bootstrap.js',
+    'sdk/addon/events.js',
+    'sdk/addon/host.js',
+    'sdk/addon/installer.js',
+    'sdk/addon/manager.js',
+    'sdk/addon/runner.js',
+    'sdk/addon/window.js',
+    'sdk/browser/events.js',
+    'sdk/console/plain-text.js',
+    'sdk/console/traceback.js',
+    'sdk/content/content-worker.js',
+    'sdk/content/content.js',
+    'sdk/content/context-menu.js',
+    'sdk/content/events.js',
+    'sdk/content/l10n-html.js',
+    'sdk/content/loader.js',
+    'sdk/content/mod.js',
+    'sdk/content/page-mod.js',
+    'sdk/content/page-worker.js',
+    'sdk/content/sandbox.js',
+    'sdk/content/tab-events.js',
+    'sdk/content/thumbnail.js',
+    'sdk/content/utils.js',
+    'sdk/content/worker-child.js',
+    'sdk/content/worker.js',
+    'sdk/content/sandbox/events.js',
+    'sdk/context-menu/context.js',
+    'sdk/context-menu/core.js',
+    'sdk/context-menu/readers.js',
+    'sdk/core/disposable.js',
+    'sdk/core/heritage.js',
+    'sdk/core/namespace.js',
+    'sdk/core/observer.js',
+    'sdk/core/promise.js',
+    'sdk/core/reference.js',
+    'sdk/deprecated/events/assembler.js',
+    'sdk/dom/events-shimmed.js',
+    'sdk/dom/events.js',
+    'sdk/dom/events/keys.js',
+    'sdk/event/chrome.js',
+    'sdk/event/core.js',
+    'sdk/event/dom.js',
+    'sdk/event/target.js',
+    'sdk/event/utils.js',
+    'sdk/fs/path.js',
+    'sdk/input/browser.js',
+    'sdk/input/customizable-ui.js',
+    'sdk/input/frame.js',
+    'sdk/input/system.js',
+    'sdk/io/buffer.js',
+    'sdk/io/byte-streams.js',
+    'sdk/io/file.js',
+    'sdk/io/fs.js',
+    'sdk/io/stream.js',
+    'sdk/io/text-streams.js',
+    'sdk/keyboard/hotkeys.js',
+    'sdk/keyboard/observer.js',
+    'sdk/keyboard/utils.js',
+    'sdk/l10n/core.js',
+    'sdk/l10n/html.js',
+    'sdk/l10n/loader.js',
+    'sdk/l10n/locale.js',
+    'sdk/l10n/plural-rules.js',
+    'sdk/l10n/prefs.js',
+    'sdk/l10n/json/core.js',
+    'sdk/l10n/properties/core.js',
+    'sdk/lang/functional.js',
+    'sdk/lang/type.js',
+    'sdk/lang/weak-set.js',
+    'sdk/lang/functional/concurrent.js',
+    'sdk/lang/functional/core.js',
+    'sdk/lang/functional/helpers.js',
+    'sdk/loader/cuddlefish.js',
+    'sdk/loader/sandbox.js',
+    'sdk/model/core.js',
+    'sdk/net/url.js',
+    'sdk/net/xhr.js',
+    'sdk/output/system.js',
+    'sdk/page-mod/match-pattern.js',
+    'sdk/passwords/utils.js',
+    'sdk/platform/xpcom.js',
+    'sdk/preferences/event-target.js',
+    'sdk/preferences/native-options.js',
+    'sdk/preferences/service.js',
+    'sdk/preferences/utils.js',
+    'sdk/private-browsing/utils.js',
+    'sdk/remote/child.js',
+    'sdk/remote/core.js',
+    'sdk/remote/parent.js',
+    'sdk/remote/utils.js',
+    'sdk/stylesheet/style.js',
+    'sdk/stylesheet/utils.js',
+    'sdk/system/child_process.js',
+    'sdk/system/environment.js',
+    'sdk/system/events-shimmed.js',
+    'sdk/system/events.js',
+    'sdk/system/globals.js',
+    'sdk/system/process.js',
+    'sdk/system/runtime.js',
+    'sdk/system/unload.js',
+    'sdk/system/xul-app.js',
+    'sdk/system/xul-app.jsm',
+    'sdk/system/child_process/subprocess.js',
+    'sdk/tab/events.js',
+    'sdk/ui/button/view/events.js',
+    'sdk/ui/frame/model.js',
+    'sdk/ui/frame/view.html',
+    'sdk/ui/frame/view.js',
+    'sdk/ui/state/events.js',
+    'sdk/ui/toolbar/model.js',
+    'sdk/ui/toolbar/view.js',
+    'sdk/uri/resource.js',
+    'sdk/url/utils.js',
+    'sdk/util/array.js',
+    'sdk/util/collection.js',
+    'sdk/util/contract.js',
+    'sdk/util/deprecate.js',
+    'sdk/util/dispatcher.js',
+    'sdk/util/list.js',
+    'sdk/util/match-pattern.js',
+    'sdk/util/object.js',
+    'sdk/util/rules.js',
+    'sdk/util/sequence.js',
+    'sdk/util/uuid.js',
+    'sdk/view/core.js',
+    'sdk/worker/utils.js',
+    'sdk/zip/utils.js',
+    'toolkit/loader.js',
+    'toolkit/require.js',
 ]
 
-EXTRA_JS_MODULES.commonjs.sdk.content += [
-    'source/lib/sdk/content/content-worker.js',
-    'source/lib/sdk/content/content.js',
-    'source/lib/sdk/content/context-menu.js',
-    'source/lib/sdk/content/events.js',
-    'source/lib/sdk/content/l10n-html.js',
-    'source/lib/sdk/content/loader.js',
-    'source/lib/sdk/content/mod.js',
-    'source/lib/sdk/content/page-mod.js',
-    'source/lib/sdk/content/page-worker.js',
-    'source/lib/sdk/content/sandbox.js',
-    'source/lib/sdk/content/tab-events.js',
-    'source/lib/sdk/content/thumbnail.js',
-    'source/lib/sdk/content/utils.js',
-    'source/lib/sdk/content/worker-child.js',
-    'source/lib/sdk/content/worker.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.content.sandbox += [
-    'source/lib/sdk/content/sandbox/events.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk['context-menu'] += [
-    'source/lib/sdk/context-menu/context.js',
-    'source/lib/sdk/context-menu/core.js',
-    'source/lib/sdk/context-menu/readers.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.core += [
-    'source/lib/sdk/core/disposable.js',
-    'source/lib/sdk/core/heritage.js',
-    'source/lib/sdk/core/namespace.js',
-    'source/lib/sdk/core/observer.js',
-    'source/lib/sdk/core/promise.js',
-    'source/lib/sdk/core/reference.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.deprecated.events += [
-    'source/lib/sdk/deprecated/events/assembler.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.dom += [
-    'source/lib/sdk/dom/events-shimmed.js',
-    'source/lib/sdk/dom/events.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.dom.events += [
-    'source/lib/sdk/dom/events/keys.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.event += [
-    'source/lib/sdk/event/chrome.js',
-    'source/lib/sdk/event/core.js',
-    'source/lib/sdk/event/dom.js',
-    'source/lib/sdk/event/target.js',
-    'source/lib/sdk/event/utils.js',
-]
+commonjs = EXTRA_JS_MODULES.commonjs
 
-EXTRA_JS_MODULES.commonjs.sdk.fs += [
-    'source/lib/sdk/fs/path.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.input += [
-    'source/lib/sdk/input/browser.js',
-    'source/lib/sdk/input/customizable-ui.js',
-    'source/lib/sdk/input/frame.js',
-    'source/lib/sdk/input/system.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.io += [
-    'source/lib/sdk/io/buffer.js',
-    'source/lib/sdk/io/byte-streams.js',
-    'source/lib/sdk/io/file.js',
-    'source/lib/sdk/io/fs.js',
-    'source/lib/sdk/io/stream.js',
-    'source/lib/sdk/io/text-streams.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.keyboard += [
-    'source/lib/sdk/keyboard/hotkeys.js',
-    'source/lib/sdk/keyboard/observer.js',
-    'source/lib/sdk/keyboard/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.l10n += [
-    'source/lib/sdk/l10n/core.js',
-    'source/lib/sdk/l10n/html.js',
-    'source/lib/sdk/l10n/loader.js',
-    'source/lib/sdk/l10n/locale.js',
-    'source/lib/sdk/l10n/plural-rules.js',
-    'source/lib/sdk/l10n/prefs.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.l10n.json += [
-    'source/lib/sdk/l10n/json/core.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.l10n.properties += [
-    'source/lib/sdk/l10n/properties/core.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.lang += [
-    'source/lib/sdk/lang/functional.js',
-    'source/lib/sdk/lang/type.js',
-    'source/lib/sdk/lang/weak-set.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.lang.functional += [
-    'source/lib/sdk/lang/functional/concurrent.js',
-    'source/lib/sdk/lang/functional/core.js',
-    'source/lib/sdk/lang/functional/helpers.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.loader += [
-    'source/lib/sdk/loader/cuddlefish.js',
-    'source/lib/sdk/loader/sandbox.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.model += [
-    'source/lib/sdk/model/core.js',
-]
+sources = {}
+def get_sources(path):
+    key = '/'.join(path)
+    if key in sources:
+        return sources[key]
 
-EXTRA_JS_MODULES.commonjs.sdk.net += [
-    'source/lib/sdk/net/url.js',
-    'source/lib/sdk/net/xhr.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.output += [
-    'source/lib/sdk/output/system.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk['page-mod'] += [
-    'source/lib/sdk/page-mod/match-pattern.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.passwords += [
-    'source/lib/sdk/passwords/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.platform += [
-    'source/lib/sdk/platform/xpcom.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.preferences += [
-    'source/lib/sdk/preferences/event-target.js',
-    'source/lib/sdk/preferences/native-options.js',
-    'source/lib/sdk/preferences/service.js',
-    'source/lib/sdk/preferences/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk['private-browsing'] += [
-    'source/lib/sdk/private-browsing/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.remote += [
-    'source/lib/sdk/remote/child.js',
-    'source/lib/sdk/remote/core.js',
-    'source/lib/sdk/remote/parent.js',
-    'source/lib/sdk/remote/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.stylesheet += [
-    'source/lib/sdk/stylesheet/style.js',
-    'source/lib/sdk/stylesheet/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.system += [
-    'source/lib/sdk/system/child_process.js',
-    'source/lib/sdk/system/environment.js',
-    'source/lib/sdk/system/events-shimmed.js',
-    'source/lib/sdk/system/events.js',
-    'source/lib/sdk/system/globals.js',
-    'source/lib/sdk/system/process.js',
-    'source/lib/sdk/system/runtime.js',
-    'source/lib/sdk/system/unload.js',
-    'source/lib/sdk/system/xul-app.js',
-    'source/lib/sdk/system/xul-app.jsm',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.system.child_process += [
-    'source/lib/sdk/system/child_process/subprocess.js',
-]
+    source_dir = commonjs
+    for dir_ in path:
+        source_dir = source_dir[dir_]
 
-EXTRA_JS_MODULES.commonjs.sdk.tab += [
-    'source/lib/sdk/tab/events.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.ui.button.view += [
-    'source/lib/sdk/ui/button/view/events.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.ui.frame += [
-    'source/lib/sdk/ui/frame/model.js',
-    'source/lib/sdk/ui/frame/view.html',
-    'source/lib/sdk/ui/frame/view.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.ui.state += [
-    'source/lib/sdk/ui/state/events.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.ui.toolbar += [
-    'source/lib/sdk/ui/toolbar/model.js',
-    'source/lib/sdk/ui/toolbar/view.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.uri += [
-    'source/lib/sdk/uri/resource.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.url += [
-    'source/lib/sdk/url/utils.js',
-]
+    sources[key] = source_dir
+    return source_dir
 
-EXTRA_JS_MODULES.commonjs.sdk.util += [
-    'source/lib/sdk/util/array.js',
-    'source/lib/sdk/util/collection.js',
-    'source/lib/sdk/util/contract.js',
-    'source/lib/sdk/util/deprecate.js',
-    'source/lib/sdk/util/dispatcher.js',
-    'source/lib/sdk/util/list.js',
-    'source/lib/sdk/util/match-pattern.js',
-    'source/lib/sdk/util/object.js',
-    'source/lib/sdk/util/rules.js',
-    'source/lib/sdk/util/sequence.js',
-    'source/lib/sdk/util/uuid.js',
-]
+for module in modules:
+    path = module.split('/')[:-1]
 
-EXTRA_JS_MODULES.commonjs.sdk.view += [
-    'source/lib/sdk/view/core.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.worker += [
-    'source/lib/sdk/worker/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.sdk.zip += [
-    'source/lib/sdk/zip/utils.js',
-]
-
-EXTRA_JS_MODULES.commonjs.toolkit += [
-    'source/lib/toolkit/loader.js',
-    'source/lib/toolkit/require.js',
-]
+    source_dir = get_sources(path)
+    source_dir += ['source/lib/%s' % module]
 
 with Files("**"):
     BUG_COMPONENT = ("Add-on SDK", "General")
deleted file mode 100644
--- a/addon-sdk/mozbuild.template
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# Makefile.in uses a misc target through test_addons_TARGET.
-HAS_MISC_RULE = True
-
-BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
-JETPACK_PACKAGE_MANIFESTS += ['source/test/jetpack-package.ini']
-JETPACK_ADDON_MANIFESTS += ['source/test/addons/jetpack-addon.ini']
-
-EXTRA_JS_MODULES.sdk += [
-    'source/app-extension/bootstrap.js',
-]
-
-EXTRA_JS_MODULES.sdk.system += [
-    'source/modules/system/Startup.js',
-]
--- a/build/mach_bootstrap.py
+++ b/build/mach_bootstrap.py
@@ -29,17 +29,16 @@ use and re-run mach. For this change to 
 want to export this environment variable from your shell's init scripts.
 
 Press ENTER/RETURN to continue or CTRL+c to abort.
 '''.lstrip()
 
 
 # Individual files providing mach commands.
 MACH_MODULES = [
-    'addon-sdk/mach_commands.py',
     'build/valgrind/mach_commands.py',
     'devtools/shared/css/generated/mach_commands.py',
     'dom/bindings/mach_commands.py',
     'layout/tools/reftest/mach_commands.py',
     'python/mach_commands.py',
     'python/mach/mach/commands/commandinfo.py',
     'python/mach/mach/commands/settings.py',
     'python/mozboot/mozboot/mach_commands.py',