1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17apply plugin: 'com.android.library'
18
19def generatedResourceDir = project.file('generatedResource')
20def versionFile = new File(generatedResourceDir, 'androidsupportmultidexversion.txt')
21
22task makeVersionFile(type:Exec) {
23
24    doFirst {
25        versionFile.getParentFile().mkdirs()
26    }
27
28    outputs.files versionFile
29
30    commandLine 'sh', '-c', 'git log --format="%H" -n 1 || (echo git hash not available; exit 0)'
31    standardOutput = new ByteArrayOutputStream()
32
33    doLast {
34        versionFile.text = "git.version=" + standardOutput.toString()
35    }
36}
37
38android {
39    compileSdkVersion 4
40
41    defaultConfig {
42        minSdkVersion 4
43    }
44
45    compileOptions {
46        sourceCompatibility JavaVersion.VERSION_1_7
47        targetCompatibility JavaVersion.VERSION_1_7
48    }
49
50    sourceSets {
51        main {
52            java.srcDirs         = ['src']
53            resources.srcDirs    = ['res', makeVersionFile.outputs]
54            res.srcDirs          = ['src']
55            manifest.srcFile 'AndroidManifest.xml'
56        }
57    }
58
59    lintOptions {
60        // TODO: fix errors and reenable.
61        abortOnError false
62    }
63}
64
65android.libraryVariants.all {
66    v -> v.getJavaCompiler().dependsOn(makeVersionFile)
67}
68
69uploadArchives {
70    repositories {
71        mavenDeployer {
72            repository(url: uri(rootProject.ext.supportRepoOut)) {
73            }
74
75            pom.project {
76                name 'Android Multi-Dex Library'
77                description "Library for legacy multi-dex support"
78                url ''
79                inceptionYear '2013'
80
81                licenses {
82                    license {
83                        name 'The Apache Software License, Version 2.0'
84                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
85                        distribution 'repo'
86                    }
87                }
88
89                scm {
90                    url "http://source.android.com"
91                    connection "scm:git:https://android.googlesource.com/platform/frameworks/multidex"
92                }
93                developers {
94                    developer {
95                        name 'The Android Open Source Project'
96                    }
97                }
98            }
99        }
100    }
101}
102