summaryrefslogtreecommitdiff
path: root/platform/android/gradle/gradle-bintray.gradle
blob: ac08866a6321020332fc87d63d076de07d552a7f (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
apply plugin: 'digital.wup.android-maven-publish'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.jfrog.artifactory'
apply from: file('../gradle/artifact-settings.gradle')

version = project.ext.versionName
group = project.ext.mapboxArtifactGroupId

publishing {
    publications {
        MapboxMapsSdkPublication(MavenPublication) {
            from components.android
            groupId this.group
            artifactId project.ext.mapboxArtifactId
            version this.version

            afterEvaluate {
                artifact("$buildDir/outputs/aar/mapbox-android-sdk-release.aar")
                artifact(androidSourcesJar)
                artifact(androidJavadocsJar)
            }

            pom.withXml {
                final mainNode = asNode()
                mainNode.appendNode('name', project.ext.mapboxArtifactTitle)
                mainNode.appendNode('description', project.ext.mapboxArtifactTitle)
                mainNode.appendNode('url', project.ext.mapboxArtifactUrl)

                final licenseNode = mainNode.appendNode('licenses').appendNode('license')
                licenseNode.appendNode('name', project.ext.mapboxArtifactLicenseName)
                licenseNode.appendNode('url', project.ext.mapboxArtifactLicenseUrl)
                licenseNode.appendNode('distribution', "repo")

                final developerNode = mainNode.appendNode('developers').appendNode('developer')
                developerNode.appendNode('id', project.ext.mapboxDeveloperId)
                developerNode.appendNode('name', project.ext.mapboxDeveloperName)

                final scmNode = mainNode.appendNode("scm")
                scmNode.appendNode("connection", project.ext.mapboxArtifactScmUrl)
                scmNode.appendNode("developerConnection", project.ext.mapboxArtifactScmUrl)
                scmNode.appendNode("url", project.ext.mapboxArtifactUrl)
            }
        }
    }
}

bintray {
    user = mapboxBintrayUser
    key = mapboxBintrayApiKey
    publications = ['MapboxMapsSdkPublication']
    pkg {
        repo = project.ext.mapboxBintrayRepoName
        name = project.ext.mapboxArtifactId
        userOrg = project.ext.mapboxBintrayUserOrg
        licenses = [project.ext.mapboxArtifactLicenseName]
        vcsUrl = project.ext.mapboxArtifactVcsUrl
        publish = false
        version {
            name = project.ext.versionName
            desc = project.ext.mapboxArtifactDescription
            released = new Date()
            gpg {
                sign = true
                passphrase = mapboxGpgPassphrase
            }
            mavenCentralSync {
                sync = false
            }
        }
    }
}

artifactory {
    contextUrl = 'http://oss.jfrog.org'
    publish {
        repository {
            repoKey = 'oss-snapshot-local'
            username = mapboxBintrayUser
            password = mapboxBintrayApiKey
        }
        defaults {
            publications('MapboxMapsSdkPublication')
        }
    }
}

task androidJavadocs(type: Javadoc) {
    source = android.sourceSets.main.java.sourceFiles
    classpath = files(android.bootClasspath)
    failOnError = false
}

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

task androidSourcesJar(type: Jar) {
    classifier = 'sources'
    from android.sourceSets.main.java.sourceFiles
}

tasks.withType(Javadoc) {
    options.addStringOption('encoding', 'UTF-8')
    options.addStringOption('docencoding', 'UTF-8')
    options.addStringOption('charset', 'UTF-8')
}

artifacts {
    archives androidSourcesJar
    archives androidJavadocsJar
}

afterEvaluate { project ->
    android.libraryVariants.all { variant ->
        tasks.androidJavadocs.doFirst {
            classpath += files(variant.javaCompile.classpath.files)
        }
    }
}