Bug 1412431 - Remove support for MOZ_BUILD_PROJECTS; r=nalexander

This was mainly used to support Universal MacOS builds, which were
removed several months ago.

In theory, someone could be using this feature to build multiple
applications with one build system invocation. But given that client.mk
is no longer the preferred interface to the build system and multiple
applications can be built by running `mach build` with different
mozconfigs, I don't think support for this feature is worth keeping.

This commit removes support for MOZ_BUILD_PROJECTS and related
functionality from client.mk. Support for recognizing
MOZ_CURRENT_PROJECT in configure and mozconfig evaluation has also
been removed. This includes support for the ac_add_app_options
mozconfig function.

Good riddance.

MozReview-Commit-ID: 7xI2jYxDFFr

--HG--
extra : rebase_source : 91068f3b8ae32fbcda4defb5d4bb086a04387598
This commit is contained in:
Gregory Szorc 2017-10-27 15:20:34 -07:00
parent e49a038fb6
commit 7d078ee731
6 changed files with 11 additions and 127 deletions

View File

@ -88,7 +88,6 @@ set_config('MOZ_AUTOMATION', depends_if('MOZ_AUTOMATION')(lambda x: True))
option(env='OLD_CONFIGURE', nargs=1, help='Path to the old configure script')
option(env='MOZ_CURRENT_PROJECT', nargs=1, help='Current build project')
option(env='MOZCONFIG', nargs=1, help='Mozconfig location')
option('--with-external-source-dir', env='EXTERNAL_SOURCE_DIR', nargs=1,
@ -111,11 +110,11 @@ add_old_configure_assignment('EXTERNAL_SOURCE_DIR', external_source_dir)
# be called when --help is passed, and the mozconfig wouldn't be read.
@depends('MOZ_CURRENT_PROJECT', 'MOZCONFIG', 'OLD_CONFIGURE',
@depends('MOZCONFIG', 'OLD_CONFIGURE',
check_build_environment, '--with-external-source-dir',
'--help')
@imports(_from='mozbuild.mozconfig', _import='MozconfigLoader')
def mozconfig(current_project, mozconfig, old_configure, build_env,
def mozconfig(mozconfig, old_configure, build_env,
external_source_dir, help):
if not old_configure:
die('The OLD_CONFIGURE environment variable must be set')
@ -143,10 +142,9 @@ def mozconfig(current_project, mozconfig, old_configure, build_env,
if external_source_dir:
topsrcdir = external_source_dir[0]
loader = MozconfigLoader(topsrcdir)
current_project = current_project[0] if current_project else None
mozconfig = mozconfig[0] if mozconfig else None
mozconfig = loader.find_mozconfig(env={'MOZCONFIG': mozconfig})
mozconfig = loader.read_mozconfig(mozconfig, moz_build_app=current_project)
mozconfig = loader.read_mozconfig(mozconfig)
return mozconfig

View File

@ -22,8 +22,6 @@
# more information.
#
# Options:
# MOZ_BUILD_PROJECTS - Build multiple projects in subdirectories
# of MOZ_OBJDIR
# MOZ_OBJDIR - Destination object directory
# MOZ_MAKE_FLAGS - Flags to pass to $(MAKE)
# MOZ_PREFLIGHT_ALL - Makefiles to run before building.
@ -105,8 +103,7 @@ endef
# followed by a space (since sed doesn't remove newlines), except on the
# last line, so replace both '|| ' and '||'.
# Also, make MOZ_PGO available to mozconfig when passed on make command line.
# Likewise for MOZ_CURRENT_PROJECT.
MOZCONFIG_CONTENT := $(subst ||,$(CR),$(subst || ,$(CR),$(shell $(addprefix MOZ_CURRENT_PROJECT=,$(MOZ_CURRENT_PROJECT)) MOZ_PGO=$(MOZ_PGO) $(TOPSRCDIR)/mach environment --format=client.mk | sed 's/$$/||/')))
MOZCONFIG_CONTENT := $(subst ||,$(CR),$(subst || ,$(CR),$(shell MOZ_PGO=$(MOZ_PGO) $(TOPSRCDIR)/mach environment --format=client.mk | sed 's/$$/||/')))
$(eval $(MOZCONFIG_CONTENT))
export FOUND_MOZCONFIG
@ -144,16 +141,6 @@ MOZ_MAKE_FLAGS += --output-sync=line
endif
endif
ifdef MOZ_BUILD_PROJECTS
ifdef MOZ_CURRENT_PROJECT
BUILD_PROJECT_ARG = MOZ_BUILD_APP=$(MOZ_CURRENT_PROJECT)
export MOZ_CURRENT_PROJECT
else
MOZ_MAKE = $(error Cannot build in the OBJDIR when MOZ_CURRENT_PROJECT is not set.)
endif
endif # MOZ_BUILD_PROJECTS
MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
# 'configure' scripts generated by autoconf.
@ -177,33 +164,16 @@ include $(TOPSRCDIR)/config/baseconfig.mk
include $(TOPSRCDIR)/config/makefiles/makeutils.mk
include $(TOPSRCDIR)/config/makefiles/autotargets.mk
# Create a makefile containing the mk_add_options values from mozconfig,
# but only do so when OBJDIR is defined (see further above).
ifdef MOZ_BUILD_PROJECTS
ifdef MOZ_CURRENT_PROJECT
WANT_MOZCONFIG_MK = 1
else
WANT_MOZCONFIG_MK =
endif
else
WANT_MOZCONFIG_MK = 1
endif
ifdef WANT_MOZCONFIG_MK
# For now, only output "export" lines and lines containing UPLOAD_EXTRA_FILES
# from mach environment --format=client.mk output.
MOZCONFIG_MK_LINES := $(filter export||% UPLOAD_EXTRA_FILES% %UPLOAD_EXTRA_FILES%,$(MOZCONFIG_OUT_LINES))
$(OBJDIR)/.mozconfig.mk: $(TOPSRCDIR)/client.mk $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDIR)/CLOBBER
$(if $(MOZCONFIG_MK_LINES),( $(foreach line,$(MOZCONFIG_MK_LINES), echo '$(subst ||, ,$(line))';) )) > $@
ifdef MOZ_CURRENT_PROJECT
echo export MOZ_CURRENT_PROJECT=$(MOZ_CURRENT_PROJECT) >> $@
endif
# Include that makefile so that it is created. This should not actually change
# the environment since MOZCONFIG_CONTENT, which MOZCONFIG_OUT_LINES derives
# from, has already been eval'ed.
include $(OBJDIR)/.mozconfig.mk
endif
# Print out any options loaded from mozconfig.
all realbuild clean distclean export libs install realclean::
@ -224,9 +194,8 @@ everything: clean build
####################################
# Profile-Guided Optimization
# This is up here, outside of the MOZ_CURRENT_PROJECT logic so that this
# is usable in multi-pass builds, where you might not have a runnable
# application until all the build passes and postflight scripts have run.
# This is up here so that this is usable in multi-pass builds, where you
# might not have a runnable application until all the build passes have run.
profiledbuild::
$(call BUILDSTATUS,TIERS pgo_profile_generate pgo_package pgo_profile pgo_clobber pgo_profile_use)
$(call BUILDSTATUS,TIER_START pgo_profile_generate)
@ -249,40 +218,13 @@ profiledbuild::
#####################################################
# Preflight, before building any project
ifdef MOZ_PREFLIGHT_ALL
realbuild preflight_all::
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_PREFLIGHT_ALL),,1))
# Don't run preflight_all for individual projects in multi-project builds
# (when MOZ_CURRENT_PROJECT is set.)
ifndef MOZ_BUILD_PROJECTS
# Building a single project, OBJDIR is usable.
set -e; \
for mkfile in $(MOZ_PREFLIGHT_ALL); do \
$(MAKE) -f $(TOPSRCDIR)/$$mkfile preflight_all TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
done
else
# OBJDIR refers to the project-specific OBJDIR, which is not available at
# this point when building multiple projects. Only MOZ_OBJDIR is available.
set -e; \
for mkfile in $(MOZ_PREFLIGHT_ALL); do \
$(MAKE) -f $(TOPSRCDIR)/$$mkfile preflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS='$(MOZ_BUILD_PROJECTS)'; \
done
endif
endif
# If we're building multiple projects, but haven't specified which project,
# loop through them.
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_BUILD_PROJECTS),,1))
configure realbuild $(OBJDIR_TARGETS)::
set -e; \
for app in $(MOZ_BUILD_PROJECTS); do \
$(MAKE) -f $(TOPSRCDIR)/client.mk $@ MOZ_CURRENT_PROJECT=$$app; \
done
else
# MOZ_CURRENT_PROJECT: either doing a single-project build, or building an
# individual project in a multi-project build.
####################################
# Configure
@ -345,7 +287,6 @@ configure-preqs = \
$(OBJDIR)/CLOBBER \
configure-files \
$(call mkdir_deps,$(OBJDIR)) \
$(if $(MOZ_BUILD_PROJECTS),$(call mkdir_deps,$(MOZ_OBJDIR))) \
save-mozconfig \
$(OBJDIR)/.mozconfig.json \
$(NULL)
@ -402,38 +343,20 @@ realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(OBJDIR_TARGETS):: $(OBJDIR)/Makefile $(OBJDIR)/config.status
+$(MOZ_MAKE) $@
endif # MOZ_CURRENT_PROJECT
####################################
# Postflight, after building all projects
ifdef MOZ_AUTOMATION
ifndef MOZ_CURRENT_PROJECT
$(if $(MOZ_PGO),profiledbuild,realbuild)::
# Only run the automation/build target for the first project.
# (i.e. first platform of universal builds)
$(MAKE) -f $(TOPSRCDIR)/client.mk automation/build $(addprefix MOZ_CURRENT_PROJECT=,$(firstword $(MOZ_BUILD_PROJECTS)))
endif
$(MAKE) -f $(TOPSRCDIR)/client.mk automation/build
endif
ifdef MOZ_POSTFLIGHT_ALL
realbuild postflight_all::
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_POSTFLIGHT_ALL),,1))
# Don't run postflight_all for individual projects in multi-project builds
# (when MOZ_CURRENT_PROJECT is set.)
ifndef MOZ_BUILD_PROJECTS
# Building a single project, OBJDIR is usable.
set -e; \
for mkfile in $(MOZ_POSTFLIGHT_ALL); do \
$(MAKE) -f $(TOPSRCDIR)/$$mkfile postflight_all TOPSRCDIR=$(TOPSRCDIR) OBJDIR=$(OBJDIR) MOZ_OBJDIR=$(MOZ_OBJDIR); \
done
else
# OBJDIR refers to the project-specific OBJDIR, which is not available at
# this point when building multiple projects. Only MOZ_OBJDIR is available.
set -e; \
for mkfile in $(MOZ_POSTFLIGHT_ALL); do \
$(MAKE) -f $(TOPSRCDIR)/$$mkfile postflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS='$(MOZ_BUILD_PROJECTS)'; \
done
endif
endif
echo-variable-%:

View File

@ -215,8 +215,7 @@ class MozbuildObject(ProcessExecutionMixin):
"""
if not isinstance(self._mozconfig, dict):
loader = MozconfigLoader(self.topsrcdir)
self._mozconfig = loader.read_mozconfig(path=self._mozconfig,
moz_build_app=os.environ.get('MOZ_CURRENT_PROJECT'))
self._mozconfig = loader.read_mozconfig(path=self._mozconfig)
return self._mozconfig

View File

@ -189,7 +189,7 @@ class MozconfigLoader(object):
return None
def read_mozconfig(self, path=None, moz_build_app=None):
def read_mozconfig(self, path=None):
"""Read the contents of a mozconfig into a data structure.
This takes the path to a mozconfig to load. If the given path is
@ -314,10 +314,6 @@ class MozconfigLoader(object):
result['configure_args'] = [self._expand(o) for o in parsed['ac']]
if moz_build_app is not None:
result['configure_args'].extend(self._expand(o) for o in
parsed['ac_app'][moz_build_app])
if 'MOZ_OBJDIR' in parsed['env_before']:
result['topobjdir'] = parsed['env_before']['MOZ_OBJDIR']
@ -347,7 +343,6 @@ class MozconfigLoader(object):
def _parse_loader_output(self, output):
mk_options = []
ac_options = []
ac_app_options = defaultdict(list)
before_source = {}
after_source = {}
env_before_source = {}
@ -385,9 +380,6 @@ class MozconfigLoader(object):
ac_options.append('\n'.join(current))
elif current_type == 'MK_OPTION':
mk_options.append('\n'.join(current))
elif current_type == 'AC_APP_OPTION':
app = current.pop(0)
ac_app_options[app].append('\n'.join(current))
current = None
current_type = None
@ -474,7 +466,6 @@ class MozconfigLoader(object):
return {
'mk': mk_options,
'ac': ac_options,
'ac_app': ac_app_options,
'vars_before': before_source,
'vars_after': after_source,
'env_before': env_before_source,

View File

@ -24,15 +24,6 @@ ac_add_options() {
done
}
ac_add_app_options() {
_mozconfig_app=$1
shift
echo "------BEGIN_AC_APP_OPTION"
echo $_mozconfig_app
echo "$*"
echo "------END_AC_APP_OPTION"
}
mk_add_options() {
for _mozconfig_opt; do
echo "------BEGIN_MK_OPTION"

View File

@ -287,24 +287,6 @@ class TestMozconfigLoader(unittest.TestCase):
self.assertEqual(result['configure_args'], [
'--foo=%s' % loader.topsrcdir])
def test_read_ac_app_options(self):
with NamedTemporaryFile(mode='w') as mozconfig:
mozconfig.write('ac_add_options --foo=@TOPSRCDIR@\n')
mozconfig.write('ac_add_app_options app1 --bar=@TOPSRCDIR@\n')
mozconfig.write('ac_add_app_options app2 --bar=x\n')
mozconfig.flush()
loader = self.get_loader()
result = loader.read_mozconfig(mozconfig.name, moz_build_app='app1')
self.assertEqual(result['configure_args'], [
'--foo=%s' % loader.topsrcdir,
'--bar=%s' % loader.topsrcdir])
result = loader.read_mozconfig(mozconfig.name, moz_build_app='app2')
self.assertEqual(result['configure_args'], [
'--foo=%s' % loader.topsrcdir,
'--bar=x'])
def test_read_capture_mk_options(self):
"""Ensures mk_add_options calls are captured."""
with NamedTemporaryFile(mode='w') as mozconfig: