• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1apply plugin: 'com.android.library'
2
3archivesBaseName = 'gridlayout-v7'
4
5dependencies {
6    compile project(':support-compat')
7    compile project(':support-core-ui')
8
9    androidTestCompile ("com.android.support.test:runner:${project.rootProject.ext.testRunnerVersion}") {
10        exclude module: 'support-annotations'
11    }
12    androidTestCompile ("com.android.support.test.espresso:espresso-core:${project.rootProject.ext.espressoVersion}") {
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.srcDir 'src'
28        main.res.srcDir 'res'
29        main.assets.srcDir 'assets'
30        main.resources.srcDir 'src'
31
32        // this moves src/instrumentTest to tests so all folders follow:
33        // tests/java, tests/res, tests/assets, ...
34        // This is a *reset* so it replaces the default paths
35        androidTest.setRoot('tests')
36        androidTest.java.srcDir 'tests/src'
37        androidTest.res.srcDir 'tests/res'
38        androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
39    }
40
41    compileOptions {
42        sourceCompatibility JavaVersion.VERSION_1_7
43        targetCompatibility JavaVersion.VERSION_1_7
44    }
45
46    lintOptions {
47        // TODO: fix errors and reenable.
48        abortOnError false
49    }
50}
51
52
53android.libraryVariants.all { variant ->
54    def name = variant.buildType.name
55
56    if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
57        return; // Skip debug builds.
58    }
59    def suffix = name.capitalize()
60
61    def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
62        dependsOn variant.javaCompile
63        from variant.javaCompile.destinationDir
64        from 'LICENSE.txt'
65    }
66    def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
67        source android.sourceSets.main.java
68        classpath = files(variant.javaCompile.classpath.files) + files(
69                "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
70    }
71
72    def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
73        classifier = 'javadoc'
74        from 'build/docs/javadoc'
75    }
76
77    def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
78        classifier = 'sources'
79        from android.sourceSets.main.java.srcDirs
80    }
81
82    artifacts.add('archives', javadocJarTask);
83    artifacts.add('archives', sourcesJarTask);
84}
85
86uploadArchives {
87    repositories {
88        mavenDeployer {
89            repository(url: uri(rootProject.ext.supportRepoOut)) {
90            }
91
92            pom.project {
93                name 'Android Support Library v4'
94                description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 4 or later."
95                url 'http://developer.android.com/tools/extras/support-library.html'
96                inceptionYear '2011'
97
98                licenses {
99                    license {
100                        name 'The Apache Software License, Version 2.0'
101                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
102                        distribution 'repo'
103                    }
104                }
105
106                scm {
107                    url "http://source.android.com"
108                    connection "scm:git:https://android.googlesource.com/platform/frameworks/support"
109                }
110                developers {
111                    developer {
112                        name 'The Android Open Source Project'
113                    }
114                }
115            }
116        }
117    }
118}
119