Skip to content

Commit

Permalink
Cleanup build and ensure kotlin sources are included in api JAR
Browse files Browse the repository at this point in the history
  • Loading branch information
JLLeitschuh committed Aug 4, 2017
1 parent 59b99df commit 6ff9cd8
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ subprojects { subproj ->

kotlin {
ktlint("0.9.0")
licenseHeaderFile headerText
licenseHeaderFile headerFile
trimTrailingWhitespace()
endWithNewline()
}
Expand Down
13 changes: 0 additions & 13 deletions junit-jupiter-api/junit-jupiter-api.gradle

This file was deleted.

41 changes: 41 additions & 0 deletions junit-jupiter-api/junit-jupiter-api.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

dependencies {
"api"("org.opentest4j:opentest4j:${properties["ota4jVersion"]}")
"api"(project(":junit-platform-commons"))
compileOnly("org.jetbrains.kotlin:kotlin-stdlib")
}

tasks {
"jar"(Jar::class) {
manifest {
attributes(
mapOf(
"Automatic-Module-Name" to "org.junit.jupiter.api"
)
)
}
}
}

configurations {
"apiElements" {
/*
* Needed to configure kotlin to work correctly with the "java-library" plugin.
* See:
* https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_known_issues
* https://youtrack.jetbrains.com/issue/KT-18497
*/
val compileKotlin: KotlinCompile by tasks
outgoing
.variants
.getByName("classes")
.artifact(mapOf(
"file" to compileKotlin.destinationDir,
"type" to "java-classes-directory",
"builtBy" to compileKotlin
))
}
}

3 changes: 3 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ include 'platform-tests'
// based on the project name
rootProject.children.each { project ->
project.buildFileName = "${project.name}.gradle"
if (!project.buildFile.isFile()) {
project.buildFileName = "${project.name}.gradle.kts"
}
assert project.buildFile.isFile()
}

0 comments on commit 6ff9cd8

Please sign in to comment.