{%- if target.runs|length -%} {%- for run in target.runs %} val runJav{{ loop.index }} = task("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 -%}