| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 1 | plugins { |
| 2 | // Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin. |
| Marc Kupietz | de91759 | 2025-10-31 15:44:27 +0100 | [diff] [blame] | 3 | id 'org.jetbrains.kotlin.jvm' version '2.2.21' |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 4 | |
| 5 | // Apply the application plugin to add support for building a CLI application in Java. |
| 6 | id 'application' |
| Marc Kupietz | 1b59599 | 2024-03-01 14:54:30 +0100 | [diff] [blame] | 7 | id 'com.github.johnrengelman.shadow' version '8.1.1' |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 8 | } |
| 9 | |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 10 | repositories { |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 11 | mavenCentral() |
| Marc Kupietz | 56a4556 | 2024-03-20 20:18:08 +0100 | [diff] [blame] | 12 | maven { url 'https://jitpack.io' } |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 13 | } |
| 14 | |
| Marc Kupietz | 47b43c3 | 2024-03-27 20:43:32 +0100 | [diff] [blame] | 15 | test { |
| Marc Kupietz | fc18d28 | 2025-08-31 12:07:46 +0200 | [diff] [blame] | 16 | minHeapSize = "512m" |
| 17 | maxHeapSize = "4096m" |
| 18 | jvmArgs '-XX:MaxMetaspaceSize=1024m' |
| Marc Kupietz | 47b43c3 | 2024-03-27 20:43:32 +0100 | [diff] [blame] | 19 | } |
| 20 | |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 21 | dependencies { |
| 22 | // Align versions of all Kotlin components |
| 23 | implementation platform('org.jetbrains.kotlin:kotlin-bom') |
| 24 | |
| 25 | // Use the Kotlin JDK 8 standard library. |
| 26 | implementation 'org.jetbrains.kotlin:kotlin-stdlib' |
| Marc Kupietz | fc18d28 | 2025-08-31 12:07:46 +0200 | [diff] [blame] | 27 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2' |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 28 | |
| 29 | // This dependency is used by the application. |
| Marc Kupietz | de91759 | 2025-10-31 15:44:27 +0100 | [diff] [blame] | 30 | implementation 'com.google.guava:guava:33.5.0-jre' |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 31 | |
| Marc Kupietz | 3112236 | 2024-03-02 11:13:37 +0100 | [diff] [blame] | 32 | |
| Marc Kupietz | fc18d28 | 2025-08-31 12:07:46 +0200 | [diff] [blame] | 33 | implementation ("info.picocli:picocli:4.7.7") |
| Marc Kupietz | 3112236 | 2024-03-02 11:13:37 +0100 | [diff] [blame] | 34 | |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 35 | // Use the Kotlin test library. |
| 36 | testImplementation 'org.jetbrains.kotlin:kotlin-test' |
| 37 | |
| 38 | // Use the Kotlin JUnit integration. |
| 39 | testImplementation 'org.jetbrains.kotlin:kotlin-test-junit' |
| Marc Kupietz | de91759 | 2025-10-31 15:44:27 +0100 | [diff] [blame] | 40 | testImplementation "org.jetbrains.kotlin:kotlin-test:2.2.21" |
| Marc Kupietz | 0c6e877 | 2024-03-19 07:03:07 +0100 | [diff] [blame] | 41 | |
| Marc Kupietz | 1465ce2 | 2024-03-26 09:51:17 +0100 | [diff] [blame] | 42 | implementation 'com.github.kupietz:cistern:v1.0.4' |
| Marc Kupietz | af682a4 | 2024-03-22 06:51:55 +0100 | [diff] [blame] | 43 | implementation 'org.maltparser:maltparser:1.9.2' |
| Marc Kupietz | de91759 | 2025-10-31 15:44:27 +0100 | [diff] [blame] | 44 | implementation 'org.apache.opennlp:opennlp-tools:2.5.6' |
| Marc Kupietz | fc18d28 | 2025-08-31 12:07:46 +0200 | [diff] [blame] | 45 | implementation 'org.slf4j:slf4j-simple:2.0.17' |
| Marc Kupietz | 916bdfe | 2024-09-20 09:02:57 +0200 | [diff] [blame] | 46 | implementation 'org.apache.ant:ant:1.10.15' |
| Marc Kupietz | fc18d28 | 2025-08-31 12:07:46 +0200 | [diff] [blame] | 47 | implementation 'org.apache.commons:commons-compress:1.28.0' |
| Marc Kupietz | a92bacb | 2024-04-06 20:26:05 +0200 | [diff] [blame] | 48 | |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 49 | } |
| 50 | |
| Marc Kupietz | 8d875cc | 2025-10-31 15:36:33 +0100 | [diff] [blame] | 51 | // Erzwinge JDK 21 Toolchain und Bytecode-Level 21 |
| 52 | java { |
| 53 | toolchain { |
| 54 | languageVersion = JavaLanguageVersion.of(21) |
| 55 | } |
| 56 | } |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 57 | |
| Marc Kupietz | 8d875cc | 2025-10-31 15:36:33 +0100 | [diff] [blame] | 58 | kotlin { |
| 59 | jvmToolchain(21) |
| 60 | } |
| 61 | |
| 62 | // Für evtl. vorhandenen Java-Quellcode |
| 63 | tasks.withType(JavaCompile).configureEach { |
| 64 | options.release = 21 |
| 65 | } |
| 66 | |
| 67 | tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { |
| 68 | kotlinOptions { |
| 69 | jvmTarget = "21" |
| 70 | // Falls verfügbar, sorgt dies für konsistente API-Targets ähnlich zu Java --release |
| 71 | // freeCompilerArgs += ["-Xjdk-release=21"] |
| 72 | } |
| 73 | } |
| Marc Kupietz | 9da19db | 2024-04-01 11:06:51 +0200 | [diff] [blame] | 74 | |
| Marc Kupietz | f13fc7b | 2025-10-31 17:28:21 +0100 | [diff] [blame^] | 75 | // Version des Subprojekts explizit von Root erben |
| 76 | version = rootProject.version |
| 77 | |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 78 | application { |
| 79 | // Define the main class for the application. |
| Marc Kupietz | 07c60d3 | 2025-01-21 19:32:48 +0100 | [diff] [blame] | 80 | mainClass = 'de.ids_mannheim.korapxmltools.KorapXmlToolKt' |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | jar { |
| Marc Kupietz | f13fc7b | 2025-10-31 17:28:21 +0100 | [diff] [blame^] | 84 | // Standard-JAR als "plain" kennzeichnen, um Konflikte mit ShadowJar zu vermeiden |
| 85 | archiveClassifier.set('plain') |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 86 | manifest.attributes( |
| 87 | 'Class-Path': configurations.compileClasspath.collect { it.getName() }.join(' '), |
| Marc Kupietz | de91759 | 2025-10-31 15:44:27 +0100 | [diff] [blame] | 88 | 'Main-Class': "de.ids_mannheim.korapxmltools.KorapXmlToolKt", |
| 89 | 'Implementation-Title': rootProject.name, |
| 90 | 'Implementation-Version': project.version |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 91 | ) |
| Marc Kupietz | f13fc7b | 2025-10-31 17:28:21 +0100 | [diff] [blame^] | 92 | } |
| 93 | |
| 94 | shadowJar { |
| 95 | archiveBaseName.set('korapxmltool') |
| 96 | archiveClassifier.set('') |
| 97 | archiveVersion.set(project.version.toString()) |
| 98 | manifest.attributes( |
| 99 | 'Main-Class': "de.ids_mannheim.korapxmltools.KorapXmlToolKt", |
| 100 | 'Implementation-Title': rootProject.name, |
| 101 | 'Implementation-Version': project.version |
| 102 | ) |
| 103 | } |
| 104 | |
| 105 | // Stelle sicher, dass assemble auch den ShadowJar erzeugt |
| 106 | tasks.named('assemble') { |
| 107 | dependsOn tasks.named('shadowJar') |
| 108 | } |
| 109 | |
| 110 | // Erzeuge zusätzlich eine nicht-versionierte Kopie korapxmltool.jar für stabile Skriptpfade |
| 111 | tasks.register('shadowJarLatest', Copy) { |
| 112 | dependsOn tasks.named('shadowJar') |
| 113 | from({ tasks.shadowJar.get().archiveFile.get().asFile }) |
| 114 | into({ tasks.shadowJar.get().destinationDirectory.get().asFile }) |
| 115 | rename { String _ -> 'korapxmltool.jar' } |
| 116 | } |
| 117 | |
| 118 | tasks.named('build') { |
| 119 | dependsOn tasks.named('shadowJarLatest') |
| Marc Kupietz | 4f6ed42 | 2024-03-01 07:27:46 +0100 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | |
| 123 | configurations { |
| 124 | runtimeLib.extendsFrom implementation |
| 125 | } |