Skip to content

Commit

Permalink
restore gradle integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
whyoleg committed Oct 20, 2023
1 parent f39f5a4 commit b8b944e
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,30 @@

package org.jetbrains.conventions

import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("org.jetbrains.conventions.base-java")
kotlin("jvm")
}

kotlin {
explicitApi = ExplicitApiMode.Strict

explicitApi()
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",
)
// 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",
if (rootProject.name != "dokka-integration-tests") {
optIn.addAll(
"kotlin.RequiresOptIn",
"org.jetbrains.dokka.InternalDokkaApi"
)
)
}
}
}
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

@Suppress("DSL_SCOPE_VIOLATION") // fixed in Gradle 8.1 https://github.com/gradle/gradle/pull/23639
plugins {
id("org.jetbrains.conventions.base")
id("org.jetbrains.conventions.dokka")
base
}

addDependencyOnSameTaskOfIncludedBuilds("assemble")
Expand Down
4 changes: 0 additions & 4 deletions dokka-integration-tests/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

plugins {
id("org.jetbrains.conventions.base")
}
7 changes: 5 additions & 2 deletions dokka-integration-tests/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#

# Project Settings
# TODO remove 'dokka_version' - it doesn't need to be mandatory for non-published subprojects
dokka_version=1.9.20-SNAPSHOT
# while integration tests module isn't published,
# the version here should be in sync with other versions.
# it's used to resolve dependencies
version=1.9.20-SNAPSHOT

org.jetbrains.dokka.javaToolchain.mainCompiler=8
org.jetbrains.dokka.javaToolchain.testLauncher=8
dokka_integration_test_parallelism=2
21 changes: 19 additions & 2 deletions dokka-integration-tests/gradle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,26 @@ dependencies {
implementation(libs.jsoup)
}

val dokkaSubprojects = gradle.includedBuild("dokka-subprojects")
val gradlePluginClassic = gradle.includedBuild("gradle-plugin-classic")

tasks.integrationTest {
val dokka_version: String by project
environment("DOKKA_VERSION", dokka_version)
dependsOn(
dokkaSubprojects.task(":publishAllPublicationsToProjectLocalRepository"),
gradlePluginClassic.task(":publishAllPublicationsToProjectLocalRepository"),
)
environment(
"DOKKA_VERSION",
project.version
)
environment(
"DOKKA_LOCAL_REPOSITORY_SUBPROJECTS",
dokkaSubprojects.projectDir.resolve("build/maven-project-local")
)
environment(
"DOKKA_LOCAL_REPOSITORY_GRADLE_PLUGIN",
gradlePluginClassic.projectDir.resolve("build/maven-project-local")
)
inputs.dir(file("projects"))

javaLauncher.set(javaToolchains.launcherFor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

allprojects {
repositories {
mavenLocal()
maven(System.getenv("DOKKA_LOCAL_REPOSITORY_SUBPROJECTS")) {
content {
includeGroup("org.jetbrains.dokka")
}
}
mavenCentral()
google()
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {
resolutionStrategy {
eachPlugin {
if (requested.id.id == "org.jetbrains.dokka") {
useModule("org.jetbrains.dokka:dokka-gradle-plugin:for-integration-tests-SNAPSHOT")
useModule("org.jetbrains.dokka:dokka-gradle-plugin:${System.getenv("DOKKA_VERSION")}")
}

if (requested.id.id == "com.android.library") {
Expand All @@ -31,7 +31,16 @@ pluginManagement {
}
}
repositories {
mavenLocal()
maven(System.getenv("DOKKA_LOCAL_REPOSITORY_GRADLE_PLUGIN")) {
content {
includeGroup("org.jetbrains.dokka")
}
}
maven(System.getenv("DOKKA_LOCAL_REPOSITORY_SUBPROJECTS")) {
content {
includeGroup("org.jetbrains.dokka")
}
}
mavenCentral()
gradlePluginPortal()
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,5 @@ public fun AbstractIntegrationTest.applyGitDiffFromFile(diffFile: File) {
private fun removeGitFile(repository: Path) =
repository.toFile()
.listFiles().orEmpty()
.filter { it.name.toLowerCase() == ".git" }
.filter { it.name.equals(".git", ignoreCase = true) }
.forEach { it.delete() }


8 changes: 6 additions & 2 deletions dokka-integration-tests/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ dependencyResolutionManagement {

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

includeBuild("../dokka-runners/gradle-plugin-classic")
includeBuild("../dokka-runners/cli")
includeBuild("../dokka-subprojects")

include(
":cli",
// ":cli",
":gradle",
":maven",
// ":maven",
":integration-test-utilities",
)
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ plugins {
}

// TODO [structure-refactoring] enable all
//includeBuild("dokka-integration-tests")
includeBuild("dokka-integration-tests")
includeBuild("dokka-subprojects")
// gradle-plugin should sync, but might not be buildable yet
//includeBuild("dokka-runners/gradle-plugin")
Expand Down

0 comments on commit b8b944e

Please sign in to comment.