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

Side by Side Diff: build/android/gradle/generate_gradle.py

Issue 2699963002: Plumb bootclasspath GN -> Android Studio (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « build/android/gradle/android.jinja ('k') | build/android/gyp/write_build_config.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Generates an Android Studio project from a GN target.""" 6 """Generates an Android Studio project from a GN target."""
7 7
8 import argparse 8 import argparse
9 import codecs 9 import codecs
10 import glob 10 import glob
(...skipping 19 matching lines...) Expand all
30 30
31 _DEFAULT_ANDROID_MANIFEST_PATH = os.path.join( 31 _DEFAULT_ANDROID_MANIFEST_PATH = os.path.join(
32 host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'AndroidManifest.xml') 32 host_paths.DIR_SOURCE_ROOT, 'build', 'android', 'AndroidManifest.xml')
33 _FILE_DIR = os.path.dirname(__file__) 33 _FILE_DIR = os.path.dirname(__file__)
34 _SRCJARS_SUBDIR = 'extracted-srcjars' 34 _SRCJARS_SUBDIR = 'extracted-srcjars'
35 _JNI_LIBS_SUBDIR = 'symlinked-libs' 35 _JNI_LIBS_SUBDIR = 'symlinked-libs'
36 _ARMEABI_SUBDIR = 'armeabi' 36 _ARMEABI_SUBDIR = 'armeabi'
37 _RES_SUBDIR = 'extracted-res' 37 _RES_SUBDIR = 'extracted-res'
38 38
39 _DEFAULT_TARGETS = [ 39 _DEFAULT_TARGETS = [
40 # TODO(agrieve): Requires alternate android.jar to compile. 40 # TODO(agrieve): .build_config seem not quite right for this target
41 # because it has resources as deps of android_apk() rather than using an
42 # android_library() intermediate target.
41 # '//android_webview:system_webview_apk', 43 # '//android_webview:system_webview_apk',
42 '//android_webview/test:android_webview_apk', 44 '//android_webview/test:android_webview_apk',
43 '//android_webview/test:android_webview_test_apk', 45 '//android_webview/test:android_webview_test_apk',
44 '//base:base_junit_tests', 46 '//base:base_junit_tests',
45 '//chrome/android:chrome_junit_tests', 47 '//chrome/android:chrome_junit_tests',
46 '//chrome/android:chrome_public_apk', 48 '//chrome/android:chrome_public_apk',
47 '//chrome/android:chrome_public_test_apk', 49 '//chrome/android:chrome_public_test_apk',
48 '//chrome/android:chrome_sync_shell_apk', 50 '//chrome/android:chrome_sync_shell_apk',
49 '//chrome/android:chrome_sync_shell_test_apk', 51 '//chrome/android:chrome_sync_shell_test_apk',
50 '//content/public/android:content_junit_tests', 52 '//content/public/android:content_junit_tests',
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 return None 415 return None
414 416
415 variables['target_name'] = os.path.splitext(deps_info['name'])[0] 417 variables['target_name'] = os.path.splitext(deps_info['name'])[0]
416 variables['template_type'] = target_type 418 variables['template_type'] = target_type
417 variables['use_gradle_process_resources'] = ( 419 variables['use_gradle_process_resources'] = (
418 generator.use_gradle_process_resources) 420 generator.use_gradle_process_resources)
419 variables['build_tools_version'] = ( 421 variables['build_tools_version'] = (
420 build_vars['android_sdk_build_tools_version']) 422 build_vars['android_sdk_build_tools_version'])
421 variables['compile_sdk_version'] = build_vars['android_sdk_version'] 423 variables['compile_sdk_version'] = build_vars['android_sdk_version']
422 variables['main'] = generator.Generate(entry) 424 variables['main'] = generator.Generate(entry)
425 bootclasspath = gradle.get('bootclasspath')
426 if bootclasspath:
427 # Must use absolute path here.
428 variables['bootclasspath'] = _RebasePath(bootclasspath)
423 if entry.android_test_entry: 429 if entry.android_test_entry:
424 variables['android_test'] = generator.Generate( 430 variables['android_test'] = generator.Generate(
425 entry.android_test_entry) 431 entry.android_test_entry)
426 432
427 return jinja_processor.Render( 433 return jinja_processor.Render(
428 _TemplatePath(target_type.split('_')[0]), variables) 434 _TemplatePath(target_type.split('_')[0]), variables)
429 435
430 436
431 def _GenerateRootGradle(jinja_processor): 437 def _GenerateRootGradle(jinja_processor):
432 """Returns the data for the root project's build.gradle.""" 438 """Returns the data for the root project's build.gradle."""
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 _ExtractZips(generator.project_dir, zip_tuples) 624 _ExtractZips(generator.project_dir, zip_tuples)
619 625
620 logging.warning('Project created! (%d subprojects)', len(project_entries)) 626 logging.warning('Project created! (%d subprojects)', len(project_entries))
621 logging.warning('Generated projects work best with Android Studio 2.2') 627 logging.warning('Generated projects work best with Android Studio 2.2')
622 logging.warning('For more tips: https://chromium.googlesource.com/chromium' 628 logging.warning('For more tips: https://chromium.googlesource.com/chromium'
623 '/src.git/+/master/docs/android_studio.md') 629 '/src.git/+/master/docs/android_studio.md')
624 630
625 631
626 if __name__ == '__main__': 632 if __name__ == '__main__':
627 main() 633 main()
OLDNEW
« no previous file with comments | « build/android/gradle/android.jinja ('k') | build/android/gyp/write_build_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698