Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Unified Diff: pylib/gyp/generator/ninja.py

Issue 23601020: Add ninja generator flag for writing library deps. (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Review comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/generator/ninja.py
diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py
index b7dbd521c37ad7c77c8b059132d2f33a6c3eabd0..8010fd107128324843fc5f243ec293d0b0e1baa6 100644
--- a/pylib/gyp/generator/ninja.py
+++ b/pylib/gyp/generator/ninja.py
@@ -210,7 +210,7 @@ class Target:
class NinjaWriter:
def __init__(self, qualified_target, target_outputs, base_dir, build_dir,
output_file, toplevel_build, output_file_name, flavor,
- toplevel_dir=None):
+ deps_file_name=None, toplevel_dir=None):
Nico 2013/09/10 21:58:02 rename to deps_file
"""
base_dir: path from source root to directory containing this gyp file,
by gyp semantics, all input paths are relative to this
@@ -245,6 +245,14 @@ class NinjaWriter:
base_to_top = gyp.common.InvertRelativePath(base_dir, toplevel_dir)
self.base_to_build = os.path.join(base_to_top, build_dir)
+ # The self.link_deps_file will either be a file object if the file is
+ # requested, or it will be false if not. This file should contain a
+ # mapping from target to the list of library dependencies it has.
+ if deps_file_name:
+ self.link_deps_file = open(deps_file_name, 'ab')
+ else:
+ self.link_deps_file = None
Nico 2013/09/10 21:58:02 remove most of this, and just keep `self.link_deps
+
def ExpandSpecial(self, path, product_dir=None):
"""Expand specials like $!PRODUCT_DIR in |path|.
@@ -975,6 +983,13 @@ class NinjaWriter:
continue
linkable = target.Linkable()
if linkable:
+ if self.link_deps_file:
+ # Save the mapping of link deps.
+ self.link_deps_file.write(self.qualified_target)
+ self.link_deps_file.write(' ')
+ self.link_deps_file.write(target.binary)
+ self.link_deps_file.write('\n')
+
if (self.flavor == 'win' and
target.component_objs and
self.msvs_settings.IsUseLibraryDependencyInputs(config_name)):
@@ -2019,10 +2034,18 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
obj += '.' + toolset
output_file = os.path.join(obj, base_path, name + '.ninja')
+ # Extract the optional link deps file name.
+ LINK_DEPS_FILE = 'link_deps_file'
+ if LINK_DEPS_FILE in generator_flags:
+ link_deps_file = generator_flags.get(LINK_DEPS_FILE)
Nico 2013/09/10 21:58:02 Do link_deps_file = open(gen…ILE), 'wb') here
+ else:
+ link_deps_file = None
+
writer = NinjaWriter(qualified_target, target_outputs, base_path, build_dir,
OpenOutput(os.path.join(toplevel_build, output_file)),
toplevel_build, output_file,
- flavor, toplevel_dir=options.toplevel_dir)
+ flavor, link_deps_file,
+ toplevel_dir=options.toplevel_dir)
master_ninja.subninja(output_file)
target = writer.WriteSpec(spec, config_name, generator_flags)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698