• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
16buildscript {
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}
23apply plugin: 'com.android.library'
24
25android {
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
45    packagingOptions {
46        exclude 'META-INF/services/javax.annotation.processing.Processor'
47        exclude 'META-INF/LICENSE.txt'
48        exclude 'META-INF/NOTICE.txt'
49    }
50}
51
52dependencies {
53    provided 'com.android.support:support-v4:+'
54    provided 'com.android.support:cardview-v7:+'
55    provided 'com.android.support:appcompat-v7:+'
56}
57
58//create jar tasks
59android.libraryVariants.all { variant ->
60    def name = variant.buildType.name
61
62    if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
63        return; // Skip debug builds.
64    }
65    def suffix = name.capitalize()
66
67    def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
68        source variant.javaCompile.source
69        classpath = files(variant.javaCompile.classpath.files) + files(
70                "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
71    }
72
73    def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
74        classifier = 'javadoc'
75        from 'build/docs/javadoc'
76    }
77    javadocJarTask.dependsOn javadocTask
78
79    def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
80        classifier = 'sources'
81        from android.sourceSets.main.java.srcDirs
82    }
83
84    artifacts.add('archives', javadocJarTask);
85    artifacts.add('archives', sourcesJarTask);
86}
87
88uploadArchives {
89    repositories {
90        mavenDeployer {
91            pom.artifactId = "adapters"
92            pom.project {
93                licenses {
94                    license {
95                        name dataBindingConfig.licenseName
96                        url dataBindingConfig.licenseUrl
97                        distribution dataBindingConfig.licenseDistribution
98                    }
99                }
100            }
101        }
102    }
103}
104
105
106task prebuild(type : Copy) {
107    dependsOn uploadArchives
108    from "$buildDir/outputs/aar/baseAdapters-release.aar"
109    into dataBindingConfig.prebuildFolder
110    rename { String fileName ->
111        "databinding-adapters.aar"
112    }
113}