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 mavenCentral() 19 } 20 21 dependencies { 22 classpath 'com.android.tools.build:gradle:0.12.+' 23 } 24} 25 26apply plugin: 'com.android.application' 27 28<#if sample.repository?has_content> 29repositories { 30<#list sample.repository as rep> 31 ${rep} 32</#list> 33} 34</#if> 35 36dependencies { 37 38<#list sample.dependency as dep> 39 compile "${dep}" 40</#list> 41<#list sample.dependency_external as dep> 42 compile files(${dep}) 43</#list> 44 45 <#-- TODO: use sample variables to set these dependencies --> 46 compile 'com.google.android.gms:play-services:5.0.+' 47 compile 'com.android.support:support-v13:20.0.+' 48 compile project(':Shared') 49 wearApp project(':Wearable') 50 51} 52 53// The sample build uses multiple directories to 54// keep boilerplate and common code separate from 55// the main sample code. 56List<String> dirs = [ 57 'main', // main sample code; look here for the interesting stuff. 58 'common', // components that are reused by multiple samples 59 'template'] // boilerplate code that is generated by the sample template process 60 61android { 62 compileSdkVersion 20 63 64 buildToolsVersion "20" 65 66 sourceSets { 67 main { 68 dirs.each { dir -> 69<#noparse> 70 java.srcDirs "src/${dir}/java" 71 res.srcDirs "src/${dir}/res" 72</#noparse> 73 } 74 } 75 androidTest.setRoot('tests') 76 androidTest.java.srcDirs = ['tests/src'] 77 78<#if sample.defaultConfig?has_content> 79 defaultConfig { 80 ${sample.defaultConfig} 81 } 82<#else> 83</#if> 84 } 85 86} 87// BEGIN_EXCLUDE 88// Tasks below this line will be hidden from release output 89 90task preflight (dependsOn: parent.preflight) { 91 project.afterEvaluate { 92 // Inject a preflight task into each variant so we have a place to hook tasks 93 // that need to run before any of the android build tasks. 94 // 95 android.applicationVariants.each { variant -> 96 <#noparse> 97 tasks.getByPath("prepare${variant.name.capitalize()}Dependencies").dependsOn preflight 98 </#noparse> 99 } 100 } 101} 102 103// END_EXCLUDE 104