-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use buildSrc convention plugins to configure the Dokka subprojects (#…
- Loading branch information
Showing
45 changed files
with
769 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
import java.util.* | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
kotlin { | ||
jvmToolchain { | ||
languageVersion.set(JavaLanguageVersion.of(8)) | ||
} | ||
} | ||
|
||
// TODO define versions in Gradle Version Catalog https://github.com/Kotlin/dokka/pull/2884 | ||
val properties = file("../gradle.properties").inputStream().use { | ||
Properties().apply { load(it) } | ||
} | ||
|
||
val kotlinVersion = properties["kotlin_version"] | ||
|
||
dependencies { | ||
implementation("com.github.jengelman.gradle.plugins:shadow:2.0.4") | ||
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.10.1") | ||
// Import Gradle Plugins that will be used in the buildSrc pre-compiled script plugins, and any `build.gradle.kts` | ||
// files in the project. | ||
// Use their Maven coordinates (plus versions), not Gradle plugin IDs! | ||
// This should be the only place that Gradle plugin versions are defined, so they are aligned across all build scripts | ||
|
||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") | ||
implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2") | ||
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.12.1") | ||
implementation("io.github.gradle-nexus:publish-plugin:1.1.0") | ||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.8.10") | ||
implementation("com.gradle.publish:plugin-publish-plugin:0.20.0") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
rootProject.name = "buildSrc" | ||
|
||
pluginManagement { | ||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
@Suppress("UnstableApiUsage") | ||
dependencyResolutionManagement { | ||
repositories { | ||
mavenCentral() | ||
google() | ||
gradlePluginPortal() | ||
} | ||
} |
29 changes: 0 additions & 29 deletions
29
buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
buildSrc/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.jetbrains.conventions | ||
|
||
/** | ||
* Base configuration for Java projects. | ||
* | ||
* This convention plugin contains shared Java config for both the [KotlinJvmPlugin] convention plugin and | ||
* the Gradle Plugin subproject (which cannot have the `kotlin("jvm")` plugin applied). | ||
*/ | ||
|
||
plugins { | ||
`java` | ||
} | ||
|
||
java { | ||
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(8)) | ||
} | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
} |
12 changes: 12 additions & 0 deletions
12
buildSrc/src/main/kotlin/org/jetbrains/conventions/base.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.jetbrains.conventions | ||
|
||
plugins { | ||
base | ||
} | ||
|
||
// common Gradle configuration that should be applied to all projects | ||
|
||
if (project != rootProject) { | ||
project.group = rootProject.group | ||
project.version = rootProject.version | ||
} |
75 changes: 75 additions & 0 deletions
75
buildSrc/src/main/kotlin/org/jetbrains/conventions/dokka-integration-test.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package org.jetbrains.conventions | ||
|
||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat | ||
import org.gradle.api.tasks.testing.logging.TestLogEvent | ||
|
||
plugins { | ||
id("org.jetbrains.conventions.kotlin-jvm") | ||
} | ||
|
||
val integrationTestSourceSet = sourceSets.create("integrationTest") { | ||
compileClasspath += sourceSets.main.get().output | ||
runtimeClasspath += sourceSets.main.get().output | ||
} | ||
|
||
val integrationTestImplementation by configurations.getting { | ||
extendsFrom(configurations.implementation.get()) | ||
} | ||
|
||
val integrationTestRuntimeOnly by configurations.getting { | ||
extendsFrom(configurations.runtimeOnly.get()) | ||
} | ||
|
||
/** | ||
* Dokka's integration test task is not cacheable because the HTML outputs | ||
* it produces when running the tests are used for showcasing resulting documentation, | ||
* which does not work well with caching. | ||
* | ||
* At the moment there are two problems that do not allow to make it cacheable: | ||
* | ||
* 1. The task's inputs are such that changes in Dokka's code do not invalidate the cache, | ||
* because it is run with the same version of Dokka (`"DOKKA_VERSION"`) on the same | ||
* test project inputs. | ||
* 2. The tests generate HTML output which is then used to showcase documentation. | ||
* The outputs are usually copied to a location from which it will be served. | ||
* However, if the test is cacheable, it produces no outputs, so no documentation | ||
* to showcase. It needs to be broken into two separate tasks: one cacheable for running | ||
* the tests and producing HTML output, and another non-cacheable for copying the output. | ||
* | ||
* @see [org.jetbrains.dokka.it.TestOutputCopier] for more details on showcasing documentation | ||
*/ | ||
@DisableCachingByDefault(because = "Contains incorrect inputs/outputs configuration, see the KDoc for details") | ||
abstract class NonCacheableIntegrationTest : Test() | ||
|
||
val integrationTest by tasks.registering(NonCacheableIntegrationTest::class) { | ||
maxHeapSize = "2G" | ||
description = "Runs integration tests." | ||
group = "verification" | ||
useJUnit() | ||
|
||
testClassesDirs = integrationTestSourceSet.output.classesDirs | ||
classpath = integrationTestSourceSet.runtimeClasspath | ||
|
||
setForkEvery(1) | ||
project.properties["dokka_integration_test_parallelism"]?.toString()?.toIntOrNull()?.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() | ||
) | ||
|
||
testLogging { | ||
exceptionFormat = TestExceptionFormat.FULL | ||
events(TestLogEvent.SKIPPED, TestLogEvent.FAILED) | ||
showExceptions = true | ||
showCauses = true | ||
showStackTraces = true | ||
} | ||
} | ||
|
||
tasks.check { | ||
dependsOn(integrationTest) | ||
} |
13 changes: 13 additions & 0 deletions
13
buildSrc/src/main/kotlin/org/jetbrains/conventions/dokka.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.jetbrains.conventions | ||
|
||
import org.gradle.kotlin.dsl.invoke | ||
import org.jetbrains.isLocalPublication | ||
|
||
plugins { | ||
id("org.jetbrains.dokka") | ||
} | ||
|
||
tasks.dokkaHtml { | ||
onlyIf { !isLocalPublication } | ||
outputDirectory.set(layout.buildDirectory.dir("dokka").map { it.asFile }) | ||
} |
Oops, something went wrong.