summaryrefslogtreecommitdiff
path: root/javaEE/bintray.gradle
blob: f151bb9be3c62345c90c741f439b00e29de45965 (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
apply plugin: "com.jfrog.bintray"
apply plugin: 'maven-publish'
apply plugin: 'maven'

def siteUrl = 'https://github.com/smartdevicelink/sdl_android'      // Homepage URL of the library
def gitUrl = 'https://github.com/smartdevicelink/sdl_android.git'   // Git repository URL
group = "com.smartdevicelink" // Maven Group ID for the artifact
def libDescription = 'SmartDeviceLink mobile library'

task sourcesJar(type: Jar, dependsOn: classes) {
    classifier = 'sources'
    from sourceSets.main.allSource
}

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

artifacts {
    archives sourcesJar
    archives javadocJar
}

bintray {
    Properties props = new Properties()
    props.load(new FileInputStream("$projectDir/bintray.properties"))

    // Authorization
    user = props.getProperty("bintray.user")
    key = props.getProperty("bintray.key")
    version = "$project.version"
    publications = ['mavenPublication']


    pkg {
        repo = props.getProperty("bintray.repo")
        name = props.getProperty("bintray.artifact")
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        userOrg = props.getProperty("bintray.userorg")
        licenses = ["BSD 3-Clause"]
        publish = props.getProperty("bintray.publish")  // Will upload to jCenter
        version {
            name = "$project.version"  // Change to release version
            desc = libDescription
            released  = new Date()  // Will be the current date & time
            vcsTag = props.getProperty("bintray.vcs") // Should match git tag
        }
    }
}

def pomConfig = {
    Properties props = new Properties()
    props.load(new FileInputStream("$projectDir/bintray.properties"))
    
    licenses {
        license {
            name 'BSD 3-Clause'
            url 'https://opensource.org/licenses/BSD-3-Clause'
            distribution "repo"
        }
    }

    scm {
        url siteUrl
    }
}

publishing {
    publications {
        mavenPublication(MavenPublication) {
            Properties props = new Properties()
            props.load(new FileInputStream("$projectDir/bintray.properties"))

            from components.java
            artifact sourcesJar {
                classifier "sources"
            }
            artifact javadocJar {
                classifier "javadoc"
            }
            groupId props.getProperty("bintray.userorg")
            artifactId props.getProperty("bintray.artifact")
            version "$project.version"
            pom.withXml {
                def root = asNode()
                root.appendNode('description', libDescription)
                root.appendNode('name', props.getProperty("bintray.artifact"))
                root.appendNode('url', siteUrl)
                root.children().last() + pomConfig
            }
        }
    }
}