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 = "21"/> 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 = "21"/> 64 </#if> 65 <#-- Set the global build tools version --> 66 <#assign build_tools_version='"21.0.0"'/> 67