{%- if current_target.custom_runs|length -%} {%- for custom_run in current_target.custom_runs %} val {{ varprefix }}{{ custom_run['_object_index'] }} = task("{{ varprefix }}{{ custom_run['_object_index'] }}") { group = "build" description = "Code generation by run custom program" {#- Ignore default CWD to export_root -#} {%- if custom_run.cwd and custom_run.cwd != export_root %} workingDir = file({{ PatchRoots(custom_run.cwd) }}) {%- else %} workingDir = file("$buildDir") {%- endif %} commandLine("bash", "-c", listOf( {%- for arg in custom_run.command -%} {%- if custom_run.depends|select("eq", arg)|length %} {{ PatchRoots(arg, true) }} {%- elif custom_run.outputs|select("eq", arg)|length %} {%- if proto_template -%} {#- generated proto put to prepared proto dir #} {{ PatchGeneratedProto(arg) }} {%- else %} {{ PatchRoots(arg, false, true) }} {%- endif -%} {%- else %} {{ PatchRoots(arg) }} {%- endif -%} {%- if not loop.last %}, {% endif -%} {%- endfor %} ).joinToString(" ")) {%- if custom_run.depends|length -%} {%- for depend in custom_run.depends|unique %} inputs.files({{ PatchRoots(depend, true) }}) {% endfor -%} {%- endif -%} {%- if custom_run.outputs|length -%} {%- for out in custom_run.outputs|unique %} {%- if proto_template %} outputs.files({{ PatchGeneratedProto(out) }}) {%- else %} outputs.files({{ PatchRoots(out, false, true) }}) {%- endif -%} {%- endfor -%} {%- endif -%} {#- Не использованы атрибуты custom_run-env="list" #} } {%- endfor -%} {%- endif -%}