Index: build/android/gradle/android.jinja |
diff --git a/build/android/gradle/android.jinja b/build/android/gradle/android.jinja |
index 5dba39daeb0ecedfdc55bd1e9306ff3e1c2428ec..b4b934092a900dd12f78ee37853c109fe5450a16 100644 |
--- a/build/android/gradle/android.jinja |
+++ b/build/android/gradle/android.jinja |
@@ -1,6 +1,23 @@ |
{# Copyright 2016 The Chromium Authors. All rights reserved. #} |
{# Use of this source code is governed by a BSD-style license that can be #} |
{# found in the LICENSE file. #} |
+{% macro expand_sourceset(variables, prefix) %} |
+{% if variables is defined %} |
+ {{ prefix }} { |
+ manifest.srcFile "{{ variables.android_manifest }}" |
+ java.srcDirs = [ |
+{% for path in variables.java_dirs %} |
+ "{{ path }}", |
+{% endfor %} |
+ ] |
+ jniLibs.srcDirs = [ |
+{% for path in variables.jni_libs %} |
+ "{{ path }}", |
+{% endfor %} |
+ ] |
+ } |
+{% endif %} |
+{% endmacro %} |
// Generated by //build/android/generate_gradle.py |
{% if template_type in ('android_library', 'android_junit') %} |
@@ -32,20 +49,9 @@ android { |
} |
{% endfor %} |
- main.manifest.srcFile "{{ android_manifest }}" |
- |
- {{ sourceSetName }} { |
- java.srcDirs = [ |
-{% for path in java_dirs %} |
- "{{ path }}", |
-{% endfor %} |
- ] |
- jniLibs.srcDirs = [ |
-{% for path in jni_libs %} |
- "{{ path }}", |
-{% endfor %} |
- ] |
- } |
+{{ expand_sourceset(main, 'main') }} |
+{{ expand_sourceset(test, 'test') }} |
+{{ expand_sourceset(android_test, 'androidTest') }} |
} |
} |