aboutsummaryrefslogtreecommitdiff
path: root/runners/maven-plugin/build.gradle
blob: d73126f42272f133a389fa1812de1a2d86e036e5 (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
import org.jetbrains.CrossPlatformExec

apply plugin: 'kotlin'
apply plugin: 'com.github.johnrengelman.shadow'


configurations {
    provided
}

tasks.withType(AbstractCompile) {
    classpath += configurations.provided
    classpath += configurations.shadow
}

dependencies {
    shadow project(":runners:fatjar")
    shadow "org.apache.maven:maven-core:$maven_version"
    shadow "org.apache.maven:maven-model:$maven_version"
    shadow "org.apache.maven:maven-plugin-api:$maven_version"
    shadow "org.apache.maven:maven-archiver:$maven_archiver_version"
    shadow "org.codehaus.plexus:plexus-utils:$plexus_utils_version"
    shadow "org.codehaus.plexus:plexus-archiver:$plexus_archiver_version"
    shadow "org.apache.maven.plugin-tools:maven-plugin-annotations:$maven_plugin_tools_version"
}

task generatePom << {
    final pomTemplate = new File(projectDir, "pom.tpl.xml")
    final pom = new File(buildDir, "pom.xml")
    pom.text = pomTemplate.text.replace("<version>dokka_version</version>", "<version>$dokka_version</version>")
            .replace("<maven.version></maven.version>", "<maven.version>$maven_version</maven.version>")
            .replace("<version>maven-plugin-plugin</version>", "<version>$maven_plugin_tools_version</version>")
}

task pluginDescriptor(type: CrossPlatformExec) {
    workingDir buildDir
    commandLine mvn, '-e', '-B', 'org.apache.maven.plugins:maven-plugin-plugin:descriptor'
}

task helpMojo(type: CrossPlatformExec) {
    workingDir buildDir
    commandLine mvn, '-e', '-B', 'org.apache.maven.plugins:maven-plugin-plugin:helpmojo'
}


helpMojo.dependsOn generatePom
sourceSets.main.java.srcDir("$buildDir/generated-sources/plugin")
compileJava.dependsOn helpMojo

pluginDescriptor.dependsOn generatePom

shadowJar {
    baseName = 'dokka-maven-plugin'
    classifier = ''

    relocate('kotlin.', 'dokkakotlin.')
}

shadowJar.dependsOn pluginDescriptor


task sourceJar(type: Jar) {
    from sourceSets.main.allSource
}

apply plugin: 'maven-publish'

publishing {
    publications {
        dokkaMavenPlugin(MavenPublication) {
            from components.shadow
            artifactId = 'dokka-maven-plugin'

            artifact sourceJar {
                classifier "sources"
            }
        }
    }
}

bintrayPublication(project, ['dokkaMavenPlugin'])