• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1apply plugin: 'com.android.library'
2archivesBaseName = 'support-fragment'
3
4
5createApiSourceSets(project, gradle.ext.studioCompat.modules.fragment.apiTargets)
6dependencies {
7    compile project(':support-compat')
8    compile project(':support-media-compat')
9    compile project(':support-core-ui')
10    compile project(':support-core-utils')
11    androidTestCompile ("com.android.support.test:runner:${project.rootProject.ext.testRunnerVersion}") {
12        exclude module: 'support-annotations'
13    }
14    androidTestCompile ("com.android.support.test.espresso:espresso-core:${project.rootProject.ext.espressoVersion}") {
15        exclude module: 'support-annotations'
16    }
17    androidTestCompile 'org.mockito:mockito-core:1.9.5'
18    androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
19    androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
20    testCompile 'junit:junit:4.12'
21}
22
23sourceCompatibility = JavaVersion.VERSION_1_7
24targetCompatibility = JavaVersion.VERSION_1_7
25setApiModuleDependencies(project, dependencies, gradle.ext.studioCompat.modules.fragment.dependencies)
26
27android {
28    compileSdkVersion 9
29
30    defaultConfig {
31        minSdkVersion 9
32        // TODO: get target from branch
33        //targetSdkVersion 19
34
35        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
36    }
37
38    sourceSets {
39        main.manifest.srcFile 'AndroidManifest.xml'
40        main.java.srcDirs = ['java']
41
42        androidTest.setRoot('tests')
43        androidTest.java.srcDir 'tests/java'
44        androidTest.res.srcDir 'tests/res'
45        androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
46    }
47
48    lintOptions {
49        // TODO: fix errors and reenable.
50        abortOnError false
51    }
52
53    compileOptions {
54        sourceCompatibility JavaVersion.VERSION_1_7
55        targetCompatibility JavaVersion.VERSION_1_7
56    }
57
58    testOptions {
59        unitTests.returnDefaultValues = true
60        compileSdkVersion project.ext.currentSdk
61    }
62}
63
64android.libraryVariants.all { variant ->
65    def name = variant.buildType.name
66
67    if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
68        return; // Skip debug builds.
69    }
70    def suffix = name.capitalize()
71
72    def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
73        dependsOn variant.javaCompile
74        from variant.javaCompile.destinationDir
75        from 'LICENSE.txt'
76    }
77    def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
78        source android.sourceSets.main.java
79        classpath = files(variant.javaCompile.classpath.files) + files(
80                "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
81    }
82
83    def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
84        classifier = 'javadoc'
85        from 'build/docs/javadoc'
86    }
87
88    def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
89        classifier = 'sources'
90        from android.sourceSets.main.java.srcDirs
91        exclude('android/content/pm/**')
92        exclude('android/service/media/**')
93    }
94
95    project.ext.allSS.each { ss ->
96        javadocTask.source ss.java
97        sourcesJarTask.from ss.java.srcDirs
98    }
99
100    artifacts.add('archives', javadocJarTask);
101    artifacts.add('archives', sourcesJarTask);
102}
103
104uploadArchives {
105    repositories {
106        mavenDeployer {
107            repository(url: uri(rootProject.ext.supportRepoOut)) {
108            }
109
110            pom.project {
111                name 'Android Support Library v4'
112                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."
113                url 'http://developer.android.com/tools/extras/support-library.html'
114                inceptionYear '2011'
115
116                licenses {
117                    license {
118                        name 'The Apache Software License, Version 2.0'
119                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
120                        distribution 'repo'
121                    }
122                }
123
124                scm {
125                    url "http://source.android.com"
126                    connection "scm:git:https://android.googlesource.com/platform/frameworks/support"
127                }
128                developers {
129                    developer {
130                        name 'The Android Open Source Project'
131                    }
132                }
133            }
134        }
135    }
136}