summaryrefslogtreecommitdiffstats
path: root/v7/mediarouter/build.gradle
blob: 48f47508cdf8da479ddf4fbe2eaecfb7fa05b2c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
apply plugin: 'android-library'

archivesBaseName = 'mediarouter-v7'


dependencies {
    compile project(':support-appcompat-v7')
    compile project(':support-palette-v7')
}

// some of the source requires compiling against a newer API.
// Right now, use normal Java source sets to compile those into a jar and 
// package it as a local dependencies inside the library aar.

sourceSets {
    jellybean.java.srcDir 'jellybean'
    jellybeanmr1.java.srcDir 'jellybean-mr1'
    jellybeanmr2.java.srcDir 'jellybean-mr2'
}

// create a jar task for the code above
tasks.create(name: "jar", type: Jar) {
    from sourceSets.jellybean.output
    from sourceSets.jellybeanmr1.output
    from sourceSets.jellybeanmr2.output
    baseName "internal_impl"
}


dependencies {
    jellybeanCompile getAndroidPrebuilt('16')

    jellybeanmr1Compile getAndroidPrebuilt('17')
    jellybeanmr1Compile sourceSets.jellybean.output

    jellybeanmr2Compile getAndroidPrebuilt('current')
    jellybeanmr2Compile sourceSets.jellybean.output
    jellybeanmr2Compile sourceSets.jellybeanmr1.output

    compile files(jar.archivePath)
}

android {
    compileSdkVersion 'current'

    sourceSets {
        main.manifest.srcFile 'AndroidManifest.xml'
        main.java.srcDir 'src'
        main.res.srcDir 'res'
        main.assets.srcDir 'assets'
        main.resources.srcDir 'src'

        // this moves src/instrumentTest to tests so all folders follow:
        // tests/java, tests/res, tests/assets, ...
        // This is a *reset* so it replaces the default paths
        androidTest.setRoot('tests')
        androidTest.java.srcDir 'tests/src'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    lintOptions {
        // TODO: fix errors and reenable.
        abortOnError false
    }
}

android.libraryVariants.all { variant ->
    variant.javaCompile.dependsOn jar

    def name = variant.buildType.name

    if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
        return; // Skip debug builds.
    }
    def suffix = name.capitalize()

    def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
        dependsOn variant.javaCompile
        from variant.javaCompile.destinationDir
        from 'LICENSE.txt'
    }
    def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
        source android.sourceSets.main.java
        classpath = files(variant.javaCompile.classpath.files) + files(
                "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
    }

    def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
        classifier = 'javadoc'
        from 'build/docs/javadoc'
    }

    def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
        classifier = 'sources'
        from android.sourceSets.main.java.srcDirs
    }

    javadocTask.source  project.sourceSets.jellybean.java
    sourcesJarTask.from project.sourceSets.jellybean.java.srcDirs
    javadocTask.source  project.sourceSets.jellybeanmr1.java
    sourcesJarTask.from project.sourceSets.jellybeanmr1.java.srcDirs
    javadocTask.source  project.sourceSets.jellybeanmr2.java
    sourcesJarTask.from project.sourceSets.jellybeanmr2.java.srcDirs

    artifacts.add('archives', javadocJarTask);
    artifacts.add('archives', sourcesJarTask);
}

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: uri(rootProject.ext.supportRepoOut)) {
            }

            pom.project {
                name 'Android MediaRouter Support Library'
                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."
                url 'http://developer.android.com/tools/extras/support-library.html'
                inceptionYear '2011'

                licenses {
                    license {
                        name 'The Apache Software License, Version 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                        distribution 'repo'
                    }
                }

                scm {
                    url "http://source.android.com"
                    connection "scm:git:https://android.googlesource.com/platform/frameworks/support"
                }
                developers {
                    developer {
                        name 'The Android Open Source Project'
                    }
                }
            }
        }
    }
}