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 dependencies {
     41 <#list sample.dependency_wearable as dep>
     42     <#-- Output dependency after checking if it is a play services depdency and
     43     needs the latest version number attached. -->
     44     <@update_play_services_dependency dep="${dep}" />
     45 </#list>
     46     compile ${play_services_wearable_dependency}
     47     compile ${android_support_v13_dependency}
     48 
     49     <#if sample.preview_wearable_support_provided_dependency?? && sample.preview_wearable_support_provided_dependency?has_content>
     50     provided '${sample.preview_wearable_support_provided_dependency}'
     51     <#else>
     52     provided ${wearable_support_provided_dependency}
     53     </#if>
     54 
     55     <#if sample.preview_wearable_support_dependency?? && sample.preview_wearable_support_dependency?has_content>
     56     compile '${sample.preview_wearable_support_dependency}'
     57     <#else>
     58     compile ${wearable_support_dependency}
     59     </#if>
     60 
     61     compile project(':Shared')
     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 
     74       <#if sample.compileSdkVersionWear?? && sample.compileSdkVersionWear?has_content>
     75         compileSdkVersion ${sample.compileSdkVersionWear}
     76       <#else>
     77         compileSdkVersion ${compile_sdk}
     78       </#if>
     79 
     80     buildToolsVersion ${build_tools_version}
     81 
     82     defaultConfig {
     83         versionCode 1
     84         versionName "1.0"
     85 
     86       <#if sample.minSdkVersionWear?? && sample.minSdkVersionWear?has_content>
     87         minSdkVersion ${sample.minSdkVersionWear}
     88       <#else>
     89         minSdkVersion ${min_sdk}
     90       </#if>
     91 
     92       <#if sample.targetSdkVersionWear?? && sample.targetSdkVersionWear?has_content>
     93         targetSdkVersion ${sample.targetSdkVersionWear}
     94       <#else>
     95         targetSdkVersion ${compile_sdk}
     96       </#if>
     97 
     98        <#if sample.multiDexEnabled?? && sample.multiDexEnabled?has_content>
     99          multiDexEnabled ${sample.multiDexEnabled}
    100        </#if>
    101 
    102     }
    103 
    104     compileOptions {
    105         sourceCompatibility JavaVersion.VERSION_1_7
    106         targetCompatibility JavaVersion.VERSION_1_7
    107     }
    108 
    109     sourceSets {
    110         main {
    111             dirs.each { dir ->
    112 <#noparse>
    113                 java.srcDirs "src/${dir}/java"
    114                 res.srcDirs "src/${dir}/res"
    115 </#noparse>
    116             }
    117         }
    118         androidTest.setRoot('tests')
    119         androidTest.java.srcDirs = ['tests/src']
    120 
    121 <#if sample.defaultConfig?has_content>
    122         defaultConfig {
    123         ${sample.defaultConfig}
    124         }
    125 <#else>
    126 </#if>
    127     }
    128 }
    129