aboutsummaryrefslogtreecommitdiff
path: root/dokka-integration-tests/cli/build.gradle.kts
blob: 34f1f79737ad42f22069a4f4b3b74a2175c2fc1a (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
/*
 * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
    id("dokkabuild.test-integration")
    id("com.github.johnrengelman.shadow")
}

dependencies {
    implementation(kotlin("test-junit5"))
    implementation(libs.junit.jupiterApi)
    implementation(projects.utilities)
}

/* Create a fat base plugin jar for cli tests */
val basePluginShadow: Configuration by configurations.creating {
    attributes {
        attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, "java-runtime"))
    }
}

val cliConfiguration: Configuration by configurations.creating {
    attributes {
        attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, Usage.JAVA_RUNTIME))
        attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling::class.java, Bundling.SHADOWED))
    }
    // we should have single artifact here
    isTransitive = false
}

dependencies {
    cliConfiguration("org.jetbrains.dokka:runner-cli")

    basePluginShadow("org.jetbrains.dokka:plugin-base")

    // TODO [beresnev] analysis switcher
    basePluginShadow("org.jetbrains.dokka:analysis-kotlin-descriptors") {
        attributes {
            attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling::class.java, Bundling.SHADOWED))
        }
    }
}

val basePluginShadowJar by tasks.register("basePluginShadowJar", ShadowJar::class) {
    configurations = listOf(basePluginShadow)
    archiveFileName.set("fat-base-plugin-${project.version}.jar")
    archiveClassifier.set("")

    // service files are merged to make sure all Dokka plugins
    // from the dependencies are loaded, and not just a single one.
    mergeServiceFiles()
}

tasks.integrationTest {
    dependsOn(cliConfiguration)
    dependsOn(basePluginShadowJar)

    inputs.dir(file("projects"))
    environment("CLI_JAR_PATH", cliConfiguration.singleFile)
    environment("BASE_PLUGIN_JAR_PATH", basePluginShadowJar.archiveFile.get())
}