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

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

Issue 1518313002: ninja: Correctly handle copies steps in sourceless shared_library targets. (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: comment Created 5 years 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 | test/copies/gyptest-sourceless-shared-lib.py » ('j') | 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 b13affe0a172392ae115201874d5f44223b38c38..d8a45c7d240f902f50bb39d295d489f2d7388a05 100644
--- a/pylib/gyp/generator/ninja.py
+++ b/pylib/gyp/generator/ninja.py
@@ -1058,16 +1058,16 @@ class NinjaWriter(object):
cmd = map.get(lang)
ninja_file.build(gch, cmd, input, variables=[(var_name, lang_flag)])
- def WriteLink(self, spec, config_name, config, link_deps):
+ def WriteLink(self, spec, config_name, config, link_deps, compile_deps):
"""Write out a link step. Fills out target.binary. """
if self.flavor != 'mac' or len(self.archs) == 1:
return self.WriteLinkForArch(
- self.ninja, spec, config_name, config, link_deps)
+ self.ninja, spec, config_name, config, link_deps, compile_deps)
else:
output = self.ComputeOutput(spec)
inputs = [self.WriteLinkForArch(self.arch_subninjas[arch], spec,
config_name, config, link_deps[arch],
- arch=arch)
+ compile_deps, arch=arch)
for arch in self.archs]
extra_bindings = []
build_output = output
@@ -1086,7 +1086,7 @@ class NinjaWriter(object):
return output
def WriteLinkForArch(self, ninja_file, spec, config_name, config,
- link_deps, arch=None):
+ link_deps, compile_deps, arch=None):
"""Write out a link step. Fills out target.binary. """
command = {
'executable': 'link',
@@ -1099,6 +1099,14 @@ class NinjaWriter(object):
solibs = set()
order_deps = set()
+ if compile_deps:
+ # Normally, the compiles of the target already depend on compile_deps,
+ # but a shared_library target might have no sources and only link together
+ # a few static_library deps, so the link step also needs to depend
+ # on compile_deps to make sure actions in the shared_library target
+ # get run before the link.
+ order_deps.add(compile_deps)
+
if 'dependencies' in spec:
# Two kinds of dependencies:
# - Linkable dependencies (like a .a or a .so): add them to the link line.
@@ -1308,7 +1316,8 @@ class NinjaWriter(object):
# needed.
variables=variables)
else:
- self.target.binary = self.WriteLink(spec, config_name, config, link_deps)
+ self.target.binary = self.WriteLink(spec, config_name, config, link_deps,
+ compile_deps)
return self.target.binary
def WriteMacBundle(self, spec, mac_bundle_depends, is_empty):
« no previous file with comments | « no previous file | test/copies/gyptest-sourceless-shared-lib.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698