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

Side by Side Diff: build/android/gradle/build.gradle.jinja

Issue 2621413002: Android: Split up build.gradle.jinja (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
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 #}
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.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
46 {% if template_type in ('android_library', 'android_junit') %}
47 apply plugin: "com.android.library"
48 {% elif template_type == 'android_apk' %}
49 apply plugin: "com.android.application"
50 {% endif %}
51
52 android {
53 compileSdkVersion {{ compile_sdk_version }}
54 buildToolsVersion "{{ build_tools_version }}"
55 publishNonDefault true
56
57 compileOptions {
58 sourceCompatibility JavaVersion.VERSION_1_7
59 targetCompatibility JavaVersion.VERSION_1_7
60 }
61
62 sourceSets {
63 {% for name in ['main', 'test', 'androidTest', 'debug', 'release'] %}
64 {{ name }} {
65 aidl.srcDirs = []
66 assets.srcDirs = []
67 java.srcDirs = []
68 jni.srcDirs = []
69 renderscript.srcDirs = []
70 res.srcDirs = []
71 resources.srcDirs = []
72 }
73 {% endfor %}
74
75 main.manifest.srcFile "{{ android_manifest }}"
76
77 {% if template_type == 'android_library' %}
78 main {
79 {% else %}
80 test {
81 {% endif %}
82 java.srcDirs = [
83 {% for path in java_dirs %}
84 "{{ path }}",
85 {% endfor %}
86 ]
87 }
88 }
89 }
90
91 {% endif %}
92 {% if template_type != 'root' %}
93
94 dependencies {
95 {% for path in prebuilts %}
96 {{ depCompileName }} files("{{ path }}")
97 {% endfor %}
98 {% for proj in java_project_deps %}
99 {{ depCompileName }} project(":{{ proj }}")
100 {% endfor %}
101 {% for proj in android_project_deps %}
102 {{ depCompileName }} project(path: ":{{ proj }}", configuration: "debug")
103 {% endfor %}
104 }
105
106 {% if template_type.startswith('android') %}
107 android.variantFilter { variant ->
108 if (variant.buildType.name.equals('release')) {
109 variant.setIgnore(true);
110 }
111 }
112
113 afterEvaluate {
114 def tasksToDisable = tasks.findAll {
115 return (it.name.equals('generateDebugSources') // causes unwanted Andro idManifest.java
116 || it.name.equals('generateReleaseSources')
117 || it.name.endsWith('Assets')
118 || it.name.endsWith('BuildConfig') // causes unwanted BuildConf ig.java
119 {% if not use_gradle_process_resources %}
120 || it.name.endsWith('Resources')
121 || it.name.endsWith('ResValues')
122 {% endif %}
123 || it.name.endsWith('Aidl')
124 || it.name.endsWith('Renderscript')
125 || it.name.endsWith('Shaders'))
126 }
127 tasksToDisable.each { Task task ->
128 task.enabled = false
129 }
130 }
131
132 {% endif %}
133 {% endif %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698