Skip to content

Commit

Permalink
fix CompositeBuildExampleTest
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-enko committed Sep 5, 2024
1 parent 7830483 commit 21aa530
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package dev.adamko.dokkatoo.tests.examples
package org.jetbrains.dokka.it.gradle.examples

import io.kotest.assertions.withClue
import io.kotest.matchers.shouldBe
Expand All @@ -19,7 +19,12 @@ import kotlin.io.path.*

class CompositeBuildExampleTest {

val exampleProject = initProject(projectTestTempDir)
private val exampleProject = initProject(projectTestTempDir)

@Test
fun `check name`() {
exampleProjectDir.name shouldBe "composite-build-example"
}

@Nested
@DisplayName("verify generated HTML")
Expand All @@ -30,7 +35,6 @@ class CompositeBuildExampleTest {
.addArguments(
"clean",
":build",
"--stacktrace",
)
.forwardOutput()
.build {
Expand Down Expand Up @@ -145,7 +149,7 @@ class CompositeBuildExampleTest {
): GradleProjectTest {

return GradleProjectTest(destinationDir).apply {
projectDir.deleteRecursively()
//projectDir.deleteRecursively()
exampleProjectDir.copyToRecursively(projectDir, overwrite = true, followLinks = false)

gradleProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,6 @@ inline fun GradleRunner.buildAndFail(

fun GradleRunner.updateGradleProperties(
arguments: GradleProjectTest.GradleProperties,
): GradleRunner {
val gradlePropertiesFile = projectDir.resolve("gradle.properties").apply {
if (!exists()) {
parentFile.mkdirs()
createNewFile()
}
}

val gradleProperties = Properties()
.loadFile(gradlePropertiesFile)
.entries.associate { it.key.toString() to it.value.toString() }.toMutableMap()

arguments.toGradleProperties().forEach { (k, v) ->
gradleProperties[k] = v
}

gradlePropertiesFile.writeText(
gradleProperties
.entries
.sortedBy { it.key }
.joinToString("\n", postfix = "\n") { (k, v) -> "$k=$v" }
)

return this
}

fun GradleRunner.updateGradlePropertiesV2(
arguments: GradleProjectTest.GradleProperties,
): GradleRunner {
projectDir.walk()
.filter { it.name == "settings.gradle.kts" || it.name == "settings.gradle" }
Expand Down

0 comments on commit 21aa530

Please sign in to comment.