1apply plugin: 'com.android.library'
2
3archivesBaseName = 'customtabs'
4
5dependencies {
6    compile project(':support-v4')
7    compile project(':support-annotations')
8
9    androidTestCompile ('com.android.support.test:runner:0.4.1') {
10        exclude module: 'support-annotations'
11    }
12    androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.1') {
13        exclude module: 'support-annotations'
14    }
15    testCompile 'junit:junit:4.12'
16}
17
18android {
19    compileSdkVersion project.ext.currentSdk
20
21    defaultConfig {
22        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
23    }
24
25    sourceSets {
26        main.manifest.srcFile 'AndroidManifest.xml'
27        main.java.srcDirs = ['src']
28        main.aidl.srcDirs = ['src']
29        main.res.srcDir 'res'
30        main.assets.srcDir 'assets'
31        main.resources.srcDir 'java'
32
33        androidTest.setRoot('tests')
34        androidTest.java.srcDir('tests/src/')
35    }
36
37    compileOptions {
38        sourceCompatibility JavaVersion.VERSION_1_7
39        targetCompatibility JavaVersion.VERSION_1_7
40    }
41}
42
43android.libraryVariants.all { variant ->
44    def name = variant.buildType.name
45
46    if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
47        return; // Skip debug builds.
48    }
49    def suffix = name.capitalize()
50
51    def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
52        dependsOn variant.javaCompile
53        from variant.javaCompile.destinationDir
54        from 'LICENSE.txt'
55    }
56    def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
57        source android.sourceSets.main.java
58        classpath = files(variant.javaCompile.classpath.files) + files(
59                "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
60    }
61
62    def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
63        classifier = 'javadoc'
64        from 'build/docs/javadoc'
65    }
66
67    def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
68        classifier = 'sources'
69        from android.sourceSets.main.java.srcDirs
70    }
71
72    artifacts.add('archives', javadocJarTask);
73    artifacts.add('archives', sourcesJarTask);
74}
75