Skip to content

Commit

Permalink
Fix custom-dokka-plugin example and update test
Browse files Browse the repository at this point in the history
- Add custom test tasks to only test a specific example project.
  • Loading branch information
adam-enko committed Nov 12, 2024
1 parent 971bfcc commit 54fc084
Show file tree
Hide file tree
Showing 57 changed files with 3,741 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ abstract class SystemPropertyAdder @Inject internal constructor(
return task.inputs.property("SystemProperty input property $key", value)
}

fun inputProperty(
key: String,
value: String,
): TaskInputPropertyBuilder {
task.jvmArgumentProviders.add(
SystemPropertyArgumentProvider(key, value) { it }
)
return task.inputs.property("SystemProperty input property $key", value)
}

@JvmName("inputBooleanProperty")
fun inputProperty(
key: String,
Expand Down
7 changes: 7 additions & 0 deletions build-logic/src/main/kotlin/dokkabuild/utils/strings.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package dokkabuild.utils

/** Title case the first char of a string */
fun String.uppercaseFirstChar(): String = replaceFirstChar(Char::uppercaseChar)
27 changes: 26 additions & 1 deletion dokka-integration-tests/gradle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import dokkabuild.tasks.GitCheckoutTask
import dokkabuild.utils.systemProperty
import dokkabuild.utils.uppercaseFirstChar
import org.gradle.api.tasks.PathSensitivity.NAME_ONLY
import org.gradle.api.tasks.PathSensitivity.RELATIVE

Expand Down Expand Up @@ -198,7 +199,7 @@ testing {
}
val testExampleProjects by suites.registering(JvmTestSuite::class) {
targets.configureEach {
testTask.configure {
testTask {

val exampleGradleProjectsDir = projectDir.resolve("../../examples/gradle-v2")
systemProperty
Expand All @@ -215,5 +216,29 @@ testing {
systemProperty("junit.jupiter.execution.parallel.mode.default", "CONCURRENT")
}
}

listOf(
"basic-gradle-example",
"composite-build-example",
"custom-dokka-plugin-example",
"custom-styling-example",
"java-example",
"javadoc-example",
"kotlin-as-java-example",
"kotlin-multiplatform-example",
"library-publishing-example",
"multimodule-example",
"versioning-multimodule-example",
).forEach { exampleProjectName ->
val prettyName = exampleProjectName.split("-").joinToString("") { it.uppercaseFirstChar() }
targets.register("test$prettyName") {
testTask {
description = "Only test $exampleProjectName"
group = "verification - example projects"
systemProperty
.inputProperty("exampleProjectFilter", exampleProjectName)
}
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 54fc084

Please sign in to comment.