Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KT-64377 - Update Dokka build properties #3420

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build-logic/src/main/kotlin/dokkabuild.base.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

import dokkabuild.DokkaBuildProperties
import org.gradle.language.base.plugins.LifecycleBasePlugin.VERIFICATION_GROUP

/**
* A convention plugin that sets up common config and sensible defaults for all subprojects.
Expand All @@ -21,3 +22,9 @@ tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}

val integrationTestPreparation by tasks.registering {
description =
"lifecycle task for preparing the project for integration tests (for example, publishing to the test Maven repo)"
group = VERIFICATION_GROUP
}
15 changes: 5 additions & 10 deletions build-logic/src/main/kotlin/dokkabuild.test-integration.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,16 @@ val integrationTest by tasks.registering(NonCacheableIntegrationTest::class) {
classpath = integrationTestSourceSet.runtimeClasspath

useJUnitPlatform {
val useK2 = (project.properties["org.jetbrains.dokka.experimental.tryK2"] as? String)?.toBoolean() ?: false
if (useK2) excludeTags("onlyDescriptors", "onlyDescriptorsMPP")
if (dokkaBuild.integrationTestUseK2.get()) excludeTags("onlyDescriptors", "onlyDescriptorsMPP")
}

setForkEvery(1)
project.properties["dokka_integration_test_parallelism"]?.toString()?.toIntOrNull()?.let { parallelism ->
systemProperty("org.jetbrains.dokka.experimental.tryK2", dokkaBuild.integrationTestUseK2.get())

dokkaBuild.integrationTestParallelism.orNull?.let { parallelism ->
maxParallelForks = parallelism
}

environment(
"isExhaustive",
project.properties["dokka_integration_test_is_exhaustive"]?.toString()?.toBoolean()
?: System.getenv("DOKKA_INTEGRATION_TEST_IS_EXHAUSTIVE")?.toBoolean()
?: false.toString()
)
environment("isExhaustive", dokkaBuild.integrationTestExhaustive.get())

testLogging {
exceptionFormat = TestExceptionFormat.FULL
Expand Down
14 changes: 14 additions & 0 deletions build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ abstract class DokkaBuildProperties @Inject constructor(
val kotlinLanguageLevel: Provider<KotlinVersion> =
dokkaProperty("kotlinLanguageLevel", KotlinVersion::fromVersion)

/** Control [org.gradle.api.tasks.testing.Test.maxParallelForks] in integration tests. */
val integrationTestParallelism: Provider<Int> =
dokkaProperty("integration_test.parallelism", String::toInt)

/** Not currently used - should be dropped. */
val integrationTestExhaustive: Provider<Boolean> =
dokkaProperty("integration_test.exhaustive", String::toBoolean)
.orElse(false)

/** Control whether integration tests should use the `org.jetbrains.dokka.experimental.tryK2` flag. */
val integrationTestUseK2: Provider<Boolean> =
dokkaProperty("integration_test.useK2", String::toBoolean)
.orElse(false)


private fun <T : Any> dokkaProperty(name: String, convert: (String) -> T) =
providers.gradleProperty("org.jetbrains.dokka.$name").map(convert)
Expand Down
2 changes: 1 addition & 1 deletion dokka-integration-tests/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ version=1.9.20-SNAPSHOT

org.jetbrains.dokka.javaToolchain.mainCompiler=8
org.jetbrains.dokka.javaToolchain.testLauncher=8
dokka_integration_test_parallelism=2
org.jetbrains.dokka.integration_test.parallelism=2
4 changes: 2 additions & 2 deletions dokka-integration-tests/gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ In order to update:

### Run integration tests with K2 (symbols)

To run integration tests with K2, the property `org.jetbrains.dokka.experimental.tryK2` should be set to `true`.
By default, the task `integrationTest` is run with K1 (descriptors).
To run integration tests with K2, the property `org.jetbrains.dokka.integration_test.useK2` should be set to `true`.
By default, the task `integrationTest` is run with K1 (descriptors).
5 changes: 0 additions & 5 deletions dokka-integration-tests/gradle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/


plugins {
id("dokkabuild.test-integration")
}
Expand All @@ -22,10 +21,6 @@ dependencies {
val aggregatingProject = gradle.includedBuild("dokka")

tasks.integrationTest {
// pass the property to a test fork
project.findProperty("org.jetbrains.dokka.experimental.tryK2")
?.let { systemProperty("org.jetbrains.dokka.experimental.tryK2", it) }

adam-enko marked this conversation as resolved.
Show resolved Hide resolved
dependsOn(aggregatingProject.task(":publishToMavenLocal"))

environment("DOKKA_VERSION", project.version)
Expand Down