Chromium Code Reviews| Index: build/android/build.gradle.jinja |
| diff --git a/build/android/build.gradle.jinja b/build/android/build.gradle.jinja |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..406e730304115733752a0192c6c5cf04ef8a5c40 |
| --- /dev/null |
| +++ b/build/android/build.gradle.jinja |
| @@ -0,0 +1,98 @@ |
| +{# 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.
|
| +{# Use of this source code is governed by a BSD-style license that can be #} |
| +{# found in the LICENSE file. #} |
| +// Generated by //build/android/generate_gradle.py |
| +{% if template_type == 'root' %} |
| + |
| +buildscript { |
| + repositories { |
| + jcenter() |
| + } |
| + dependencies { |
| + classpath "com.android.tools.build:gradle:2.1.2" |
| + } |
| +} |
| + |
| +{% elif template_type == 'java_library' %} |
| + |
| +apply plugin: "java" |
| + |
| +sourceSets { |
| + main { |
| + java.srcDirs = {{ java_dirs }} |
| + } |
| +} |
| + |
| +sourceCompatibility = JavaVersion.VERSION_1_7 |
| +targetCompatibility = JavaVersion.VERSION_1_7 |
| + |
| +{% else %} |
| + |
| +{% if template_type == 'android_library' %} |
| +apply plugin: "com.android.library" |
| +{% elif template_type == 'android_apk' %} |
| +apply plugin: "com.android.application" |
| +{% endif %} |
| + |
| +android { |
| + compileSdkVersion {{ compile_sdk_version }} |
| + buildToolsVersion "{{ build_tools_version }}" |
| + publishNonDefault true |
| + |
| + compileOptions { |
| + sourceCompatibility JavaVersion.VERSION_1_7 |
| + targetCompatibility JavaVersion.VERSION_1_7 |
| + } |
| + |
| + sourceSets { |
| + main { |
| + manifest.srcFile "{{ android_manifest }}" |
| + java.srcDirs = [ |
| +{% for path in java_dirs %} |
| + "{{ path }}", |
| +{% endfor %} |
| + ] |
| + resources.srcDirs = [] |
| + aidl.srcDirs = [] |
| + renderscript.srcDirs = [] |
| + res.srcDirs = [] |
| + assets.srcDirs = [] |
| + } |
| + } |
| +} |
| +{% endif %} |
| +{% if template_type != 'root' %} |
| + |
| +dependencies { |
| +{% for path in prebuilts %} |
| + compile files("{{ path }}") |
| +{% endfor %} |
| +{% for proj in java_project_deps %} |
| + compile project(":{{ proj }}") |
| +{% endfor %} |
| +{% for proj in android_project_deps %} |
| + debugCompile project(path: ":{{ proj }}", configuration: "debug") |
| + releaseCompile project(path: ":{{ proj }}", configuration: "release") |
| +{% endfor %} |
| +} |
| + |
| +afterEvaluate { |
| + def tasksToDisable = tasks.findAll { |
| + return (it.name.equals('generateDebugSources') // causes unwanted AndroidManifest.java |
| + || it.name.equals('generateReleaseSources') |
| + || it.name.endsWith('Assets') |
| + || it.name.endsWith('BuildConfig') // causes unwanted BuildConfig.java |
| +{% if not use_gradle_process_resources %} |
| + || it.name.endsWith('Resources') |
| + || it.name.endsWith('ResValues') |
| +{% endif %} |
| + || it.name.endsWith('Aidl') |
| + || it.name.endsWith('Renderscript') |
| + || it.name.endsWith('Shaders')) |
| + } |
| + tasksToDisable.each { Task task -> |
| + task.enabled = false |
| + } |
| +} |
| + |
| +{% endif %} |