Bug 1231764 - part 2 - pass the srcdir of an rlib in the moz.build object; r=chmanchester
authorNathan Froyd <froydnj@gmail.com>
Sat, 06 Aug 2016 00:49:26 -0400
changeset 397539 e331cbf6534c038e7132666f8bc60299b1e1c447
parent 397538 66d5d4c28e8d5b748289bc463a09e58aa31c0533
child 397540 ad4664e340d8c1584877fb578af6652fcc6ca847
push id25332
push usermaglione.k@gmail.com
push dateSat, 06 Aug 2016 21:21:51 +0000
reviewerschmanchester
bugs1231764
milestone51.0a1
Bug 1231764 - part 2 - pass the srcdir of an rlib in the moz.build object; r=chmanchester
python/mozbuild/mozbuild/frontend/data.py
python/mozbuild/mozbuild/frontend/emitter.py
--- a/python/mozbuild/mozbuild/frontend/data.py
+++ b/python/mozbuild/mozbuild/frontend/data.py
@@ -443,19 +443,20 @@ class Library(BaseLibrary):
         BaseLibrary.__init__(self, context, real_name or basename)
         self.basename = basename
         self.is_sdk = is_sdk
 
 
 class RustRlibLibrary(Library):
     """Context derived container object for a Rust rlib"""
 
-    def __init__(self, context, basename, crate_name, rlib_filename, link_into):
+    def __init__(self, context, basename, crate_name, srcdir, rlib_filename, link_into):
         Library.__init__(self, context, basename)
         self.crate_name = crate_name
+        self.srcdir = srcdir
         self.rlib_filename = rlib_filename
         self.link_into = link_into
 
 
 class StaticLibrary(Library):
     """Context derived container object for a static library"""
     __slots__ = (
         'link_into',
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -720,16 +720,17 @@ class TreeMetadataEmitter(LoggingMixin):
         # libraries.  We need to note all of them for linking, too.
         if libname and static_lib:
             for s in rust_sources:
                 for f in s.files:
                     (base, _) = mozpath.splitext(mozpath.basename(f))
                     crate_name = context.relsrcdir.replace('/', '_') + '_' + base
                     rlib_filename = 'lib' + base + '.rlib'
                     lib = RustRlibLibrary(context, libname, crate_name,
+                                          mozpath.join(context.srcdir, mozpath.dirname(f)),
                                           rlib_filename, final_lib)
                     self._libs[libname].append(lib)
                     self._linkage.append((context, lib, 'USE_LIBS'))
 
         for f, flags in all_flags.iteritems():
             if flags.flags:
                 ext = mozpath.splitext(f)[1]
                 yield PerSourceFlag(context, f, flags.flags)