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

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

Issue 2460603004: [Do Not Submit] Rough draft enabling junit tests for android studio (Closed)
Patch Set: Created 4 years, 2 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/build.gradle.jinja ('k') | build/android/gyp/write_build_config.py » ('j') | 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 786b542d676e6381e25ce1f845eed3ed38a31dba..40700078b6e0502cb7f5e566e87add6bfd7bbfe4 100755
--- a/build/android/gradle/generate_gradle.py
+++ b/build/android/gradle/generate_gradle.py
@@ -247,9 +247,13 @@ def _GenerateGradleFile(build_config, config_json, java_dirs, relativize,
target_type = 'android_library'
else:
target_type = 'java_library'
+ elif deps_info['type'] == 'java_binary':
+ target_type = 'android_library'
else:
return None
+ dedup = lambda x: sorted(set(x))
+
variables = {}
variables['template_type'] = target_type
variables['use_gradle_process_resources'] = use_gradle_process_resources
@@ -259,7 +263,7 @@ def _GenerateGradleFile(build_config, config_json, java_dirs, relativize,
_DEFAULT_ANDROID_MANIFEST_PATH)
variables['android_manifest'] = relativize(android_manifest)
variables['java_dirs'] = relativize(java_dirs)
- variables['prebuilts'] = relativize(gradle['dependent_prebuilt_jars'])
+ variables['prebuilts'] = dedup(relativize(gradle['dependent_prebuilt_jars']))
deps = [_ProjectEntry.FromBuildConfigPath(p)
for p in gradle['dependent_android_projects']]
@@ -370,6 +374,8 @@ def main():
# TODO(agrieve): See if it makes sense to utilize Gradle's test constructs
# for our instrumentation tests.
targets = [re.sub(r'_test_apk$', '_test_apk__apk', t) for t in targets]
+ targets = [re.sub(r'_junit_tests$', '_junit_tests__java_binary', t)
+ for t in targets]
main_entries = [_ProjectEntry(t) for t in targets]
@@ -391,7 +397,7 @@ def main():
project_entries = []
srcjar_tuples = []
for entry in all_entries:
- if entry.GetType() not in ('android_apk', 'java_library'):
+ if entry.GetType() not in ('android_apk', 'java_library', 'java_binary'):
continue
entry_output_dir = os.path.join(gradle_output_dir, entry.GradleSubdir())
« no previous file with comments | « build/android/gradle/build.gradle.jinja ('k') | build/android/gyp/write_build_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698