gecko-dev/toolkit/toolkit.mozbuild
Nathan Froyd f7fb6722a6 Bug 1231764 - part 6 - build rust code via cargo; r=chmanchester
This patch is really two separate changes.

The first change is that rust crates are large, standalone entities that
may contain multitudes of source files.  It therefore doesn't make sense
to keep them in SOURCES, as we have been doing.  Moving to use cargo
will require a higher-level approach, which suggests that we need a
different, higher-level representation for Rust sources in the build
system.

The representation here is to have the build system refer to things
defined in Cargo.toml files as the entities dealt with in the build
system, and let Cargo deal with the details of actually building things.
This approach means that adding a new crate to an existing library just
requires editing Rust and Cargo.toml files, rather than dealing with
moz.build, which seems more natural to Rust programmers.  By having the
source files for libraries (and binaries in subsequent iterations of
this support) checked in to the tree, we can also take advantage of
Cargo.lock files.

The second is that we switch the core build system over to building via
cargo, rather than invoking rustc directly.

We also clean up a number of leftover things from the Old Way of doing
things.  A number of tests are added to confirm that we'll only permit
crates to be built that have dependencies in-tree.
2016-08-06 00:49:26 -04:00

192 lines
4.1 KiB
Python

# -*- 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['MOZ_SANDBOX']:
DIRS += ['/security/sandbox']
DIRS += [
# Depends on NSS and NSPR, and must be built after sandbox or else B2G emulator
# builds fail.
'/security/certverifier',
# Depends on certverifier
'/security/apps',
]
# the signing related bits of libmar depend on nss
if CONFIG['MOZ_UPDATER']:
DIRS += ['/modules/libmar']
DIRS += [
'/config/external/freetype2',
'/xpcom',
'/modules/libpref',
'/intl',
'/netwerk',
]
if CONFIG['MOZ_AUTH_EXTENSION']:
DIRS += ['/extensions/auth']
if CONFIG['MOZ_UPDATER']:
DIRS += ['/other-licenses/bsdiff']
# Gecko/Core components.
DIRS += [
'/ipc',
'/js/ipc',
'/hal',
'/js/xpconnect',
'/intl/chardet',
'/media/libyuv',
'/modules/libjar',
'/storage',
]
if CONFIG['MOZ_PERMISSIONS']:
DIRS += [
'/extensions/cookie',
'/extensions/permissions',
]
DIRS += [
'/rdf',
]
if CONFIG['MOZ_WEBRTC']:
DIRS += [
'/media/webrtc',
'/media/mtransport',
]
if CONFIG['MOZ_OMX_PLUGIN']:
DIRS += [
'/media/omx-plugin/lib/ics/libutils',
'/media/omx-plugin/lib/ics/libstagefright',
'/media/omx-plugin/lib/ics/libvideoeditorplayer',
'/media/omx-plugin',
'/media/omx-plugin/kk',
]
if CONFIG['ENABLE_TESTS']:
DIRS += ['/testing/specialpowers']
DIRS += [
'/testing/gtest',
'/uriloader',
'/caps',
'/parser',
'/gfx',
'/image',
'/dom',
'/view',
'/widget',
'/editor',
'/layout',
'/docshell',
'/embedding',
'/xpfe/appshell'
]
# This needs to be built after the gfx/ directory
# to ensure all dependencies for skia (e.g. mozalloc, xpcom)
# have been built
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
DIRS += ['/other-licenses/skia-npapi']
if CONFIG['MOZ_UNIVERSALCHARDET']:
DIRS += ['/extensions/universalchardet']
if CONFIG['ACCESSIBILITY']:
DIRS += ['/accessible']
else:
DIRS += ['/accessible/ipc']
# toolkit
# This must precede xpfe.
if CONFIG['MOZ_JPROF']:
DIRS += ['/tools/jprof']
DIRS += [
'/tools/power',
'/tools/profiler',
'/tools/memory-profiler',
'/xpfe/components',
]
if CONFIG['MOZ_ENABLE_XREMOTE']:
DIRS += ['/widget/xremoteclient']
if CONFIG['MOZ_SPELLCHECK']:
DIRS += ['/extensions/spellcheck']
DIRS += [
'/security/manager',
'/toolkit',
]
if CONFIG['MOZ_PREF_EXTENSIONS']:
DIRS += ['/extensions/pref']
DIRS += [
'/devtools',
'/services',
'/startupcache',
'/js/ductwork/debugger',
'/other-licenses/snappy',
]
if CONFIG['MOZ_GIO_COMPONENT']:
DIRS += ['/extensions/gio']
if CONFIG['MOZ_RUST']:
DIRS += [
'/toolkit/library/gtest/rust',
'/toolkit/library/rust',
]
DIRS += [
'/toolkit/library/StaticXULComponentsEnd',
'/toolkit/library',
]
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
DIRS += ['/toolkit/system/gnome']
DIRS += ['/addon-sdk']
if CONFIG['ENABLE_MARIONETTE'] or CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('gonk', 'android'):
DIRS += ['/testing/marionette']
DIRS += [
'/tools/quitter',
'/media/gmp-clearkey/0.1',
]
if CONFIG['ENABLE_TESTS']:
DIRS += [
'/testing/mochitest',
'/testing/xpcshell',
'/testing/tools/minidumpwriter',
'/testing/tools/screenshot',
'/testing/profiles',
'/testing/mozbase',
'/testing/modules',
'/testing/runtimes',
'/testing/web-platform',
]
# The file id utility requires breakpad libraries.
if CONFIG['MOZ_CRASHREPORTER']:
DIRS += ['/testing/tools/fileid']
if CONFIG['MOZ_WEBRTC'] and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk' and not CONFIG['MOZ_TASK_TRACER']:
DIRS += [
'/media/webrtc/signaling/test',
'/media/mtransport/test',
]