1{# Copyright 2016 The Chromium Authors #} 2{# Use of this source code is governed by a BSD-style license that can be #} 3{# found in the LICENSE file. #} 4{% macro expand_sourceset(variables, prefix) %} 5{% if variables is defined %} 6 {{ prefix }} { 7{% if variables.android_manifest is defined %} 8 manifest.srcFile "{{ variables.android_manifest }}" 9{% endif %} 10{% if variables.java_dirs is defined %} 11 java.srcDirs = [ 12{% for path in variables.java_dirs %} 13 "{{ path }}", 14{% endfor %} 15 ] 16{% endif %} 17{% if variables.java_excludes is defined %} 18 java.filter.exclude([ 19{% for path in variables.java_excludes %} 20 "{{ path }}", 21{% endfor %} 22 ]) 23{% endif %} 24{% if variables.jni_libs is defined %} 25 jniLibs.srcDirs = [ 26{% for path in variables.jni_libs %} 27 "{{ path }}", 28{% endfor %} 29 ] 30{% endif %} 31{% if variables.res_dirs is defined %} 32 res.srcDirs = [ 33{% for path in variables.res_dirs %} 34 "{{ path }}", 35{% endfor %} 36 ] 37{% endif %} 38 } 39{% endif %} 40{% endmacro %} 41// Generated by //build/android/generate_gradle.py 42 43{% if template_type in ('android_library', 'android_junit') %} 44apply plugin: "com.android.library" 45{% elif template_type == 'android_apk' %} 46apply plugin: "com.android.application" 47{% endif %} 48 49android { 50 compileSdkVersion "{{ compile_sdk_version }}" 51 namespace = "org.chromium.chrome" 52 53 defaultConfig { 54 vectorDrawables.useSupportLibrary = true 55 minSdkVersion {{ min_sdk_version }} 56 targetSdkVersion {{ target_sdk_version }} 57 } 58 59 compileOptions { 60 sourceCompatibility JavaVersion.VERSION_17 61 targetCompatibility JavaVersion.VERSION_17 62 } 63 64{% if native is defined %} 65 externalNativeBuild { 66 cmake { 67 path "CMakeLists.txt" 68 } 69 } 70{% endif %} 71 72 sourceSets { 73{% for name in ['main', 'test', 'androidTest', 'debug', 'release'] %} 74 {{ name }} { 75 aidl.srcDirs = [] 76 assets.srcDirs = [] 77 java.srcDirs = [] 78 jni.srcDirs = [] 79 renderscript.srcDirs = [] 80 res.srcDirs = [] 81 resources.srcDirs = [] 82 } 83{% endfor %} 84 85{{ expand_sourceset(main, 'main') }} 86{{ expand_sourceset(test, 'test') }} 87{% if android_test is defined %} 88{% for t in android_test %} 89{{ expand_sourceset(t, 'androidTest') }} 90{% endfor %} 91{% endif %} 92 } 93} 94 95{% include 'dependencies.jinja' %} 96 97afterEvaluate { 98 def tasksToDisable = tasks.findAll { 99 return (it.name.equals('generateDebugSources') // causes unwanted AndroidManifest.java 100 || it.name.equals('generateReleaseSources') 101 || it.name.endsWith('BuildConfig') // causes unwanted BuildConfig.java 102 || it.name.equals('preDebugAndroidTestBuild') 103{% if not use_gradle_process_resources %} 104 || it.name.endsWith('Assets') 105 || it.name.endsWith('Resources') 106 || it.name.endsWith('ResValues') 107{% endif %} 108 || it.name.endsWith('Aidl') 109 || it.name.endsWith('Renderscript') 110 || it.name.endsWith('Shaders')) 111 } 112 tasksToDisable.each { Task task -> 113 task.enabled = false 114 } 115} 116