forked from kotest/kotest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
96 lines (77 loc) · 2.65 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
plugins {
id("kotest-multiplatform-library-conventions")
}
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
api(libs.kotlinx.coroutines.core)
api(projects.kotestAssertions.kotestAssertionsShared)
implementation(kotlin("reflect"))
api(projects.kotestCommon) // needs to be API so the domain objects are open
api(libs.kotlinx.coroutines.test)
}
}
val jvmMain by getting {
dependencies {
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("reflect"))
implementation(projects.kotestFramework.kotestFrameworkEngine)
implementation(projects.kotestAssertions.kotestAssertionsCore)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.mockk)
implementation(libs.junit.platform.engine)
implementation(libs.junit.platform.api)
implementation(libs.junit.platform.launcher)
implementation(libs.junit.jupiter.api)
// this is here to test that the intellij marker 'dummy' test doesn't appear in intellij
implementation(libs.junit.jupiter.engine)
}
}
}
}
tasks.create("buildConfigDocs") {
// find config files
val fileNames = listOf("KotestEngineProperties.kt")
val foundFiles = File(project.rootDir.absolutePath).walk().maxDepth(25).map { file ->
if (fileNames.contains(file.name)) {
file
} else {
null
}
}.filterNotNull()
.toList()
if (foundFiles.size != fileNames.size)
throw RuntimeException("Fail to find files -> {$fileNames} in project, found only these files -> {$foundFiles}")
// replace in docs
val docName = "config_props.md"
val docsFolder = File(project.rootDir.absolutePath, "documentation/docs/framework")
val docFileFullPath = File(docsFolder.absolutePath, docName)
val configTemplate = """
---
id: framework_config_props
title: Framework configuration properties
sidebar_label: System properties
slug: framework-config-props.html
---
""".trimIndent()
val fileTemplate = """
---
#### %s
```kotlin
%s
```
""".trimIndent()
val sb = StringBuilder(configTemplate)
foundFiles.forEach { file ->
val name = file.name
// intentionally use \n instead of System.lineSeparator to respect .editorconfig
val content = file.readLines().joinToString(separator = "\n")
sb.append(fileTemplate.format(name, content))
}
docFileFullPath.writeText(sb.toString())
}
tasks["jvmTest"].mustRunAfter(tasks["buildConfigDocs"].path)