summaryrefslogtreecommitdiffstats
path: root/build/export_generators/ide-gradle/tasks.jinja
blob: 2beeb11219f5767c80a0d0fbc2e8a1390c9ff3d5 (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
84
85
86
87
88
89
90
{#- empty line #}
tasks.withType<Jar>() {
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

tasks.withType<Copy>() {
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

tasks.withType<Sync>() {
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

{%- if hasResources %}

tasks.processResources.configure {
    dependsOn(tasks.compileJava)
}

{%-     if named_tests -%}
{%-         for extra_target in ordered_extra_targets -%}
{%-             set testname = SourceSetName(extra_target) %}

tasks.named("process{{ testname|title }}Resources").configure {
    dependsOn(tasks.named<JavaCompile>("compile{{ testname|title }}Java"))
}
{%-         endfor -%}
{%-     else -%}
{%-         if extra_targets|length %}

tasks.named("processTestResources").configure {
    dependsOn(tasks.named<JavaCompile>("compileTestJava"))
}
{%-         endif -%}
{%-     endif -%}
{%- endif -%}

{%- macro DependsCompiles(dependMode) -%}
    {{ dependMode }}(
        tasks.compileJava,
{%-     if with_kotlin %}
        tasks.compileKotlin,
{%-     endif %}
{%-     if named_tests %}
{%-         for extra_target in ordered_extra_targets -%}
{%-             set testname = SourceSetName(extra_target) %}
        tasks.named("compile{{ testname|title }}Java"),
{%-             if with_kotlin %}
        tasks.named("compile{{ testname|title }}Kotlin"),
{%-             endif -%}
{%-         endfor %}
{%-     else %}
{%-         if extra_targets|length %}
        tasks.named("compileTestJava"),
{%-             if with_kotlin %}
        tasks.named("compileTestKotlin"),
{%-             endif -%}
{%-         endif %}
{%-     endif %}
    )
{%- endmacro %}

tasks.named("sourcesJar").configure {
{{ DependsCompiles("mustRunAfter") }}
    mustRunAfter(tasks.named<Jar>("jar"))
    mustRunAfter(tasks.named("javadocJar"))
{%- if with_lombok_plugin %}
    mustRunAfter(tasks.named("delombok"))
{%- endif %}
}

{%- if with_lombok_plugin %}

tasks.named("delombok").configure {
{{ DependsCompiles("mustRunAfter") }}
    mustRunAfter(tasks.named<Jar>("jar"))
}
{%- endif -%}

{#- To disable redundant javadoc (it may fail the build) #}

tasks.withType<Javadoc>().configureEach {
    isEnabled = false
}

tasks.register("compileAll") {
    group = "build"
    description = "Compiles all source sets without running tests"
{{ DependsCompiles("dependsOn") }}
}