From fe46da75a800f50df30c7523fc1daa7bc77e879f Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 1 Dec 2015 18:45:56 +0900 Subject: [PATCH] Bug 1229279 - Use mozbuild.context.Path for FINAL_TARGET{_PP}_FILES. r=gps --- browser/branding/branding-common.mozbuild | 2 +- build/moz.build | 13 ++++++------- python/mozbuild/mozbuild/backend/fastermake.py | 9 +++++---- python/mozbuild/mozbuild/backend/recursivemake.py | 14 +++++++------- python/mozbuild/mozbuild/frontend/context.py | 6 +++--- python/mozbuild/mozbuild/frontend/emitter.py | 4 ++-- .../mozbuild/test/backend/test_recursivemake.py | 4 ++-- .../mozbuild/test/frontend/test_emitter.py | 2 +- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/browser/branding/branding-common.mozbuild b/browser/branding/branding-common.mozbuild index 524ff3046a8..8ca85f64fcc 100644 --- a/browser/branding/branding-common.mozbuild +++ b/browser/branding/branding-common.mozbuild @@ -5,7 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. JS_PREFERENCE_FILES += [ - 'pref/firefox-branding.js', + '/%s/pref/firefox-branding.js' % CONFIG['MOZ_BRANDING_DIRECTORY'], ] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': diff --git a/build/moz.build b/build/moz.build index b3ea43fa3de..21ea098ce72 100644 --- a/build/moz.build +++ b/build/moz.build @@ -54,23 +54,22 @@ if CONFIG['MOZ_BUILD_APP'] == 'browser': ] if CONFIG['ENABLE_TESTS'] or CONFIG['MOZ_DMD']: - tools_dir = TOPSRCDIR + '/tools/rb/' - FINAL_TARGET_FILES += [tools_dir + 'fix_stack_using_bpsyms.py'] + FINAL_TARGET_FILES += ['/tools/rb/fix_stack_using_bpsyms.py'] if CONFIG['OS_ARCH'] == 'Darwin': - FINAL_TARGET_FILES += [tools_dir + 'fix_macosx_stack.py'] + FINAL_TARGET_FILES += ['/tools/rb/fix_macosx_stack.py'] if CONFIG['OS_ARCH'] == 'Linux': - FINAL_TARGET_FILES += [tools_dir + 'fix_linux_stack.py'] + FINAL_TARGET_FILES += ['/tools/rb/fix_linux_stack.py'] if CONFIG['MOZ_DMD']: - FINAL_TARGET_FILES += [TOPSRCDIR + '/memory/replace/dmd/dmd.py'] + FINAL_TARGET_FILES += ['/memory/replace/dmd/dmd.py'] # Put a useful .gdbinit in the bin directory, to be picked up automatically # by GDB when we debug executables there. -FINAL_TARGET_FILES += [TOPSRCDIR + '/.gdbinit'] +FINAL_TARGET_FILES += ['/.gdbinit'] # Install the clang-cl runtime library for ASAN next to the binaries we produce. if CONFIG['MOZ_ASAN'] and CONFIG['CLANG_CL']: - FINAL_TARGET_FILES += [CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']] + FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']] if CONFIG['MOZ_APP_BASENAME']: FINAL_TARGET_PP_FILES += ['application.ini'] diff --git a/python/mozbuild/mozbuild/backend/fastermake.py b/python/mozbuild/mozbuild/backend/fastermake.py index f028f5b89ab..ec09bdba991 100644 --- a/python/mozbuild/mozbuild/backend/fastermake.py +++ b/python/mozbuild/mozbuild/backend/fastermake.py @@ -77,13 +77,14 @@ class FasterMakeBackend(CommonBackend): elif isinstance(obj, (FinalTargetFiles, FinalTargetPreprocessedFiles)) and \ obj.install_target.startswith('dist/bin'): - for path, strings in obj.files.walk(): - for f in strings: + for path, files in obj.files.walk(): + for f in files: if isinstance(obj, FinalTargetPreprocessedFiles): - self._add_preprocess(obj, f, path, defines=defines) + self._add_preprocess(obj, f.full_path, path, + defines=defines) else: self._install_manifests[obj.install_target].add_symlink( - mozpath.join(obj.srcdir, f), + f.full_path, mozpath.join(path, mozpath.basename(f)) ) diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index 5bca4df0afc..fd06a3f6cca 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -1316,20 +1316,20 @@ INSTALL_TARGETS += %(prefix)s else: raise Exception("Cannot install to " + target) - for path, strings in files.walk(): - for f in strings: - source = mozpath.normpath(os.path.join(obj.srcdir, f)) + for path, files in files.walk(): + for f in files: dest = mozpath.join(reltarget, path, mozpath.basename(f)) - install_manifest.add_symlink(source, dest) + install_manifest.add_symlink(f.full_path, dest) def _process_final_target_pp_files(self, obj, files, backend_file): # We'd like to install these via manifests as preprocessed files. # But they currently depend on non-standard flags being added via # some Makefiles, so for now we just pass them through to the # underlying Makefile.in. - for i, (path, strings) in enumerate(files.walk()): - for f in strings: - backend_file.write('DIST_FILES_%d += %s\n' % (i, f)) + for i, (path, files) in enumerate(files.walk()): + for f in files: + backend_file.write('DIST_FILES_%d += %s\n' % ( + i, self._pretty_path(f, backend_file))) backend_file.write('DIST_FILES_%d_PATH := $(DEPTH)/%s\n' % (i, mozpath.join(obj.install_target, path))) backend_file.write('PP_TARGETS += DIST_FILES_%d\n' % i) diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index 924a6b7b54f..8c3ca2bb717 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -1001,7 +1001,7 @@ VARIABLES = { break the build in subtle ways. """, 'misc'), - 'FINAL_TARGET_FILES': (HierarchicalStringList, list, + 'FINAL_TARGET_FILES': (ContextDerivedTypedHierarchicalStringList(Path), list, """List of files to be installed into the application directory. ``FINAL_TARGET_FILES`` will copy (or symlink, if the platform supports it) @@ -1021,11 +1021,11 @@ VARIABLES = { disabled. """, None), - 'FINAL_TARGET_PP_FILES': (HierarchicalStringList, list, + 'FINAL_TARGET_PP_FILES': (ContextDerivedTypedHierarchicalStringList(Path), list, """Like ``FINAL_TARGET_FILES``, with preprocessing. """, 'libs'), - 'TESTING_FILES': (HierarchicalStringList, list, + 'TESTING_FILES': (ContextDerivedTypedHierarchicalStringList(Path), list, """List of files to be installed in the _tests directory. This works similarly to FINAL_TARGET_FILES. diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 87fabc25694..d45f4a5ba8a 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -674,11 +674,11 @@ class TreeMetadataEmitter(LoggingMixin): if mozpath.split(base)[0] == 'res': has_resources = True for f in files: - path = os.path.join(context.srcdir, f) + path = f.full_path if not os.path.exists(path): raise SandboxValidationError( 'File listed in %s does not exist: %s' - % (var, f), context) + % (var, path), context) # Addons (when XPI_NAME is defined) and Applications (when # DIST_SUBDIR is defined) use a different preferences directory diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py index c18e8b73cc9..50bf3ab6efc 100644 --- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py +++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py @@ -646,8 +646,8 @@ class TestRecursiveMakeBackend(BackendTester): lines = [l.strip() for l in open(backend_path, 'rt').readlines()[2:]] expected = [ - 'DIST_FILES_0 += install.rdf', - 'DIST_FILES_0 += main.js', + 'DIST_FILES_0 += $(srcdir)/install.rdf', + 'DIST_FILES_0 += $(srcdir)/main.js', 'DIST_FILES_0_PATH := $(DEPTH)/dist/bin/', 'PP_TARGETS += DIST_FILES_0', ] diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py index d14a9dff175..fbd2c1173dd 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py +++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py @@ -826,7 +826,7 @@ class TestEmitterBasic(unittest.TestCase): expected = {'install.rdf', 'main.js'} for f in files: - self.assertTrue(f in expected) + self.assertTrue(unicode(f) in expected) def test_missing_final_target_pp_files(self): """Test that FINAL_TARGET_PP_FILES with missing files throws errors."""