Skip to content

Commit 6ff9cd8

Browse files
committed
Cleanup build and ensure kotlin sources are included in api JAR
1 parent 59b99df commit 6ff9cd8

File tree

4 files changed

+45
-14
lines changed

4 files changed

+45
-14
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ subprojects { subproj ->
442442

443443
kotlin {
444444
ktlint("0.9.0")
445-
licenseHeaderFile headerText
445+
licenseHeaderFile headerFile
446446
trimTrailingWhitespace()
447447
endWithNewline()
448448
}

junit-jupiter-api/junit-jupiter-api.gradle

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import org.gradle.jvm.tasks.Jar
2+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3+
4+
dependencies {
5+
"api"("org.opentest4j:opentest4j:${properties["ota4jVersion"]}")
6+
"api"(project(":junit-platform-commons"))
7+
compileOnly("org.jetbrains.kotlin:kotlin-stdlib")
8+
}
9+
10+
tasks {
11+
"jar"(Jar::class) {
12+
manifest {
13+
attributes(
14+
mapOf(
15+
"Automatic-Module-Name" to "org.junit.jupiter.api"
16+
)
17+
)
18+
}
19+
}
20+
}
21+
22+
configurations {
23+
"apiElements" {
24+
/*
25+
* Needed to configure kotlin to work correctly with the "java-library" plugin.
26+
* See:
27+
* https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_known_issues
28+
* https://youtrack.jetbrains.com/issue/KT-18497
29+
*/
30+
val compileKotlin: KotlinCompile by tasks
31+
outgoing
32+
.variants
33+
.getByName("classes")
34+
.artifact(mapOf(
35+
"file" to compileKotlin.destinationDir,
36+
"type" to "java-classes-directory",
37+
"builtBy" to compileKotlin
38+
))
39+
}
40+
}
41+

settings.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ include 'platform-tests'
2121
// based on the project name
2222
rootProject.children.each { project ->
2323
project.buildFileName = "${project.name}.gradle"
24+
if (!project.buildFile.isFile()) {
25+
project.buildFileName = "${project.name}.gradle.kts"
26+
}
2427
assert project.buildFile.isFile()
2528
}

0 commit comments

Comments
 (0)