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 /integration-tests/gradle/src/main/kotlin/org | |
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 'integration-tests/gradle/src/main/kotlin/org')
3 files changed, 0 insertions, 154 deletions
diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt deleted file mode 100644 index f2b28578..00000000 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt +++ /dev/null @@ -1,84 +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.dokka.it.gradle - -import org.gradle.testkit.runner.BuildResult -import org.gradle.testkit.runner.GradleRunner -import org.gradle.testkit.runner.internal.DefaultGradleRunner -import org.gradle.tooling.GradleConnectionException -import org.gradle.util.GradleVersion -import org.jetbrains.dokka.it.AbstractIntegrationTest -import java.io.File -import java.net.URI -import kotlin.test.BeforeTest - -public abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { - - @BeforeTest - public fun copyTemplates() { - File("projects").listFiles().orEmpty() - .filter { it.isFile } - .filter { it.name.startsWith("template.") } - .forEach { file -> file.copyTo(File(tempFolder, file.name)) } - } - - public fun createGradleRunner( - buildVersions: BuildVersions, - vararg arguments: String, - jvmArgs: List<String> = listOf("-Xmx2G", "-XX:MaxMetaspaceSize=1G") - ): GradleRunner { - return GradleRunner.create() - .withProjectDir(projectDir) - .forwardOutput() - .withJetBrainsCachedGradleVersion(buildVersions.gradleVersion) - .withTestKitDir(File("build", "gradle-test-kit").absoluteFile) - .withArguments( - listOfNotNull( - "-Pkotlin_version=${buildVersions.kotlinVersion}", - "-Pdokka_it_kotlin_version=${buildVersions.kotlinVersion}", - buildVersions.androidGradlePluginVersion?.let { androidVersion -> - "-Pdokka_it_android_gradle_plugin_version=$androidVersion" - }, - * arguments - ) - ).run { this as DefaultGradleRunner } - .withJvmArguments(jvmArgs) - } - - public fun GradleRunner.buildRelaxed(): BuildResult { - return try { - build() - } catch (e: Throwable) { - val gradleConnectionException = e.withAllCauses().find { it is GradleConnectionException } - if (gradleConnectionException != null) { - gradleConnectionException.printStackTrace() - throw IllegalStateException("Assumed Gradle connection", gradleConnectionException) - - } - throw e - } - } -} - -private fun GradleRunner.withJetBrainsCachedGradleVersion(version: GradleVersion): GradleRunner { - return withGradleDistribution( - URI.create( - "https://cache-redirector.jetbrains.com/" + - "services.gradle.org/distributions/" + - "gradle-${version.version}-bin.zip" - ) - ) -} - -private fun Throwable.withAllCauses(): Sequence<Throwable> { - val root = this - return sequence { - yield(root) - val cause = root.cause - if (cause != null && cause != root) { - yieldAll(cause.withAllCauses()) - } - } -} diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/BuildVersions.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/BuildVersions.kt deleted file mode 100644 index ab387420..00000000 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/BuildVersions.kt +++ /dev/null @@ -1,52 +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.dokka.it.gradle - -import org.gradle.util.GradleVersion - -public data class BuildVersions( - val gradleVersion: GradleVersion, - val kotlinVersion: String, - val androidGradlePluginVersion: String? = null, -) { - public constructor( - gradleVersion: String, - kotlinVersion: String, - androidGradlePluginVersion: String? = null - ) : this( - gradleVersion = GradleVersion.version(gradleVersion), - kotlinVersion = kotlinVersion, - androidGradlePluginVersion = androidGradlePluginVersion - ) - - override fun toString(): String { - return buildString { - append("Gradle ${gradleVersion.version}, Kotlin $kotlinVersion") - if (androidGradlePluginVersion != null) { - append(", Android $androidGradlePluginVersion") - } - } - } - - public companion object { - public fun permutations( - gradleVersions: List<String>, - kotlinVersions: List<String>, - androidGradlePluginVersions: List<String?> = listOf(null) - ): List<BuildVersions> { - return gradleVersions.distinct().flatMap { gradleVersion -> - kotlinVersions.distinct().flatMap { kotlinVersion -> - androidGradlePluginVersions.distinct().map { androidVersion -> - BuildVersions( - gradleVersion = gradleVersion, - kotlinVersion = kotlinVersion, - androidGradlePluginVersion = androidVersion - ) - } - } - } - } - } -} diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/TestEnvironment.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/TestEnvironment.kt deleted file mode 100644 index 174060aa..00000000 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/TestEnvironment.kt +++ /dev/null @@ -1,18 +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.dokka.it.gradle - -public object TestEnvironment { - public val isExhaustive: Boolean = checkNotNull(System.getenv("isExhaustive")) { - "Missing `isExhaustive` environment variable" - }.toBoolean() -} - -/** - * Will only return values if [TestEnvironment.isExhaustive] is set to true - */ -public inline fun <reified T> ifExhaustive(vararg values: T): Array<out T> { - return if (TestEnvironment.isExhaustive) values else emptyArray() -} |