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