OLD | NEW |
1 {# Copyright 2016 The Chromium Authors. All rights reserved. #} | 1 {# Copyright 2016 The Chromium Authors. All rights reserved. #} |
2 {# Use of this source code is governed by a BSD-style license that can be #} | 2 {# Use of this source code is governed by a BSD-style license that can be #} |
3 {# found in the LICENSE file. #} | 3 {# found in the LICENSE file. #} |
| 4 {% macro expand_sourceset(variables, prefix) %} |
| 5 {% if variables is defined %} |
| 6 {{ prefix }} { |
| 7 manifest.srcFile "{{ variables.android_manifest }}" |
| 8 java.srcDirs = [ |
| 9 {% for path in variables.java_dirs %} |
| 10 "{{ path }}", |
| 11 {% endfor %} |
| 12 ] |
| 13 jniLibs.srcDirs = [ |
| 14 {% for path in variables.jni_libs %} |
| 15 "{{ path }}", |
| 16 {% endfor %} |
| 17 ] |
| 18 } |
| 19 {% endif %} |
| 20 {% endmacro %} |
4 // Generated by //build/android/generate_gradle.py | 21 // Generated by //build/android/generate_gradle.py |
5 | 22 |
6 {% if template_type in ('android_library', 'android_junit') %} | 23 {% if template_type in ('android_library', 'android_junit') %} |
7 apply plugin: "com.android.library" | 24 apply plugin: "com.android.library" |
8 {% elif template_type == 'android_apk' %} | 25 {% elif template_type == 'android_apk' %} |
9 apply plugin: "com.android.application" | 26 apply plugin: "com.android.application" |
10 {% endif %} | 27 {% endif %} |
11 | 28 |
12 android { | 29 android { |
13 compileSdkVersion {{ compile_sdk_version }} | 30 compileSdkVersion {{ compile_sdk_version }} |
(...skipping 11 matching lines...) Expand all Loading... |
25 aidl.srcDirs = [] | 42 aidl.srcDirs = [] |
26 assets.srcDirs = [] | 43 assets.srcDirs = [] |
27 java.srcDirs = [] | 44 java.srcDirs = [] |
28 jni.srcDirs = [] | 45 jni.srcDirs = [] |
29 renderscript.srcDirs = [] | 46 renderscript.srcDirs = [] |
30 res.srcDirs = [] | 47 res.srcDirs = [] |
31 resources.srcDirs = [] | 48 resources.srcDirs = [] |
32 } | 49 } |
33 {% endfor %} | 50 {% endfor %} |
34 | 51 |
35 main.manifest.srcFile "{{ android_manifest }}" | 52 {{ expand_sourceset(main, 'main') }} |
36 | 53 {{ expand_sourceset(test, 'test') }} |
37 {{ sourceSetName }} { | 54 {{ expand_sourceset(android_test, 'androidTest') }} |
38 java.srcDirs = [ | |
39 {% for path in java_dirs %} | |
40 "{{ path }}", | |
41 {% endfor %} | |
42 ] | |
43 jniLibs.srcDirs = [ | |
44 {% for path in jni_libs %} | |
45 "{{ path }}", | |
46 {% endfor %} | |
47 ] | |
48 } | |
49 } | 55 } |
50 } | 56 } |
51 | 57 |
52 {% include 'dependencies.jinja' %} | 58 {% include 'dependencies.jinja' %} |
53 | 59 |
54 android.variantFilter { variant -> | 60 android.variantFilter { variant -> |
55 if (variant.buildType.name.equals('release')) { | 61 if (variant.buildType.name.equals('release')) { |
56 variant.setIgnore(true); | 62 variant.setIgnore(true); |
57 } | 63 } |
58 } | 64 } |
59 | 65 |
60 afterEvaluate { | 66 afterEvaluate { |
61 def tasksToDisable = tasks.findAll { | 67 def tasksToDisable = tasks.findAll { |
62 return (it.name.equals('generateDebugSources') // causes unwanted Andro
idManifest.java | 68 return (it.name.equals('generateDebugSources') // causes unwanted Andro
idManifest.java |
63 || it.name.equals('generateReleaseSources') | 69 || it.name.equals('generateReleaseSources') |
64 || it.name.endsWith('Assets') | 70 || it.name.endsWith('Assets') |
65 || it.name.endsWith('BuildConfig') // causes unwanted BuildConf
ig.java | 71 || it.name.endsWith('BuildConfig') // causes unwanted BuildConf
ig.java |
66 {% if not use_gradle_process_resources %} | 72 {% if not use_gradle_process_resources %} |
67 || it.name.endsWith('Resources') | 73 || it.name.endsWith('Resources') |
68 || it.name.endsWith('ResValues') | 74 || it.name.endsWith('ResValues') |
69 {% endif %} | 75 {% endif %} |
70 || it.name.endsWith('Aidl') | 76 || it.name.endsWith('Aidl') |
71 || it.name.endsWith('Renderscript') | 77 || it.name.endsWith('Renderscript') |
72 || it.name.endsWith('Shaders')) | 78 || it.name.endsWith('Shaders')) |
73 } | 79 } |
74 tasksToDisable.each { Task task -> | 80 tasksToDisable.each { Task task -> |
75 task.enabled = false | 81 task.enabled = false |
76 } | 82 } |
77 } | 83 } |
OLD | NEW |