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