openai/openai-java
Publicmirrored from https://github.com/openai/openai-javaAvailable
buildSrc/src/main/kotlin/openai.java.gradle.kts
48lines · modecode
| 1 | import com.diffplug.gradle.spotless.SpotlessExtension |
| 2 | import org.gradle.api.tasks.testing.logging.TestExceptionFormat |
| 3 | |
| 4 | plugins { |
| 5 | `java-library` |
| 6 | id("com.diffplug.spotless") |
| 7 | } |
| 8 | |
| 9 | repositories { |
| 10 | mavenCentral() |
| 11 | } |
| 12 | |
| 13 | configure<SpotlessExtension> { |
| 14 | java { |
| 15 | importOrder() |
| 16 | removeUnusedImports() |
| 17 | palantirJavaFormat() |
| 18 | toggleOffOn() |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | java { |
| 23 | toolchain { |
| 24 | languageVersion.set(JavaLanguageVersion.of(17)) |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | tasks.withType<JavaCompile>().configureEach { |
| 29 | options.compilerArgs.add("-Werror") |
| 30 | options.release.set(8) |
| 31 | } |
| 32 | |
| 33 | tasks.named<Jar>("jar") { |
| 34 | manifest { |
| 35 | attributes(mapOf( |
| 36 | "Implementation-Title" to project.name, |
| 37 | "Implementation-Version" to project.version |
| 38 | )) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | tasks.named<Test>("test") { |
| 43 | useJUnitPlatform() |
| 44 | |
| 45 | testLogging { |
| 46 | exceptionFormat = TestExceptionFormat.FULL |
| 47 | } |
| 48 | } |
| 49 | |