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

Unified Diff: build/android/gradle/generate_gradle.py

Issue 2727523002: Reland of Make generate_gradle.py work with preview SDKs. (Closed)
Patch Set: make relative to output dir Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/gradle/android.jinja ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gradle/generate_gradle.py
diff --git a/build/android/gradle/generate_gradle.py b/build/android/gradle/generate_gradle.py
index 2044aa375775905240472d0042bb002f3246c282..ab3bd63ceb57edbb09285e642c7cf97902209743 100755
--- a/build/android/gradle/generate_gradle.py
+++ b/build/android/gradle/generate_gradle.py
@@ -92,9 +92,9 @@ def _WriteFile(path, data):
output_file.write(data)
-def _ReadBuildVars(output_dir):
- with open(os.path.join(output_dir, 'build_vars.txt')) as f:
- return dict(l.rstrip().split('=', 1) for l in f)
+def _ReadPropertiesFile(path):
+ with open(path) as f:
+ return dict(l.rstrip().split('=', 1) for l in f if '=' in l)
def _RunNinja(output_dir, args):
@@ -514,9 +514,12 @@ def _GenerateGradleFile(entry, generator, build_vars, jinja_processor):
variables['template_type'] = target_type
variables['use_gradle_process_resources'] = (
generator.use_gradle_process_resources)
- variables['build_tools_version'] = (
- build_vars['android_sdk_build_tools_version'])
- variables['compile_sdk_version'] = build_vars['android_sdk_version']
+ source_properties = _ReadPropertiesFile(
+ _RebasePath(os.path.join(build_vars['android_sdk_build_tools'],
+ 'source.properties')))
+ variables['build_tools_version'] = source_properties['Pkg.Revision']
+ variables['compile_sdk_version'] = (
+ 'android-%s' % build_vars['android_sdk_version'])
variables['main'] = generator.Generate(entry)
bootclasspath = gradle.get('bootclasspath')
if bootclasspath:
@@ -660,7 +663,7 @@ def main():
_gradle_output_dir = os.path.abspath(
args.project_dir.replace('$CHROMIUM_OUTPUT_DIR', output_dir))
jinja_processor = jinja_template.JinjaProcessor(_FILE_DIR)
- build_vars = _ReadBuildVars(output_dir)
+ build_vars = _ReadPropertiesFile(os.path.join(output_dir, 'build_vars.txt'))
generator = _ProjectContextGenerator(_gradle_output_dir, build_vars,
args.use_gradle_process_resources, jinja_processor, args.split_projects)
logging.warning('Creating project at: %s', generator.project_dir)
« no previous file with comments | « build/android/gradle/android.jinja ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698