• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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        main.res.srcDirs = []
35        apiModule.resourceFolders.each {
36            main.res.srcDirs += "../$it"
37        }
38        main.assets.srcDirs = []
39        apiModule.assetFolders.each {
40            main.assets.srcDirs += "../$it"
41        }
42        main.resources.srcDirs = []
43        apiModule.javaResourceFolders.each {
44            main.resources.srcDirs += "../$it"
45        }
46    }
47
48    lintOptions {
49        abortOnError false
50    }
51
52    compileOptions {
53        sourceCompatibility JavaVersion.VERSION_1_7
54        targetCompatibility JavaVersion.VERSION_1_7
55    }
56
57    enforceUniquePackageName = false
58}
59
60
61dependencies {
62    if (apiModule.prev != null) {
63        compile project(apiModule.prev.moduleName)
64    } else {
65        apiModule.parentModuleDependencies.each { dep ->
66            compile project(dep)
67        }
68    }
69}
70