diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-07-27 16:38:43 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-07-27 14:49:38 +0000 |
commit | 9d6566ee193e8996fb867cf776dc13f697400f24 (patch) | |
tree | eac8ed5438c16211994f83bce2e5a6d27fcfade4 | |
parent | 111e290cf6994e3e51994c06fadb0efae13b7eab (diff) |
Improve path handling in gyp's ninja generator
Ensure we generate ninja files under the right folder, and handle
absolute sources better, so they don't cause objects in the same folder.
Change-Id: Ia020616c53c4fb43790345c6724b94120c18c6ac
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
-rw-r--r-- | chromium/tools/gyp/pylib/gyp/generator/ninja.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chromium/tools/gyp/pylib/gyp/generator/ninja.py b/chromium/tools/gyp/pylib/gyp/generator/ninja.py index 9eb311cdb2b..43e31acc527 100644 --- a/chromium/tools/gyp/pylib/gyp/generator/ninja.py +++ b/chromium/tools/gyp/pylib/gyp/generator/ninja.py @@ -336,6 +336,8 @@ class NinjaWriter(object): obj += '.' + self.toolset path_dir, path_basename = os.path.split(path) + if os.path.isabs(path_dir): + path_dir = gyp.common.RelativePath(path_dir, self.abs_build_dir) #assert not os.path.isabs(path_dir), ( #"'%s' can not be absolute path (see crbug.com/462153)." % path_dir) @@ -2343,10 +2345,16 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, hash_for_rules = hashlib.md5(qualified_target_for_hash).hexdigest() base_path = os.path.dirname(build_file) + output_file_path = base_path + if os.path.commonprefix([output_file_path, os.path.pardir]) == os.path.pardir: + # avoid escaping the build-dir due to generated files + # outside the source directory + output_file_path = output_file_path.replace('..', '.') + obj = 'obj' if toolset != 'target': obj += '.' + toolset - output_file = os.path.join(obj, base_path, name + '.ninja') + output_file = os.path.join(obj, output_file_path, name + '.ninja') ninja_output = StringIO() writer = NinjaWriter(hash_for_rules, target_outputs, base_path, build_dir, |