Bug 1235021 - Use SourcePaths for JAR_MANIFESTS. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 24 Dec 2015 14:14:06 +0900
changeset 278020 40ae4d686d46eccff4710ec13f0103fe370be66d
parent 278019 12386f9fb7179f092ab50c56791dab280fdadb2a
child 278021 cce5cfe52a3db8bbabf8539c5715f62793715c9f
push id29841
push userryanvm@gmail.com
push dateSat, 02 Jan 2016 00:29:52 +0000
treeherdermozilla-central@f7fbc524f9f3 [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 - Use SourcePaths for JAR_MANIFESTS. r=gps
python/mozbuild/mozbuild/backend/fastermake.py
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/frontend/context.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/test/frontend/test_emitter.py
--- a/python/mozbuild/mozbuild/backend/fastermake.py
+++ b/python/mozbuild/mozbuild/backend/fastermake.py
@@ -126,37 +126,37 @@ class FasterMakeBackend(CommonBackend):
         pp = Preprocessor()
         pp.context.update(defines)
         pp.context.update(self.environment.defines)
         pp.context.update(
             AB_CD='en-US',
             BUILD_FASTER=1,
         )
         pp.out = JarManifestParser()
-        pp.do_include(obj.path)
+        pp.do_include(obj.path.full_path)
         self.backend_input_files |= pp.includes
 
         for jarinfo in pp.out:
             install_target = obj.install_target
             if jarinfo.base:
                 install_target = mozpath.normpath(
                     mozpath.join(install_target, jarinfo.base))
             for e in jarinfo.entries:
                 if e.is_locale:
                     if jarinfo.relativesrcdir:
                         path = mozpath.join(self.environment.topsrcdir,
                                             jarinfo.relativesrcdir)
                     else:
-                        path = mozpath.dirname(obj.path)
+                        path = mozpath.dirname(obj.path.full_path)
                     src = mozpath.join( path, 'en-US', e.source)
                 elif e.source.startswith('/'):
                     src = mozpath.join(self.environment.topsrcdir,
                                        e.source[1:])
                 else:
-                    src = mozpath.join(mozpath.dirname(obj.path), e.source)
+                    src = mozpath.join(mozpath.dirname(obj.path.full_path), e.source)
 
                 if '*' in e.source:
                     if e.preprocess:
                         raise Exception('%s: Wildcards are not supported with '
                                         'preprocessing' % obj.path)
                     def _prefix(s):
                         for p in s.split('/'):
                             if '*' not in p:
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -523,17 +523,17 @@ class RecursiveMakeBackend(CommonBackend
            inputs=' ' + ' '.join(obj.inputs) if obj.inputs else '',
            script=obj.script,
            method=obj.method))
 
         elif isinstance(obj, TestHarnessFiles):
             self._process_test_harness_files(obj, backend_file)
 
         elif isinstance(obj, JARManifest):
-            backend_file.write('JAR_MANIFEST := %s\n' % obj.path)
+            backend_file.write('JAR_MANIFEST := %s\n' % obj.path.full_path)
 
         elif isinstance(obj, Program):
             self._process_program(obj.program, backend_file)
             self._process_linked_libraries(obj, backend_file)
 
         elif isinstance(obj, HostProgram):
             self._process_host_program(obj.program, backend_file)
             self._process_linked_libraries(obj, backend_file)
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -1302,17 +1302,17 @@ VARIABLES = {
         some files that wouldn't be installed by default. Set this variable to
         False to force to not install some files that would be installed by
         default.
 
         This is confusing for historical reasons, but eventually, the behavior
         will be made explicit.
         """, None),
 
-    'JAR_MANIFESTS': (StrictOrderingOnAppendList, list,
+    'JAR_MANIFESTS': (ContextDerivedTypedList(SourcePath, StrictOrderingOnAppendList), list,
         """JAR manifest files that should be processed as part of the build.
 
         JAR manifests are files in the tree that define how to package files
         into JARs and how chrome registration is performed. For more info,
         see :ref:`jar_manifests`.
         """, 'libs'),
 
     # IDL Generation.
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -1264,17 +1264,17 @@ class TreeMetadataEmitter(LoggingMixin):
 
     def _process_jar_manifests(self, context):
         jar_manifests = context.get('JAR_MANIFESTS', [])
         if len(jar_manifests) > 1:
             raise SandboxValidationError('While JAR_MANIFESTS is a list, '
                 'it is currently limited to one value.', context)
 
         for path in jar_manifests:
-            yield JARManifest(context, mozpath.join(context.srcdir, path))
+            yield JARManifest(context, path)
 
         # Temporary test to look for jar.mn files that creep in without using
         # the new declaration. Before, we didn't require jar.mn files to
         # declared anywhere (they were discovered). This will detect people
         # relying on the old behavior.
         if os.path.exists(os.path.join(context.srcdir, 'jar.mn')):
             if 'jar.mn' not in jar_manifests:
                 raise SandboxValidationError('A jar.mn exists but it '
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -6,16 +6,17 @@ from __future__ import unicode_literals
 
 import os
 import unittest
 
 from mozunit import main
 
 from mozbuild.frontend.context import (
     ObjDirPath,
+    Path,
 )
 from mozbuild.frontend.data import (
     AndroidResDirs,
     BrandingFiles,
     ChromeManifestEntry,
     ConfigFileSubstitution,
     Defines,
     DirectoryTraversal,
@@ -693,17 +694,17 @@ class TestEmitterBasic(unittest.TestCase
 
     def test_jar_manifests(self):
         reader = self.reader('jar-manifests')
         objs = self.read_topsrcdir(reader)
 
         self.assertEqual(len(objs), 1)
         for obj in objs:
             self.assertIsInstance(obj, JARManifest)
-            self.assertTrue(os.path.isabs(obj.path))
+            self.assertIsInstance(obj.path, Path)
 
     def test_jar_manifests_multiple_files(self):
         with self.assertRaisesRegexp(SandboxValidationError, 'limited to one value'):
             reader = self.reader('jar-manifests-multiple-files')
             self.read_topsrcdir(reader)
 
     def test_xpidl_module_no_sources(self):
         """XPIDL_MODULE without XPIDL_SOURCES should be rejected."""