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 // Generated by //build/android/generate_gradle.py | 4 // Generated by //build/android/generate_gradle.py |
5 {% if template_type == 'root' %} | |
6 | |
7 buildscript { | |
8 repositories { | |
9 jcenter() | |
10 } | |
11 dependencies { | |
12 classpath "com.android.tools.build:gradle:2.2.3" | |
13 } | |
14 } | |
15 | |
16 {% elif template_type in ('java_library', 'java_binary') %} | |
17 | |
18 apply plugin: "java" | |
19 {% if template_type == 'java_binary' %} | |
20 apply plugin: "application" | |
21 {% endif %} | |
22 | |
23 sourceSets { | |
24 main { | |
25 java.srcDirs = [ | |
26 {% for path in java_dirs %} | |
27 "{{ path }}", | |
28 {% endfor %} | |
29 ] | |
30 } | |
31 } | |
32 | |
33 sourceCompatibility = JavaVersion.VERSION_1_7 | |
34 targetCompatibility = JavaVersion.VERSION_1_7 | |
35 | |
36 {% if template_type == 'java_binary' %} | |
37 mainClassName = "{{ main_class }}" | |
38 applicationName = "{{ target_name }}" | |
39 {% endif %} | |
40 {% if template_type in ('java_binary', 'java_library') %} | |
41 archivesBaseName = "{{ target_name }}" | |
42 {% endif %} | |
43 | |
44 {% else %} | |
45 | 5 |
46 {% if template_type in ('android_library', 'android_junit') %} | 6 {% if template_type in ('android_library', 'android_junit') %} |
47 apply plugin: "com.android.library" | 7 apply plugin: "com.android.library" |
48 {% elif template_type == 'android_apk' %} | 8 {% elif template_type == 'android_apk' %} |
49 apply plugin: "com.android.application" | 9 apply plugin: "com.android.application" |
50 {% endif %} | 10 {% endif %} |
51 | 11 |
52 android { | 12 android { |
53 compileSdkVersion {{ compile_sdk_version }} | 13 compileSdkVersion {{ compile_sdk_version }} |
54 buildToolsVersion "{{ build_tools_version }}" | 14 buildToolsVersion "{{ build_tools_version }}" |
(...skipping 27 matching lines...) Expand all Loading... |
82 ] | 42 ] |
83 jniLibs.srcDirs = [ | 43 jniLibs.srcDirs = [ |
84 {% for path in jni_libs %} | 44 {% for path in jni_libs %} |
85 "{{ path }}", | 45 "{{ path }}", |
86 {% endfor %} | 46 {% endfor %} |
87 ] | 47 ] |
88 } | 48 } |
89 } | 49 } |
90 } | 50 } |
91 | 51 |
92 {% endif %} | 52 {% include 'dependencies.jinja' %} |
93 {% if template_type != 'root' %} | |
94 | 53 |
95 dependencies { | |
96 {% for path in prebuilts %} | |
97 {{ depCompileName }} files("{{ path }}") | |
98 {% endfor %} | |
99 {% for proj in java_project_deps %} | |
100 {{ depCompileName }} project(":{{ proj }}") | |
101 {% endfor %} | |
102 {% for proj in android_project_deps %} | |
103 {{ depCompileName }} project(path: ":{{ proj }}", configuration: "debug") | |
104 {% endfor %} | |
105 } | |
106 | |
107 {% if template_type.startswith('android') %} | |
108 android.variantFilter { variant -> | 54 android.variantFilter { variant -> |
109 if (variant.buildType.name.equals('release')) { | 55 if (variant.buildType.name.equals('release')) { |
110 variant.setIgnore(true); | 56 variant.setIgnore(true); |
111 } | 57 } |
112 } | 58 } |
113 | 59 |
114 afterEvaluate { | 60 afterEvaluate { |
115 def tasksToDisable = tasks.findAll { | 61 def tasksToDisable = tasks.findAll { |
116 return (it.name.equals('generateDebugSources') // causes unwanted Andro
idManifest.java | 62 return (it.name.equals('generateDebugSources') // causes unwanted Andro
idManifest.java |
117 || it.name.equals('generateReleaseSources') | 63 || it.name.equals('generateReleaseSources') |
118 || it.name.endsWith('Assets') | 64 || it.name.endsWith('Assets') |
119 || it.name.endsWith('BuildConfig') // causes unwanted BuildConf
ig.java | 65 || it.name.endsWith('BuildConfig') // causes unwanted BuildConf
ig.java |
120 {% if not use_gradle_process_resources %} | 66 {% if not use_gradle_process_resources %} |
121 || it.name.endsWith('Resources') | 67 || it.name.endsWith('Resources') |
122 || it.name.endsWith('ResValues') | 68 || it.name.endsWith('ResValues') |
123 {% endif %} | 69 {% endif %} |
124 || it.name.endsWith('Aidl') | 70 || it.name.endsWith('Aidl') |
125 || it.name.endsWith('Renderscript') | 71 || it.name.endsWith('Renderscript') |
126 || it.name.endsWith('Shaders')) | 72 || it.name.endsWith('Shaders')) |
127 } | 73 } |
128 tasksToDisable.each { Task task -> | 74 tasksToDisable.each { Task task -> |
129 task.enabled = false | 75 task.enabled = false |
130 } | 76 } |
131 } | 77 } |
132 | |
133 {% endif %} | |
134 {% endif %} | |
OLD | NEW |