123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- plugins {
- {% if targets|selectattr("app_main_class") -%}
- `application`
- {% else -%}
- `java-library`
- {% endif -%}
- {% if targets|selectattr('publish') -%}
- `maven-publish`
- `signing`
- {% endif -%}
- kotlin("jvm") version "1.8.22"
- kotlin("plugin.allopen") version "1.8.22"
- }
- allOpen {
- annotation("org.springframework.stereotype.Component")
- }
- kotlin {
- jvmToolchain(17)
- }
- {% if targets|selectattr('publish') -%}
- group = "{{ targets[0].publish_group }}"
- version = project.properties["version"]
- {% endif -%}
- repositories {
- mavenCentral()
- }
- configurations {
- all {
- exclude(group = "ch.qos.logback", module = "logback-classic")
- exclude(group = "org.apache.logging.log4j", module = "log4j-to-slf4j")
- }
- }
- {% if targets|selectattr("app_main_class") -%}
- application {
- {% for target in targets|selectattr("app_main_class") -%}
- mainClass.set("{{ target.app_main_class }}")
- {% endfor -%}
- }
- {% endif -%}
- java {
- withSourcesJar()
- withJavadocJar()
- }
- {% if target.jar_source_set is defined -%}
- {% for source_set in target.jar_source_set -%}
- {%- set srcdir, glob = source_set.split(':') -%}
- sourceSets.main.java.srcDirs += '{{ srcdir }}'
- {% endfor -%}
- {% endif -%}
- dependencies {
- {% for target in targets -%}
- {% if target.junit5_test -%}
- testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
- api("org.apache.commons:commons-math3:3.6.1")
- api("com.google.guava:guava:31.0.1-jre")
- {% endif -%}
- {% for library in target.consumer -%}
- {% set classpath = library.classpath -%}
- {% if targets|selectattr("app_main_class") -%}
- {% if library.excludes.consumer is defined %}
- implementation({{ classpath }}) {
- {% for exclude in library.excludes.consumer -%}
- {% set classpath_parts = exclude.classpath.split(':') -%}
- exclude group: '{{ classpath_parts[0] }}', module: '{{ classpath_parts[1] }}'
- {% endfor -%}
- }
- {% else -%}
- implementation({{ classpath }})
- {% endif -%}
- {% elif target.isTest -%}
- testImplementation({{ classpath }})
- {% else -%}
- api({{ classpath }})
- {% endif -%}
- {% endfor -%}
- {% endfor -%}
- }
- {% if targets|selectattr("junit5_test") -%}
- tasks.named<Test>("test") {
- useJUnitPlatform()
- }
- {% endif -%}
- tasks.test {
- testLogging {
- showStandardStreams = true
- events("passed", "skipped", "failed")
- }
- }
- val testsJar by tasks.registering(Jar::class) {
- dependsOn(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME)
- archiveClassifier.set("tests")
- from(sourceSets["test"].output)
- }
- artifacts.add(configurations.create("testOutput").name, testsJar)
- {% include "extra-tests.gradle.kts" ignore missing %}
- {% if targets|selectattr('publish') -%}
- {% include 'publish.gradle.kts' -%}
- {% endif -%}
|