-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Test DGPv2 example projects Test the DGPv2 examples by comparing using golden testing. The example projects are executed using Gradle TestKit. The generated Dokka output is compared against data committed into the directory `./dokka-integration-tests/gradle/src/testExampleProjects/expectedData/` KT-71346
- Loading branch information
Showing
631 changed files
with
111,195 additions
and
105 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
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
72 changes: 72 additions & 0 deletions
72
...egration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/gradleCCReportData.kt
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,72 @@ | ||
/* | ||
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
package org.jetbrains.dokka.it.gradle | ||
|
||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.json.Json | ||
import org.jetbrains.dokka.gradle.utils.GradleProjectTest | ||
import java.nio.file.Path | ||
import kotlin.io.path.isRegularFile | ||
import kotlin.io.path.readText | ||
import kotlin.io.path.walk | ||
|
||
/** | ||
* Gradle creates an HTML report for each Configuration Cache result. | ||
* This report contains JSON data that we can parse to get fine-grained details about the | ||
* Configuration Cache result. | ||
* | ||
* Only the first CC report will be parsed, so make sure to clean the CC report directory | ||
* before running any Gradle tasks to ensure only one report is found. | ||
*/ | ||
fun GradleProjectTest.loadConfigurationCacheReportData(): ConfigurationCacheReportData? { | ||
val ccReportFile = projectDir.resolve("build/reports/configuration-cache") | ||
.walk() | ||
.filter { it.isRegularFile() } | ||
.singleOrNull() | ||
?: return null | ||
|
||
return parseCCReportData(ccReportFile) | ||
} | ||
|
||
@Serializable | ||
data class ConfigurationCacheReportData( | ||
val diagnostics: List<DiagnosticsItem>, | ||
val totalProblemCount: Int, | ||
val buildName: String, | ||
val requestedTasks: String, | ||
val cacheAction: String, | ||
val documentationLink: String, | ||
) { | ||
|
||
@Serializable | ||
data class DiagnosticsItem( | ||
val trace: List<Trace>, | ||
val input: List<Input>, | ||
val documentationLink: String? = null, | ||
) | ||
|
||
@Serializable | ||
data class Trace( | ||
val kind: String, | ||
val type: String? = null, | ||
val location: String? = null, | ||
) | ||
|
||
@Serializable | ||
data class Input( | ||
val text: String? = null, | ||
val name: String? = null, | ||
) | ||
} | ||
|
||
/** | ||
* Extract and parse the JSON data from [ccReport]. | ||
*/ | ||
private fun parseCCReportData(ccReport: Path): ConfigurationCacheReportData { | ||
val reportData = ccReport.readText() | ||
.substringAfter("// begin-report-data", "could not find 'begin-report-data'") | ||
.substringBefore("// end-report-data", "could not find 'end-report-data'") | ||
|
||
return Json.decodeFromString<ConfigurationCacheReportData>(reportData) | ||
} |
87 changes: 87 additions & 0 deletions
87
...pleProjects/basic-gradle-example/html/-dokka -gradle -example/demo/-greeter/-greeter.html
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.