Handle protoc targets in scons ninja build

This commit is contained in:
Brad Chase
2017-02-17 09:25:54 -05:00
committed by seelabs
parent 60416b18a5
commit 1e438f51c5
2 changed files with 8 additions and 8 deletions

View File

@@ -1231,7 +1231,8 @@ for tu_style in ['classic', 'unity']:
if should_build_ninja(tu_style, toolchain, variant):
print('Generating ninja: {}:{}:{}'.format(tu_style, toolchain, variant))
scons_to_ninja.GenerateNinjaFile(
[object_builder.env] + object_builder.child_envs,
# add base env last to ensure protoc targets are added
[object_builder.env] + object_builder.child_envs + [base],
dest_file='build.ninja')
for key, value in aliases.iteritems():

View File

@@ -37,13 +37,12 @@ def GenerateNinjaFile(envs, dest_file):
node_list = []
node_map = {}
def CustomCommandPrinter(cmd, targets, source, env):
assert len(targets) == 1, len(targets)
node = targets[0]
# There can sometimes be multiple commands per target (e.g. ar+ranlib).
# We must collect these together to output a single Ninja rule.
if node not in node_map:
node_list.append(node)
node_map.setdefault(node, []).append(cmd)
for node in targets:
# There can sometimes be multiple commands per target (e.g. ar+ranlib).
# We must collect these together to output a single Ninja rule.
if node not in node_map:
node_list.append(node)
node_map.setdefault(node, []).append(cmd)
for e in envs:
e.Append(PRINT_CMD_LINE_FUNC=CustomCommandPrinter)
def WriteFile():