blob: 48f47508cdf8da479ddf4fbe2eaecfb7fa05b2c7 [file] [log] [blame]
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -08001apply plugin: 'android-library'
2
3archivesBaseName = 'mediarouter-v7'
4
Xavier Ducrohet855a9222014-01-02 19:00:43 -08005
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -08006dependencies {
Xavier Ducrohet855a9222014-01-02 19:00:43 -08007 compile project(':support-appcompat-v7')
Jaewan Kim00548262015-08-19 18:59:29 +09008 compile project(':support-palette-v7')
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -08009}
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
15sourceSets {
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
22tasks.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
30dependencies {
31 jellybeanCompile getAndroidPrebuilt('16')
32
33 jellybeanmr1Compile getAndroidPrebuilt('17')
34 jellybeanmr1Compile sourceSets.jellybean.output
35
Insun Kang7a4b10e2016-01-20 05:20:38 +000036 jellybeanmr2Compile getAndroidPrebuilt('current')
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080037 jellybeanmr2Compile sourceSets.jellybean.output
38 jellybeanmr2Compile sourceSets.jellybeanmr1.output
39
40 compile files(jar.archivePath)
41}
42
43android {
Xavier Ducrohet30bfd592014-06-02 18:41:21 -070044 compileSdkVersion 'current'
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080045
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 Ducrohet86fb8ef2013-02-22 15:04:37 -080052
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 Ducrohet020e4322014-03-18 16:41:30 -070056 androidTest.setRoot('tests')
57 androidTest.java.srcDir 'tests/src'
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080058 }
Xavier Ducrohet61becda2014-01-29 19:02:16 -080059
Chris Banes8d5b8a62015-08-19 14:45:09 +010060 compileOptions {
61 sourceCompatibility JavaVersion.VERSION_1_7
62 targetCompatibility JavaVersion.VERSION_1_7
63 }
64
Xavier Ducrohet61becda2014-01-29 19:02:16 -080065 lintOptions {
66 // TODO: fix errors and reenable.
67 abortOnError false
68 }
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080069}
70
71android.libraryVariants.all { variant ->
72 variant.javaCompile.dependsOn jar
Xavier Ducrohet11b83982015-03-31 15:12:42 -070073
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
113uploadArchives {
114 repositories {
115 mavenDeployer {
116 repository(url: uri(rootProject.ext.supportRepoOut)) {
117 }
118
119 pom.project {
Chris Banes3f175da2015-10-01 12:42:26 +0100120 name 'Android MediaRouter Support Library'
Xavier Ducrohet11b83982015-03-31 15:12:42 -0700121 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 Moll5057daa2013-10-29 17:01:14 -0700145}