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