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

Side by Side Diff: pylib/gyp/generator/msvs.py

Issue 10382161: Fix bug in ninja generator when there's no default action. (Closed) Base URL: http://git.chromium.org/external/gyp.git@master
Patch Set: fix other generators Created 8 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import copy 5 import copy
6 import ntpath 6 import ntpath
7 import os 7 import os
8 import posixpath 8 import posixpath
9 import re 9 import re
10 import subprocess 10 import subprocess
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 rules_filename = '%s%s.rules' % (spec['target_name'], 482 rules_filename = '%s%s.rules' % (spec['target_name'],
483 options.suffix) 483 options.suffix)
484 rules_file = MSVSToolFile.Writer(os.path.join(output_dir, rules_filename), 484 rules_file = MSVSToolFile.Writer(os.path.join(output_dir, rules_filename),
485 spec['target_name']) 485 spec['target_name'])
486 # Add each rule. 486 # Add each rule.
487 for r in rules: 487 for r in rules:
488 rule_name = r['rule_name'] 488 rule_name = r['rule_name']
489 rule_ext = r['extension'] 489 rule_ext = r['extension']
490 inputs = _FixPaths(r.get('inputs', [])) 490 inputs = _FixPaths(r.get('inputs', []))
491 outputs = _FixPaths(r.get('outputs', [])) 491 outputs = _FixPaths(r.get('outputs', []))
492 # Skip a rule with no action and no inputs.
493 if 'action' not in r and not r.get('rule_sources', []):
494 continue
492 cmd = _BuildCommandLineForRule(spec, r, has_input_path=True, 495 cmd = _BuildCommandLineForRule(spec, r, has_input_path=True,
493 do_setup_env=True) 496 do_setup_env=True)
494 rules_file.AddCustomBuildRule(name=rule_name, 497 rules_file.AddCustomBuildRule(name=rule_name,
495 description=r.get('message', rule_name), 498 description=r.get('message', rule_name),
496 extensions=[rule_ext], 499 extensions=[rule_ext],
497 additional_dependencies=inputs, 500 additional_dependencies=inputs,
498 outputs=outputs, 501 outputs=outputs,
499 cmd=cmd) 502 cmd=cmd)
500 # Write out rules file. 503 # Write out rules file.
501 rules_file.WriteIfChanged() 504 rules_file.WriteIfChanged()
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 # MSBuild rules are implemented using three files: an XML file, a .targets 1938 # MSBuild rules are implemented using three files: an XML file, a .targets
1936 # file and a .props file. 1939 # file and a .props file.
1937 # See http://blogs.msdn.com/b/vcblog/archive/2010/04/21/quick-help-on-vs2010-c ustom-build-rule.aspx 1940 # See http://blogs.msdn.com/b/vcblog/archive/2010/04/21/quick-help-on-vs2010-c ustom-build-rule.aspx
1938 # for more details. 1941 # for more details.
1939 rules = spec.get('rules', []) 1942 rules = spec.get('rules', [])
1940 rules_native = [r for r in rules if not int(r.get('msvs_external_rule', 0))] 1943 rules_native = [r for r in rules if not int(r.get('msvs_external_rule', 0))]
1941 rules_external = [r for r in rules if int(r.get('msvs_external_rule', 0))] 1944 rules_external = [r for r in rules if int(r.get('msvs_external_rule', 0))]
1942 1945
1943 msbuild_rules = [] 1946 msbuild_rules = []
1944 for rule in rules_native: 1947 for rule in rules_native:
1948 # Skip a rule with no action and no inputs.
1949 if 'action' not in rule and not rule.get('rule_sources', []):
1950 continue
1945 msbuild_rule = MSBuildRule(rule, spec) 1951 msbuild_rule = MSBuildRule(rule, spec)
1946 msbuild_rules.append(msbuild_rule) 1952 msbuild_rules.append(msbuild_rule)
1947 extension_to_rule_name[msbuild_rule.extension] = msbuild_rule.rule_name 1953 extension_to_rule_name[msbuild_rule.extension] = msbuild_rule.rule_name
1948 if msbuild_rules: 1954 if msbuild_rules:
1949 base = spec['target_name'] + options.suffix 1955 base = spec['target_name'] + options.suffix
1950 props_name = base + '.props' 1956 props_name = base + '.props'
1951 targets_name = base + '.targets' 1957 targets_name = base + '.targets'
1952 xml_name = base + '.xml' 1958 xml_name = base + '.xml'
1953 1959
1954 props_files_of_rules.add(props_name) 1960 props_files_of_rules.add(props_name)
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
3110 action_spec.extend( 3116 action_spec.extend(
3111 # TODO(jeanluc) 'Document' for all or just if as_sources? 3117 # TODO(jeanluc) 'Document' for all or just if as_sources?
3112 [['FileType', 'Document'], 3118 [['FileType', 'Document'],
3113 ['Command', command], 3119 ['Command', command],
3114 ['Message', description], 3120 ['Message', description],
3115 ['Outputs', outputs] 3121 ['Outputs', outputs]
3116 ]) 3122 ])
3117 if additional_inputs: 3123 if additional_inputs:
3118 action_spec.append(['AdditionalInputs', additional_inputs]) 3124 action_spec.append(['AdditionalInputs', additional_inputs])
3119 actions_spec.append(action_spec) 3125 actions_spec.append(action_spec)
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698