mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1227892 - Emit a specialized object for chrome.manifest entries. r=gps
This new ChromeManifestEntry object type is generic and can hold any kind of chrome manifest entry, but we currently only emit them for binary components. References to sub-directory manifests is left to the backend, for now, until all manifest entries are emitted by the frontend.
This commit is contained in:
parent
79e06586da
commit
3900e2c115
@ -5,19 +5,6 @@
|
||||
# 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/.
|
||||
|
||||
ifndef NO_DIST_INSTALL
|
||||
ifdef SHARED_LIBRARY
|
||||
ifdef IS_COMPONENT
|
||||
target:: $(SUBMAKEFILES) $(SHARED_LIBRARY)
|
||||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
|
||||
ifndef NO_COMPONENTS_MANIFEST
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest 'manifest components/components.manifest')
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/components/components.manifest 'binary-component $(SHARED_LIBRARY)')
|
||||
endif
|
||||
endif # IS_COMPONENT
|
||||
endif # SHARED_LIBRARY
|
||||
endif # !NO_DIST_INSTALL
|
||||
|
||||
ifndef NO_DIST_INSTALL
|
||||
|
||||
ifneq (,$(strip $(PROGRAM)$(SIMPLE_PROGRAMS)))
|
||||
@ -37,12 +24,10 @@ endif # LIBRARY
|
||||
|
||||
|
||||
ifdef SHARED_LIBRARY
|
||||
ifndef IS_COMPONENT
|
||||
SHARED_LIBRARY_FILES = $(SHARED_LIBRARY)
|
||||
SHARED_LIBRARY_DEST ?= $(FINAL_TARGET)
|
||||
SHARED_LIBRARY_DEST ?= $(FINAL_TARGET)$(if $(IS_COMPONENT),/components)
|
||||
SHARED_LIBRARY_TARGET = target
|
||||
INSTALL_TARGETS += SHARED_LIBRARY
|
||||
endif # ! IS_COMPONENT
|
||||
endif # SHARED_LIBRARY
|
||||
|
||||
ifneq (,$(strip $(HOST_SIMPLE_PROGRAMS)$(HOST_PROGRAM)))
|
||||
|
@ -6,6 +6,7 @@ from __future__ import absolute_import, unicode_literals, print_function
|
||||
|
||||
from mozbuild.backend.common import CommonBackend
|
||||
from mozbuild.frontend.data import (
|
||||
ChromeManifestEntry,
|
||||
ContextDerived,
|
||||
Defines,
|
||||
DistFiles,
|
||||
@ -167,6 +168,16 @@ class FasterMakeBackend(CommonBackend):
|
||||
self._add_preprocess(obj, f, '', defines=defines,
|
||||
silence_missing_directive_warnings=True)
|
||||
|
||||
elif isinstance(obj, ChromeManifestEntry) and \
|
||||
obj.install_target.startswith('dist/bin'):
|
||||
top_level = mozpath.join(obj.install_target, 'chrome.manifest')
|
||||
if obj.path != top_level:
|
||||
entry = 'manifest %s' % mozpath.relpath(obj.path,
|
||||
obj.install_target)
|
||||
if entry not in self._manifest_entries[top_level]:
|
||||
self._manifest_entries[top_level].append(entry)
|
||||
self._manifest_entries[obj.path].append(str(obj.entry))
|
||||
|
||||
else:
|
||||
# We currently ignore a lot of object types, so just acknowledge
|
||||
# everything.
|
||||
|
@ -37,6 +37,7 @@ from ..frontend.data import (
|
||||
AndroidExtraPackages,
|
||||
AndroidEclipseProjectData,
|
||||
BrandingFiles,
|
||||
ChromeManifestEntry,
|
||||
ConfigFileSubstitution,
|
||||
ContextDerived,
|
||||
ContextWrapped,
|
||||
@ -631,6 +632,9 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
for p in sorted(set(obj.packages)):
|
||||
backend_file.write('ANDROID_EXTRA_PACKAGES += %s\n' % p)
|
||||
|
||||
elif isinstance(obj, ChromeManifestEntry):
|
||||
self._process_chrome_manifest_entry(obj, backend_file)
|
||||
|
||||
else:
|
||||
return False
|
||||
|
||||
@ -1391,6 +1395,29 @@ INSTALL_TARGETS += %(prefix)s
|
||||
dest = mozpath.join(reltarget, path, mozpath.basename(f))
|
||||
install_manifest.add_symlink(source, dest)
|
||||
|
||||
def _process_chrome_manifest_entry(self, obj, backend_file):
|
||||
fragment = Makefile()
|
||||
rule = fragment.create_rule(targets=['misc:'])
|
||||
|
||||
top_level = mozpath.join(obj.install_target, 'chrome.manifest')
|
||||
if obj.path != top_level:
|
||||
args = [
|
||||
mozpath.join('$(DEPTH)', top_level),
|
||||
make_quote(shell_quote('manifest %s' %
|
||||
mozpath.relpath(obj.path,
|
||||
obj.install_target))),
|
||||
]
|
||||
rule.add_commands(['$(call py_action,buildlist,%s)' %
|
||||
' '.join(args)])
|
||||
args = [
|
||||
mozpath.join('$(DEPTH)', obj.path),
|
||||
make_quote(shell_quote(str(obj.entry))),
|
||||
]
|
||||
rule.add_commands(['$(call py_action,buildlist,%s)' % ' '.join(args)])
|
||||
fragment.dump(backend_file.fh, removal_guard=False)
|
||||
|
||||
self._no_skip['misc'].add(obj.relativedir)
|
||||
|
||||
def _write_manifests(self, dest, manifests):
|
||||
man_dir = mozpath.join(self.environment.topobjdir, '_build_manifests',
|
||||
dest)
|
||||
|
@ -19,6 +19,7 @@ from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from mozbuild.util import StrictOrderingOnAppendList
|
||||
from mozbuild.shellutil import quote as shell_quote
|
||||
from mozpack.chrome.manifest import ManifestEntry
|
||||
|
||||
import mozpack.path as mozpath
|
||||
from .context import FinalTargetValue
|
||||
@ -999,3 +1000,20 @@ class AndroidExtraPackages(ContextDerived):
|
||||
def __init__(self, context, packages):
|
||||
ContextDerived.__init__(self, context)
|
||||
self.packages = packages
|
||||
|
||||
class ChromeManifestEntry(ContextDerived):
|
||||
"""Represents a chrome.manifest entry."""
|
||||
|
||||
__slots__ = (
|
||||
'entry',
|
||||
)
|
||||
|
||||
def __init__(self, context, manifest_path, entry):
|
||||
ContextDerived.__init__(self, context)
|
||||
assert isinstance(entry, ManifestEntry)
|
||||
self.path = mozpath.join(self.install_target, manifest_path)
|
||||
# Ensure the entry is relative to the directory containing the
|
||||
# manifest path.
|
||||
entry = entry.rebase(mozpath.dirname(manifest_path))
|
||||
# Then add the install_target to the entry base directory.
|
||||
self.entry = entry.move(mozpath.dirname(self.path))
|
||||
|
@ -29,6 +29,7 @@ from .data import (
|
||||
AndroidExtraResDirs,
|
||||
AndroidResDirs,
|
||||
BrandingFiles,
|
||||
ChromeManifestEntry,
|
||||
ConfigFileSubstitution,
|
||||
ContextWrapped,
|
||||
Defines,
|
||||
@ -75,6 +76,7 @@ from .data import (
|
||||
WebIDLFile,
|
||||
XPIDLFile,
|
||||
)
|
||||
from mozpack.chrome.manifest import ManifestBinaryComponent
|
||||
|
||||
from .reader import SandboxValidationError
|
||||
|
||||
@ -509,6 +511,10 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
lib = SharedLibrary(context, libname, **shared_args)
|
||||
self._libs[libname].append(lib)
|
||||
self._linkage.append((context, lib, 'USE_LIBS'))
|
||||
if is_component and not context['NO_COMPONENTS_MANIFEST']:
|
||||
yield ChromeManifestEntry(context,
|
||||
'components/components.manifest',
|
||||
ManifestBinaryComponent('components', lib.lib_name))
|
||||
if static_lib:
|
||||
lib = StaticLibrary(context, libname, **static_args)
|
||||
self._libs[libname].append(lib)
|
||||
@ -582,7 +588,6 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
'LD_VERSION_SCRIPT',
|
||||
'USE_EXTENSION_MANIFEST',
|
||||
'NO_JS_MANIFEST',
|
||||
'NO_COMPONENTS_MANIFEST',
|
||||
]
|
||||
for v in varlist:
|
||||
if v in context and context[v]:
|
||||
@ -695,7 +700,8 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
if branding_files:
|
||||
yield BrandingFiles(context, branding_files)
|
||||
|
||||
self._handle_libraries(context)
|
||||
for obj in self._handle_libraries(context):
|
||||
yield obj
|
||||
|
||||
for obj in self._process_test_manifests(context):
|
||||
yield obj
|
||||
|
Loading…
Reference in New Issue
Block a user