Skip to content

Commit 56b1df6

Browse files
committed
Globs for resources, globs for sources only for single files
Globs for resources, globs for sources only for single files commit_hash:3049acdecaba2a41f045ffda4408e8604f930ceb
1 parent dac8b31 commit 56b1df6

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

build/export_generators/ide-gradle/source_sets.jinja

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1+
{%- macro IncludeGlobs(some_set, dir) -%}
2+
.include({%- for glob in some_set.globs -%}"{{ glob }}"{%- if not loop.last -%}, {%- endif -%}{%- endfor -%})
3+
{%- endmacro -%}
4+
15
{%- macro SomeSet(some_set, module, reldir = "") -%}
26
{%- set dir = some_set.dir -%}
37
{%- if (reldir != "") and (dir[0] != "/") -%}
48
{#- Relative path in tests #}
59
{%- set dir = reldir + dir -%}
6-
{%- endif -%}
7-
{%- if some_set.globs|join('')|replace('*', '') != some_set.globs|join('') %}
10+
{%- endif %}
811
{{ module }}.srcDir({{ PatchRoots(dir) }})
12+
{%- if module == 'resources' -%}
13+
{%- if not('**/*' in some_set.globs) -%}
14+
{{ IncludeGlobs(some_set, dir) }}
15+
{%- endif -%}
916
{%- else -%}
10-
{#- TODO Use single source file from each glob
11-
{%- for glob in some_set.globs %}
12-
{{ module }}.include({{ PatchRoots(dir, false, false, "/" + glob) }})
13-
{%- endfor -%}
14-
#}
15-
{{ module }}.srcDir({{ PatchRoots(dir) }})
17+
{%- if some_set.globs|join('')|replace('*', '') == some_set.globs|join('') -%}
18+
{#- Use single source file from each glob -#}
19+
{{ IncludeGlobs(some_set, dir) }}
20+
{%- endif -%}
1621
{%- endif -%}
1722
{%- endmacro -%}
1823

0 commit comments

Comments
 (0)