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

Side by Side Diff: platform_tools/android/gyp_gen/gypd_parser.py

Issue 198063002: Updates to Android.mk generation. (Closed) Base URL: https://skia.googlesource.com/skia.git@android_mk
Patch Set: Add a comment explaining the motivation of OrderedSet. Created 6 years, 9 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
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright 2014 Google Inc. 3 # Copyright 2014 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 """ 8 """
9 Functions for parsing the gypd output from gyp. 9 Functions for parsing the gypd output from gyp.
10 """ 10 """
11 11
12 import vars_dict_lib
13
14 def parse_dictionary(var_dict, d, current_target_name): 12 def parse_dictionary(var_dict, d, current_target_name):
15 """ 13 """
16 Helper function to get the meaningful entries in a dictionary. 14 Helper function to get the meaningful entries in a dictionary.
17 @param var_dict VarsDict object for storing the results of the parsing. 15 @param var_dict VarsDict object for storing the results of the parsing.
18 @param d Dictionary object to parse. 16 @param d Dictionary object to parse.
19 @param current_target_name The current target being parsed. If this 17 @param current_target_name The current target being parsed. If this
20 dictionary is a target, this will be its entry 18 dictionary is a target, this will be its entry
21 'target_name'. Otherwise, this will be the name of 19 'target_name'. Otherwise, this will be the name of
22 the target which contains this dictionary. 20 the target which contains this dictionary.
23 """ 21 """
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 include = include.replace('..', '$(LOCAL_PATH)', 1) 80 include = include.replace('..', '$(LOCAL_PATH)', 1)
83 # Remove a trailing slash, if present. 81 # Remove a trailing slash, if present.
84 if include.endswith('/'): 82 if include.endswith('/'):
85 include = include[:-1] 83 include = include[:-1]
86 var_dict.LOCAL_C_INCLUDES.add(include) 84 var_dict.LOCAL_C_INCLUDES.add(include)
87 # For the top level, libskia, include directories should be exported. 85 # For the top level, libskia, include directories should be exported.
88 if current_target_name == 'libskia': 86 if current_target_name == 'libskia':
89 var_dict.LOCAL_EXPORT_C_INCLUDE_DIRS.add(include) 87 var_dict.LOCAL_EXPORT_C_INCLUDE_DIRS.add(include)
90 88
91 for define in d.get('defines', []): 89 for define in d.get('defines', []):
92 var_dict.LOCAL_CFLAGS.add('-D' + define) 90 var_dict.DEFINES.add(define)
93 91
94 92
95 def parse_gypd(var_dict, path, desired_targets=None): 93 def parse_gypd(var_dict, path, desired_targets=None):
96 """ 94 """
97 Parse a gypd file. 95 Parse a gypd file.
98 @param var_dict VarsDict object for storing the result of the parse. 96 @param var_dict VarsDict object for storing the result of the parse.
99 @param path Path to gypd file. 97 @param path Path to gypd file.
100 @param desired_targets List of targets to be parsed from this file. If empty, 98 @param desired_targets List of targets to be parsed from this file. If empty,
101 parse all targets. 99 parse all targets.
102 """ 100 """
(...skipping 10 matching lines...) Expand all
113 # Avoid circular dependencies 111 # Avoid circular dependencies
114 continue 112 continue
115 if desired_targets and target_name not in desired_targets: 113 if desired_targets and target_name not in desired_targets:
116 # Our caller does not depend on this one 114 # Our caller does not depend on this one
117 continue 115 continue
118 # Add it to our known targets so we don't parse it again 116 # Add it to our known targets so we don't parse it again
119 var_dict.KNOWN_TARGETS.add(target_name) 117 var_dict.KNOWN_TARGETS.add(target_name)
120 118
121 parse_dictionary(var_dict, target, target_name) 119 parse_dictionary(var_dict, target, target_name)
122 120
OLDNEW
« no previous file with comments | « platform_tools/android/gyp_gen/generate_user_config.py ('k') | platform_tools/android/gyp_gen/makefile_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698