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