summaryrefslogtreecommitdiffhomepage
path: root/tunnel/publish.gradle
blob: 7124da648c46fa7698ea62cb201401055bc8d565 (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
apply plugin: 'maven-publish'

afterEvaluate {
    publishing {
        publications {
            release(MavenPublication) {
                groupId = groupName
                artifactId = 'tunnel'
                version wireguardVersionName

                artifact sourcesJar
                artifact javadocJar

                from components.getByName("release")

                pom {
                    name = 'WireGuard Tunnel Library'
                    description = 'Embeddable tunnel library for WireGuard for Android'
                    url = 'https://www.wireguard.com/'

                    licenses {
                        license {
                            name = 'The Apache Software License, Version 2.0'
                            url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                            distribution = 'repo'
                        }
                    }
                    scm {
                        connection = 'scm:git:https://git.zx2c4.com/wireguard-android'
                        developerConnection = 'scm:git:https://git.zx2c4.com/wireguard-android'
                        url = 'https://git.zx2c4.com/wireguard-android'
                    }
                    developers {
                        organization {
                            name = 'WireGuard'
                            url = 'https://www.wireguard.com/'
                        }
                    }
                }
            }
        }
        repositories {
            maven {
                name = "bintray"
                url = uri("https://api.bintray.com/maven/wireguard/wireguard-android/wireguard-android/;publish=1;override=0")
                credentials {
                    username = hasProperty('BINTRAY_USER') ? getProperty('BINTRAY_USER') : System.getenv('BINTRAY_USER')
                    password = hasProperty('BINTRAY_KEY') ? getProperty('BINTRAY_KEY') : System.getenv('BINTRAY_KEY')
                }
            }
        }
    }
}

android.libraryVariants.all { variant ->
    if (variant.name == 'release') {
        task javadoc(type: Javadoc) {
            source = variant.javaCompileProvider.get().source
            classpath = files((android.bootClasspath.join(File.pathSeparator)))
            classpath += variant.javaCompileProvider.get().classpath
            title = 'Embeddable WireGuard Tunnel for Android v$wireguardVersionName'
        }
        task javadocJar(type: Jar, dependsOn: javadoc) {
            archiveClassifier = 'javadoc'
            from javadoc.destinationDir
        }
        task sourcesJar(type: Jar) {
            archiveClassifier = 'sources'
            from android.sourceSets.main.java.srcDirs
        }
    }
}