Skip to content

Commit

Permalink
Bug 1239217 - Add the FasterMake+RecursiveMake hybrid backend. r=gps
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Jan 22, 2016
1 parent e50a6cf commit 6098e02
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 3 deletions.
24 changes: 23 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,16 @@ default:: $(BUILD_BACKEND_FILES)
endif

install_manifests := \
$(addprefix dist/,bin branding idl include public private sdk xpi-stage) \
$(addprefix dist/,branding idl include public private sdk xpi-stage) \
_tests \
$(NULL)
# Skip the dist/bin install manifest when using the hybrid
# FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
# xpidl handling to FasterMake in that case, mechanically making the dist/bin
# install manifest non-existent (non-existent manifests being skipped)
ifeq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
install_manifests += dist/bin
endif
install_manifest_depends = \
CLOBBER \
$(configure_dir)/configure \
Expand All @@ -145,6 +152,15 @@ endif
.PHONY: install-manifests
install-manifests: $(addprefix install-,$(install_manifests))

# If we're using the hybrid FasterMake/RecursiveMake backend, we want
# to recurse in the faster/ directory in parallel of install manifests.
ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
install-manifests: faster
.PHONY: faster
faster:
$(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
endif

# process_install_manifest needs to be invoked with --no-remove when building
# js as standalone because automated builds are building nspr separately and
# that would remove the resulting files.
Expand All @@ -156,6 +172,12 @@ endif

.PHONY: $(addprefix install-,$(subst /,_,$(install_manifests)))
$(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends)
ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
@# If we're using the hybrid FasterMake/RecursiveMake backend, we want
@# to ensure the FasterMake end doesn't have install manifests for the
@# same directory, because that would blow up
$(if $(wildcard _build_manifests/install/$(subst /,_,$*)),$(if $(wildcard faster/install_$(subst /,_,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle $*)))
endif
$(addprefix $(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )$*) ,$(wildcard _build_manifests/install/$(subst /,_,$*)))

# Dummy wrapper rule to allow the faster backend to piggy back
Expand Down
7 changes: 6 additions & 1 deletion config/faster/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,19 @@ ifndef NO_XPIDL
default: $(TOPOBJDIR)/config/makefiles/xpidl/xpidl
endif

ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
# Mac builds require to copy things in dist/bin/*.app
# TODO: remove the MOZ_WIDGET_TOOLKIT and MOZ_BUILD_APP variables from
# faster/Makefile and python/mozbuild/mozbuild/test/backend/test_build.py
# when this is not required anymore.
# We however don't need to do this when using the hybrid
# FasterMake/RecursiveMake backend (FASTER_RECURSIVE_MAKE is set when
# recursing from the RecursiveMake backend)
ifndef FASTER_RECURSIVE_MAKE
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
default:
$(MAKE) -C $(TOPOBJDIR)/$(MOZ_BUILD_APP)/app repackage
endif
endif

.PHONY: FORCE

Expand Down
6 changes: 6 additions & 0 deletions python/mozbuild/mozbuild/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@
'CompileDB': 'mozbuild.compilation.database',
'CppEclipse': 'mozbuild.backend.cpp_eclipse',
'FasterMake': 'mozbuild.backend.fastermake',
'FasterMake+RecursiveMake': None,
'RecursiveMake': 'mozbuild.backend.recursivemake',
'VisualStudio': 'mozbuild.backend.visualstudio',
}


def get_backend_class(name):
if '+' in name:
from mozbuild.backend.base import HybridBackend
return HybridBackend(*(get_backend_class(name)
for name in name.split('+')))

class_name = '%sBackend' % name
module = __import__(backends[name], globals(), locals(), [class_name])
return getattr(module, class_name)
4 changes: 3 additions & 1 deletion python/mozbuild/mozbuild/backend/fastermake.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def consume_finished(self):
'MOZ_BUILD_APP',
'MOZ_WIDGET_TOOLKIT',
):
mk.add_statement('%s = %s' % (var, self.environment.substs[var]))
value = self.environment.substs.get(var)
if value is not None:
mk.add_statement('%s = %s' % (var, value))

install_manifests_bases = self._install_manifests.keys()

Expand Down
25 changes: 25 additions & 0 deletions python/mozbuild/mozbuild/test/backend/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import mozpack.path as mozpath
from contextlib import contextmanager
from mozunit import main
from mozbuild.backend import get_backend_class
from mozbuild.backend.configenvironment import ConfigEnvironment
from mozbuild.backend.recursivemake import RecursiveMakeBackend
from mozbuild.backend.fastermake import FasterMakeBackend
Expand Down Expand Up @@ -92,6 +93,30 @@ def test_recursive_make(self):

self.validate(config)

def test_faster_recursive_make(self):
substs = list(BASE_SUBSTS) + [
('BUILD_BACKENDS', 'FasterMake+RecursiveMake'),
]
with self.do_test_backend(get_backend_class(
'FasterMake+RecursiveMake'), substs=substs) as config:
buildid = mozpath.join(config.topobjdir, 'config', 'buildid')
ensureParentDir(buildid)
with open(buildid, 'w') as fh:
fh.write('20100101012345\n')

build = MozbuildObject(config.topsrcdir, None, None,
config.topobjdir)
overrides = [
'install_manifest_depends=',
'MOZ_CHROME_FILE_FORMAT=flat',
'TEST_MOZBUILD=1',
]
with self.line_handler() as handle_make_line:
build._run_make(directory=config.topobjdir, target=overrides,
silent=False, line_handler=handle_make_line)

self.validate(config)

def test_faster_make(self):
substs = list(BASE_SUBSTS) + [
('MOZ_BUILD_APP', 'dummy_app'),
Expand Down

0 comments on commit 6098e02

Please sign in to comment.