123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- {%- set publish = target.publish -%}
- {%- set mainClass = target.app_main_class -%}
- {%- set hasJunit5Test = extra_targets|selectattr('junit5_test') -%}
- plugins {
- {% if mainClass -%}
- `application`
- {% else -%}
- `java-library`
- {% endif -%}
- {% if publish -%}
- `maven-publish`
- `signing`
- {% endif -%}
- }
- {% if publish -%}
- group = "{{ target.publish_group }}"
- version = project.properties["version"]
- {% endif -%}
- repositories {
- mavenCentral()
- }
- {% if mainClass -%}
- application {
- mainClass.set("{{ mainClass }}")
- }
- {% endif -%}
- java {
- withSourcesJar()
- withJavadocJar()
- }
- dependencies {
- {% if hasJunit5Test -%}
- 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 classpath|replace('"','') == classpath -%}
- {% set classpath = '"' + classpath + '"' -%}
- {% endif -%}
- {% if mainClass -%}
- {% if library.excludes.consumer is defined %}
- implementation({{ classpath }}) {
- {% for exclude in library.excludes.consumer if exclude.classpath -%}
- {% set classpath = exclude.classpath|replace('"','') -%}
- {% set classpath_parts = split(classpath, ':') -%}
- exclude(group = "{{ classpath_parts[0] }}", module = "{{ classpath_parts[1] }}")
- {% endfor -%}
- }
- {% else -%}
- implementation({{ classpath }})
- {% endif -%}
- {% else -%}
- api({{ classpath }})
- {% endif -%}
- {% endfor -%}
- {% for extra_target in extra_targets -%}
- {% for library in extra_target.consumer -%}
- {% set classpath = library.classpath -%}
- {% if classpath|replace('"','') == classpath -%}
- {% set classpath = '"' + classpath + '"' -%}
- {% endif -%}
- testImplementation({{ classpath }})
- {% endfor -%}
- {% endfor -%}
- }
- {% if hasJunit5Test -%}
- tasks.named<Test>("test") {
- useJUnitPlatform()
- }
- {% endif -%}
- tasks.test {
- testLogging {
- showStandardStreams = true
- events("passed", "skipped", "failed")
- }
- }
- {% include "extra-tests.gradle.kts" ignore missing %}
- {% if publish -%}
- {% include 'publish.gradle.kts' -%}
- {% endif -%}
|