diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2023-11-10 11:46:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 11:46:54 +0100 |
commit | 8e5c63d035ef44a269b8c43430f43f5c8eebfb63 (patch) | |
tree | 1b915207b2b9f61951ddbf0ff2e687efd053d555 /build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt | |
parent | a44efd4ba0c2e4ab921ff75e0f53fc9335aa79db (diff) | |
download | dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.gz dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.bz2 dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.zip |
Restructure the project to utilize included builds (#3174)
* Refactor and simplify artifact publishing
* Update Gradle to 8.4
* Refactor and simplify convention plugins and build scripts
Fixes #3132
---------
Co-authored-by: Adam <897017+aSemy@users.noreply.github.com>
Co-authored-by: Oleg Yukhnevich <whyoleg@gmail.com>
Diffstat (limited to 'build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt')
-rw-r--r-- | build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt b/build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt new file mode 100644 index 00000000..ad39177c --- /dev/null +++ b/build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt @@ -0,0 +1,58 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +package dokkabuild + +import org.gradle.api.provider.Provider +import org.gradle.api.provider.ProviderFactory +import org.gradle.jvm.toolchain.JavaLanguageVersion +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion +import javax.inject.Inject + +/** + * Common build properties used to build Dokka subprojects. + * + * This is an extension created by the [org.jetbrains.conventions.Base_gradle] convention plugin. + * + * Default values are set in the root `gradle.properties`, and can be overridden via + * [project properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties) + */ +abstract class DokkaBuildProperties @Inject constructor( + private val providers: ProviderFactory, +) { + + /** + * The main version of Java that should be used to build Dokka source code. + * + * Updating the Java target is a breaking change. + */ + val mainJavaVersion: Provider<JavaLanguageVersion> = + dokkaProperty("javaToolchain.mainCompiler", JavaLanguageVersion::of) + + /** + * The version of Java that should be used to run Dokka tests. + * + * This value is set in CI/CD environments to make sure that Dokka still works with different + * versions of Java. + */ + val testJavaLauncherVersion: Provider<JavaLanguageVersion> = + dokkaProperty("javaToolchain.testLauncher", JavaLanguageVersion::of) + .orElse(mainJavaVersion) + + /** + * The Kotlin language level that Dokka artifacts are compiled to support. + * + * Updating the language level is a breaking change. + */ + val kotlinLanguageLevel: Provider<KotlinVersion> = + dokkaProperty("kotlinLanguageLevel", KotlinVersion::fromVersion) + + + private fun <T : Any> dokkaProperty(name: String, convert: (String) -> T) = + providers.gradleProperty("org.jetbrains.dokka.$name").map(convert) + + companion object { + const val EXTENSION_NAME = "dokkaBuild" + } +} |