aboutsummaryrefslogtreecommitdiffstats
path: root/build/export_generators/gradle/build.gradle.kts.jinja
blob: 1106967749516207658976f8b26c8365297171be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
plugins {
{% if targets|selectattr("app_main_class") -%}
    `application`
{% else -%}
    `java-library`
{% endif -%}
{% if targets|selectattr('publish') -%}
    `maven-publish`
    `signing`
{% endif -%}
}

{% if targets|selectattr('publish') -%}
group = "{{ targets[0].publish_group }}"
version = project.properties["version"]

{% endif -%}
repositories {
    mavenCentral()
}

{% 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()
}

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 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 -%}
{%         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")
    }
}

{% include "extra-tests.gradle.kts" ignore missing %}
{% if targets|selectattr('publish') -%}
{% include 'publish.gradle.kts' -%}
{% endif -%}