OLD | NEW |
---|---|
(Empty) | |
1 {# Copyright 2016 The Chromium Authors. All rights reserved. #} | |
jbudorick
2016/07/07 22:32:29
Can we put all of this in a //build/android/gradle
agrieve
2016/07/08 19:07:28
Done.
| |
2 {# Use of this source code is governed by a BSD-style license that can be #} | |
3 {# found in the LICENSE file. #} | |
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.1.2" | |
13 } | |
14 } | |
15 | |
16 {% elif template_type == 'java_library' %} | |
17 | |
18 apply plugin: "java" | |
19 | |
20 sourceSets { | |
21 main { | |
22 java.srcDirs = {{ java_dirs }} | |
23 } | |
24 } | |
25 | |
26 sourceCompatibility = JavaVersion.VERSION_1_7 | |
27 targetCompatibility = JavaVersion.VERSION_1_7 | |
28 | |
29 {% else %} | |
30 | |
31 {% if template_type == 'android_library' %} | |
32 apply plugin: "com.android.library" | |
33 {% elif template_type == 'android_apk' %} | |
34 apply plugin: "com.android.application" | |
35 {% endif %} | |
36 | |
37 android { | |
38 compileSdkVersion {{ compile_sdk_version }} | |
39 buildToolsVersion "{{ build_tools_version }}" | |
40 publishNonDefault true | |
41 | |
42 compileOptions { | |
43 sourceCompatibility JavaVersion.VERSION_1_7 | |
44 targetCompatibility JavaVersion.VERSION_1_7 | |
45 } | |
46 | |
47 sourceSets { | |
48 main { | |
49 manifest.srcFile "{{ android_manifest }}" | |
50 java.srcDirs = [ | |
51 {% for path in java_dirs %} | |
52 "{{ path }}", | |
53 {% endfor %} | |
54 ] | |
55 resources.srcDirs = [] | |
56 aidl.srcDirs = [] | |
57 renderscript.srcDirs = [] | |
58 res.srcDirs = [] | |
59 assets.srcDirs = [] | |
60 } | |
61 } | |
62 } | |
63 {% endif %} | |
64 {% if template_type != 'root' %} | |
65 | |
66 dependencies { | |
67 {% for path in prebuilts %} | |
68 compile files("{{ path }}") | |
69 {% endfor %} | |
70 {% for proj in java_project_deps %} | |
71 compile project(":{{ proj }}") | |
72 {% endfor %} | |
73 {% for proj in android_project_deps %} | |
74 debugCompile project(path: ":{{ proj }}", configuration: "debug") | |
75 releaseCompile project(path: ":{{ proj }}", configuration: "release") | |
76 {% endfor %} | |
77 } | |
78 | |
79 afterEvaluate { | |
80 def tasksToDisable = tasks.findAll { | |
81 return (it.name.equals('generateDebugSources') // causes unwanted Andro idManifest.java | |
82 || it.name.equals('generateReleaseSources') | |
83 || it.name.endsWith('Assets') | |
84 || it.name.endsWith('BuildConfig') // causes unwanted BuildConf ig.java | |
85 {% if not use_gradle_process_resources %} | |
86 || it.name.endsWith('Resources') | |
87 || it.name.endsWith('ResValues') | |
88 {% endif %} | |
89 || it.name.endsWith('Aidl') | |
90 || it.name.endsWith('Renderscript') | |
91 || it.name.endsWith('Shaders')) | |
92 } | |
93 tasksToDisable.each { Task task -> | |
94 task.enabled = false | |
95 } | |
96 } | |
97 | |
98 {% endif %} | |
OLD | NEW |