build.gradle revision a6e4583962e19e8e93b4ca3f9fe3d34560b6d96c
1/* 2 * Copyright (C) 2015 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 18apply plugin: 'maven' 19apply plugin: 'com.android.library' 20apply plugin: 'com.android.databinding' 21 22android { 23 compileSdkVersion 21 24 buildToolsVersion "21.1.2" 25 26 defaultConfig { 27 minSdkVersion 7 28 targetSdkVersion 21 29 versionCode 1 30 versionName "1.0" 31 } 32 buildTypes { 33 release { 34 minifyEnabled false 35 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 36 } 37 } 38 39 packagingOptions { 40 exclude 'META-INF/services/javax.annotation.processing.Processor' 41 exclude 'META-INF/LICENSE.txt' 42 exclude 'META-INF/NOTICE.txt' 43 } 44} 45 46dependencies { 47 compile "com.android.databinding:baseLibrary:${config.snapshotVersion}" 48 provided "com.android.databinding:annotationprocessor:${config.snapshotVersion}" 49 compile 'com.android.support:support-v4:+' 50 compile 'com.android.support:cardview-v7:+' 51 compile 'com.android.support:appcompat-v7:+' 52} 53 54configurations { 55 jarArchives 56} 57 58 59//create jar tasks 60android.libraryVariants.all { variant -> 61 def name = variant.buildType.name 62 63 if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) { 64 return; // Skip debug builds. 65 } 66 // @Jar version is needed to run compiler tests 67 def task = project.tasks.create "jar${name.capitalize()}", Jar 68 task.dependsOn variant.javaCompile 69 task.from variant.javaCompile.destinationDir 70 def packageName = "com.android.databinding.library.baseAdapters" 71 def appPkgAsClass = packageName.replace('.', '/') 72 task.exclude("com/android/databinding/layouts/*.*") 73 task.exclude("$appPkgAsClass/generated/*") 74 task.exclude("$appPkgAsClass/BR.*") 75 artifacts.add('jarArchives', task); 76} 77 78uploadArchives { 79} 80 81uploadJarArchives { 82 repositories { 83 mavenDeployer { 84 repository(url: "file://${config.mavenRepoDir}") 85 pom.artifactId = "adapters" 86 pom.whenConfigured { 87 println("configured pom, $it") 88 it.dependencies.find {dep -> dep.groupId == 'com.android.support' && dep.artifactId == 'support-v4' }.optional = true 89 it.dependencies.find {dep -> dep.groupId == 'com.android.support' && dep.artifactId == 'cardview-v7' }.optional = true 90 it.dependencies.find {dep -> dep.groupId == 'com.android.support' && dep.artifactId == 'appcompat-v7' }.optional = true 91 } 92 } 93 } 94} 95 96uploadArchives.dependsOn uploadJarArchives 97