build.gradle 5.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * *************************************************************************
 *  build.gradle.java
 * **************************************************************************
 *  Copyright © 2015 VLC authors and VideoLAN
 *  Author: Geoffrey Métais
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *  ***************************************************************************
 */

apply plugin: 'com.android.library'
25 26
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
27 28

android {
29
    compileSdkVersion rootProject.ext.compileSdkVersion
30 31 32 33 34 35 36 37 38 39 40 41 42

    defaultConfig {
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

43 44 45 46 47
task generateSources (type: Jar) {
    classifier = 'sources'
    from android.sourceSets.main.java.srcDirs
}

48 49 50 51 52 53 54 55 56 57
task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

58
dependencies {
Geoffrey Métais's avatar
Geoffrey Métais committed
59 60
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    api "com.android.support:appcompat-v7:$rootProject.ext.appCompatVersion"
Geoffrey Métais's avatar
Geoffrey Métais committed
61
    testImplementation 'junit:junit:4.12'
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 146 147 148 149

def properties = new Properties()
properties.load( new FileInputStream("local.properties"))
group = properties.getProperty("package.groupId")
version = properties.getProperty("version.name")

install {
    repositories.mavenInstaller {
        pom {
            project {
                packaging 'aar'
                groupId properties.getProperty("package.groupId")
                artifactId properties.getProperty("package.name")

                name properties.getProperty("package.name")
                description properties.getProperty("package.description")
                url properties.getProperty("package.url")

                licenses {
                    license {
                        name properties.getProperty("license.name")
                        url properties.getProperty("license.url")
                    }
                }
                developers {
                    developer {
                        id properties.getProperty("developer.id")
                        name properties.getProperty("developer.name")
                        email properties.getProperty("developer.email")
                    }
                }
                scm {
                    connection properties.getProperty("vcs.connection")
                    developerConnection properties.getProperty("vcs.connection")
                    url properties.getProperty("vcs.url")
                }
            }
        }
    }
}

artifacts {
    archives javadocJar
    archives generateSources
}

bintray {
    user = properties.getProperty("bintray.user")
    key = properties.getProperty("bintray.apikey")

    configurations = ['archives']

    pkg {
        repo = properties.getProperty("package.repository")
        name = properties.getProperty("package.name")
        //userOrg = properties.getProperty("package.groupId")
        desc = properties.getProperty("package.description")
        websiteUrl = properties.getProperty("package.url")
        vcsUrl = properties.getProperty("vcs.url")
        licenses = [properties.getProperty("package.licenses")]
        publish = true
        publicDownloadNumbers = true
        version {
            name = properties.getProperty("version.name")
            desc = properties.getProperty("version.description")
            released = new Date()
            vcsTag = properties.getProperty("vcs.tag")
            //gpg {
            //    sign = true
            //    passphrase = properties.getProperty("bintray.gpg.password")
            //}
            //mavenCentralSync {
            //    sync = true
            //    user = properties.getProperty("bintray.user") //OSS user token: mandatory
            //    password = properties.getProperty("bintray.password") //OSS user password: mandatory
            //    close = '1'
            //}
        }
    }
}

// launch uploadApi to upload extension api on bintray based on values in local.properties
task uploadApi {
    dependsOn 'install'
    dependsOn 'bintrayUpload'
    tasks.findByName('bintrayUpload').mustRunAfter 'install'
}