Bug 1295542 - Ensure at least an empty chrome.manifest next to each omnijar file. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 13 Sep 2016 18:05:15 +0900
changeset 314575 ccf231e054b5b6974fb98abdb669e2231eac23be
parent 314469 8192ae07b2ba5c67d170d9d5a4257aabd52dae2d
child 314576 bc66eae9b55b62d733c0dd3392cabf99890548f1
push id30732
push usercbook@mozilla.com
push dateWed, 21 Sep 2016 10:04:03 +0000
treeherdermozilla-central@560b2c805bf7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1295542
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1295542 - Ensure at least an empty chrome.manifest next to each omnijar file. r=gps
python/mozbuild/mozpack/packager/formats.py
python/mozbuild/mozpack/test/test_packager_formats.py
--- a/python/mozbuild/mozpack/packager/formats.py
+++ b/python/mozbuild/mozpack/packager/formats.py
@@ -250,16 +250,21 @@ class OmniJarFormatter(JarFormatter):
         JarFormatter.__init__(self, copier, compress, optimize)
         self._omnijar_name = omnijar_name
         self._non_resources = non_resources
 
     def _add_base(self, base, addon=False):
         if addon:
             JarFormatter._add_base(self, base, addon)
         else:
+            # Initialize a chrome.manifest next to the omnijar file so that
+            # there's always a chrome.manifest file, even an empty one.
+            path = mozpath.normpath(mozpath.join(base, 'chrome.manifest'))
+            if not self.copier.contains(path):
+                self.copier.add(path, ManifestFile(''))
             self._sub_formatter[base] = OmniJarSubFormatter(
                 FileRegistrySubtree(base, self.copier), self._omnijar_name,
                 self._compress, self._optimize, self._non_resources)
 
 
 class OmniJarSubFormatter(PiecemealFormatter):
     '''
     Sub-formatter for the omnijar package format. It is a PiecemealFormatter
--- a/python/mozbuild/mozpack/test/test_packager_formats.py
+++ b/python/mozbuild/mozpack/test/test_packager_formats.py
@@ -210,16 +210,17 @@ RESULT_OMNIJAR.update({
         for p in (
             'chrome.manifest',
             'chrome/chrome.manifest',
             'chrome/foo/foo',
             'components/components.manifest',
             'components/foo.js',
         )
     },
+    'app/chrome.manifest': [],
 })
 
 RESULT_OMNIJAR['omni.foo'].update({
     p: RESULT_FLAT[p]
     for p in (
         'chrome.manifest',
         'chrome/chrome.manifest',
         'chrome/f/f.manifest',