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         google()
     19         jcenter()
     20     }
     21 
     22     dependencies {
     23         classpath 'com.android.tools.build:gradle:3.3.2'
     24     }
     25 }
     26 
     27 apply plugin: 'com.android.application'
     28 
     29 repositories {
     30     google()
     31     jcenter()
     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     implementation ${play_services_wearable_dependency}
     46 
     47   <#-- TODO (jewalker): Revise once androidX is released to production. -->
     48   <#if !sample.androidX?? || !sample.androidX?has_content || sample.androidX == "false">
     49     implementation ${android_support_v13_dependency}
     50   </#if>
     51 
     52     <#if sample.preview_wearable_support_provided_dependency?? && sample.preview_wearable_support_provided_dependency?has_content>
     53     compileOnly '${sample.preview_wearable_support_provided_dependency}'
     54     <#else>
     55     compileOnly ${wearable_support_provided_dependency}
     56     </#if>
     57 
     58     <#if sample.preview_wearable_support_dependency?? && sample.preview_wearable_support_dependency?has_content>
     59     implementation '${sample.preview_wearable_support_dependency}'
     60     <#else>
     61     implementation ${wearable_support_dependency}
     62     </#if>
     63 
     64     implementation project(':Shared')
     65 }
     66 
     67 // The sample build uses multiple directories to
     68 // keep boilerplate and common code separate from
     69 // the main sample code.
     70 List<String> dirs = [
     71     'main',     // main sample code; look here for the interesting stuff.
     72     'common',   // components that are reused by multiple samples
     73     'template'] // boilerplate code that is generated by the sample template process
     74 
     75 android {
     76 
     77   <#if sample.compileSdkVersionWear?? && sample.compileSdkVersionWear?has_content>
     78     compileSdkVersion ${sample.compileSdkVersionWear}
     79   <#else>
     80     compileSdkVersion ${compile_sdk}
     81   </#if>
     82 
     83     buildToolsVersion ${build_tools_version}
     84 
     85     defaultConfig {
     86         versionCode 1
     87         versionName "1.0"
     88 
     89       <#if sample.minSdkVersionWear?? && sample.minSdkVersionWear?has_content>
     90         minSdkVersion ${sample.minSdkVersionWear}
     91       <#else>
     92         minSdkVersion ${min_sdk}
     93       </#if>
     94 
     95       <#if sample.targetSdkVersionWear?? && sample.targetSdkVersionWear?has_content>
     96         targetSdkVersion ${sample.targetSdkVersionWear}
     97       <#else>
     98         targetSdkVersion ${compile_sdk}
     99       </#if>
    100 
    101        <#if sample.multiDexEnabled?? && sample.multiDexEnabled?has_content>
    102          multiDexEnabled ${sample.multiDexEnabled}
    103        </#if>
    104 
    105     }
    106 
    107     compileOptions {
    108         sourceCompatibility JavaVersion.VERSION_1_7
    109         targetCompatibility JavaVersion.VERSION_1_7
    110     }
    111 
    112     sourceSets {
    113         main {
    114             dirs.each { dir ->
    115 <#noparse>
    116                 java.srcDirs "src/${dir}/java"
    117                 res.srcDirs "src/${dir}/res"
    118 </#noparse>
    119             }
    120         }
    121         androidTest.setRoot('tests')
    122         androidTest.java.srcDirs = ['tests/src']
    123 
    124 <#if sample.defaultConfig?has_content>
    125         defaultConfig {
    126         ${sample.defaultConfig}
    127         }
    128 <#else>
    129 </#if>
    130     }
    131 }
    132