1<#-- 2 Copyright 2014 The Android Open Source Project 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15--> 16buildscript { 17 repositories { 18 google() 19 jcenter() 20 } 21 22 dependencies { 23 classpath 'com.android.tools.build:gradle:3.4.2' 24 } 25} 26 27apply plugin: 'com.android.application' 28 29repositories { 30 google() 31 jcenter() 32<#if sample.repository?has_content> 33 <#list sample.repository as rep> 34 ${rep} 35 </#list> 36</#if> 37} 38 39 40 41dependencies { 42 43<#list sample.dependency_wearable as dep> 44 <#-- Output dependency after checking if it is a play services depdency and 45 needs the latest version number attached. --> 46 <@update_play_services_dependency dep="${dep}" /> 47</#list> 48 49<#list sample.provided_dependency_wearable as dep> 50 provided "${dep}" 51</#list> 52 53 implementation ${play_services_wearable_dependency} 54 55 <#-- TODO (jewalker): Revise once androidX is released to production. --> 56 <#if !sample.androidX?? || !sample.androidX?has_content || sample.androidX == "false"> 57 implementation ${android_support_v13_dependency} 58 </#if> 59 60 <#if sample.preview_wearable_support_provided_dependency?? && sample.preview_wearable_support_provided_dependency?has_content> 61 compileOnly '${sample.preview_wearable_support_provided_dependency}' 62 <#else> 63 compileOnly ${wearable_support_provided_dependency} 64 </#if> 65 66 <#if sample.preview_wearable_support_dependency?? && sample.preview_wearable_support_dependency?has_content> 67 implementation '${sample.preview_wearable_support_dependency}' 68 <#else> 69 implementation ${wearable_support_dependency} 70 </#if> 71 72} 73 74// The sample build uses multiple directories to 75// keep boilerplate and common code separate from 76// the main sample code. 77List<String> dirs = [ 78 'main', // main sample code; look here for the interesting stuff. 79 'common', // components that are reused by multiple samples 80 'template'] // boilerplate code that is generated by the sample template process 81 82android { 83 84 <#if sample.compileSdkVersionWear?? && sample.compileSdkVersionWear?has_content> 85 compileSdkVersion ${sample.compileSdkVersionWear} 86 <#else> 87 compileSdkVersion ${compile_sdk} 88 </#if> 89 90 buildToolsVersion ${build_tools_version} 91 92 defaultConfig { 93 versionCode 1 94 versionName "1.0" 95 96 <#if sample.minSdkVersionWear?? && sample.minSdkVersionWear?has_content> 97 minSdkVersion ${sample.minSdkVersionWear} 98 <#else> 99 minSdkVersion ${min_sdk} 100 </#if> 101 102 <#if sample.targetSdkVersionWear?? && sample.targetSdkVersionWear?has_content> 103 targetSdkVersion ${sample.targetSdkVersionWear} 104 <#else> 105 targetSdkVersion ${compile_sdk} 106 </#if> 107 108 <#if sample.multiDexEnabled?? && sample.multiDexEnabled?has_content> 109 multiDexEnabled ${sample.multiDexEnabled} 110 </#if> 111 112 } 113 114 compileOptions { 115 sourceCompatibility JavaVersion.VERSION_1_7 116 targetCompatibility JavaVersion.VERSION_1_7 117 } 118 119 sourceSets { 120 main { 121 dirs.each { dir -> 122<#noparse> 123 java.srcDirs "src/${dir}/java" 124 res.srcDirs "src/${dir}/res" 125</#noparse> 126 } 127 } 128 androidTest.setRoot('tests') 129 androidTest.java.srcDirs = ['tests/src'] 130 131<#if sample.defaultConfig?has_content> 132 defaultConfig { 133 ${sample.defaultConfig} 134 } 135<#else> 136</#if> 137 } 138} 139