Skip to content

Commit dded852

Browse files
committed
Fix exporting run_antlr(4) to CMake
Fix exporting run_antlr(4) to CMake commit_hash:13fe87a90bc6cb50c8e9ecd46ee85d17655316f1
1 parent f62313c commit dded852

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

build/export_generators/cmake/generator.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ copy=["cmake/FindJNITarget.cmake"]
209209
add_values=[{attr="includes", values=["cmake/FindJNITarget.cmake"]}]
210210

211211
[[rules]]
212-
attrs=["target_commands-macro=run_antlr"]
212+
attrs=["custom_runs-command=run_antlr"]
213213
copy=["cmake/antlr.cmake"]
214214
add_values=[{attr="includes", values=["cmake/antlr.cmake"]}]
215215

216216
[[rules]]
217-
attrs=["target_commands-macro=run_antlr4"]
217+
attrs=["custom_runs-command=run_antlr4"]
218218
copy=["cmake/antlr4.cmake"]
219219
add_values=[{attr="includes", values=["cmake/antlr4.cmake"]}]
220220

build/export_generators/cmake/target_commands.jinja

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
{%- if current_target.custom_runs|length -%}
2222
{%- for custom_run in current_target.custom_runs %}
2323
{%- set first_arg = custom_run.command|first %}
24-
{%- set tail_args = custom_run.command|slice(1, custom_run.command|length - 1) %}
2524
{%- if (first_arg == "run_antlr") or (first_arg == "run_antlr4") %}
2625
{{ first_arg }}(
2726
{%- if custom_run.outputs|length %}
@@ -34,14 +33,16 @@
3433
WORKING_DIRECTORY
3534
{{ custom_run.cwd }}
3635
{%- endif -%}
37-
{%- if tail_args|length %}
38-
ANTLR_ARGS
39-
{%- for tail_arg in tail_args %}
40-
{{ tail_arg }}
36+
{%- if custom_run.command|length > 1 %}
37+
ANTLER_ARGS
38+
{%- for arg in custom_run.command -%}
39+
{%- if not loop.first %}
40+
{{ arg }}
41+
{%- endif -%}
4142
{%- endfor -%}
42-
{%- endif -%}
43+
{%- endif %}
4344
)
44-
{%- else %}
45+
{% else %}
4546
add_custom_command(
4647
{%- if custom_run.outputs|length %}
4748
OUTPUT

build/ymake.core.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4568,10 +4568,10 @@ macro RUN_PYTHON3(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], O
45684568
}
45694569

45704570
# tag:java-specific
4571-
macro _RUN_ANTLR_BASE(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", JAR[], SEM="run_java", SEM_ARGS_PREFIX="", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", Args...) {
4571+
macro _RUN_ANTLR_BASE(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", JAR[], SEM="run_java", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", Args...) {
45724572
PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
45734573
.CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input;pre=build/scripts/:HIDE_OUTPUT.py} $JDK_RESOURCE/bin/java $JAR $Args ${hide;tool:TOOL} ${hide;input:IN} ${hide;context=TEXT;input:IN_NOPARSE} ${hide;output_include:OUTPUT_INCLUDES} $INDUCED_DEPS ${hide;output:OUT} ${hide;noauto;output:OUT_NOAUTO} ${stdout;output:STDOUT} ${stdout;noauto;output:STDOUT_NOAUTO} ${hide;kv:"p JV"} ${hide;kv:"pc light-blue"} ${hide;kv:"show_out"}
4574-
.SEM=custom_runs-ITEM && custom_runs-depends ${input:IN} && custom_runs-command $SEM $Args && custom_runs-outputs ${output:OUT} ${noauto;output:OUT_NOAUTO} ${pre=&& custom_runs-cwd :CWD}
4574+
.SEM=custom_runs-ITEM && custom_runs-depends ${input:IN} && custom_runs-command $SEM && custom_runs-command $Args && custom_runs-outputs ${output:OUT} ${noauto;output:OUT_NOAUTO} ${pre=&& custom_runs-cwd :CWD}
45754575
}
45764576

45774577
### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
@@ -4930,14 +4930,14 @@ macro ASM_PREINCLUDE(PREINCLUDES...) {
49304930
###
49314931
### Macro to invoke ANTLR3 generator (general case)
49324932
macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
4933-
_RUN_ANTLR_BASE($Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD} JAR -jar ${input:"contrib/java/antlr/antlr3/antlr.jar"} SEM run_antlr SEM_ARGS_PREFIX ANTLER_ARGS)
4933+
_RUN_ANTLR_BASE($Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD} JAR -jar ${input:"contrib/java/antlr/antlr3/antlr.jar"} SEM run_antlr)
49344934
}
49354935

49364936
### @usage: RUN_ANTLR4(Args...)
49374937
###
49384938
### Macro to invoke ANTLR4 generator (general case)
49394939
macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
4940-
_RUN_ANTLR_BASE($Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD} JAR -jar ${input:"contrib/java/antlr/antlr4/antlr.jar"} SEM run_antlr4 SEM_ARGS_PREFIX ANTLER_ARGS)
4940+
_RUN_ANTLR_BASE($Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD} JAR -jar ${input:"contrib/java/antlr/antlr4/antlr.jar"} SEM run_antlr4)
49414941
}
49424942

49434943
_ANTLR4_LISTENER_GRAMMAR=-listener

0 commit comments

Comments
 (0)