| OLD | NEW | 
 | (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         {{ sourceSetName }} { |  | 
|   78             java.srcDirs = [ |  | 
|   79 {% for path in java_dirs %} |  | 
|   80                 "{{ path }}", |  | 
|   81 {% endfor %} |  | 
|   82             ] |  | 
|   83             jniLibs.srcDirs = [ |  | 
|   84 {% for path in jni_libs %} |  | 
|   85                 "{{ path }}", |  | 
|   86 {% endfor %} |  | 
|   87             ] |  | 
|   88         } |  | 
|   89     } |  | 
|   90 } |  | 
|   91  |  | 
|   92 {% endif %} |  | 
|   93 {% if template_type != 'root' %} |  | 
|   94  |  | 
|   95 dependencies { |  | 
|   96 {% for path in prebuilts %} |  | 
|   97     {{ depCompileName }} files("{{ path }}") |  | 
|   98 {% endfor %} |  | 
|   99 {% for proj in java_project_deps %} |  | 
|  100     {{ depCompileName }} project(":{{ proj }}") |  | 
|  101 {% endfor %} |  | 
|  102 {% for proj in android_project_deps %} |  | 
|  103     {{ depCompileName }} project(path: ":{{ proj }}", configuration: "debug") |  | 
|  104 {% endfor %} |  | 
|  105 } |  | 
|  106  |  | 
|  107 {% if template_type.startswith('android') %} |  | 
|  108 android.variantFilter { variant -> |  | 
|  109     if (variant.buildType.name.equals('release')) { |  | 
|  110         variant.setIgnore(true); |  | 
|  111     } |  | 
|  112 } |  | 
|  113  |  | 
|  114 afterEvaluate { |  | 
|  115     def tasksToDisable = tasks.findAll { |  | 
|  116         return (it.name.equals('generateDebugSources')  // causes unwanted Andro
     idManifest.java |  | 
|  117                 || it.name.equals('generateReleaseSources') |  | 
|  118                 || it.name.endsWith('Assets') |  | 
|  119                 || it.name.endsWith('BuildConfig')  // causes unwanted BuildConf
     ig.java |  | 
|  120 {% if not use_gradle_process_resources %} |  | 
|  121                 || it.name.endsWith('Resources') |  | 
|  122                 || it.name.endsWith('ResValues') |  | 
|  123 {% endif %} |  | 
|  124                 || it.name.endsWith('Aidl') |  | 
|  125                 || it.name.endsWith('Renderscript') |  | 
|  126                 || it.name.endsWith('Shaders')) |  | 
|  127     } |  | 
|  128     tasksToDisable.each { Task task -> |  | 
|  129       task.enabled = false |  | 
|  130     } |  | 
|  131 } |  | 
|  132  |  | 
|  133 {% endif %} |  | 
|  134 {% endif %} |  | 
| OLD | NEW |