Home | History | Annotate | Download | only in _MODULE_
      1 <#--
      2  Copyright 2013 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         mavenCentral()
     19     }
     20 
     21     dependencies {
     22         classpath 'com.android.tools.build:gradle:0.6.+'
     23     }
     24 }
     25 
     26 apply plugin: 'android'
     27 
     28 dependencies {
     29     // Add the support lib that is appropriate for SDK ${sample.minSdk}
     30 <#if sample.minSdk?number < 7>
     31     compile "com.android.support:support-v4:18.0.+"
     32 <#elseif sample.minSdk?number < 13>
     33     compile "com.android.support:support-v4:18.0.+"
     34     compile "com.android.support:gridlayout-v7:18.0.+"
     35 <#else>
     36     compile "com.android.support:support-v13:18.0.+"
     37 </#if>
     38 <#list sample.dependency as dep>
     39     compile "${dep}"
     40 </#list>
     41 }
     42 
     43 // The sample build uses multiple directories to
     44 // keep boilerplate and common code separate from
     45 // the main sample code.
     46 List<String> dirs = [
     47     'main',     // main sample code; look here for the interesting stuff.
     48     'common',   // components that are reused by multiple samples
     49     'template'] // boilerplate code that is generated by the sample template process
     50 
     51 android {
     52      <#-- Note that target SDK is hardcoded in this template. We expect all samples
     53           to always use the most current SDK as their target. -->
     54     compileSdkVersion ${compile_sdk}
     55     buildToolsVersion "19"
     56 
     57     sourceSets {
     58         main {
     59             dirs.each { dir ->
     60 <#noparse>
     61                 java.srcDirs "src/${dir}/java"
     62                 res.srcDirs "src/${dir}/res"
     63 </#noparse>
     64             }
     65         }
     66         instrumentTest.setRoot('tests')
     67         instrumentTest.java.srcDirs = ['tests/src']
     68     }
     69 }
     70 // BEGIN_EXCLUDE
     71 // Tasks below this line will be hidden from release output
     72 
     73 task preflight (dependsOn: parent.preflight) {
     74     project.afterEvaluate {
     75         // Inject a preflight task into each variant so we have a place to hook tasks
     76         // that need to run before any of the android build tasks.
     77         //
     78         android.applicationVariants.each { variant ->
     79         <#noparse>
     80             tasks.getByPath("prepare${variant.name.capitalize()}Dependencies").dependsOn preflight
     81         </#noparse>
     82         }
     83     }
     84 }
     85 
     86 // END_EXCLUDE
     87