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