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