|
| 1 | +import org.jetbrains.kotlin.gradle.dsl.JvmTarget |
| 2 | +import org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper |
| 3 | +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| 4 | +import java.time.Duration |
| 5 | + |
| 6 | +plugins { |
| 7 | + id("java") |
| 8 | + id("org.jetbrains.kotlin.jvm") version "2.1.10" |
| 9 | + id("org.jlleitschuh.gradle.ktlint") version "12.1.2" |
| 10 | + id("io.github.gradle-nexus.publish-plugin") version "2.0.0" |
| 11 | +} |
| 12 | + |
| 13 | +group = project.property("GROUP_ID") as String |
| 14 | + |
| 15 | +apply("gradle-tasks/specs.gradle.kts") |
| 16 | +apply("$rootDir/gradle-tasks/snapshot.gradle") |
| 17 | + |
| 18 | +allprojects { |
| 19 | + repositories { |
| 20 | + mavenCentral() |
| 21 | + maven { |
| 22 | + url = uri("https://oss.sonatype.org/content/repositories/snapshots/") |
| 23 | + } |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +subprojects { |
| 28 | + apply(plugin = "java") |
| 29 | + apply(plugin = "org.jetbrains.kotlin.jvm") |
| 30 | + apply(plugin = "org.jlleitschuh.gradle.ktlint") |
| 31 | + |
| 32 | + plugins.withId("org.jetbrains.kotlin.jvm") { |
| 33 | + kotlin { |
| 34 | + jvmToolchain(8) |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | + plugins.withType<KotlinBasePluginWrapper>().configureEach { |
| 39 | + tasks.withType<KotlinCompile>().configureEach { |
| 40 | + compilerOptions { |
| 41 | + jvmTarget.set(JvmTarget.JVM_1_8) |
| 42 | + } |
| 43 | + } |
| 44 | + } |
| 45 | + |
| 46 | + java { |
| 47 | + withSourcesJar() |
| 48 | + withJavadocJar() |
| 49 | + |
| 50 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 51 | + targetCompatibility = JavaVersion.VERSION_1_8 |
| 52 | + |
| 53 | + // Gradle 7+ Java toolchain approach (also sets 1.8) |
| 54 | + toolchain { |
| 55 | + languageVersion.set(JavaLanguageVersion.of(8)) |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + ktlint { |
| 60 | + debug.set(true) |
| 61 | + version.set("1.5.0") |
| 62 | + verbose.set(true) |
| 63 | + |
| 64 | + additionalEditorconfig.set( |
| 65 | + mapOf( |
| 66 | + "max_line_length" to "200", |
| 67 | + "indent_style" to "space", |
| 68 | + "indent_size" to "4", |
| 69 | + "insert_final_newline" to "true", |
| 70 | + "end_of_line" to "lf", |
| 71 | + ), |
| 72 | + ) |
| 73 | + } |
| 74 | +} |
| 75 | + |
| 76 | +nexusPublishing { |
| 77 | + repositories { |
| 78 | + sonatype { |
| 79 | + username.set(System.getenv("SONATYPE_USERNAME")) |
| 80 | + password.set(System.getenv("SONATYPE_PASSWORD")) |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + transitionCheckOptions { |
| 85 | + maxRetries.set(60) |
| 86 | + delayBetween.set(Duration.ofMillis(5000)) |
| 87 | + } |
| 88 | +} |
0 commit comments