summaryrefslogtreecommitdiff
path: root/deps/v8/build/android/gradle/android.jinja
blob: 4a7da2961e39d0c39d8a2f4be612fe961cd3f99b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{# Copyright 2016 The Chromium Authors. All rights reserved. #}
{# Use of this source code is governed by a BSD-style license that can be #}
{# found in the LICENSE file. #}
{% macro expand_sourceset(variables, prefix) %}
{% if variables is defined %}
        {{ prefix }} {
{% if variables.android_manifest is defined %}
            manifest.srcFile "{{ variables.android_manifest }}"
{% endif %}
{% if variables.java_dirs is defined %}
            java.srcDirs = [
{% for path in variables.java_dirs %}
                "{{ path }}",
{% endfor %}
            ]
{% endif %}
{% if variables.java_excludes is defined %}
            java.filter.exclude(
{% for path in variables.java_excludes %}
                "{{ path }}",
{% endfor %}
            )
{% endif %}
{% if variables.jni_libs is defined %}
            jniLibs.srcDirs = [
{% for path in variables.jni_libs %}
                "{{ path }}",
{% endfor %}
            ]
{% endif %}
{% if variables.res_dirs is defined %}
            res.srcDirs = [
{% for path in variables.res_dirs %}
                "{{ path }}",
{% endfor %}
            ]
{% endif %}
        }
{% endif %}
{% endmacro %}
// Generated by //build/android/generate_gradle.py

{% if template_type in ('android_library', 'android_junit') %}
apply plugin: "com.android.library"
{% elif template_type == 'android_apk' %}
apply plugin: "com.android.application"
{% endif %}

android {
    compileSdkVersion "{{ compile_sdk_version }}"

    defaultConfig {
        vectorDrawables.useSupportLibrary = true
        minSdkVersion 19
        targetSdkVersion {{ target_sdk_version }}
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

{% if native is defined %}
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
{% endif %}

    sourceSets {
{% for name in ['main', 'test', 'androidTest', 'debug', 'release'] %}
        {{ name }} {
            aidl.srcDirs = []
            assets.srcDirs = []
            java.srcDirs = []
            jni.srcDirs = []
            renderscript.srcDirs = []
            res.srcDirs = []
            resources.srcDirs = []
        }
{% endfor %}

{{ expand_sourceset(main, 'main') }}
{{ expand_sourceset(test, 'test') }}
{% if android_test is defined %}
{% for t in android_test %}
{{ expand_sourceset(t, 'androidTest') }}
{% endfor %}
{% endif %}
    }
}

{% include 'dependencies.jinja' %}

afterEvaluate {
    def tasksToDisable = tasks.findAll {
        return (it.name.equals('generateDebugSources')  // causes unwanted AndroidManifest.java
                || it.name.equals('generateReleaseSources')
                || it.name.endsWith('BuildConfig')  // causes unwanted BuildConfig.java
                || it.name.equals('preDebugAndroidTestBuild')
{% if not use_gradle_process_resources %}
                || it.name.endsWith('Assets')
                || 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
    }
}