Bug 1207897 - Add a configure option to build multiple build backends. r=gps

Also record what backends were requested at configure time so that running
`mach build-backend` or `config.status` uses the same set.
This commit is contained in:
Mike Hommey 2015-09-25 08:29:46 +09:00
parent 8742f025c6
commit 80df6c3cee
5 changed files with 34 additions and 6 deletions

View File

@ -222,3 +222,15 @@ MOZ_RUN_CONFIG_STATUS()],
define([AC_CONFIG_HEADER],
[m4_fatal([Use CONFIGURE_DEFINE_FILES in moz.build files to produce header files.])
])
define([MOZ_BUILD_BACKEND],
[
BUILD_BACKENDS="RecursiveMake"
MOZ_ARG_ENABLE_STRING(build-backend,
[ --enable-build-backend={AndroidEclipse,CppEclipse,VisualStudio,FasterMake}
Enable additional build backends],
[ BUILD_BACKENDS="RecursiveMake `echo $enableval | sed 's/,/ /g'`"])
AC_SUBST_LIST([BUILD_BACKENDS])
])

View File

@ -137,6 +137,8 @@ MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd`
MOZ_PYTHON
MOZ_BUILD_BACKEND
MOZ_DEFAULT_COMPILER
COMPILE_ENVIRONMENT=1

View File

@ -125,6 +125,8 @@ MOZ_ARG_WITH_STRING(dist-dir,
TOP_DIST=dist)
AC_SUBST(TOP_DIST)
MOZ_BUILD_BACKEND
MOZ_DEFAULT_COMPILER
COMPILE_ENVIRONMENT=1

View File

@ -88,6 +88,15 @@ def config_status(topobjdir='.', topsrcdir='.',
raise Exception('topsrcdir must be defined as an absolute directory: '
'%s' % topsrcdir)
default_backends = ['RecursiveMake']
# We have a chicken/egg problem, where we only have a dict for substs after
# creating the ConfigEnvironment, which requires argument parsing to have
# occurred.
for name, value in substs:
if name == 'BUILD_BACKENDS':
default_backends = value
break
parser = ArgumentParser()
parser.add_argument('--recheck', dest='recheck', action='store_true',
help='update config.status by reconfiguring in the same conditions')
@ -100,8 +109,9 @@ def config_status(topobjdir='.', topsrcdir='.',
parser.add_argument('-b', '--backend', nargs='+',
choices=['RecursiveMake', 'AndroidEclipse', 'CppEclipse',
'VisualStudio', 'FasterMake'],
default=['RecursiveMake'],
help='what backend to build (default: RecursiveMake).')
default=default_backends,
help='what backend to build (default: %s).' %
' '.join(default_backends))
options = parser.parse_args()
# Without -n, the current directory is meant to be the top object directory

View File

@ -561,9 +561,8 @@ class Build(MachCommandBase):
@CommandArgument('-b', '--backend', nargs='+',
choices=['RecursiveMake', 'AndroidEclipse', 'CppEclipse',
'VisualStudio', 'FasterMake'],
default=['RecursiveMake'],
help='Which backend to build (default: RecursiveMake).')
def build_backend(self, backend='RecursiveMake', diff=False):
help='Which backend to build.')
def build_backend(self, backend, diff=False):
python = self.virtualenv_manager.python_path
config_status = os.path.join(self.topobjdir, 'config.status')
@ -573,7 +572,10 @@ class Build(MachCommandBase):
% backend)
return 1
args = [python, config_status, '--backend'] + backend
args = [python, config_status]
if backend:
args.append('--backend')
args.extend(backend)
if diff:
args.append('--diff')