Bug 1235021 - Always use the % marker for preprocessed css files. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 24 Dec 2015 16:36:50 +0900
changeset 277917 666f5a3e18a410fe198c1a3977d248b064358572
parent 277916 7880d2168cf7f4f4158c0ee34e0566ce10b29995
child 277918 73e69f3c9ea160d3a18594fd0833f3336e5dbfcf
push id69650
push usermh@glandium.org
push dateWed, 30 Dec 2015 22:08:21 +0000
treeherdermozilla-inbound@70708efd7d3b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1235021
milestone46.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 1235021 - Always use the % marker for preprocessed css files. r=gps Currently, only css files added through jar manifests are treated this way. There is really no reason for the discrepancy, but there are actually no css files added directly through moz.build, so this was never a problem. On the other hand, it makes things simpler in a world where jar manifests are treated as if they were entirely described in moz.build (which is where the FasterMake backend is heading).
config/rules.mk
python/mozbuild/mozbuild/backend/fastermake.py
python/mozbuild/mozbuild/test/backend/data/build/app/moz.build
python/mozbuild/mozbuild/test/backend/data/build/foo.css
python/mozbuild/mozbuild/test/backend/data/build/jar.mn
python/mozbuild/mozbuild/test/backend/data/build/moz.build
python/mozbuild/mozbuild/test/backend/test_build.py
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -1443,16 +1443,18 @@ pp_target_results = $(foreach file,$($(1
 )
 
 PP_TARGETS_ALL_RESULTS := $(sort $(foreach tier,$(PP_TARGETS_TIERS),$(PP_TARGETS_RESULTS_$(tier))))
 $(PP_TARGETS_ALL_RESULTS):
 	$(if $(filter-out $(notdir $@),$(notdir $(<:.in=))),$(error Looks like $@ has an unexpected dependency on $< which breaks PP_TARGETS))
 	$(RM) '$@'
 	$(call py_action,preprocessor,--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) $(MOZ_DEBUG_DEFINES) '$<' -o '$@')
 
+$(filter %.css,$(PP_TARGETS_ALL_RESULTS)): PP_TARGET_FLAGS+=--marker %
+
 # The depfile is based on the filename, and we don't want conflicts. So check
 # there's only one occurrence of any given filename in PP_TARGETS_ALL_RESULTS.
 PP_TARGETS_ALL_RESULT_NAMES := $(notdir $(PP_TARGETS_ALL_RESULTS))
 $(foreach file,$(sort $(PP_TARGETS_ALL_RESULT_NAMES)), \
   $(if $(filter-out 1,$(words $(filter $(file),$(PP_TARGETS_ALL_RESULT_NAMES)))), \
     $(error Multiple preprocessing rules are creating a $(file) file) \
   ) \
 )
--- a/python/mozbuild/mozbuild/backend/fastermake.py
+++ b/python/mozbuild/mozbuild/backend/fastermake.py
@@ -42,16 +42,18 @@ class FasterMakeBackend(CommonBackend):
         self._has_xpidl = False
 
     def _add_preprocess(self, obj, path, dest, target=None, **kwargs):
         if target is None:
             target = mozpath.basename(path)
             # This matches what PP_TARGETS do in config/rules.
             if target.endswith('.in'):
                 target = target[:-3]
+        if target.endswith('.css'):
+            kwargs['marker'] = '%'
         depfile = mozpath.join(
             self.environment.topobjdir, 'faster', '.deps',
             mozpath.join(obj.install_target, dest, target).replace('/', '_'))
         self._install_manifests[obj.install_target].add_preprocess(
             mozpath.join(obj.srcdir, path),
             mozpath.join(dest, target),
             depfile,
             **kwargs)
@@ -184,26 +186,22 @@ class FasterMakeBackend(CommonBackend):
                         # it, but it's how it works in the recursive make,
                         # not that anything relies on that, but it's simpler.
                         src = mozpath.join(obj.objdir, e.source)
                     self._dependencies['install-%s' % install_target] \
                         .append(mozpath.relpath(
                         src, self.environment.topobjdir))
 
                 if e.preprocess:
-                    kwargs = {}
-                    if src.endswith('.css'):
-                        kwargs['marker'] = '%'
                     self._add_preprocess(
                         obj,
                         src,
                         mozpath.join(jarinfo.name, mozpath.dirname(e.output)),
                         mozpath.basename(e.output),
-                        defines=defines,
-                        **kwargs)
+                        defines=defines)
                 else:
                     self._install_manifests[install_target].add_symlink(
                         src,
                         mozpath.join(jarinfo.name, e.output))
 
             manifest = mozpath.normpath(mozpath.join(install_target,
                                                      jarinfo.name))
             manifest += '.manifest'
--- a/python/mozbuild/mozbuild/test/backend/data/build/app/moz.build
+++ b/python/mozbuild/mozbuild/test/backend/data/build/app/moz.build
@@ -21,16 +21,17 @@ FINAL_TARGET_FILES += [
 ]
 
 FINAL_TARGET_FILES.child += [
     '../bar.ini',
 ]
 
 FINAL_TARGET_PP_FILES += [
     '../baz.ini',
+    '../foo.css',
 ]
 
 FINAL_TARGET_PP_FILES.child2 += [
     '../qux.ini',
 ]
 
 EXTRA_COMPONENTS += [
     '../components.manifest',
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/test/backend/data/build/foo.css
@@ -0,0 +1,2 @@
+%filter substitution
+foo.css: FOO is @FOO@
--- a/python/mozbuild/mozbuild/test/backend/data/build/jar.mn
+++ b/python/mozbuild/mozbuild/test/backend/data/build/jar.mn
@@ -1,10 +1,11 @@
 foo.jar:
 % content bar %child/
 % content foo %
   foo.js
+* foo.css
   bar.js          (subdir/bar.js)
   qux.js          (subdir/bar.js)
 * child/hoge.js   (bar.js)
 * child/baz.jsm
 
 % override   chrome://foo/bar.svg#hello   chrome://bar/bar.svg#hello
--- a/python/mozbuild/mozbuild/test/backend/data/build/moz.build
+++ b/python/mozbuild/mozbuild/test/backend/data/build/moz.build
@@ -27,16 +27,17 @@ FINAL_TARGET_FILES.child += [
     'bar.ini',
 ]
 
 FINAL_TARGET_PP_FILES += [
     'baz.ini',
 ]
 
 FINAL_TARGET_PP_FILES.child2 += [
+    'foo.css',
     'qux.ini',
 ]
 
 EXTRA_COMPONENTS += [
     'components.manifest',
     'foo.js',
 ]
 
--- a/python/mozbuild/mozbuild/test/backend/test_build.py
+++ b/python/mozbuild/mozbuild/test/backend/test_build.py
@@ -128,30 +128,32 @@ class TestBuild(unittest.TestCase):
         result = {
             p: f.open().read().decode('utf-8')
             for p, f in FileFinder(mozpath.join(config.topobjdir, 'dist'))
         }
         self.assertTrue(len(result))
         self.assertEqual(result, {
             'bin/baz.ini': 'baz.ini: FOO is foo\n',
             'bin/child/bar.ini': 'bar.ini\n',
+            'bin/child2/foo.css': 'foo.css: FOO is foo\n',
             'bin/child2/qux.ini': 'qux.ini: BAR is not defined\n',
             'bin/chrome.manifest':
                 'manifest chrome/foo.manifest\n'
                 'manifest components/components.manifest\n',
             'bin/chrome/foo.manifest':
                 'content bar foo/child/\n'
                 'content foo foo/\n'
                 'override chrome://foo/bar.svg#hello '
                 'chrome://bar/bar.svg#hello\n',
             'bin/chrome/foo/bar.js': 'bar.js\n',
             'bin/chrome/foo/child/baz.jsm':
                 '//@line 2 "%sbaz.jsm"\nbaz.jsm: FOO is foo\n' % (test_path),
             'bin/chrome/foo/child/hoge.js':
                 '//@line 2 "%sbar.js"\nbar.js: FOO is foo\n' % (test_path),
+            'bin/chrome/foo/foo.css': 'foo.css: FOO is foo\n',
             'bin/chrome/foo/foo.js': 'foo.js\n',
             'bin/chrome/foo/qux.js': 'bar.js\n',
             'bin/components/bar.js':
                 '//@line 2 "%sbar.js"\nbar.js: FOO is foo\n' % (test_path),
             'bin/components/components.manifest':
                 'component {foo} foo.js\ncomponent {bar} bar.js\n',
             'bin/components/foo.js': 'foo.js\n',
             'bin/defaults/pref/prefs.js': 'prefs.js\n',
@@ -177,24 +179,26 @@ class TestBuild(unittest.TestCase):
                 'content foo foo/\n'
                 'override chrome://foo/bar.svg#hello '
                 'chrome://bar/bar.svg#hello\n',
             'bin/app/chrome/foo/bar.js': 'bar.js\n',
             'bin/app/chrome/foo/child/baz.jsm':
                 '//@line 2 "%sbaz.jsm"\nbaz.jsm: FOO is bar\n' % (test_path),
             'bin/app/chrome/foo/child/hoge.js':
                 '//@line 2 "%sbar.js"\nbar.js: FOO is bar\n' % (test_path),
+            'bin/app/chrome/foo/foo.css': 'foo.css: FOO is bar\n',
             'bin/app/chrome/foo/foo.js': 'foo.js\n',
             'bin/app/chrome/foo/qux.js': 'bar.js\n',
             'bin/app/components/bar.js':
                 '//@line 2 "%sbar.js"\nbar.js: FOO is bar\n' % (test_path),
             'bin/app/components/components.manifest':
                 'component {foo} foo.js\ncomponent {bar} bar.js\n',
             'bin/app/components/foo.js': 'foo.js\n',
             'bin/app/defaults/preferences/prefs.js': 'prefs.js\n',
+            'bin/app/foo.css': 'foo.css: FOO is bar\n',
             'bin/app/foo.ini': 'foo.ini\n',
             'bin/app/modules/baz.jsm':
                 '//@line 2 "%sbaz.jsm"\nbaz.jsm: FOO is bar\n' % (test_path),
             'bin/app/modules/child/bar.jsm': 'bar.jsm\n',
             'bin/app/modules/child2/qux.jsm':
                 '//@line 2 "%squx.jsm"\nqux.jsm: BAR is defined\n'
                 % (test_path),
             'bin/app/modules/foo.jsm': 'foo.jsm\n',