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}</#if> 34 35dependencies { 36 compile 'com.google.android.gms:play-services-wearable:5.0.+' 37 compile 'com.android.support:support-v13:20.0.+' 38 compile 'com.google.android.support:wearable:1.0.+' 39 compile project(':Shared') 40} 41 42// The sample build uses multiple directories to 43// keep boilerplate and common code separate from 44// the main sample code. 45List<String> dirs = [ 46 'main', // main sample code; look here for the interesting stuff. 47 'common', // components that are reused by multiple samples 48 'template'] // boilerplate code that is generated by the sample template process 49 50android { 51 <#-- Note that target SDK is hardcoded in this template. We expect all samples 52 to always use the most current SDK as their target. --> 53 compileSdkVersion 'android-20' 54 55 buildToolsVersion '20' 56 57 buildTypes { 58 release { 59 runProguard false 60 proguardFiles getDefaultProguardFile('proguard-android.txt') 61 } 62 } 63 sourceSets { 64 main { 65 dirs.each { dir -> 66<#noparse> 67 java.srcDirs "src/${dir}/java" 68 res.srcDirs "src/${dir}/res" 69</#noparse> 70 } 71 } 72 androidTest.setRoot('tests') 73 androidTest.java.srcDirs = ['tests/src'] 74 75<#if sample.defaultConfig?has_content> 76 defaultConfig { 77 ${sample.defaultConfig} 78 } 79<#else> 80</#if> 81 } 82} 83 84// BEGIN_EXCLUDE 85// Tasks below this line will be hidden from release output 86 87task preflight (dependsOn: parent.preflight) { 88 project.afterEvaluate { 89 // Inject a preflight task into each variant so we have a place to hook tasks 90 // that need to run before any of the android build tasks. 91 // 92 android.applicationVariants.each { variant -> 93 <#noparse> 94 tasks.getByPath("prepare${variant.name.capitalize()}Dependencies").dependsOn preflight 95 </#noparse> 96 } 97 } 98} 99 100// END_EXCLUDE 101