Home | History | Annotate | Download | only in _MODULE_
      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 -->
     16 buildscript {
     17     repositories {
     18         mavenCentral()
     19     }
     20 
     21     dependencies {
     22         classpath 'com.android.tools.build:gradle:1.0.0'
     23     }
     24 }
     25 
     26 apply plugin: 'com.android.application'
     27 
     28 <#if sample.repository?has_content>
     29 repositories {
     30 <#list sample.repository as rep>
     31     ${rep}
     32 </#list>
     33 }
     34 </#if>
     35 
     36 dependencies {
     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     compile ${play_services_wearable_dependency}
     46     compile ${android_support_v13_dependency}
     47     wearApp project(':Wearable')
     48 }
     49 
     50 // The sample build uses multiple directories to
     51 // keep boilerplate and common code separate from
     52 // the main sample code.
     53 List<String> dirs = [
     54     'main',     // main sample code; look here for the interesting stuff.
     55     'common',   // components that are reused by multiple samples
     56     'template'] // boilerplate code that is generated by the sample template process
     57 
     58 android {
     59     compileSdkVersion ${compile_sdk}
     60 
     61     buildToolsVersion ${build_tools_version}
     62 
     63     defaultConfig {
     64         minSdkVersion ${min_sdk}
     65         targetSdkVersion ${compile_sdk}
     66         versionCode 1
     67         versionName "1.0"
     68     }
     69 
     70     sourceSets {
     71         main {
     72             dirs.each { dir ->
     73 <#noparse>
     74                 java.srcDirs "src/${dir}/java"
     75                 res.srcDirs "src/${dir}/res"
     76 </#noparse>
     77             }
     78         }
     79         androidTest.setRoot('tests')
     80         androidTest.java.srcDirs = ['tests/src']
     81 
     82 <#if sample.defaultConfig?has_content>
     83         defaultConfig {
     84         ${sample.defaultConfig}
     85         }
     86 <#else>
     87 </#if>
     88     }
     89 
     90 }
     91 // BEGIN_EXCLUDE
     92 // Tasks below this line will be hidden from release output
     93 
     94 task preflight (dependsOn: parent.preflight) {
     95     project.afterEvaluate {
     96         // Inject a preflight task into each variant so we have a place to hook tasks
     97         // that need to run before any of the android build tasks.
     98         //
     99         android.applicationVariants.each { variant ->
    100         <#noparse>
    101             tasks.getByPath("prepare${variant.name.capitalize()}Dependencies").dependsOn preflight
    102         </#noparse>
    103         }
    104     }
    105 }
    106 
    107 // END_EXCLUDE
    108