aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: 1076810604b119d267748c5d0aee6b0b83277600 (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
plugins {
    id "com.jfrog.bintray" version "1.4"
}

apply plugin: 'maven-publish'

task updatePom << {
    def parser = new XmlParser()
    def pomFile = new File("maven-plugin/pom.xml")
    def pom = parser.parse(pomFile)
    pom.version[0].setValue(dokka_version)
    pom.properties.kotlinVersion[0].setValue(kotlin_version)
    pomFile.setText(groovy.xml.XmlUtil.serialize(pom))
}

task buildMavenPlugin << {
    def process = "mvn clean package".execute(null, new File("maven-plugin"))
    process.waitFor()
    def mvnOutput = process.text
    def exitValue = process.exitValue()
    if (exitValue != 0) {
        throw new IOException("Failed to run Maven command: exit value $exitValue, output $mvnOutput")
    }

    def uploadDir = new File("maven-plugin/upload")
    uploadDir.mkdirs()
    def releaseFileName = "dokka-maven-plugin-${dokka_version}"
    new File("maven-plugin/target/${releaseFileName}.jar").renameTo(new File(uploadDir, "${releaseFileName}.jar"))
    new File(uploadDir, "${releaseFileName}.pom").bytes = new File("maven-plugin/pom.xml").bytes
}

buildMavenPlugin.dependsOn(updatePom)

bintray {
    user = System.getenv('BINTRAY_USER')
    key = System.getenv('BINTRAY_KEY')

    pkg {
        repo = 'dokka'
        name = 'dokka'
        userOrg = 'kotlin'
        desc = 'Dokka, the Kotlin documentation tool'
        vcsUrl = 'https://github.com/kotlin/dokka.git'
        licenses = ['Apache-2.0']
        version {
            name = dokka_version
        }
    }

    filesSpec {
        from 'maven-plugin/upload'
        into "/kotlin/dokka/dokka/${dokka_version}/org/jetbrains/dokka/dokka-maven-plugin/${dokka_version}"
    }
}