Bug 910781 - add support for FINAL_TARGET_FILES; r=gps

This commit is contained in:
Joshua Cranmer 2014-07-23 13:56:25 -04:00
parent e81fe01221
commit 7faf79f786
7 changed files with 60 additions and 7 deletions

View file

@ -93,7 +93,7 @@ include backend.RecursiveMakeBackend.pp
default:: backend.RecursiveMakeBackend
install_manifests := \
$(addprefix dist/,bin idl include public private sdk) \
$(addprefix dist/,bin idl include public private sdk xpi-stage) \
_tests \
$(NULL)
install_manifest_depends = \

View file

@ -69,9 +69,6 @@ libs::
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(FINAL_TARGET)/chrome/icons/default
endif
libs:: $(srcdir)/profile/prefs.js
$(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile
ifndef LIBXUL_SDK
# channel-prefs.js is handled separate from other prefs due to bug 756325
libs:: $(srcdir)/profile/channel-prefs.js
@ -79,9 +76,6 @@ libs:: $(srcdir)/profile/channel-prefs.js
$(call py_action,preprocessor,-Fsubstitution $(PREF_PPFLAGS) $(ACDEFINES) $^ -o $(DIST)/bin/defaults/pref/channel-prefs.js)
endif
libs:: $(srcdir)/blocklist.xml
$(INSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
MAC_APP_NAME = $(MOZ_APP_DISPLAYNAME)

View file

@ -15,6 +15,9 @@ SOURCES += [
'nsBrowserApp.cpp',
]
FINAL_TARGET_FILES += ['blocklist.xml']
FINAL_TARGET_FILES.defaults.profile += ['profile/prefs.js']
DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
for var in ('MOZILLA_OFFICIAL', 'LIBXUL_SDK'):

View file

@ -36,6 +36,7 @@ from ..frontend.data import (
DirectoryTraversal,
Exports,
ExternalLibrary,
FinalTargetFiles,
GeneratedInclude,
HostLibrary,
HostProgram,
@ -307,6 +308,7 @@ class RecursiveMakeBackend(CommonBackend):
'dist_public',
'dist_private',
'dist_sdk',
'dist_xpi-stage',
'tests',
'xpidl',
]}
@ -479,6 +481,8 @@ class RecursiveMakeBackend(CommonBackend):
self._process_host_library(obj, backend_file)
self._process_linked_libraries(obj, backend_file)
elif isinstance(obj, FinalTargetFiles):
self._process_final_target_files(obj, obj.files, obj.target)
else:
return
obj.ack()
@ -1203,6 +1207,22 @@ INSTALL_TARGETS += %(prefix)s
# Process library-based defines
self._process_defines(obj.defines, backend_file)
def _process_final_target_files(self, obj, files, target):
if target.startswith('dist/bin'):
install_manifest = self._install_manifests['dist_bin']
reltarget = mozpath.relpath(target, 'dist/bin')
elif target.startswith('dist/xpi-stage'):
install_manifest = self._install_manifests['dist_xpi-stage']
reltarget = mozpath.relpath(target, 'dist/xpi-stage')
else:
raise Exception("Cannot install to " + target)
for path, strings in files.walk():
for f in strings:
source = mozpath.normpath(os.path.join(obj.srcdir, f))
dest = mozpath.join(reltarget, path, mozpath.basename(f))
install_manifest.add_symlink(source, dest)
def _write_manifests(self, dest, manifests):
man_dir = mozpath.join(self.environment.topobjdir, '_build_manifests',
dest)

View file

@ -501,6 +501,21 @@ VARIABLES = {
delimiters.
""", None),
'FINAL_TARGET_FILES': (HierarchicalStringList, list,
"""List of files to be installed into the application directory.
``FINAL_TARGET_FILES`` will copy (or symlink, if the platform supports it)
the contents of its files to the directory specified by
``FINAL_TARGET`` (typically ``dist/bin``). Files that are destined for a
subdirectory can be specified by accessing a field, or as a dict access.
For example, to export ``foo.png`` to the top-level directory and
``bar.svg`` to the directory ``images/do-not-use``, append to
``FINAL_TARGET_FILES`` like so::
FINAL_TARGET_FILES += ['foo.png']
FINAL_TARGET_FILES.images['do-not-use'] += ['bar.svg']
""", None),
'DISABLE_STL_WRAPPING': (bool, bool,
"""Disable the wrappers for STL which allow it to work with C++ exceptions
disabled.

View file

@ -753,6 +753,22 @@ class InstallationTarget(ContextDerived):
DIST_SUBDIR=self.subdir)) == self.target
class FinalTargetFiles(ContextDerived):
"""Sandbox container object for FINAL_TARGET_FILES, which is a
HierarchicalStringList.
We need an object derived from ContextDerived for use in the backend, so
this object fills that role. It just has a reference to the underlying
HierarchicalStringList, which is created when parsing FINAL_TARGET_FILES.
"""
__slots__ = ('files', 'target')
def __init__(self, sandbox, files, target):
ContextDerived.__init__(self, sandbox)
self.files = files
self.target = target
class ClassPathEntry(object):
"""Represents a classpathentry in an Android Eclipse project."""

View file

@ -30,6 +30,7 @@ from .data import (
Defines,
DirectoryTraversal,
Exports,
FinalTargetFiles,
GeneratedEventWebIDLFile,
GeneratedInclude,
GeneratedWebIDLFile,
@ -600,6 +601,10 @@ class TreeMetadataEmitter(LoggingMixin):
context.get('DIST_SUBDIR'):
yield InstallationTarget(context)
final_target_files = context.get('FINAL_TARGET_FILES')
if final_target_files:
yield FinalTargetFiles(context, final_target_files, context['FINAL_TARGET'])
host_libname = context.get('HOST_LIBRARY_NAME')
libname = context.get('LIBRARY_NAME')