Skip to content

Commit d8d7136

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

File tree

4 files changed

+43
-14
lines changed

4 files changed

+43
-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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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(mapOf(
14+
"Automatic-Module-Name" to "org.junit.jupiter.api"
15+
))
16+
}
17+
}
18+
}
19+
20+
configurations {
21+
"apiElements" {
22+
/*
23+
* Needed to configure kotlin to work correctly with the "java-library" plugin.
24+
* See:
25+
* https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_known_issues
26+
* https://youtrack.jetbrains.com/issue/KT-18497
27+
*/
28+
val compileKotlin: KotlinCompile by tasks
29+
outgoing
30+
.variants
31+
.getByName("classes")
32+
.artifact(mapOf(
33+
"file" to compileKotlin.destinationDir,
34+
"type" to "java-classes-directory",
35+
"builtBy" to compileKotlin
36+
))
37+
}
38+
}
39+

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)