build.gradle revision 3ac77bf186f87ecad4bf0063b2f6c4384efbd56a
12823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunkapply plugin: 'com.android.library' 22823ce0ce6f9d508a07de20912c93cce9165027fRuben BrunkarchivesBaseName = 'support-compat' 32823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk 42823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk 52823ce0ce6f9d508a07de20912c93cce9165027fRuben BrunkcreateApiSourceSets(project, gradle.ext.studioCompat.modules.v4.apiTargets) 62823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunkdependencies { 72823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk androidTestCompile ('com.android.support.test:runner:0.4.1') { 82823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk exclude module: 'support-annotations' 92823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk } 102823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.1') { 112823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk exclude module: 'support-annotations' 122823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk } 132823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk androidTestCompile 'org.mockito:mockito-core:1.9.5' 142823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk androidTestCompile 'com.google.dexmaker:dexmaker:1.2' 152823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2' 162823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk testCompile 'junit:junit:4.12' 172823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk} 182823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk 192823ce0ce6f9d508a07de20912c93cce9165027fRuben BrunksourceCompatibility = JavaVersion.VERSION_1_7 202823ce0ce6f9d508a07de20912c93cce9165027fRuben BrunktargetCompatibility = JavaVersion.VERSION_1_7 212823ce0ce6f9d508a07de20912c93cce9165027fRuben BrunksetApiModuleDependencies(project, dependencies, gradle.ext.studioCompat.modules.v4.dependencies) 222823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk 232823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunkandroid { 242823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk compileSdkVersion 4 252823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk 262823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk defaultConfig { 272823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk minSdkVersion 4 282823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk // TODO: get target from branch 29090ef604f81447eab4aa0a5b45d6307482573560Chih-Hung Hsieh //targetSdkVersion 19 30090ef604f81447eab4aa0a5b45d6307482573560Chih-Hung Hsieh 312823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 322823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk } 33412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala 342823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk sourceSets { 35412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala main.manifest.srcFile 'AndroidManifest.xml' 362823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk main.java.srcDirs = ['java'] 372823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk main.aidl.srcDirs = ['java'] 38412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala 39412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala androidTest.setRoot('tests') 40412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala androidTest.java.srcDir 'tests/java' 41412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala androidTest.res.srcDir 'tests/res' 42412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala androidTest.manifest.srcFile 'tests/AndroidManifest.xml' 43412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala } 44412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala 45412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala lintOptions { 46412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala // TODO: fix errors and reenable. 47412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala abortOnError false 482823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk } 492823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk 502823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk compileOptions { 512823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk sourceCompatibility JavaVersion.VERSION_1_7 522823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk targetCompatibility JavaVersion.VERSION_1_7 532823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk } 542823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk 552823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk testOptions { 562823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk unitTests.returnDefaultValues = true 572823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk compileSdkVersion project.ext.currentSdk 582823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk } 592823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk} 602823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk 61412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvalaandroid.libraryVariants.all { variant -> 62412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala def name = variant.buildType.name 63412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala 64412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) { 65412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala return; // Skip debug builds. 66412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala } 67412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala def suffix = name.capitalize() 68412fe56cd7cf7d73bc5d2bcc3f635bc650d18de9Eino-Ville Talvala 692823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){ 702823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk dependsOn variant.javaCompile 712823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk from variant.javaCompile.destinationDir 722823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk from 'LICENSE.txt' 732823ce0ce6f9d508a07de20912c93cce9165027fRuben Brunk } 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}