Bug 1426528: Get rid of support for BRANDING_FILES in `moz.build`; r?Build draft
authorTom Prince <mozilla@hocat.ca>
Wed, 20 Dec 2017 15:42:05 -0700
changeset 714289 e8e7552122a6a6927d3ab454c5605333adba5818
parent 714288 c25b315d565fcd9d30496a2f8c4a901d1d2f0b35
child 744559 ddd43381de89b72259ea65e5f42c837553dbc401
push id93889
push userbmo:mozilla@hocat.ca
push dateFri, 22 Dec 2017 06:09:18 +0000
reviewersBuild
bugs1426528
milestone59.0a1
Bug 1426528: Get rid of support for BRANDING_FILES in `moz.build`; r?Build MozReview-Commit-ID: 72R6toOA1R0
browser/branding/branding-common.mozbuild
browser/locales/Makefile.in
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/backend/tup.py
python/mozbuild/mozbuild/frontend/context.py
python/mozbuild/mozbuild/frontend/data.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/test/backend/data/branding-files/bar.ico
python/mozbuild/mozbuild/test/backend/data/branding-files/foo.ico
python/mozbuild/mozbuild/test/backend/data/branding-files/moz.build
python/mozbuild/mozbuild/test/backend/data/branding-files/sub/quux.png
python/mozbuild/mozbuild/test/backend/test_recursivemake.py
python/mozbuild/mozbuild/test/frontend/test_emitter.py
--- a/browser/branding/branding-common.mozbuild
+++ b/browser/branding/branding-common.mozbuild
@@ -13,45 +13,16 @@ def FirefoxBranding():
     if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
         FINAL_TARGET_FILES['..'] += [
             'firefox.VisualElementsManifest.xml',
         ]
         FINAL_TARGET_FILES.VisualElements += [
             'VisualElements_150.png',
             'VisualElements_70.png',
         ]
-        BRANDING_FILES += [
-            'bgstub.jpg',
-            'bgstub_2x.jpg',
-            'branding.nsi',
-            'document.ico',
-            'firefox.ico',
-            'firefox64.ico',
-            'newtab.ico',
-            'newwindow.ico',
-            'pbmode.ico',
-            'wizHeader.bmp',
-            'wizHeaderRTL.bmp',
-            'wizWatermark.bmp',
-         ]
-    elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
-        BRANDING_FILES += [
-            'background.png',
-            'disk.icns',
-            'document.icns',
-            'dsstore',
-            'firefox.icns',
-        ]
     elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
-        BRANDING_FILES += [
-            'default128.png',
-            'default16.png',
-            'default32.png',
-            'default48.png',
-            'default64.png',
-        ]
         FINAL_TARGET_FILES.chrome.icons.default += [
             'default128.png',
             'default16.png',
             'default32.png',
             'default48.png',
             'default64.png',
         ]
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -57,19 +57,16 @@ DIST_SUBDIRS = $(DIST_SUBDIR)
 include $(topsrcdir)/config/rules.mk
 
 include $(topsrcdir)/toolkit/locales/l10n.mk
 
 $(list-json): $(call mkdir_deps,$(SEARCHPLUGINS_PATH)) $(if $(IS_LANGUAGE_REPACK),FORCE)
 	$(call py_action,generate_searchjson,$(srcdir)/search/list.json $(AB_CD) $(list-json))
 searchplugins:: $(list-json)
 
-$(DIST)/branding:
-	$(NSINSTALL) -D $@
-
 DEFINES += -DBOOKMARKS_INCLUDE_DIR=$(dir $(call MERGE_FILE,profile/bookmarks.inc))
 
 libs-%: AB_CD=$*
 libs-%:
 	$(if $(filter en-US,$(AB_CD)),, @$(MAKE) merge-$*)
 	$(NSINSTALL) -D $(DIST)/install
 	@$(MAKE) -C ../../toolkit/locales libs-$* XPI_ROOT_APPID='$(XPI_ROOT_APPID)'
 	@$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$*
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -1400,37 +1400,28 @@ class RecursiveMakeBackend(CommonBackend
 
     def _process_final_target_files(self, obj, files, backend_file):
         target = obj.install_target
         path = mozpath.basedir(target, (
             'dist/bin',
             'dist/xpi-stage',
             '_tests',
             'dist/include',
-            'dist/branding',
         ))
         if not path:
             raise Exception("Cannot install to " + target)
 
         # Exports are not interesting to artifact builds.
         if path == 'dist/include' and self.environment.is_artifact_build:
             return
 
         manifest = path.replace('/', '_')
         install_manifest = self._install_manifests[manifest]
         reltarget = mozpath.relpath(target, path)
 
-        # Also emit the necessary rules to create $(DIST)/branding during
-        # partial tree builds. The locale makefiles rely on this working.
-        if path == 'dist/branding':
-            backend_file.write('NONRECURSIVE_TARGETS += export\n')
-            backend_file.write('NONRECURSIVE_TARGETS_export += branding\n')
-            backend_file.write('NONRECURSIVE_TARGETS_export_branding_DIRECTORY = $(DEPTH)\n')
-            backend_file.write('NONRECURSIVE_TARGETS_export_branding_TARGETS += install-dist/branding\n')
-
         for path, files in files.walk():
             target_var = (mozpath.join(target, path)
                           if path else target).replace('/', '_')
             have_objdir_files = False
             for f in files:
                 assert not isinstance(f, RenamedSourcePath)
                 dest = mozpath.join(reltarget, path, f.target_basename)
                 if not isinstance(f, ObjDirPath):
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -368,17 +368,16 @@ class TupOnly(CommonBackend, PartialBack
     def _process_final_target_files(self, obj):
         target = obj.install_target
         if not isinstance(obj, ObjdirFiles):
             path = mozpath.basedir(target, (
                 'dist/bin',
                 'dist/xpi-stage',
                 '_tests',
                 'dist/include',
-                'dist/branding',
                 'dist/sdk',
             ))
             if not path:
                 raise Exception("Cannot install to " + target)
 
         if target.startswith('_tests'):
             # TODO: TEST_HARNESS_FILES present a few challenges for the tup
             # backend (bug 1372381).
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -1651,30 +1651,16 @@ VARIABLES = {
 
         The given file contains a list of symbols to be exported, and is
         preprocessed.
         A special marker "@DATA@" must be added after a symbol name if it
         points to data instead of code, so that the Windows linker can treat
         them correctly.
         """),
 
-    'BRANDING_FILES': (ContextDerivedTypedHierarchicalStringList(Path), list,
-        """List of files to be installed into the branding directory.
-
-        ``BRANDING_FILES`` will copy (or symlink, if the platform supports it)
-        the contents of its files to the ``dist/branding`` directory. Files that
-        are destined for a subdirectory can be specified by accessing a field.
-        For example, to export ``foo.png`` to the top-level directory and
-        ``bar.png`` to the directory ``images/subdir``, append to
-        ``BRANDING_FILES`` like so::
-
-           BRANDING_FILES += ['foo.png']
-           BRANDING_FILES.images.subdir += ['bar.png']
-        """),
-
     'SIMPLE_PROGRAMS': (StrictOrderingOnAppendList, list,
         """Compile a list of executable names.
 
         Each name in this variable corresponds to an executable built from the
         corresponding source file with the same base name.
 
         If the configuration token ``BIN_SUFFIX`` is set, its value will be
         automatically appended to each name. If a name already ends with
--- a/python/mozbuild/mozbuild/frontend/data.py
+++ b/python/mozbuild/mozbuild/frontend/data.py
@@ -1041,29 +1041,16 @@ class Exports(FinalTargetFiles):
     this object fills that role. It just has a reference to the underlying
     HierarchicalStringList, which is created when parsing EXPORTS.
     """
     @property
     def install_target(self):
         return 'dist/include'
 
 
-class BrandingFiles(FinalTargetFiles):
-    """Sandbox container object for BRANDING_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 BRANDING_FILES.
-    """
-    @property
-    def install_target(self):
-        return 'dist/branding'
-
-
 class GeneratedFile(ContextDerived):
     """Represents a generated file."""
 
     __slots__ = (
         'script',
         'method',
         'outputs',
         'inputs',
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -24,17 +24,16 @@ import pytoml
 
 from .data import (
     AndroidAssetsDirs,
     AndroidExtraPackages,
     AndroidExtraResDirs,
     AndroidResDirs,
     BaseRustProgram,
     BaseSources,
-    BrandingFiles,
     ChromeManifestEntry,
     ComputedFlags,
     ConfigFileSubstitution,
     ContextWrapped,
     Defines,
     DirectoryTraversal,
     Exports,
     FinalTargetFiles,
@@ -1137,17 +1136,16 @@ class TreeMetadataEmitter(LoggingMixin):
 
         for obj in self._handle_linkables(context, passthru, generated_files):
             yield obj
 
         generated_files.update(['%s%s' % (k, self.config.substs.get('BIN_SUFFIX', '')) for k in self._binaries.keys()])
 
         components = []
         for var, cls in (
-            ('BRANDING_FILES', BrandingFiles),
             ('EXPORTS', Exports),
             ('FINAL_TARGET_FILES', FinalTargetFiles),
             ('FINAL_TARGET_PP_FILES', FinalTargetPreprocessedFiles),
             ('LOCALIZED_FILES', LocalizedFiles),
             ('LOCALIZED_PP_FILES', LocalizedPreprocessedFiles),
             ('OBJDIR_FILES', ObjdirFiles),
             ('OBJDIR_PP_FILES', ObjdirPreprocessedFiles),
             ('TEST_HARNESS_FILES', TestHarnessFiles),
deleted file mode 100644
deleted file mode 100644
deleted file mode 100644
--- a/python/mozbuild/mozbuild/test/backend/data/branding-files/moz.build
+++ /dev/null
@@ -1,12 +0,0 @@
-# Any copyright is dedicated to the Public Domain.
-# http://creativecommons.org/publicdomain/zero/1.0/
-
-BRANDING_FILES += [
-    'bar.ico',
-    'sub/quux.png',
-]
-
-BRANDING_FILES.icons += [
-    'foo.ico',
-]
-
deleted file mode 100644
--- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
+++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
@@ -504,28 +504,16 @@ class TestRecursiveMakeBackend(BackendTe
         self.assertIn('res/foo.res', m)
         self.assertIn('res/fonts/font1.ttf', m)
         self.assertIn('res/fonts/desktop/desktop2.ttf', m)
 
         self.assertIn('res/bar.res.in', m)
         self.assertIn('res/tests/test.manifest', m)
         self.assertIn('res/tests/extra.manifest', m)
 
-    def test_branding_files(self):
-        """Ensure BRANDING_FILES is handled properly."""
-        env = self._consume('branding-files', RecursiveMakeBackend)
-
-        #BRANDING_FILES should appear in the dist_branding install manifest.
-        m = InstallManifest(path=os.path.join(env.topobjdir,
-            '_build_manifests', 'install', 'dist_branding'))
-        self.assertEqual(len(m), 3)
-        self.assertIn('bar.ico', m)
-        self.assertIn('quux.png', m)
-        self.assertIn('icons/foo.ico', m)
-
     def test_test_manifests_files_written(self):
         """Ensure test manifests get turned into files."""
         env = self._consume('test-manifests-written', RecursiveMakeBackend)
 
         tests_dir = mozpath.join(env.topobjdir, '_tests')
         m_master = mozpath.join(tests_dir, 'testing', 'mochitest', 'tests', 'mochitest.ini')
         x_master = mozpath.join(tests_dir, 'xpcshell', 'xpcshell.ini')
         self.assertTrue(os.path.exists(m_master))
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -10,17 +10,16 @@ import unittest
 from mozunit import main
 
 from mozbuild.frontend.context import (
     ObjDirPath,
     Path,
 )
 from mozbuild.frontend.data import (
     AndroidResDirs,
-    BrandingFiles,
     ChromeManifestEntry,
     ComputedFlags,
     ConfigFileSubstitution,
     Defines,
     DirectoryTraversal,
     Exports,
     FinalTargetPreprocessedFiles,
     GeneratedFile,
@@ -635,32 +634,16 @@ class TestEmitterBasic(unittest.TestCase
             self.assertEqual(sorted(expected[path]), basenames)
 
     def test_test_harness_files_root(self):
         reader = self.reader('test-harness-files-root')
         with self.assertRaisesRegexp(SandboxValidationError,
             'Cannot install files to the root of TEST_HARNESS_FILES'):
             self.read_topsrcdir(reader)
 
-    def test_branding_files(self):
-        reader = self.reader('branding-files')
-        objs = self.read_topsrcdir(reader)
-
-        self.assertEqual(len(objs), 1)
-        self.assertIsInstance(objs[0], BrandingFiles)
-
-        files = objs[0].files
-
-        self.assertEqual(files._strings, ['bar.ico', 'baz.png', 'foo.xpm'])
-
-        self.assertIn('icons', files._children)
-        icons = files._children['icons']
-
-        self.assertEqual(icons._strings, ['quux.icns'])
-
     def test_program(self):
         reader = self.reader('program')
         objs = self.read_topsrcdir(reader)
 
         self.assertEqual(len(objs), 5)
         self.assertIsInstance(objs[0], ComputedFlags)
         self.assertIsInstance(objs[1], ComputedFlags)
         self.assertIsInstance(objs[2], Program)