aboutsummaryrefslogtreecommitdiff
path: root/dokka-fatjar/build.gradle
blob: 6f7d0d6340347ab5a625c13972f56adac0213895 (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
group 'org.jetbrains.dokka'
version dokka_version
import proguard.gradle.ProGuardTask

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'net.sf.proguard:proguard-gradle:5.2.1'
    }
}

apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

task wrapper(type: Wrapper) {
    gradleVersion = '2.5'
    distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}

task sourceJar(type: Jar) {
    from fileTree('../src')
}

task proguard(type: ProGuardTask) {
    configuration 'dokka.pro'

    injars "build/libs/dokka-fatjar-${dokka_version}.jar"
    outjars "build/libs/dokka-fatjar-${dokka_version}.out.jar"
}
proguard.doLast {
    def inFile = new File("$projectDir/build/libs/dokka-fatjar-${dokka_version}.jar")
    if (!inFile.exists()) {
        throw new IOException("Could not find Proguard input file ${inFile.absolutePath}")
    }
    inFile.renameTo("$projectDir/build/libs/dokka-fatjar-${dokka_version}.in.jar")
    new File("$projectDir/build/libs/dokka-fatjar-${dokka_version}.out.jar").renameTo(inFile)
}

jar {
    manifest {
        attributes "Implementation-Title": "Dokka Kotlin Documentation tool"
        attributes "Implementation-Version": version
        attributes "Main-Class" : "org.jetbrains.dokka.MainKt"
    }
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE

    fileTree(project.file('../lib')).filter {
        it.name.endsWith('.jar') &&
                !it.name.contains("-sources") &&
                !it.name.contains("-javadoc")
    }.each {
        from (zipTree(it)) {
            exclude 'META-INF/MANIFEST.MF'
            exclude 'META-INF/*.SF'
            exclude 'META-INF/*.DSA'
            exclude 'META-INF/*.RSA'
            exclude '**/*.kt'
            exclude '**/*.java'
            exclude '**/*.md'
        }
    }
    ['dokka.jar', 'dokka-ant.jar'].each {
        from (zipTree(project.file("../out/$it"))) {
            exclude 'META-INF/MANIFEST.MF'
            exclude 'META-INF/*.SF'
            exclude 'META-INF/*.DSA'
            exclude 'META-INF/*.RSA'
            exclude '**/*.kt'
            exclude '**/*.java'
            exclude '**/*.md'
        }
    }
}

publishing {
    publications {
        maven(MavenPublication) {
            from components.java

            artifact sourceJar {
                classifier "sources"
            }
        }
    }
}

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
        }
    }

    publications = ['maven']
}