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