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