build.gradle revision 9c95c40e44e4ed885ad4266485853db2aee033c2
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 17apply plugin: 'com.android.library' 18project.ext.addDataBindingAdapters = false 19apply plugin: 'com.android.databinding' 20 21android { 22 compileSdkVersion 21 23 buildToolsVersion "21.1.2" 24 25 defaultConfig { 26 minSdkVersion 7 27 targetSdkVersion 21 28 versionCode 1 29 versionName "1.0" 30 } 31 buildTypes { 32 release { 33 minifyEnabled false 34 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 35 } 36 } 37 38 packagingOptions { 39 exclude 'META-INF/services/javax.annotation.processing.Processor' 40 exclude 'META-INF/LICENSE.txt' 41 exclude 'META-INF/NOTICE.txt' 42 } 43} 44 45dependencies { 46 provided 'com.android.support:support-v4:+' 47 provided 'com.android.support:cardview-v7:+' 48 provided 'com.android.support:appcompat-v7:+' 49} 50 51//create jar tasks 52android.libraryVariants.all { variant -> 53 def name = variant.buildType.name 54 55 if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) { 56 return; // Skip debug builds. 57 } 58 def suffix = name.capitalize() 59 60 def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) { 61 source variant.javaCompile.source 62 classpath = files(variant.javaCompile.classpath.files) + files( 63 "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar") 64 } 65 66 def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) { 67 classifier = 'javadoc' 68 from 'build/docs/javadoc' 69 } 70 javadocJarTask.dependsOn javadocTask 71 72 def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) { 73 classifier = 'sources' 74 from android.sourceSets.main.java.srcDirs 75 } 76 77 artifacts.add('archives', javadocJarTask); 78 artifacts.add('archives', sourcesJarTask); 79} 80 81uploadArchives { 82 repositories { 83 mavenDeployer { 84 repository(url: "file://${config.mavenRepoDir}") 85 pom.artifactId = "adapters" 86 pom.project { 87 licenses { 88 license { 89 name config.licenseName 90 url config.licenseUrl 91 distribution config.licenseDistribution 92 } 93 } 94 } 95 } 96 } 97} 98 99 100task prebuild(type : Copy) { 101 dependsOn uploadArchives 102 from "$buildDir/outputs/aar/baseAdapters-release.aar" 103 into config.prebuildFolder 104 rename { String fileName -> 105 "databinding-adapters.aar" 106 } 107}