Backed out 2 changesets (bug 1474028) per chmanchester`s request. a=backout

Backed out changeset 52bd814d3589 (bug 1474028)
Backed out changeset 39a528147c34 (bug 1474028)
This commit is contained in:
Narcis Beleuzu 2018-08-12 21:22:45 +03:00
Родитель ca86972424
Коммит f4e5fb2d0f
15 изменённых файлов: 100 добавлений и 131 удалений

Просмотреть файл

@ -107,13 +107,13 @@ def GeckoCppUnitTests(names, **kwargs):
@template
def GeckoSharedLibrary(name, output_category=None, **kwargs):
def GeckoSharedLibrary(name, **kwargs):
'''Template for shared libraries related to Gecko.
`name` identifies the library base name.
See the documentation for `GeckoBinary` for other possible arguments.
'''
SharedLibrary(name, output_category)
SharedLibrary(name)
kwargs.setdefault('mozglue', 'library')
@ -121,13 +121,13 @@ def GeckoSharedLibrary(name, output_category=None, **kwargs):
@template
def GeckoFramework(name, output_category=None, **kwargs):
def GeckoFramework(name, **kwargs):
'''Template for OSX frameworks related to Gecko.
`name` identifies the library base name.
See the documentation for `GeckoBinary` for other possible arguments.
'''
Framework(name, output_category)
Framework(name)
kwargs.setdefault('mozglue', 'library')

Просмотреть файл

@ -58,7 +58,7 @@ def AllowCompilerWarnings():
COMPILE_FLAGS['WARNINGS_AS_ERRORS'] = []
@template
def RustLibrary(name, features=None, target_dir=None, output_category=None):
def RustLibrary(name, features=None, target_dir=None):
'''Template for Rust libraries.'''
Library(name)
@ -72,27 +72,21 @@ def RustLibrary(name, features=None, target_dir=None, output_category=None):
if target_dir:
RUST_LIBRARY_TARGET_DIR = target_dir
if output_category:
RUST_LIBRARY_OUTPUT_CATEGORY = output_category
@template
def SharedLibrary(name, output_category=None):
def SharedLibrary(name):
'''Template for shared libraries.'''
Library(name)
FORCE_SHARED_LIB = True
if output_category:
SHARED_LIBRARY_OUTPUT_CATEGORY = output_category
Binary()
@template
def Framework(name, output_category=None):
def Framework(name):
'''Template for OSX Frameworks.'''
SharedLibrary(name, output_category)
SharedLibrary(name)
IS_FRAMEWORK = True

Просмотреть файл

@ -18,9 +18,7 @@ endif
ifdef SHARED_LIBRARY
SHARED_LIBRARY_FILES = $(SHARED_LIBRARY)
SHARED_LIBRARY_DEST ?= $(FINAL_TARGET)
ifndef SHARED_LIBRARY_TARGET
SHARED_LIBRARY_TARGET = target
endif
INSTALL_TARGETS += SHARED_LIBRARY
endif # SHARED_LIBRARY

Просмотреть файл

@ -41,7 +41,7 @@ binaries::
# Carefully avoid $(eval) type of rule generation, which makes pymake slower
# than necessary.
# Get current tier and corresponding subtiers from the data in root.mk.
CURRENT_TIER := $(filter $(foreach tier,$(TIERS) $(non_default_tiers),recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
CURRENT_TIER := $(filter $(foreach tier,$(TIERS),recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
ifneq (,$(filter-out 0 1,$(words $(CURRENT_TIER))))
$(error $(CURRENT_TIER) not supported on the same make command line)
endif

Просмотреть файл

@ -446,7 +446,7 @@ compile:: host target
host:: $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(HOST_RUST_PROGRAMS) $(HOST_RUST_LIBRARY_FILE) $(HOST_SHARED_LIBRARY)
target:: $(filter-out $(MOZBUILD_NON_DEFAULT_TARGETS),$(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(RUST_LIBRARY_FILE) $(RUST_PROGRAMS))
target:: $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(RUST_LIBRARY_FILE) $(RUST_PROGRAMS)
ifndef LIBRARY
ifdef OBJS

Просмотреть файл

@ -810,39 +810,12 @@ class RecursiveMakeBackend(CommonBackend):
compile_roots = [t for t, deps in self._compile_graph.iteritems()
if not deps or t not in all_compile_deps]
def add_category_rules(category, roots, graph):
rule = root_deps_mk.create_rule(['recurse_%s' % category])
rule.add_dependencies(roots)
for target, deps in sorted(graph.items()):
if deps:
rule = root_deps_mk.create_rule([target])
rule.add_dependencies(deps)
non_default_roots = defaultdict(list)
non_default_graphs = defaultdict(lambda: OrderedDefaultDict(set))
default_root_dirs = set()
for root in compile_roots:
# If this is a non-default target, separate the root from the
# rest of the compile graph.
target_name = mozpath.basename(root)
if target_name not in ('target', 'host'):
non_default_roots[target_name].append(root)
compile_roots.remove(root)
non_default_graphs[target_name][root] = self._compile_graph[root]
del self._compile_graph[root]
else:
dir_name = mozpath.dirname(root)
default_root_dirs.add(dir_name)
# If a directory only contains non-default compile targets, we don't
# attempt to dump symbols there.
self._no_skip['syms'] &= default_root_dirs
add_category_rules('compile', compile_roots, self._compile_graph)
for category, graph in non_default_graphs.iteritems():
add_category_rules(category, non_default_roots[category], graph)
rule = root_deps_mk.create_rule(['recurse_compile'])
rule.add_dependencies(compile_roots)
for target, deps in sorted(self._compile_graph.items()):
if deps:
rule = root_deps_mk.create_rule([target])
rule.add_dependencies(deps)
root_mk = Makefile()
@ -858,15 +831,6 @@ class RecursiveMakeBackend(CommonBackend):
root_mk.add_statement('syms_targets := %s' % ' '.join(sorted(
set('%s/syms' % d for d in self._no_skip['syms']))))
root_mk.add_statement('non_default_tiers := %s' % ' '.join(sorted(
non_default_roots.keys())))
for category, graphs in non_default_graphs.iteritems():
category_dirs = [mozpath.dirname(target)
for target in graphs.keys()]
root_mk.add_statement('%s_dirs := %s' % (category,
' '.join(category_dirs)))
root_mk.add_statement('include root-deps.mk')
with self._write_file(
@ -1288,10 +1252,6 @@ class RecursiveMakeBackend(CommonBackend):
backend_file.write('COMPUTED_%s += %s\n' % (var,
' '.join(make_quote(shell_quote(f)) for f in flags)))
def _process_non_default_target(self, libdef, target_name, backend_file):
backend_file.write("%s:: %s\n" % (libdef.output_category, target_name))
backend_file.write('MOZBUILD_NON_DEFAULT_TARGETS += %s\n' % target_name)
def _process_shared_library(self, libdef, backend_file):
backend_file.write_once('LIBRARY_NAME := %s\n' % libdef.basename)
backend_file.write('FORCE_SHARED_LIB := 1\n')
@ -1303,14 +1263,6 @@ class RecursiveMakeBackend(CommonBackend):
backend_file.write('SYMBOLS_FILE := %s\n' % libdef.symbols_file)
if not libdef.cxx_link:
backend_file.write('LIB_IS_C_ONLY := 1\n')
if libdef.output_category:
self._process_non_default_target(libdef, libdef.lib_name,
backend_file)
# Override the install rule target for this library. This is hacky,
# but can go away as soon as we start building libraries in their
# final location (bug 1459764).
backend_file.write('SHARED_LIBRARY_TARGET := %s\n' %
libdef.output_category)
def _process_static_library(self, libdef, backend_file):
backend_file.write_once('LIBRARY_NAME := %s\n' % libdef.basename)
@ -1331,8 +1283,6 @@ class RecursiveMakeBackend(CommonBackend):
backend_file.write('CARGO_TARGET_DIR := %s\n' % target_dir)
if libdef.features:
backend_file.write('%s := %s\n' % (libdef.FEATURES_VAR, ' '.join(libdef.features)))
if libdef.output_category:
self._process_non_default_target(libdef, libdef.import_name, backend_file)
def _process_host_library(self, libdef, backend_file):
backend_file.write('HOST_LIBRARY_NAME = %s\n' % libdef.basename)
@ -1341,11 +1291,8 @@ class RecursiveMakeBackend(CommonBackend):
backend_file.write('HOST_SHARED_LIBRARY = %s\n' % libdef.lib_name)
def _build_target_for_obj(self, obj):
target_name = obj.KIND
if hasattr(obj, 'output_category') and obj.output_category:
target_name = obj.output_category
return '%s/%s' % (mozpath.relpath(obj.objdir,
self.environment.topobjdir), target_name)
self.environment.topobjdir), obj.KIND)
def _process_linked_libraries(self, obj, backend_file):
def pretty_relpath(lib, name):

Просмотреть файл

@ -256,29 +256,23 @@ class TupBackend(CommonBackend):
# These are 'group' dependencies - All rules that list these as an output
# will be built before any rules that list this as an input.
self._installed_idls = self._output_group('installed-idls')
self._installed_files = self._output_group('installed-files')
self._rust_libs = self._output_group('rust-libs')
self._installed_idls = '$(MOZ_OBJ_ROOT)/<installed-idls>'
self._installed_files = '$(MOZ_OBJ_ROOT)/<installed-files>'
self._rust_libs = '$(MOZ_OBJ_ROOT)/<rust-libs>'
# The preprocessor including source-repo.h and buildid.h creates
# dependencies that aren't specified by moz.build and cause errors
# in Tup. Express these as a group dependency.
self._early_generated_files = self._output_group('early-generated-files')
self._early_generated_files = '$(MOZ_OBJ_ROOT)/<early-generated-files>'
self._shlibs = self._output_group('shlibs')
self._default_group = self._output_group('default')
self._shlibs = '$(MOZ_OBJ_ROOT)/<shlibs>'
self._gtests = '$(MOZ_OBJ_ROOT)/<gtest>'
self._default_group = '$(MOZ_OBJ_ROOT)/<default>'
self._rust_cmds = set()
self._built_in_addons = set()
self._built_in_addons_file = 'dist/bin/browser/chrome/browser/content/browser/built_in_addons.json'
def _output_group(self, label):
if label:
return '$(MOZ_OBJ_ROOT)/<%s>' % label
def _rust_output_group(self, label):
if label:
return self._output_group('rust-' + label)
def _get_mozconfig_env(self, config):
env = {}
@ -349,8 +343,8 @@ class TupBackend(CommonBackend):
shlib = backend_file.shared_lib
output_group = self._shlibs
if shlib.output_category:
output_group = self._output_group(shlib.output_category)
if 'toolkit/library/gtest' in backend_file.objdir:
output_group = self._gtests
if shlib.cxx_link:
mkshlib = (
@ -377,16 +371,16 @@ class TupBackend(CommonBackend):
list_file_name = '%s.list' % shlib.name.replace('.', '_')
list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
rust_linked = [l for l in backend_file.shared_lib.linked_libraries
if isinstance(l, RustLibrary)]
rust_linked = self._lib_paths(backend_file.objdir,
(l for l in backend_file.shared_lib.linked_libraries
if isinstance(l, RustLibrary)))
inputs = objs + static_libs + shared_libs
extra_inputs = []
if rust_linked:
extra_inputs = [self._rust_output_group(rust_linked[0].output_category) or
self._rust_libs]
static_libs += self._lib_paths(backend_file.objdir, rust_linked)
extra_inputs = [self._rust_libs]
static_libs += rust_linked
symbols_file = []
if (shlib.symbols_file and
@ -745,7 +739,7 @@ class TupBackend(CommonBackend):
return env
def _gen_cargo_rules(self, backend_file, build_plan, cargo_env, output_group):
def _gen_cargo_rules(self, backend_file, build_plan, cargo_env):
invocations = build_plan['invocations']
processed = set()
@ -837,14 +831,14 @@ class TupBackend(CommonBackend):
command,
inputs=sorted(inputs),
outputs=outputs,
output_group=output_group,
output_group=self._rust_libs,
extra_inputs=[self._installed_files],
display='%s %s' % (header, display_name(invocation)),
check_unchanged=check_unchanged,
)
for dst, link in invocation['links'].iteritems():
rust_backend_file.symlink_rule(link, dst, output_group)
rust_backend_file.symlink_rule(link, dst, self._rust_libs)
for val in enumerate(invocations):
_process(*val)
@ -868,10 +862,7 @@ class TupBackend(CommonBackend):
'\n'.join(output_lines))
cargo_plan = json.loads(''.join(output_lines))
self._gen_cargo_rules(backend_file, cargo_plan, cargo_env,
self._rust_output_group(obj.output_category) or
self._rust_libs)
self._gen_cargo_rules(backend_file, cargo_plan, cargo_env)
self.backend_input_files |= set(cargo_plan['inputs'])

Просмотреть файл

@ -1552,18 +1552,6 @@ VARIABLES = {
Implies FORCE_SHARED_LIB.
"""),
'SHARED_LIBRARY_OUTPUT_CATEGORY': (unicode, unicode,
"""The output category for this context's shared library. If set this will
correspond to the build command that will build this shared library, and
the library will not be built as part of the default build.
"""),
'RUST_LIBRARY_OUTPUT_CATEGORY': (unicode, unicode,
"""The output category for this context's rust library. If set this will
correspond to the build command that will build this rust library, and
the library will not be built as part of the default build.
"""),
'IS_FRAMEWORK': (bool, bool,
"""Whether the library to build should be built as a framework on OSX.

Просмотреть файл

@ -673,7 +673,6 @@ class RustLibrary(StaticLibrary):
'deps_path',
'features',
'target_dir',
'output_category',
)
TARGET_SUBST_VAR = 'RUST_TARGET'
FEATURES_VAR = 'RUST_LIBRARY_FEATURES'
@ -695,7 +694,6 @@ class RustLibrary(StaticLibrary):
self.dependencies = dependencies
self.features = features
self.target_dir = target_dir
self.output_category = context.get('RUST_LIBRARY_OUTPUT_CATEGORY')
# Skip setting properties below which depend on cargo
# when we don't have a compile environment. The required
# config keys won't be available, but the instance variables
@ -715,7 +713,6 @@ class SharedLibrary(Library):
'soname',
'variant',
'symbols_file',
'output_category',
)
DICT_ATTRS = {
@ -736,7 +733,6 @@ class SharedLibrary(Library):
Library.__init__(self, context, basename, real_name)
self.variant = variant
self.lib_name = real_name or basename
self.output_category = context.get('SHARED_LIBRARY_OUTPUT_CATEGORY')
assert self.lib_name
if variant == self.FRAMEWORK:

Просмотреть файл

@ -601,12 +601,19 @@ class GTestCommands(MachCommandBase):
active_backend = config.substs.get('BUILD_BACKENDS', [None])[0]
if 'Tup' in active_backend:
gtest_build_target = mozpath.join(self.topobjdir, '<gtest>')
gtest_build_path = mozpath.join(self.topobjdir, '<gtest>')
else:
gtest_build_target = 'recurse_gtest'
# This path happens build the necessary parts of the tree in the
# Make backend due to the odd nature of partial tree builds.
gtest_build_path = mozpath.relpath(mozpath.join(self.topobjdir,
'toolkit', 'library',
'gtest', 'rust'),
self.topsrcdir)
os.environ[b'LINK_GTEST_DURING_COMPILE'] = b'1'
res = self._mach_context.commands.dispatch('build', self._mach_context,
what=[gtest_build_target])
what=[gtest_build_path])
del os.environ[b'LINK_GTEST_DURING_COMPILE']
if res:
print("Could not build xul-gtest")
return res

Просмотреть файл

@ -2,6 +2,27 @@
# 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/.
# Enforce that the clean/distclean rules removes everything that needs
# to be removed from this directory.
ifneq (,$(filter clean distclean,$(MAKECMDGOALS)))
LINK_GTEST_DURING_COMPILE = 1
endif
# Don't link the gtest xul during MOZ_PROFILE_GENERATE, it doesn't get
# used during profiling anyway.
ifdef MOZ_PROFILE_GENERATE
LINK_GTEST_DURING_COMPILE =
endif
ifndef LINK_GTEST_DURING_COMPILE
# Force to not include backend.mk unless LINK_GTEST_DURING_COMPILE is set.
# Not including backend.mk makes traversing this directory do nothing.
STANDALONE_MAKEFILE = 1
else
include $(topsrcdir)/toolkit/library/libxul.mk
include $(topsrcdir)/config/config.mk
endif

Просмотреть файл

@ -32,8 +32,7 @@ if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android':
# This needs to come after static:xul to avoid things like libfallible coming
# before StaticXULComponentStart.
Libxul('xul-gtest-real',
output_category=None if CONFIG['LINK_GTEST_DURING_COMPILE'] else 'gtest')
Libxul('xul-gtest-real')
DIRS += [
'static',

Просмотреть файл

@ -0,0 +1,29 @@
# 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/.
# This file looks quite similar to toolkit/library/gtest/Makefile.in.
# We only want to build gkrust-gtest when we are building libxul-gtest.
# Enforce that the clean/distclean rules removes everything that needs
# to be removed from this directory.
ifneq (,$(filter clean distclean,$(MAKECMDGOALS)))
LINK_GTEST_DURING_COMPILE = 1
endif
# Don't build gkrust-gtest during MOZ_PROFILE_GENERATE, it doesn't get
# used during profiling anyway.
ifdef MOZ_PROFILE_GENERATE
LINK_GTEST_DURING_COMPILE =
endif
ifndef LINK_GTEST_DURING_COMPILE
# Force to not include backend.mk unless LINK_GTEST_DURING_COMPILE is set.
# Not including backend.mk makes traversing this directory do nothing.
STANDALONE_MAKEFILE = 1
else
include $(topsrcdir)/config/config.mk
endif

Просмотреть файл

@ -6,5 +6,4 @@
include('../../rust/gkrust-features.mozbuild')
RustLibrary('gkrust-gtest', gkrust_features, '../..',
output_category=None if CONFIG['LINK_GTEST_DURING_COMPILE'] else 'gtest')
RustLibrary('gkrust-gtest', gkrust_features, '../..')

Просмотреть файл

@ -12,14 +12,14 @@ def Libxul_defines():
LIBRARY_DEFINES['STATIC_EXPORTABLE_JS_API'] = True
@template
def Libxul(name, output_category=None):
def Libxul(name):
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
# This is going to be a framework named "XUL", not an ordinary library named
# "libxul.dylib"
GeckoFramework(name, output_category=output_category, linkage=None)
GeckoFramework(name, linkage=None)
SHARED_LIBRARY_NAME = 'XUL'
else:
GeckoSharedLibrary(name, output_category=output_category, linkage=None)
GeckoSharedLibrary(name, linkage=None)
SHARED_LIBRARY_NAME = 'xul'
DELAYLOAD_DLLS += [