1apply plugin: 'com.android.library' 2archivesBaseName = 'support-core-ui' 3 4 5createApiSourceSets(project, gradle.ext.studioCompat.modules.coreui.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.coreui.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.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 buildTypes.all { 51 consumerProguardFiles 'proguard-rules.pro' 52 } 53 54 compileOptions { 55 sourceCompatibility JavaVersion.VERSION_1_7 56 targetCompatibility JavaVersion.VERSION_1_7 57 } 58 59 testOptions { 60 unitTests.returnDefaultValues = true 61 compileSdkVersion project.ext.currentSdk 62 } 63} 64 65android.libraryVariants.all { variant -> 66 def name = variant.buildType.name 67 68 if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) { 69 return; // Skip debug builds. 70 } 71 def suffix = name.capitalize() 72 73 def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){ 74 dependsOn variant.javaCompile 75 from variant.javaCompile.destinationDir 76 from 'LICENSE.txt' 77 } 78 def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) { 79 source android.sourceSets.main.java 80 classpath = files(variant.javaCompile.classpath.files) + files( 81 "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar") 82 } 83 84 def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) { 85 classifier = 'javadoc' 86 from 'build/docs/javadoc' 87 } 88 89 def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) { 90 classifier = 'sources' 91 from android.sourceSets.main.java.srcDirs 92 exclude('android/content/pm/**') 93 exclude('android/service/media/**') 94 } 95 96 project.ext.allSS.each { ss -> 97 javadocTask.source ss.java 98 sourcesJarTask.from ss.java.srcDirs 99 } 100 101 artifacts.add('archives', javadocJarTask); 102 artifacts.add('archives', sourcesJarTask); 103} 104 105uploadArchives { 106 repositories { 107 mavenDeployer { 108 repository(url: uri(rootProject.ext.supportRepoOut)) { 109 } 110 111 pom.project { 112 name 'Android Support Library v4' 113 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." 114 url 'http://developer.android.com/tools/extras/support-library.html' 115 inceptionYear '2011' 116 117 licenses { 118 license { 119 name 'The Apache Software License, Version 2.0' 120 url 'http://www.apache.org/licenses/LICENSE-2.0.txt' 121 distribution 'repo' 122 } 123 } 124 125 scm { 126 url "http://source.android.com" 127 connection "scm:git:https://android.googlesource.com/platform/frameworks/support" 128 } 129 developers { 130 developer { 131 name 'The Android Open Source Project' 132 } 133 } 134 } 135 } 136 } 137}