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

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 f37d4403677ea5662513f99535008fd7d2fcd3e9..01df42ffca0c040b413b5339ed9a459880083923 100644
--- a/pylib/gyp/generator/ninja.py
+++ b/pylib/gyp/generator/ninja.py
@@ -211,7 +211,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=None, toplevel_dir=None):
"""
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,7 @@ class NinjaWriter:
# Relative path from base dir to build dir.
base_to_top = gyp.common.InvertRelativePath(base_dir, toplevel_dir)
self.base_to_build = os.path.join(base_to_top, build_dir)
+ self.link_deps_file = deps_file
def ExpandSpecial(self, path, product_dir=None):
"""Expand specials like $!PRODUCT_DIR in |path|.
@@ -982,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)):
@@ -2006,6 +2014,14 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
# target_short_names is a map from target short name to a list of Target
# objects.
target_short_names = {}
+
+ # Extract the optional link deps file name.
+ LINK_DEPS_FILE = 'link_deps_file'
+ if LINK_DEPS_FILE in generator_flags:
+ link_deps_file = open(generator_flags.get(LINK_DEPS_FILE), 'wb')
+ else:
+ link_deps_file = None
+
for qualified_target in target_list:
# qualified_target is like: third_party/icu/icu.gyp:icui18n#target
build_file, name, toolset = \
@@ -2031,7 +2047,9 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
writer = NinjaWriter(qualified_target, target_outputs, base_path, build_dir,
ninja_output,
toplevel_build, output_file,
- flavor, toplevel_dir=options.toplevel_dir)
+ flavor, link_deps_file,
+ toplevel_dir=options.toplevel_dir)
+
target = writer.WriteSpec(spec, config_name, generator_flags)
if ninja_output.tell() > 0:
« 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