Bug 1417309 - Move some definitions from top-level moz.build to application-specific moz.build files. r=nalexander
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 08 Nov 2017 09:19:09 +0900
changeset 698683 74a6998f7206ed69b56b290a5eed70f187eb50ac
parent 698682 8c4fac311fe1fa7ffa906a87333e949de542e317
child 698684 1e648d0142777e06c6b4bddc51be0e918c93afe3
push id89331
push userbmo:mh+mozilla@glandium.org
push dateWed, 15 Nov 2017 23:40:09 +0000
reviewersnalexander
bugs1417309
milestone59.0a1
Bug 1417309 - Move some definitions from top-level moz.build to application-specific moz.build files. r=nalexander 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 the same information as they were 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
js/src/make-source-package.sh
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 += [
+        '/js/src',
+    ]
+else:
+    TEST_DIRS += [
+        '/js/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/js/src/make-source-package.sh
+++ b/js/src/make-source-package.sh
@@ -68,16 +68,17 @@ case $cmd in
     fi
     ${MKDIR} -p ${tgtpath}/js/src
 
     cp -pPR ${TOPSRCDIR}/configure.py \
        ${TOPSRCDIR}/moz.configure \
        ${TOPSRCDIR}/test.mozbuild \
        ${tgtpath}
 
+    cp -pPR ${TOPSRCDIR}/js/app.mozbuild ${tgtpath}/js
     cp -pPR ${TOPSRCDIR}/js/moz.configure ${tgtpath}/js
     cp -pPR ${TOPSRCDIR}/js/ffi.configure ${tgtpath}/js
 
     mkdir -p ${tgtpath}/taskcluster/taskgraph
     cp -pPR ${TOPSRCDIR}/taskcluster/moz.build ${tgtpath}/taskcluster/
     cp -pPR ${TOPSRCDIR}/taskcluster/taskgraph/test ${tgtpath}/taskcluster/taskgraph/
 
     # copy the embedded icu
--- a/moz.build
+++ b/moz.build
@@ -67,27 +67,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',
     ]
@@ -97,50 +86,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',
 ]