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

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

Issue 10387164: msvs: fix regression in r1378, environment not set up properly for multiple actions on one input (Closed) Base URL: https://gyp.googlecode.com/svn/trunk
Patch Set: add comment Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/many-actions/file0 » ('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 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 fh = open(filename, 'w') 1450 fh = open(filename, 'w')
1451 fh.write(data) 1451 fh.write(data)
1452 fh.close() 1452 fh.close()
1453 1453
1454 1454
1455 def _AddActions(actions_to_add, spec, relative_path_of_gyp_file, vcproj_file): 1455 def _AddActions(actions_to_add, spec, relative_path_of_gyp_file, vcproj_file):
1456 # Add actions. 1456 # Add actions.
1457 actions = spec.get('actions', []) 1457 actions = spec.get('actions', [])
1458 # Don't setup_env every time. When all the actions are run together in one 1458 # Don't setup_env every time. When all the actions are run together in one
1459 # batch file in VS, the PATH will grow too long. 1459 # batch file in VS, the PATH will grow too long.
1460 first_action = True 1460 have_setup_env = {}
jeanluc1 2012/05/16 22:11:06 Please document what this variable does (e.g. key/
1461 for a in actions: 1461 for a in actions:
1462 cmd = _BuildCommandLineForRule(spec, a, has_input_path=False,
1463 do_setup_env=first_action)
1464 # Attach actions to the gyp file if nothing else is there. 1462 # Attach actions to the gyp file if nothing else is there.
1465 inputs = a.get('inputs') or [relative_path_of_gyp_file] 1463 inputs = a.get('inputs') or [relative_path_of_gyp_file]
1464 attached_to = inputs[0]
1465 need_setup_env = attached_to not in have_setup_env
1466 cmd = _BuildCommandLineForRule(spec, a, has_input_path=False,
1467 do_setup_env=need_setup_env)
1468 have_setup_env[attached_to] = True
1466 if vcproj_file: 1469 if vcproj_file:
1467 # Additionally, on MSVS 2008, we record the command in a file 1470 # Additionally, on MSVS 2008, we record the command in a file
1468 # and add this as a dependency so that when the command changes, 1471 # and add this as a dependency so that when the command changes,
1469 # the action gets re-run. This is not necessary on MSVS 2010 1472 # the action gets re-run. This is not necessary on MSVS 2010
1470 # which tracks command changes for us. 1473 # which tracks command changes for us.
1471 command_file = '%s_%s.gypcmd' % (vcproj_file, a['action_name']) 1474 command_file = '%s_%s.gypcmd' % (vcproj_file, a['action_name'])
1472 _WriteFileIfChanged(command_file, cmd) 1475 _WriteFileIfChanged(command_file, cmd)
1473 inputs = inputs + [os.path.basename(command_file)] 1476 inputs = inputs + [os.path.basename(command_file)]
1474 # Add the action. 1477 # Add the action.
1475 _AddActionStep(actions_to_add, 1478 _AddActionStep(actions_to_add,
1476 inputs=inputs, 1479 inputs=inputs,
1477 outputs=a.get('outputs', []), 1480 outputs=a.get('outputs', []),
1478 description=a.get('message', a['action_name']), 1481 description=a.get('message', a['action_name']),
1479 command=cmd) 1482 command=cmd)
1480 first_action = False
1481 1483
1482 1484
1483 def _WriteMSVSUserFile(project_path, version, spec): 1485 def _WriteMSVSUserFile(project_path, version, spec):
1484 # Add run_as and test targets. 1486 # Add run_as and test targets.
1485 if 'run_as' in spec: 1487 if 'run_as' in spec:
1486 run_as = spec['run_as'] 1488 run_as = spec['run_as']
1487 action = run_as.get('action', []) 1489 action = run_as.get('action', [])
1488 environment = run_as.get('environment', []) 1490 environment = run_as.get('environment', [])
1489 working_directory = run_as.get('working_directory', '.') 1491 working_directory = run_as.get('working_directory', '.')
1490 elif int(spec.get('test', 0)): 1492 elif int(spec.get('test', 0)):
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
3117 action_spec.extend( 3119 action_spec.extend(
3118 # TODO(jeanluc) 'Document' for all or just if as_sources? 3120 # TODO(jeanluc) 'Document' for all or just if as_sources?
3119 [['FileType', 'Document'], 3121 [['FileType', 'Document'],
3120 ['Command', command], 3122 ['Command', command],
3121 ['Message', description], 3123 ['Message', description],
3122 ['Outputs', outputs] 3124 ['Outputs', outputs]
3123 ]) 3125 ])
3124 if additional_inputs: 3126 if additional_inputs:
3125 action_spec.append(['AdditionalInputs', additional_inputs]) 3127 action_spec.append(['AdditionalInputs', additional_inputs])
3126 actions_spec.append(action_spec) 3128 actions_spec.append(action_spec)
OLDNEW
« no previous file with comments | « no previous file | test/many-actions/file0 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698