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

Side by Side Diff: build/android/gyp/generate_v14_compatible_resources.py

Issue 1261113003: Allow third_party deps to use res/values/layout instead of res/values/layout-v17 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@codec-open
Patch Set: remove assert_not_deprecated=False Created 5 years, 4 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Convert Android xml resources to API 14 compatible. 7 """Convert Android xml resources to API 14 compatible.
8 8
9 There are two reasons that we cannot just use API 17 attributes, 9 There are two reasons that we cannot just use API 17 attributes,
10 so we are generating another set of resources by this script. 10 so we are generating another set of resources by this script.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 root_node = IterateXmlElements(dom).next() 106 root_node = IterateXmlElements(dom).next()
107 return bool(root_node.nodeName == 'resources' and 107 return bool(root_node.nodeName == 'resources' and
108 list(root_node.getElementsByTagName('style'))) 108 list(root_node.getElementsByTagName('style')))
109 109
110 110
111 def ErrorIfStyleResourceExistsInDir(input_dir): 111 def ErrorIfStyleResourceExistsInDir(input_dir):
112 """If a style resource is in input_dir, raises an exception.""" 112 """If a style resource is in input_dir, raises an exception."""
113 for input_filename in build_utils.FindInDirectory(input_dir, '*.xml'): 113 for input_filename in build_utils.FindInDirectory(input_dir, '*.xml'):
114 dom = ParseAndReportErrors(input_filename) 114 dom = ParseAndReportErrors(input_filename)
115 if HasStyleResource(dom): 115 if HasStyleResource(dom):
116 raise Exception('error: style file ' + input_filename + 116 # Allow style file in third_party to exist in non-v17 directories so long
117 ' should be under ' + input_dir + 117 # as they do not contain deprecated attributes.
118 '-v17 directory. Please refer to ' 118 if not 'third_party' in input_dir or (
119 'http://crbug.com/243952 for the details.') 119 GenerateV14StyleResourceDom(dom, input_filename)):
120 raise Exception('error: style file ' + input_filename +
121 ' should be under ' + input_dir +
122 '-v17 directory. Please refer to '
123 'http://crbug.com/243952 for the details.')
120 124
121 125
122 def GenerateV14LayoutResourceDom(dom, filename, assert_not_deprecated=True): 126 def GenerateV14LayoutResourceDom(dom, filename, assert_not_deprecated=True):
123 """Convert layout resource to API 14 compatible layout resource. 127 """Convert layout resource to API 14 compatible layout resource.
124 128
125 Args: 129 Args:
126 dom: Parsed minidom object to be modified. 130 dom: Parsed minidom object to be modified.
127 filename: Filename that the DOM was parsed from. 131 filename: Filename that the DOM was parsed from.
128 assert_not_deprecated: Whether deprecated attributes (e.g. paddingLeft) will 132 assert_not_deprecated: Whether deprecated attributes (e.g. paddingLeft) will
129 cause an exception to be thrown. 133 cause an exception to be thrown.
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 build_utils.MakeDirectory(res_v14_dir) 315 build_utils.MakeDirectory(res_v14_dir)
312 316
313 GenerateV14Resources(options.res_dir, res_v14_dir) 317 GenerateV14Resources(options.res_dir, res_v14_dir)
314 318
315 if options.stamp: 319 if options.stamp:
316 build_utils.Touch(options.stamp) 320 build_utils.Touch(options.stamp)
317 321
318 if __name__ == '__main__': 322 if __name__ == '__main__':
319 sys.exit(main()) 323 sys.exit(main())
320 324
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698