Repository navigation
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
166 lines (128 loc) · 4.5 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
166 lines (128 loc) · 4.5 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter
fun properties(key: String) = project.findProperty(key).toString()
plugins {
`kotlin-dsl`
id("java")
id("java-gradle-plugin")
id("maven-publish")
id("com.gradle.plugin-publish") version "1.3.1"
id("com.github.blueboxware.tocme") version "1.8"
id("com.github.gmazzo.buildconfig") version "5.6.7"
}
group = properties("group")
version = properties("pluginVersion")
repositories {
mavenCentral()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("com.badlogicgames.gdx:gdx-tools:" + properties("gdxVersion"))
implementation("com.badlogicgames.gdx:gdx-backend-lwjgl3:" + properties("gdxVersion"))
implementation("com.badlogicgames.gdx:gdx-platform:" + properties("gdxVersion") + ":natives-desktop")
implementation("com.badlogicgames.gdx:gdx-freetype-platform:" + properties("gdxVersion") + ":natives-desktop")
implementation("commons-io:commons-io:2.19.0")
testImplementation(gradleTestKit())
testImplementation(kotlin("test"))
testImplementation("io.kotest:kotest-runner-junit5:" + properties("kotestVersion"))
}
buildConfig {
packageName("com.github.blueboxware")
buildConfigField("String", "GDX_VERSION", "\"" + properties("gdxVersion") + "\"")
}
abstract class TestTask : Test() {
@get:Input
abstract val useBuildCache: Property<Boolean>
@get:Input
abstract val useConfigurationCache: Property<Boolean>
@get:Input
abstract val version: Property<String>
override fun getGroup(): String = "verification"
override fun getFilter(): TestFilter? {
return DefaultTestFilter().includeTestsMatching("*")
}
@TaskAction
override fun executeTests() {
systemProperty("gdxplugin.cache.build", useBuildCache.get())
systemProperty("gdxplugin.cache.configuration", useConfigurationCache.get())
systemProperty("gdxplugin.gradle.version", version.get())
super.executeTests()
}
}
@Suppress("UnstableApiUsage")
for (useBuildCache in listOf(true, false)) {
for (useConfCache in listOf(true, false)) {
for (version in listOf("9.0.0", "9.6.0")) {
val name = buildString {
append("test")
if (useConfCache) append("ConfCache")
if (useBuildCache) append("BuildCache")
append("Version")
append(version)
}
val test by testing.suites.existing(JvmTestSuite::class)
val task = tasks.register<TestTask>(name) {
this.useBuildCache = useBuildCache
this.useConfigurationCache = useConfCache
this.version = version
testClassesDirs = files(test.map { it.sources.output.classesDirs })
classpath = files(test.map { it.sources.runtimeClasspath })
}
tasks.test {
dependsOn(task)
}
}
}
}
tasks {
test {
exclude("*")
}
withType<Test>().configureEach {
useJUnitPlatform()
dependsOn("publishToMavenLocal")
}
register("createReadmes") {
inputs.file("README.md.src")
inputs.file("gradle.properties")
outputs.files(fileTree("dir" to ".", "include" to "*.md"))
dependsOn(project.tasks.named("insertTocs"))
doLast {
val baseText = file("README.md.src")
.readText()
.replace(Regex("(?s)<exclude>.*?</exclude>\\s?"), "")
.replace(Regex("(?s)</?test[^>]*>\\s*"), "")
.replace("<releasedVersion>", properties("releasedPluginVersion"))
.replace("<pluginVersion>", properties("pluginVersion"))
.replace("<gdxVersion>", properties("gdxVersion"))
file("README.md").writeText(
baseText
.replace(Regex("(?s)<kotlin>.*?</kotlin>"), "")
.replace(Regex("(?s)```kotlin.*?```\\n?"), "")
.replace(Regex("(?s)</?groovy>"), "")
)
file("README-kotlin.md").writeText(
baseText
.replace(Regex("(?s)<groovy>.*?</groovy>"), "")
.replace(Regex("(?s)```groovy.*?```\\n?"), "")
.replace(Regex("(?s)</?kotlin>"), "")
)
}
}
}
gradlePlugin {
website.set("https://github.com/BlueBoxWare/LibGDXGradlePlugin")
vcsUrl.set("https://github.com/BlueBoxWare/LibGDXGradlePlugin.git")
plugins {
create("gdxPlugin") {
id = "com.github.blueboxware.gdx"
implementationClass = "com.github.blueboxware.gdxplugin.GdxPlugin"
displayName = "LibGDX Gradle plugin"
description = "Plugin to create Texture Packs, Bitmap Fonts, Nine patches and Distance Fields for use with LibGDX"
version = properties("pluginVersion")
tags.set(listOf("LibGDX"))
}
}
}
tocme {
docs("README.md.src")
}