1/* 2 * Copyright (C) 2016 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 17/** 18 * Generic build.gradle file that can be used for API specific support lib implementations. 19 * This file is used only if Android Studio opens the project. 20 */ 21apply plugin: 'com.android.library' 22def apiModule = gradle.ext.getApiModule(project) 23logger.info ("apiModule for ${project.projectDir} is $apiModule. " 24 + "compileSDK: ${apiModule.apiForSourceSet} minSDK: ${apiModule.api}") 25android { 26 compileSdkVersion apiModule.apiForSourceSet 27 // these api modules all use the same package name so we should not package their BuildConfig 28 // files. 29 packageBuildConfig false 30 31 sourceSets { 32 main.manifest.srcFile '../AndroidManifest.xml' 33 main.java.srcDirs = ['.'] 34 35 apiModule.resourceFolders.each { 36 main.res.srcDirs += "../$it" 37 } 38 apiModule.assetFolders.each { 39 main.assets.srcDirs += "../$it" 40 } 41 apiModule.javaResourceFolders.each { 42 main.resources.srcDirs += "../$it" 43 } 44 } 45 46 lintOptions { 47 abortOnError false 48 } 49 50 compileOptions { 51 sourceCompatibility JavaVersion.VERSION_1_7 52 targetCompatibility JavaVersion.VERSION_1_7 53 } 54 55 enforceUniquePackageName = false 56} 57 58 59dependencies { 60 if (apiModule.prev != null) { 61 compile project(apiModule.prev.moduleName) 62 } else { 63 apiModule.parentModuleDependencies.each { dep -> 64 compile project(dep) 65 } 66 } 67} 68