summaryrefslogtreecommitdiff
path: root/build.gradle.kts
blob: d388b1ffe902ba6d3071de04ed3ad5fbf3882167 (plain)
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
plugins { kotlin("jvm").version("1.7.20"); java; `maven-publish` }
group = "moe.nea"
version = "1.1.0"
repositories { mavenCentral() }
java.toolchain { languageVersion.set(JavaLanguageVersion.of(8)) }
java.withSourcesJar()
sourceSets.main { java.setSrcDirs(listOf("src/")); resources.setSrcDirs(listOf("res")) }
sourceSets.test { java.setSrcDirs(listOf("test/src")); resources.setSrcDirs(listOf("test/res")) }

publishing {
	publications {
		create<MavenPublication>("maven") {
			from(components["java"])
		}
	}
}

val testReportFile = layout.buildDirectory.file("test-results/nealisp/results.xml")

tasks.create("testLisps", JavaExec::class) {
	javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
	classpath(sourceSets.test.get().runtimeClasspath)
	mainClass.set("TestMain")
	dependsOn(tasks.testClasses)
	dependsOn(tasks.processTestResources)
	outputs.file(testReportFile)
	systemProperty("test.report", testReportFile.map { it.asFile.absolutePath }.get())
	systemProperty("test.suites", "test")
	systemProperty("test.imports", "secondary")
	group = "verification"
}


tasks.create("testLispsHtml", Exec::class) {
	dependsOn("testLisps")
	executable("xunit-viewer")
	inputs.file(testReportFile)
	val testReportHtmlFile = layout.buildDirectory.file("reports/nealisp/tests/index.html")
	outputs.file(testReportHtmlFile)
	args(
		"-r", testReportFile.map { it.asFile.absolutePath }.get(),
		"-o", testReportHtmlFile.map { it.asFile.absolutePath }.get()
	)
	group = "verification"
}