Bug 1417309 - Move some definitions from top-level moz.build to application-specific moz.build files. r?build draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 08 Nov 2017 09:19:09 +0900
changeset 698009 d079edc94aa5014926cabf67dc210dfb423b0a03
parent 698008 506a82a7e10298ae42774a0510cb93e7326d11d4
child 698010 4c30b099087df17ac4610ab3a319cc20a09173a1
push id89172
push userbmo:mh+mozilla@glandium.org
push dateWed, 15 Nov 2017 05:25:33 +0000
reviewersbuild
bugs1417309
milestone59.0a1
Bug 1417309 - Move some definitions from top-level moz.build to application-specific moz.build files. r?build When building with a --enable-project that is neither js nor a toolkit-based one (like browser or mobile/android), we don't want to be building things that are specific to gecko and/or spidermonkey. At the same time, this lifts the exception that js standalone doesn't have an app.mozbuild included, and makes the moz.build parsers that don't set a MOZ_BUILD_APP get all the things through toolkit.mozbuild. We still keep mfbt, build and a few other DIRS set from the top-level, because at the moment, there aren't really any --enable-project that would benefit from those not being recursed.
js/app.mozbuild
moz.build
toolkit/toolkit.mozbuild
new file mode 100644
--- /dev/null
+++ b/js/app.mozbuild
@@ -0,0 +1,33 @@
+# -*- Mode: python; c-basic-offset: 4; 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/.
+
+if CONFIG['COMPILE_ENVIRONMENT']:
+    DIRS += [
+        'src',
+    ]
+else:
+    TEST_DIRS += [
+        'src/tests',
+    ]
+
+DIRS += [
+    '/config/external/fdlibm',
+    '/config/external/nspr',
+    '/config/external/zlib',
+    '/memory',
+    '/mozglue',
+]
+
+if CONFIG['USE_ICU']:
+    DIRS += [
+        '/config/external/icu',
+    ]
+
+if CONFIG['COMPILE_ENVIRONMENT'] and CONFIG['BUILD_CTYPES']:
+    DIRS += [
+        '/config/external/ffi',
+    ]
+
--- a/moz.build
+++ b/moz.build
@@ -79,27 +79,16 @@ DIRS += [
     'config',
     'python',
     'taskcluster',
     'testing/mozbase',
     'third_party/python',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] or not CONFIG['MOZ_BUILD_APP']:
-    # These python manifests are included here so they get picked up without an objdir
-    PYTHON_UNITTEST_MANIFESTS += [
-        'layout/tools/reftest/selftest/python.ini',
-        'testing/marionette/harness/marionette_harness/tests/harness_unit/python.ini',
-        'testing/mochitest/tests/python/python.ini',
-        'testing/talos/talos/unittests/python.ini'
-    ]
-
-    CONFIGURE_SUBST_FILES += [
-        'tools/update-packaging/Makefile',
-    ]
     CONFIGURE_DEFINE_FILES += [
         'mozilla-config.h',
     ]
     EXPORTS += [
         '!buildid.h',
         '!mozilla-config.h',
         '!source-repo.h',
     ]
@@ -109,50 +98,23 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] or not C
         'source-repo.h',
     ]
 
     GENERATED_FILES['buildid.h'].script = 'build/variables.py:buildid_header'
     GENERATED_FILES['source-repo.h'].script = 'build/variables.py:source_repo_header'
 
     DIRS += [
         'build',
-        'tools',
     ]
 
-if CONFIG['COMPILE_ENVIRONMENT'] and (CONFIG['MOZ_WIDGET_TOOLKIT'] or
-                                      CONFIG['JS_STANDALONE']):
-    DIRS += ['js/src']
-
 DIRS += [
-    'config/external/fdlibm',
-    'config/external/nspr',
-    'config/external/zlib',
-    'memory',
     'mfbt',
-    'mozglue',
 ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT']:
-    DIRS += ['xpcom/xpidl']
-
-if CONFIG['USE_ICU']:
-    DIRS += ['config/external/icu']
-
-if CONFIG['COMPILE_ENVIRONMENT']:
-    if CONFIG['MOZ_WIDGET_TOOLKIT']:
-        DIRS += [
-            'config/external',
-            'security',
-        ]
-
-    if CONFIG['BUILD_CTYPES']:
-        DIRS += ['config/external/ffi']
-
-else:
-    TEST_DIRS += ['js/src/tests']
-
-if not CONFIG['JS_STANDALONE'] and CONFIG['MOZ_BUILD_APP']:
+if CONFIG['MOZ_BUILD_APP']:
     # Bring in the configuration for the configured application.
     include('/' + CONFIG['MOZ_BUILD_APP'] + '/app.mozbuild')
+else:
+    include('/toolkit/toolkit.mozbuild')
 
 CONFIGURE_SUBST_FILES += ['.cargo/config']
 
 include('build/templates.mozbuild')
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -1,14 +1,38 @@
 # -*- Mode: python; c-basic-offset: 4; 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/.
 
+include('/js/app.mozbuild')
+
+PYTHON_UNITTEST_MANIFESTS += [
+    '/layout/tools/reftest/selftest/python.ini',
+    '/testing/marionette/harness/marionette_harness/tests/harness_unit/python.ini',
+    '/testing/mochitest/tests/python/python.ini',
+    '/testing/talos/talos/unittests/python.ini'
+]
+
+CONFIGURE_SUBST_FILES += [
+    '/tools/update-packaging/Makefile',
+]
+
+DIRS += [
+    '/tools',
+    '/xpcom/xpidl',
+]
+
+if CONFIG['COMPILE_ENVIRONMENT']:
+    DIRS += [
+        '/config/external',
+        '/security',
+    ]
+
 if CONFIG['ENABLE_TESTS']:
     DIRS += [
         '/toolkit/library/gtest/rust',
     ]
 
 DIRS += [
     '/toolkit/library/rust',
 ]