aboutsummaryrefslogtreecommitdiffstats
path: root/build/export_generators/ide-gradle/run_java_program.jinja
blob: f28ef430cc68f00d4dea3dcadb9d7bdbc4e2d25f (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
{%- if target.runs|length -%}
{%-     for run in target.runs %}

val runJav{{ loop.index }} = task<JavaExec>("runJavaProgram{{ loop.index }}") {
    group = "build"
    description = "Code generation by run java program"
{%-        set classpaths = run.classpath|reject('eq', '@.cplst') -%}
{%-        if classpaths|length -%}
{%             for classpath in classpaths -%}
{%-                set rel_file_classpath = classpath|replace('@', '')|replace(export_root, '')|replace(arcadia_root, '') %}

    val classpaths = "$project_root/" + File("$project_root{{ rel_file_classpath }}").readText().trim().replace(":", ":$project_root/")
    classpath = files(classpaths.split(":"))
{%-            endfor -%}
{%-        endif %}

    mainClass.set("{{ run.args[0] }}")
{%-        if run.args|length > 1 %}

    args = listOf(
{%-            for arg in run.args -%}
{%-                if not loop.first %}
        "{{ arg }}",
{%-                endif -%}
{%-            endfor %}
    )
{%         endif -%}

{%-        if run.in_dir -%}
{%-            for in_dir in run.in_dir %}
    inputs.files(fileTree("{{ in_dir }}"))
{%             endfor -%}
{%-        endif -%}

{%-        if run.in -%}
{%-            for in_file in run.in %}
    inputs.files("{{ in_file }}")
{%             endfor -%}
{%-        endif -%}

{%-        if run.out_dir|length -%}
{%-            for out_dir in run.out_dir|unique %}
    outputs.dir("{{ out_dir }}")
{%-            endfor -%}
{%-        endif -%}
{#-
    Не использованы аттрибуты
    run-out="list"
    run-cwd="str"
    run-in_dirs_inputs="list"
    run-in_noparse="list"
    run-tool="list"
#}
}

tasks.getByName("sourcesJar").dependsOn(runJav{{ loop.index }})

tasks.compileJava.configure {
    dependsOn(runJav{{ loop.index }})
}
{%-        if with_kotlin %}

tasks.compileKotlin.configure {
    dependsOn(runJav{{ loop.index }})
}
{%-        endif %}
{%     endfor -%}
{% endif -%}