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