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

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: 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..5b89dad43a179c6ab88c4e518e2791d4ed14dd1e 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):
+ generator_flags, toplevel_dir=None):
Nico 2013/09/09 23:27:27 It's nicer to not pass in the whole flags object,
brettw 2013/09/10 21:12:13 Done.
"""
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,15 @@ 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.
+ LINK_DEPS_FILE = 'link_deps_file'
+ if LINK_DEPS_FILE in generator_flags:
+ self.link_deps_file = open(generator_flags.get(LINK_DEPS_FILE), 'ab')
Nico 2013/09/09 23:27:27 Do you want to empty the file before creating the
brettw 2013/09/10 21:12:13 I currently delete it from GN before doing the spa
Nico 2013/09/10 21:56:55 Huh? Couldn't you create the file in GenerateOutpu
+ else:
+ self.link_deps_file = False
Evan Martin 2013/09/09 23:49:34 Why not "None" (also above in the comment), since
brettw 2013/09/10 21:12:13 Good idea, done.
+
def ExpandSpecial(self, path, product_dir=None):
"""Expand specials like $!PRODUCT_DIR in |path|.
@@ -975,6 +984,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)
Nico 2013/09/09 23:27:27 This isn't correct on windows if you want to use i
brettw 2013/09/10 21:12:13 I'll worry about this later, I don't understand ho
+ self.link_deps_file.write('\n')
+
if (self.flavor == 'win' and
target.component_objs and
self.msvs_settings.IsUseLibraryDependencyInputs(config_name)):
@@ -2022,7 +2038,8 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
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, generator_flags,
+ 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