aboutsummaryrefslogtreecommitdiff
path: root/build-logic/src/main/kotlin/org
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-11-10 11:46:54 +0100
committerGitHub <noreply@github.com>2023-11-10 11:46:54 +0100
commit8e5c63d035ef44a269b8c43430f43f5c8eebfb63 (patch)
tree1b915207b2b9f61951ddbf0ff2e687efd053d555 /build-logic/src/main/kotlin/org
parenta44efd4ba0c2e4ab921ff75e0f53fc9335aa79db (diff)
downloaddokka-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/org')
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/DokkaBuildProperties.kt58
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/DokkaPublicationChannel.kt66
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/DokkaVersion.kt23
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/DokkaVersionType.kt12
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/ValidatePublications.kt49
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts42
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/conventions/base-unit-test.gradle.kts43
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/conventions/base.gradle.kts30
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-html-frontend-files.gradle.kts35
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-integration-test.gradle.kts81
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/conventions/dokka.gradle.kts17
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/conventions/gradle-plugin.gradle.kts13
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/conventions/kotlin-jvm.gradle.kts58
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts104
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/conventions/maven-publish.gradle.kts72
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/internal/gradleKotlinDslAccessors.kt41
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/projectUtils.kt20
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/publication.kt125
-rw-r--r--build-logic/src/main/kotlin/org/jetbrains/taskUtils.kt26
19 files changed, 0 insertions, 915 deletions
diff --git a/build-logic/src/main/kotlin/org/jetbrains/DokkaBuildProperties.kt b/build-logic/src/main/kotlin/org/jetbrains/DokkaBuildProperties.kt
deleted file mode 100644
index 6d1e0ae4..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/DokkaBuildProperties.kt
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains
-
-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"
- }
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/DokkaPublicationChannel.kt b/build-logic/src/main/kotlin/org/jetbrains/DokkaPublicationChannel.kt
deleted file mode 100644
index 34981302..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/DokkaPublicationChannel.kt
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-@file:Suppress("LocalVariableName")
-
-package org.jetbrains
-
-import org.gradle.api.Project
-
-enum class DokkaPublicationChannel {
- SPACE_DOKKA_DEV,
- MAVEN_CENTRAL,
- MAVEN_CENTRAL_SNAPSHOT,
- GRADLE_PLUGIN_PORTAL;
-
- val acceptedDokkaVersionTypes: List<DokkaVersionType>
- get() = when(this) {
- MAVEN_CENTRAL -> listOf(DokkaVersionType.RELEASE, DokkaVersionType.RC)
- MAVEN_CENTRAL_SNAPSHOT -> listOf(DokkaVersionType.SNAPSHOT)
- SPACE_DOKKA_DEV -> listOf(DokkaVersionType.RELEASE, DokkaVersionType.RC, DokkaVersionType.DEV, DokkaVersionType.SNAPSHOT)
- GRADLE_PLUGIN_PORTAL -> listOf(DokkaVersionType.RELEASE, DokkaVersionType.RC)
- }
-
- fun isSpaceRepository() = this == SPACE_DOKKA_DEV
-
- fun isMavenRepository() = this == MAVEN_CENTRAL || this == MAVEN_CENTRAL_SNAPSHOT
-
- fun isGradlePluginPortal() = this == GRADLE_PLUGIN_PORTAL
-
- companion object {
- fun fromPropertyString(value: String): DokkaPublicationChannel = when (value) {
- "space-dokka-dev" -> SPACE_DOKKA_DEV
- "maven-central-release" -> MAVEN_CENTRAL
- "maven-central-snapshot" -> MAVEN_CENTRAL_SNAPSHOT
- "gradle-plugin-portal" -> GRADLE_PLUGIN_PORTAL
- else -> throw IllegalArgumentException("Unknown dokka_publication_channel=$value")
- }
- }
-}
-
-val Project.publicationChannels: Set<DokkaPublicationChannel>
- get() {
- val publicationChannel = this.properties["dokka_publication_channel"]?.toString()
- val publicationChannels = this.properties["dokka_publication_channels"]?.toString()
- if (publicationChannel != null && publicationChannels != null) {
- throw IllegalArgumentException(
- "Only one of dokka_publication_channel and dokka_publication_channel*s* can be set. Found: \n" +
- "dokka_publication_channel=$publicationChannel\n" +
- "dokka_publication_channels=$publicationChannels"
- )
- }
-
- if (publicationChannel != null) {
- return setOf(DokkaPublicationChannel.fromPropertyString(publicationChannel))
- }
-
- if (publicationChannels != null) {
- return publicationChannels.split("&").map { channel ->
- DokkaPublicationChannel.fromPropertyString(channel)
- }.toSet()
- }
-
- return emptySet()
- }
-
diff --git a/build-logic/src/main/kotlin/org/jetbrains/DokkaVersion.kt b/build-logic/src/main/kotlin/org/jetbrains/DokkaVersion.kt
deleted file mode 100644
index 9028e8cf..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/DokkaVersion.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains
-
-import org.gradle.api.Project
-import org.gradle.kotlin.dsl.extra
-import org.gradle.kotlin.dsl.provideDelegate
-
-@Suppress("LocalVariableName") // property name with underscore as taken from gradle.properties
-fun Project.configureDokkaVersion(): String {
- val dokka_version: String? by this.extra
- return checkNotNull(dokka_version)
-}
-
-val Project.dokkaVersion: String
- get() = configureDokkaVersion()
-
-val Project.dokkaVersionType: DokkaVersionType?
- get() = DokkaVersionType.values().find {
- it.suffix.matches(dokkaVersion.substringAfter("-", ""))
- }
diff --git a/build-logic/src/main/kotlin/org/jetbrains/DokkaVersionType.kt b/build-logic/src/main/kotlin/org/jetbrains/DokkaVersionType.kt
deleted file mode 100644
index 7ceb595b..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/DokkaVersionType.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains
-
-enum class DokkaVersionType(val suffix: Regex) {
- RELEASE("^$".toRegex()),
- RC("RC\\d?".toRegex()),
- SNAPSHOT("SNAPSHOT".toRegex()),
- DEV("dev-\\d+".toRegex());
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/ValidatePublications.kt b/build-logic/src/main/kotlin/org/jetbrains/ValidatePublications.kt
deleted file mode 100644
index 293ae96b..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/ValidatePublications.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains
-
-import org.gradle.api.DefaultTask
-import org.gradle.api.GradleException
-import org.gradle.api.Project
-import org.gradle.api.artifacts.Dependency
-import org.gradle.api.artifacts.ProjectDependency
-import org.gradle.api.publish.PublishingExtension
-import org.gradle.api.publish.maven.MavenPublication
-import org.gradle.api.tasks.TaskAction
-import org.gradle.kotlin.dsl.findByType
-
-open class ValidatePublications : DefaultTask() {
-
- init {
- group = "verification"
- project.tasks.named("check") {
- dependsOn(this@ValidatePublications)
- }
- }
-
- @TaskAction
- fun validatePublicationConfiguration() {
- project.subprojects.forEach { subProject ->
- val publishing = subProject.extensions.findByType<PublishingExtension>() ?: return@forEach
- publishing.publications
- .filterIsInstance<MavenPublication>()
- .filter { it.version == project.dokkaVersion }
- .forEach { _ ->
- subProject.assertPublicationVersion()
- }
- }
- }
-
- private fun Project.assertPublicationVersion() {
- val versionTypeMatchesPublicationChannels = publicationChannels.all { publicationChannel ->
- publicationChannel.acceptedDokkaVersionTypes.any { acceptedVersionType ->
- acceptedVersionType == dokkaVersionType
- }
- }
- if (!versionTypeMatchesPublicationChannels) {
- throw AssertionError("Wrong version $dokkaVersion for configured publication channels $publicationChannels")
- }
- }
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts
deleted file mode 100644
index 9270be47..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-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 {
- id("org.jetbrains.conventions.base")
- java
-}
-
-java {
- toolchain {
- languageVersion.set(dokkaBuild.mainJavaVersion)
- }
- withSourcesJar()
-}
-
-tasks.withType<Test>().configureEach {
- useJUnitPlatform()
-
- maxParallelForks = if (System.getenv("GITHUB_ACTIONS") != null) {
- Runtime.getRuntime().availableProcessors()
- } else {
- (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
- }
-
- javaLauncher.set(javaToolchains.launcherFor {
- languageVersion.set(dokkaBuild.testJavaLauncherVersion)
- })
-}
-
-dependencies {
- testImplementation(platform(libs.junit.bom))
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/base-unit-test.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/base-unit-test.gradle.kts
deleted file mode 100644
index 4911499d..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/conventions/base-unit-test.gradle.kts
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.conventions
-
-/**
- * Utility to run ynit tests for K1 and K2 (analysis API).
- */
-
-plugins {
- id("org.jetbrains.conventions.base")
- id("org.jetbrains.conventions.base-java")
-}
-
-val descriptorsTestConfiguration: Configuration by configurations.creating {
- extendsFrom(configurations.testImplementation.get())
-}
-val symbolsTestConfiguration: Configuration by configurations.creating {
- extendsFrom(configurations.testImplementation.get())
-}
-
-val symbolsTest = tasks.register<Test>("symbolsTest") {
- useJUnitPlatform {
- excludeTags("onlyDescriptors", "onlyDescriptorsMPP")
- }
- classpath += symbolsTestConfiguration
-}
-// run symbols and descriptors tests
-tasks.test {
- //enabled = false
- classpath += descriptorsTestConfiguration
- dependsOn(symbolsTest)
-}
-
-val descriptorsTest = tasks.register<Test>("descriptorsTest") {
- classpath += descriptorsTestConfiguration
-}
-
-tasks.check {
- dependsOn(symbolsTest)
-}
-
diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/base.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/base.gradle.kts
deleted file mode 100644
index b485520a..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/conventions/base.gradle.kts
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.conventions
-
-import org.jetbrains.DokkaBuildProperties
-
-/**
- * A convention plugin that sets up common config and sensible defaults for all subprojects.
- *
- * It provides the [DokkaBuildProperties] extension, for accessing common build properties.
- */
-
-plugins {
- base
-}
-
-val dokkaBuildProperties: DokkaBuildProperties = extensions.create(DokkaBuildProperties.EXTENSION_NAME)
-
-if (project != rootProject) {
- project.group = rootProject.group
- project.version = rootProject.version
-}
-
-tasks.withType<AbstractArchiveTask>().configureEach {
- // https://docs.gradle.org/current/userguide/working_with_files.html#sec:reproducible_archives
- isPreserveFileTimestamps = false
- isReproducibleFileOrder = true
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-html-frontend-files.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-html-frontend-files.gradle.kts
deleted file mode 100644
index 198194b1..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-html-frontend-files.gradle.kts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.conventions
-
-import org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE
-
-/**
- * Utility for sharing the Dokka HTML frontend files between subprojects in a safe, cacheable way.
- */
-
-plugins {
- id("org.jetbrains.conventions.base")
-}
-
-/** Apply a distinct attribute to the incoming/outgoing configuration */
-fun AttributeContainer.dokkaHtmlFrontendFilesAttribute() =
- attribute(USAGE_ATTRIBUTE, objects.named("org.jetbrains.dokka.html-frontend-files"))
-
-// incoming configuration
-val dokkaHtmlFrontendFiles by configurations.registering {
- description = "Retrieve Dokka HTML frontend files from other subprojects"
- isCanBeConsumed = false
- isCanBeResolved = true
- attributes { dokkaHtmlFrontendFilesAttribute() }
-}
-
-// outgoing configuration
-val dokkaHtmlFrontendFilesElements by configurations.registering {
- description = "Provide Dokka HTML frontend files to other subprojects"
- isCanBeConsumed = true
- isCanBeResolved = false
- attributes { dokkaHtmlFrontendFilesAttribute() }
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-integration-test.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-integration-test.gradle.kts
deleted file mode 100644
index 75e27a62..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-integration-test.gradle.kts
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-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: SourceSet = sourceSets.create("integrationTest") {
- compileClasspath += sourceSets.main.get().output
- runtimeClasspath += sourceSets.main.get().output
-}
-
-val integrationTestImplementation: Configuration by configurations.getting {
- extendsFrom(configurations.implementation.get())
-}
-
-val integrationTestRuntimeOnly: Configuration 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"
- testClassesDirs = integrationTestSourceSet.output.classesDirs
- classpath = integrationTestSourceSet.runtimeClasspath
-
- useJUnitPlatform()
-
- 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)
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka.gradle.kts
deleted file mode 100644
index 5abd8575..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka.gradle.kts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-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"))
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/gradle-plugin.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/gradle-plugin.gradle.kts
deleted file mode 100644
index fb2ca119..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/conventions/gradle-plugin.gradle.kts
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.conventions
-
-plugins {
- id("org.gradle.kotlin.kotlin-dsl")
- id("org.jetbrains.conventions.maven-publish")
- id("com.gradle.plugin-publish")
- id("org.jetbrains.conventions.base-java")
- kotlin("jvm")
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/kotlin-jvm.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/kotlin-jvm.gradle.kts
deleted file mode 100644
index d2425ce3..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/conventions/kotlin-jvm.gradle.kts
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.conventions
-
-import org.jetbrains.configureDokkaVersion
-import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-
-plugins {
- id("org.jetbrains.conventions.base-java")
- kotlin("jvm")
-}
-
-configureDokkaVersion()
-
-kotlin {
- explicitApi = ExplicitApiMode.Strict
-
- compilerOptions {
- allWarningsAsErrors.set(true)
- languageVersion.set(dokkaBuild.kotlinLanguageLevel)
- apiVersion.set(dokkaBuild.kotlinLanguageLevel)
-
- freeCompilerArgs.addAll(
- listOf(
- // need 1.4 support, otherwise there might be problems
- // with Gradle 6.x (it's bundling Kotlin 1.4)
- "-Xsuppress-version-warnings",
- "-Xjsr305=strict",
- "-Xskip-metadata-version-check",
- )
- )
- }
-}
-
-val projectsWithoutInternalDokkaApiUsage = setOf(
- ":integration-tests",
- ":integration-tests:gradle",
- ":integration-tests:maven",
- ":integration-tests:cli"
-)
-
-tasks.withType<KotlinCompile>().configureEach {
- // By path because Dokka has multiple projects with the same name (i.e. 'cli')
- if (project.path in projectsWithoutInternalDokkaApiUsage) {
- return@configureEach
- }
- compilerOptions {
- freeCompilerArgs.addAll(
- listOf(
- "-opt-in=kotlin.RequiresOptIn",
- "-opt-in=org.jetbrains.dokka.InternalDokkaApi",
- )
- )
- }
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts
deleted file mode 100644
index f07ff98d..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.conventions
-
-import org.gradle.kotlin.dsl.support.serviceOf
-
-/**
- * Utility for downloading and installing a Maven binary.
- *
- * Provides the `setupMavenProperties` extension that contains the default versions and locations
- * of the Maven binary.
- *
- * The task [installMavenBinary] will download and unzip the Maven bianry.
- */
-
-plugins {
- base
-}
-
-abstract class MavenCliSetupExtension {
- abstract val mavenVersion: Property<String>
- abstract val mavenPluginToolsVersion: Property<String>
-
- /** Directory that will contain the unpacked Apache Maven dependency */
- abstract val mavenInstallDir: DirectoryProperty
-
- /**
- * Path to the Maven executable.
- *
- * This should be different per OS:
- *
- * * Windows: `$mavenInstallDir/bin/mvn.cmd`
- * * Unix: `$mavenInstallDir/bin/mvn`
- */
- abstract val mvn: RegularFileProperty
-}
-
-val mavenCliSetupExtension =
- extensions.create("mavenCliSetup", MavenCliSetupExtension::class).apply {
- mavenVersion.convention(libs.versions.apacheMaven.core)
- mavenPluginToolsVersion.convention(libs.versions.apacheMaven.pluginTools)
-
- mavenInstallDir.convention(layout.buildDirectory.dir("apache-maven"))
-
- val isWindowsProvider =
- providers.systemProperty("os.name").map { "win" in it.toLowerCase() }
-
- mvn.convention(
- providers.zip(mavenInstallDir, isWindowsProvider) { mavenInstallDir, isWindows ->
- mavenInstallDir.file(
- when {
- isWindows -> "bin/mvn.cmd"
- else -> "bin/mvn"
- }
- )
- }
- )
- }
-
-val mavenBinary by configurations.registering {
- description = "used to download the Maven binary"
- isCanBeResolved = true
- isCanBeConsumed = false
- isVisible = false
-
- defaultDependencies {
- addLater(mavenCliSetupExtension.mavenVersion.map { mavenVersion ->
- project.dependencies.create(
- group = "org.apache.maven",
- name = "apache-maven",
- version = mavenVersion,
- classifier = "bin",
- ext = "zip"
- )
- })
- }
-}
-
-tasks.clean {
- delete(mavenCliSetupExtension.mavenInstallDir)
-}
-
-val installMavenBinary by tasks.registering(Sync::class) {
- val archives = serviceOf<ArchiveOperations>()
- from(
- mavenBinary.flatMap { conf ->
- @Suppress("UnstableApiUsage")
- val resolvedArtifacts = conf.incoming.artifacts.resolvedArtifacts
-
- resolvedArtifacts.map { artifacts ->
- artifacts.map { archives.zipTree(it.file) }
- }
- }
- ) {
- eachFile {
- // drop the first directory inside the zipped Maven bin (apache-maven-$version)
- relativePath = RelativePath(true, *relativePath.segments.drop(1).toTypedArray())
- }
- includeEmptyDirs = false
- }
- into(mavenCliSetupExtension.mavenInstallDir)
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-publish.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-publish.gradle.kts
deleted file mode 100644
index a5ab6b91..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-publish.gradle.kts
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.conventions
-
-import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
-
-plugins {
- id("org.jetbrains.conventions.base")
- `maven-publish`
- signing
- id("org.jetbrains.conventions.dokka")
-}
-
-val javadocJar by tasks.registering(Jar::class) {
- group = JavaBasePlugin.DOCUMENTATION_GROUP
- description = "Assembles a Javadoc JAR using Dokka HTML"
- archiveClassifier.set("javadoc")
- from(tasks.dokkaHtml)
-}
-
-publishing {
- repositories {
- // Publish to a project-local Maven directory, for verification. To test, run:
- // ./gradlew publishAllPublicationsToMavenProjectLocalRepository
- // and check $rootDir/build/maven-project-local
- maven(rootProject.layout.buildDirectory.dir("maven-project-local")) {
- name = "MavenProjectLocal"
- }
- }
-
- publications.withType<MavenPublication>().configureEach {
- artifact(javadocJar)
-
- pom {
- name.convention(provider { "Dokka ${project.name}" })
- description.convention("Dokka is an API documentation engine for Kotlin and Java, performing the same function as Javadoc for Java")
- url.convention("https://github.com/Kotlin/dokka")
-
- licenses {
- license {
- name.convention("The Apache Software License, Version 2.0")
- url.convention("https://www.apache.org/licenses/LICENSE-2.0.txt")
- distribution.convention("repo")
- }
- }
-
- developers {
- developer {
- id.convention("JetBrains")
- name.convention("JetBrains Team")
- organization.convention("JetBrains")
- organizationUrl.convention("https://www.jetbrains.com")
- }
- }
-
- scm {
- connection.convention("scm:git:git://github.com/Kotlin/dokka.git")
- url.convention("https://github.com/Kotlin/dokka/tree/master")
- }
- }
- }
-}
-
-plugins.withType<ShadowPlugin>().configureEach {
- // manually disable publication of Shadow elements https://github.com/johnrengelman/shadow/issues/651#issue-839148311
- // This is done to preserve compatibility and have the same behaviour as previous versions of Dokka.
- // For more details, see https://github.com/Kotlin/dokka/pull/2704#issuecomment-1499517930
- val javaComponent = components["java"] as AdhocComponentWithVariants
- javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) { skip() }
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/internal/gradleKotlinDslAccessors.kt b/build-logic/src/main/kotlin/org/jetbrains/internal/gradleKotlinDslAccessors.kt
deleted file mode 100644
index 6558568c..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/internal/gradleKotlinDslAccessors.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-@file:Suppress("PackageDirectoryMismatch")
-
-package org.gradle.kotlin.dsl // for convenience use a default package for gradle.kts scripts
-
-import org.gradle.api.Project
-import org.gradle.accessors.dm.LibrariesForLibs
-import org.jetbrains.DokkaBuildProperties
-
-/*
- * Utility functions for accessing Gradle extensions that are created by convention plugins.
- *
- * (Gradle can't generate the nice DSL accessors for the project that defines them)
- *
- * These functions are not needed outside the convention plugins project and should be marked as
- * `internal`
- */
-
-
-/**
- * workaround for accessing version-catalog in convention plugins
- *
- * See https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
- */
-internal val Project.libs : LibrariesForLibs
- get() = extensions.getByType()
-
-/**
- * Retrieves the [dokkaBuild][org.jetbrains.DokkaBuildProperties] extension.
- */
-internal val Project.dokkaBuild: DokkaBuildProperties
- get() = extensions.getByType()
-
-/**
- * Configures the [dokkaBuild][org.jetbrains.DokkaBuildProperties] extension.
- */
-internal fun Project.dokkaBuild(configure: DokkaBuildProperties.() -> Unit) =
- extensions.configure(configure)
diff --git a/build-logic/src/main/kotlin/org/jetbrains/projectUtils.kt b/build-logic/src/main/kotlin/org/jetbrains/projectUtils.kt
deleted file mode 100644
index 446f386c..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/projectUtils.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains
-
-import org.gradle.api.Project
-
-fun Project.whenEvaluated(action: Project.() -> Unit) {
- if (state.executed) {
- action()
- } else {
- afterEvaluate { action() }
- }
-}
-
-fun Project.invokeWhenEvaluated(action: (project: Project) -> Unit) {
- whenEvaluated { action(this) }
-}
-
diff --git a/build-logic/src/main/kotlin/org/jetbrains/publication.kt b/build-logic/src/main/kotlin/org/jetbrains/publication.kt
deleted file mode 100644
index 2a6b7a61..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/publication.kt
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains
-
-import com.github.jengelman.gradle.plugins.shadow.ShadowExtension
-import org.gradle.api.Project
-import org.gradle.api.publish.PublishingExtension
-import org.gradle.api.publish.maven.MavenPublication
-import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
-import org.gradle.kotlin.dsl.*
-import org.gradle.plugins.signing.SigningExtension
-import org.jetbrains.DokkaPublicationChannel.*
-import java.net.URI
-
-class DokkaPublicationBuilder {
- enum class Component {
- Java, Shadow
- }
-
- var artifactId: String? = null
- var component: Component = Component.Java
-}
-
-
-fun Project.registerDokkaArtifactPublication(
- publicationName: String,
- configure: DokkaPublicationBuilder.() -> Unit
-) {
- configure<PublishingExtension> {
- publications {
- register<MavenPublication>(publicationName) {
- val builder = DokkaPublicationBuilder().apply(configure)
- artifactId = builder.artifactId
- when (builder.component) {
- DokkaPublicationBuilder.Component.Java -> from(components["java"])
- DokkaPublicationBuilder.Component.Shadow -> run {
- extensions.getByType<ShadowExtension>().component(this)
- artifact(tasks["sourcesJar"])
- }
- }
- }
- }
- }
-
- configureSpacePublicationIfNecessary(publicationName)
- configureSonatypePublicationIfNecessary(publicationName)
- createDokkaPublishTaskIfNecessary()
-}
-
-fun Project.configureSpacePublicationIfNecessary(vararg publications: String) {
- if (SPACE_DOKKA_DEV in this.publicationChannels) {
- configure<PublishingExtension> {
- repositories {
- /* already registered */
- findByName(SPACE_DOKKA_DEV.name)?.let { return@repositories }
- maven {
- name = SPACE_DOKKA_DEV.name
- url = URI.create("https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev")
- credentials {
- username = System.getenv("SPACE_PACKAGES_USER")
- password = System.getenv("SPACE_PACKAGES_SECRET")
- }
- }
- }
- }
- }
-
- whenEvaluated {
- tasks.withType<PublishToMavenRepository> {
- if (this.repository.name == SPACE_DOKKA_DEV.name) {
- this.isEnabled = this.isEnabled && publication.name in publications
- if (!this.isEnabled) {
- this.group = "disabled"
- }
- }
- }
- }
-}
-
-fun Project.createDokkaPublishTaskIfNecessary() {
- tasks.maybeCreate("dokkaPublish").run {
- if (publicationChannels.any { it.isSpaceRepository() }) {
- dependsOn(tasks.named("publish"))
- }
-
- if (publicationChannels.any { it.isMavenRepository() }) {
- dependsOn(tasks.named("publishToSonatype"))
- }
-
- if (publicationChannels.any { it.isGradlePluginPortal() }) {
- dependsOn(tasks.named("publishPlugins"))
- }
- }
-}
-
-fun Project.configureSonatypePublicationIfNecessary(vararg publications: String) {
- if (publicationChannels.any { it.isMavenRepository() }) {
- signPublicationsIfKeyPresent(*publications)
- }
-}
-
-@Suppress("UnstableApiUsage")
-private fun Project.signPublicationsIfKeyPresent(vararg publications: String) {
- val signingKeyId: String? = System.getenv("SIGN_KEY_ID")
- val signingKey: String? = System.getenv("SIGN_KEY")
- val signingKeyPassphrase: String? = System.getenv("SIGN_KEY_PASSPHRASE")
-
- if (!signingKey.isNullOrBlank()) {
- extensions.configure<SigningExtension>("signing") {
- if (signingKeyId?.isNotBlank() == true) {
- useInMemoryPgpKeys(signingKeyId, signingKey, signingKeyPassphrase)
- } else {
- useInMemoryPgpKeys(signingKey, signingKeyPassphrase)
- }
- publications.forEach { publicationName ->
- extensions.getByType<PublishingExtension>()
- .publications
- .findByName(publicationName)
- ?.let { sign(it) }
- }
- }
- }
-}
diff --git a/build-logic/src/main/kotlin/org/jetbrains/taskUtils.kt b/build-logic/src/main/kotlin/org/jetbrains/taskUtils.kt
deleted file mode 100644
index b492d9a9..00000000
--- a/build-logic/src/main/kotlin/org/jetbrains/taskUtils.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains
-
-import org.gradle.api.Project
-import org.gradle.api.Task
-
-fun Task.dependsOnMavenLocalPublication() {
- project.rootProject.allprojects.forEach { otherProject ->
- otherProject.invokeWhenEvaluated { evaluatedProject ->
- evaluatedProject.tasks.findByName("publishToMavenLocal")?.let { publishingTask ->
- this.dependsOn(publishingTask)
- }
- }
- }
-}
-
-val Project.isLocalPublication: Boolean
- get() = gradle.startParameter.taskNames.any {
- it.endsWith("publishToMavenLocal", ignoreCase = true) ||
- it.endsWith("integrationTest", ignoreCase = true) ||
- it.endsWith("check", ignoreCase = true) ||
- it.endsWith("test", ignoreCase = true)
- }