Home | History | Annotate | Download | only in Wearable
      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         jcenter()
     19     }
     20 
     21     dependencies {
     22         classpath 'com.android.tools.build:gradle:2.3.2'
     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 }</#if>
     34 
     35 dependencies {
     36 
     37 <#list sample.dependency_wearable as dep>
     38     <#-- Output dependency after checking if it is a play services depdency and
     39     needs the latest version number attached. -->
     40     <@update_play_services_dependency dep="${dep}" />
     41 </#list>
     42 
     43 <#list sample.provided_dependency_wearable as dep>
     44     provided "${dep}"
     45 </#list>
     46 
     47     compile ${play_services_wearable_dependency}
     48     compile ${android_support_v13_dependency}
     49 
     50     <#if sample.preview_wearable_support_provided_dependency?? && sample.preview_wearable_support_provided_dependency?has_content>
     51     provided '${sample.preview_wearable_support_provided_dependency}'
     52     <#else>
     53     provided ${wearable_support_provided_dependency}
     54     </#if>
     55 
     56     <#if sample.preview_wearable_support_dependency?? && sample.preview_wearable_support_dependency?has_content>
     57     compile '${sample.preview_wearable_support_dependency}'
     58     <#else>
     59     compile ${wearable_support_dependency}
     60     </#if>
     61 
     62 }
     63 
     64 // The sample build uses multiple directories to
     65 // keep boilerplate and common code separate from
     66 // the main sample code.
     67 List<String> dirs = [
     68     'main',     // main sample code; look here for the interesting stuff.
     69     'common',   // components that are reused by multiple samples
     70     'template'] // boilerplate code that is generated by the sample template process
     71 
     72 android {
     73     compileSdkVersion ${compile_sdk}
     74 
     75     buildToolsVersion ${build_tools_version}
     76 
     77     defaultConfig {
     78         versionCode 1
     79         versionName "1.0"
     80 
     81       <#if sample.minSdkVersionWear?? && sample.minSdkVersionWear?has_content>
     82         minSdkVersion ${sample.minSdkVersionWear}
     83       <#else>
     84         minSdkVersion ${min_sdk}
     85       </#if>
     86 
     87       <#if sample.targetSdkVersionWear?? && sample.targetSdkVersionWear?has_content>
     88         targetSdkVersion ${sample.targetSdkVersionWear}
     89       <#else>
     90         targetSdkVersion ${compile_sdk}
     91       </#if>
     92     }
     93 
     94     compileOptions {
     95         sourceCompatibility JavaVersion.VERSION_1_7
     96         targetCompatibility JavaVersion.VERSION_1_7
     97     }
     98 
     99     sourceSets {
    100         main {
    101             dirs.each { dir ->
    102 <#noparse>
    103                 java.srcDirs "src/${dir}/java"
    104                 res.srcDirs "src/${dir}/res"
    105 </#noparse>
    106             }
    107         }
    108         androidTest.setRoot('tests')
    109         androidTest.java.srcDirs = ['tests/src']
    110 
    111 <#if sample.defaultConfig?has_content>
    112         defaultConfig {
    113         ${sample.defaultConfig}
    114         }
    115 <#else>
    116 </#if>
    117     }
    118 }
    119