Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 1 | apply plugin: 'android-library' |
| 2 | |
| 3 | archivesBaseName = 'mediarouter-v7' |
| 4 | |
Xavier Ducrohet | 855a922 | 2014-01-02 19:00:43 -0800 | [diff] [blame] | 5 | |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 6 | dependencies { |
Xavier Ducrohet | 855a922 | 2014-01-02 19:00:43 -0800 | [diff] [blame] | 7 | compile project(':support-appcompat-v7') |
Jaewan Kim | 0054826 | 2015-08-19 18:59:29 +0900 | [diff] [blame] | 8 | compile project(':support-palette-v7') |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 9 | } |
| 10 | |
| 11 | // some of the source requires compiling against a newer API. |
| 12 | // Right now, use normal Java source sets to compile those into a jar and |
| 13 | // package it as a local dependencies inside the library aar. |
| 14 | |
| 15 | sourceSets { |
| 16 | jellybean.java.srcDir 'jellybean' |
| 17 | jellybeanmr1.java.srcDir 'jellybean-mr1' |
| 18 | jellybeanmr2.java.srcDir 'jellybean-mr2' |
| 19 | } |
| 20 | |
| 21 | // create a jar task for the code above |
| 22 | tasks.create(name: "jar", type: Jar) { |
| 23 | from sourceSets.jellybean.output |
| 24 | from sourceSets.jellybeanmr1.output |
| 25 | from sourceSets.jellybeanmr2.output |
| 26 | baseName "internal_impl" |
| 27 | } |
| 28 | |
| 29 | |
| 30 | dependencies { |
| 31 | jellybeanCompile getAndroidPrebuilt('16') |
| 32 | |
| 33 | jellybeanmr1Compile getAndroidPrebuilt('17') |
| 34 | jellybeanmr1Compile sourceSets.jellybean.output |
| 35 | |
Insun Kang | 7a4b10e | 2016-01-20 05:20:38 +0000 | [diff] [blame] | 36 | jellybeanmr2Compile getAndroidPrebuilt('current') |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 37 | jellybeanmr2Compile sourceSets.jellybean.output |
| 38 | jellybeanmr2Compile sourceSets.jellybeanmr1.output |
| 39 | |
| 40 | compile files(jar.archivePath) |
| 41 | } |
| 42 | |
| 43 | android { |
Xavier Ducrohet | 30bfd59 | 2014-06-02 18:41:21 -0700 | [diff] [blame] | 44 | compileSdkVersion 'current' |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 45 | |
| 46 | sourceSets { |
| 47 | main.manifest.srcFile 'AndroidManifest.xml' |
| 48 | main.java.srcDir 'src' |
| 49 | main.res.srcDir 'res' |
| 50 | main.assets.srcDir 'assets' |
| 51 | main.resources.srcDir 'src' |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 52 | |
| 53 | // this moves src/instrumentTest to tests so all folders follow: |
| 54 | // tests/java, tests/res, tests/assets, ... |
| 55 | // This is a *reset* so it replaces the default paths |
Xavier Ducrohet | 020e432 | 2014-03-18 16:41:30 -0700 | [diff] [blame] | 56 | androidTest.setRoot('tests') |
| 57 | androidTest.java.srcDir 'tests/src' |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 58 | } |
Xavier Ducrohet | 61becda | 2014-01-29 19:02:16 -0800 | [diff] [blame] | 59 | |
Chris Banes | 8d5b8a6 | 2015-08-19 14:45:09 +0100 | [diff] [blame] | 60 | compileOptions { |
| 61 | sourceCompatibility JavaVersion.VERSION_1_7 |
| 62 | targetCompatibility JavaVersion.VERSION_1_7 |
| 63 | } |
| 64 | |
Xavier Ducrohet | 61becda | 2014-01-29 19:02:16 -0800 | [diff] [blame] | 65 | lintOptions { |
| 66 | // TODO: fix errors and reenable. |
| 67 | abortOnError false |
| 68 | } |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | android.libraryVariants.all { variant -> |
| 72 | variant.javaCompile.dependsOn jar |
Xavier Ducrohet | 11b8398 | 2015-03-31 15:12:42 -0700 | [diff] [blame] | 73 | |
| 74 | def name = variant.buildType.name |
| 75 | |
| 76 | if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) { |
| 77 | return; // Skip debug builds. |
| 78 | } |
| 79 | def suffix = name.capitalize() |
| 80 | |
| 81 | def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){ |
| 82 | dependsOn variant.javaCompile |
| 83 | from variant.javaCompile.destinationDir |
| 84 | from 'LICENSE.txt' |
| 85 | } |
| 86 | def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) { |
| 87 | source android.sourceSets.main.java |
| 88 | classpath = files(variant.javaCompile.classpath.files) + files( |
| 89 | "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar") |
| 90 | } |
| 91 | |
| 92 | def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) { |
| 93 | classifier = 'javadoc' |
| 94 | from 'build/docs/javadoc' |
| 95 | } |
| 96 | |
| 97 | def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) { |
| 98 | classifier = 'sources' |
| 99 | from android.sourceSets.main.java.srcDirs |
| 100 | } |
| 101 | |
| 102 | javadocTask.source project.sourceSets.jellybean.java |
| 103 | sourcesJarTask.from project.sourceSets.jellybean.java.srcDirs |
| 104 | javadocTask.source project.sourceSets.jellybeanmr1.java |
| 105 | sourcesJarTask.from project.sourceSets.jellybeanmr1.java.srcDirs |
| 106 | javadocTask.source project.sourceSets.jellybeanmr2.java |
| 107 | sourcesJarTask.from project.sourceSets.jellybeanmr2.java.srcDirs |
| 108 | |
| 109 | artifacts.add('archives', javadocJarTask); |
| 110 | artifacts.add('archives', sourcesJarTask); |
| 111 | } |
| 112 | |
| 113 | uploadArchives { |
| 114 | repositories { |
| 115 | mavenDeployer { |
| 116 | repository(url: uri(rootProject.ext.supportRepoOut)) { |
| 117 | } |
| 118 | |
| 119 | pom.project { |
Chris Banes | 3f175da | 2015-10-01 12:42:26 +0100 | [diff] [blame] | 120 | name 'Android MediaRouter Support Library' |
Xavier Ducrohet | 11b8398 | 2015-03-31 15:12:42 -0700 | [diff] [blame] | 121 | 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." |
| 122 | url 'http://developer.android.com/tools/extras/support-library.html' |
| 123 | inceptionYear '2011' |
| 124 | |
| 125 | licenses { |
| 126 | license { |
| 127 | name 'The Apache Software License, Version 2.0' |
| 128 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
| 129 | distribution 'repo' |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | scm { |
| 134 | url "http://source.android.com" |
| 135 | connection "scm:git:https://android.googlesource.com/platform/frameworks/support" |
| 136 | } |
| 137 | developers { |
| 138 | developer { |
| 139 | name 'The Android Open Source Project' |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | } |
Raphael Moll | 5057daa | 2013-10-29 17:01:14 -0700 | [diff] [blame] | 145 | } |