aboutsummaryrefslogtreecommitdiffstats
path: root/build/export_generators/ide-gradle/run_java_program.jinja
blob: 6f0597a86afbeb8906b4de7fc7f9d66e896d1b56 (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
{%- 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 -%}

{{         OutDirs(run, '    outputs.dir("', '")') }}
{#
    Не использованы аттрибуты
    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 }})
}
{%     endfor -%}
{% endif -%}