1 <#ftl> 2 <#-- 3 Copyright 2013 The Android Open Source Project 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16 --> 17 <#-- Add the appropriate copyright header --> 18 <#if meta.outputFile?ends_with("java")> 19 <#include "c-style-copyright.ftl"> 20 <#elseif meta.outputFile?ends_with("xml")> 21 <#include "xml-style-copyright.ftl"> 22 </#if> 23 <#-- Set the compile SDK version. This is more complicated than it should be, because 24 the version can be either a number or a string (e.g. KeyLimePie) so we need to test 25 both to see if the variable is empty. Note that to freemarker, all values from 26 template-params.xml are Strings, even those that are human-readable as ints. 27 28 Also, there's no way to check if it's a number or not without spamming output with 29 try/catch stacktraces, so we can't silently wrap a string in quotes and leave a number 30 alone. 31 --> 32 <#if (samples.compileSdkVersion)?? && (sample.compileSdkVersion)?is_string> 33 <#if (sample.compileSdkVersion?contains("android")) && !(sample.compileSdkVersion?starts_with("\"")) 34 && !(sample.compileSdkVersion?ends_with("\""))> 35 <#assign compile_sdk = "\"${sample.compileSdkVersion}\""/> 36 <#else> 37 <#assign compile_sdk = sample.compileSdkVersion/> 38 </#if> 39 <#elseif (sample.compileSdkVersion)?has_content> 40 <#assign compile_sdk = sample.compileSdkVersion/> 41 <#else> 42 <#assign compile_sdk = "24"/> 43 </#if> 44 <#-- Set the MinSDK version. This is more complicated than it should be, because 45 the version can be either a number or a string (e.g. KeyLimePie) so we need to test 46 both to see if the variable is empty. Note that to freemarker, all values from 47 template-params.xml are Strings, even those that are human-readable as ints. 48 49 Also, there's no way to check if it's a number or not without spamming output with 50 try/catch stacktraces, so we can't silently wrap a string in quotes and leave a number 51 alone. 52 --> 53 <#if (samples.minSdk)?? && (sample.minSdk)?is_string> 54 <#if (sample.minSdk?contains("android")) && !(sample.minSdk?starts_with("\"")) 55 && !(sample.minSdk?ends_with("\""))> 56 <#assign min_sdk = "\"${sample.minSdk}\""/> 57 <#else> 58 <#assign min_sdk = sample.minSdk/> 59 </#if> 60 <#elseif (sample.minSdk)?has_content> 61 <#assign min_sdk = sample.minSdk/> 62 <#else> 63 <#assign min_sdk = "24"/> 64 </#if> 65 66 <#-- Global macros --> 67 68 <#-- Check if dependency is a play services dependency and if it doesn't 69 have a version number attached use the global value 70 play_services_version --> 71 <#macro update_play_services_dependency dep> 72 <#if "${dep}"?starts_with("com.google.android.gms:play-services") 73 && "${dep}"?index_of(":") == "${dep}"?last_index_of(":")> 74 compile '${dep}:${play_services_version}' 75 <#else> 76 compile '${dep}' 77 </#if> 78 </#macro> 79 80 <#-- Set the global build tools version --> 81 <#assign build_tools_version='"24.0.1"'/> 82 83 <#assign play_services_version="8.4.0"/> 84 <#assign play_services_wearable_dependency="'com.google.android.gms:play-services-wearable:${play_services_version}'"/> 85 86 <#assign android_support_v13_dependency="'com.android.support:support-v13:24.1.1'"/> 87 88 <#assign wearable_support_dependency="'com.google.android.support:wearable:1.4.0'"/> 89