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

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

Issue 1088163002: Analyzer didn't match correctly targets that defined path to inputs with '.' (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 5 years, 8 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/analyzer/gyptest-analyzer.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) 2014 Google Inc. All rights reserved. 1 # Copyright (c) 2014 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 """ 5 """
6 This script is intended for use as a GYP_GENERATOR. It takes as input (by way of 6 This script is intended for use as a GYP_GENERATOR. It takes as input (by way of
7 the generator flag config_path) the path of a json file that dictates the files 7 the generator flag config_path) the path of a json file that dictates the files
8 and targets to search for. The following keys are supported: 8 and targets to search for. The following keys are supported:
9 files: list of paths (relative) of the files to search for. 9 files: list of paths (relative) of the files to search for.
10 targets: list of targets to search for. The target names are unqualified. 10 targets: list of targets to search for. The target names are unqualified.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 directories in |base_path|. Additionally each source may contain variables. 105 directories in |base_path|. Additionally each source may contain variables.
106 Such sources are ignored as it is assumed dependencies on them are expressed 106 Such sources are ignored as it is assumed dependencies on them are expressed
107 and tracked in some other means.""" 107 and tracked in some other means."""
108 # NOTE: gyp paths are always posix style. 108 # NOTE: gyp paths are always posix style.
109 for source in sources: 109 for source in sources:
110 if not len(source) or source.startswith('!!!') or source.startswith('$'): 110 if not len(source) or source.startswith('!!!') or source.startswith('$'):
111 continue 111 continue
112 # variable expansion may lead to //. 112 # variable expansion may lead to //.
113 org_source = source 113 org_source = source
114 source = source[0] + source[1:].replace('//', '/') 114 source = source[0] + source[1:].replace('//', '/')
115 if source.startswith('../'): 115 if source.startswith('../'):
sky 2015/04/27 15:05:52 I wonder if we should special case ./ here?
116 source = _ResolveParent(source, base_path_components) 116 source = _ResolveParent(source, base_path_components)
117 if len(source): 117 if len(source):
118 result.append(source) 118 result.append(source)
119 continue 119 continue
120 result.append(base_path + source) 120 result.append(base_path + source)
121 if debug: 121 if debug:
122 print 'AddSource', org_source, result[len(result) - 1] 122 print 'AddSource', org_source, result[len(result) - 1]
123 123
124 124
125 def _ExtractSourcesFromAction(action, base_path, base_path_components, 125 def _ExtractSourcesFromAction(action, base_path, base_path_components,
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 # If a build file (or any of its included files) is modified we assume all 322 # If a build file (or any of its included files) is modified we assume all
323 # targets in the file are modified. 323 # targets in the file are modified.
324 if build_file_in_files[build_file]: 324 if build_file_in_files[build_file]:
325 print 'matching target from modified build file', target_name 325 print 'matching target from modified build file', target_name
326 target.match_status = MATCH_STATUS_MATCHES 326 target.match_status = MATCH_STATUS_MATCHES
327 matching_targets.append(target) 327 matching_targets.append(target)
328 else: 328 else:
329 sources = _ExtractSources(target_name, target_dicts[target_name], 329 sources = _ExtractSources(target_name, target_dicts[target_name],
330 toplevel_dir) 330 toplevel_dir)
331 for source in sources: 331 for source in sources:
332 if source in files: 332 if os.path.normpath(source) in files:
333 print 'target', target_name, 'matches', source 333 print 'target', target_name, 'matches', source
334 target.match_status = MATCH_STATUS_MATCHES 334 target.match_status = MATCH_STATUS_MATCHES
335 matching_targets.append(target) 335 matching_targets.append(target)
336 break 336 break
337 337
338 # Add dependencies to visit as well as updating back pointers for deps. 338 # Add dependencies to visit as well as updating back pointers for deps.
339 for dep in target_dicts[target_name].get('dependencies', []): 339 for dep in target_dicts[target_name].get('dependencies', []):
340 targets_to_visit.append(dep) 340 targets_to_visit.append(dep)
341 341
342 created_dep_target, dep_target = _GetOrCreateTargetByName(targets, dep) 342 created_dep_target, dep_target = _GetOrCreateTargetByName(targets, dep)
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 result_dict = { 'targets': matched_search_targets, 560 result_dict = { 'targets': matched_search_targets,
561 'status': found_dependency_string if matching_targets else 561 'status': found_dependency_string if matching_targets else
562 no_dependency_string, 562 no_dependency_string,
563 'build_targets': build_targets} 563 'build_targets': build_targets}
564 if invalid_targets: 564 if invalid_targets:
565 result_dict['invalid_targets'] = invalid_targets 565 result_dict['invalid_targets'] = invalid_targets
566 _WriteOutput(params, **result_dict) 566 _WriteOutput(params, **result_dict)
567 567
568 except Exception as e: 568 except Exception as e:
569 _WriteOutput(params, error=str(e)) 569 _WriteOutput(params, error=str(e))
OLDNEW
« no previous file with comments | « no previous file | test/analyzer/gyptest-analyzer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698