diff options
author | spreis <spreis@yandex-team.ru> | 2022-04-20 07:09:14 +0300 |
---|---|---|
committer | spreis <spreis@yandex-team.ru> | 2022-04-20 07:09:14 +0300 |
commit | e09c6a375729d7f0306a4a1afc7f11c8a9ff0d11 (patch) | |
tree | 381c3b5d6457fa87bc87e8cd8208ced9186a046e | |
parent | a691b4ea21364a747960777af992ce6c28ee25e6 (diff) | |
download | ydb-e09c6a375729d7f0306a4a1afc7f11c8a9ff0d11.tar.gz |
[YMAKE-118] Add INDUCED_DEPS parameter to some macros
ref:3665ff50f42f0680ba730beab24f44f76b097bbe
-rw-r--r-- | build/ymake.core.conf | 119 |
1 files changed, 82 insertions, 37 deletions
diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 6499c743f0..19ac6c4802 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -5338,8 +5338,8 @@ macro _GENERATE_PY_EVS_INTERNAL(FILES...) { } } -macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[]) { - .CMD=$COPY_CMD ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} ${output_include;hide:OUTPUT_INCLUDES} ${kv;hide:"p CP"} ${kv;hide:"pc light-cyan"} +macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], INDUCED_DEPS[]) { + .CMD=$COPY_CMD ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${kv;hide:"p CP"} ${kv;hide:"pc light-cyan"} .SEM=copy_file ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} } @@ -5352,20 +5352,23 @@ macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[]) { ### - Destination - Output file name. ### - AUTO - Consider copied file for further processing automatically. ### - OUTPUT_INCLUDES output_includes... - Output file dependencies. +### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain. +### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) +### and set of dependencies ### ### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly ### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing. -macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[]) { - .CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES) - .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES) +macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) { + .CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS) + .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination) } ### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...]) ### ### Copy file to build root the same way as it is done for COPY_FILE, but also ### propagates the context of the source file. -macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO":"", OUTPUT_INCLUDES[]) { - .CMD=$COPY_FILE($FILE $DEST $AUTO OUTPUT_INCLUDES $FILE $OUTPUT_INCLUDES) +macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO":"", OUTPUT_INCLUDES[], INDUCED_DEPS[]) { + .CMD=$COPY_FILE($FILE $DEST $AUTO OUTPUT_INCLUDES $FILE $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS) } ### This is to join $ALL_RES_ and $EXT @@ -7006,7 +7009,37 @@ macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) { .SEM=$_SET_ENV_FOR_CUSTOM_COMMAND_IMPL(${pre=GENERATE :Args}) } -### @usage: RUN_PROGRAM(tool_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...]) + +macro _FMT_INDUCED_DEPS(For, Deps...) { + .CMD=${induced_deps=$For:Deps} +} + + +### @usage: PREPARE_INDUCED_DEPS(VAR Type Files...) +### +### Format value for `INDUCED_DEPS` param in certain macros and assign to `VAR` +### This tells that files of Type resulted from code generation macros (not neccessarily directly, +### but in processing chain of generated files) should have extra dependencies from list of Files... +### +### Prominent example here is Cython: one can generate .pyx file that may depend on .pxd and have cimpot from +### certain .h. The former is dependency for .pyx itself, while the latter is dependency for .pyx.cpp +### resulted from Cython-processing of generated pyx. The code ganeration will look like: +### ``` +### PREPARE_INDUCED_DEPS(PYX_DEPS pyx imported.pxd) +### PREPARE_INDUCED_DEPS(CPP_DEPS cpp cdefed.h) +### PYTHON3(generate_pyx.py genereted.pyx OUT generated.pyx INDUCED_DEPS $PYX_DEPS $CPP_DEPS) +### ``` +### +### The VAR will basically contain pair of `Type:[Files...]` in a form suitable for passing +### as an element of array parameter. This is needed because language of ya.make doesn't support +### Dict params right now and so it is impossible to directly pass something +### like `{Type1:[Files2...], Type2:[Files2...]}` +### +macro PREPARE_INDUCED_DEPS(VAR, For, Deps...) { + SET($VAR \$_FMT_INDUCED_DEPS($For $Deps)) +} + +### @usage: RUN_PROGRAM(tool_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...]) ### ### Run a program from arcadia. ### These macros are similar: RUN_PROGRAM, LUA, PYTHON. @@ -7021,17 +7054,19 @@ macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) { ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them. +### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain. +### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies ### ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used. ### Note that Tool is always built for the host platform, so be careful to provide that tool can be built for all Arcadia major host platforms (Linux, MacOS and Windows). -macro RUN_PROGRAM(Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) { - .CMD=${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} +macro RUN_PROGRAM(Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) { + .CMD=${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} .SEM=add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${tool:Tool} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND ${tool:Tool} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO) } # tag:lua-specific -### @usage: LUA(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...]) +### @usage: LUA(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...]) ### ### Run a lua script. ### These macros are similar: RUN_PROGRAM, LUA, PYTHON. @@ -7046,15 +7081,17 @@ macro RUN_PROGRAM(Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOA ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them. +### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain. +### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies ### ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used. -macro LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) { - .CMD=${cwd:CWD} ${env:ENV} $LUA_TOOL ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p LU"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} +macro LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) { + .CMD=${cwd:CWD} ${env:ENV} $LUA_TOOL ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p LU"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} } # tag:python-specific -### @usage: PYTHON(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...]) +### @usage: PYTHON(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...]) ### ### Run a python script with $(PYTHON)/python built from devtools/huge_python. ### These macros are similar: RUN_PROGRAM, LUA, PYTHON. @@ -7069,16 +7106,18 @@ macro LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUT ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them. +### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain. +### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies ### ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used. -macro PYTHON(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) { - .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} +macro PYTHON(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) { + .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} .SEM=find_package Python2 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python2::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO) } # tag:python-specific -### @usage: PYTHON3(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...]) +### @usage: PYTHON3(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...]) ### ### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3. ### These macros are similar: RUN_PROGRAM, LUA, PYTHON. @@ -7093,25 +7132,27 @@ macro PYTHON(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NO ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them. +### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain. +### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies ### ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used. -macro PYTHON3(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) { - .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON3 ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} +macro PYTHON3(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) { + .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON3 ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} .PEERDIR=$YMAKE_PYTHON3_PEER .SEM=find_package Python3 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python3::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO) } # tag:java-specific -macro _RUN_JAVA(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", Args...) { +macro _RUN_JAVA(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", Args...) { PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR) - .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input;pre=build/scripts/:HIDE_OUTPUT.py} $JDK_RESOURCE/bin/java $Args ${tool;hide:TOOL} ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} + .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input;pre=build/scripts/:HIDE_OUTPUT.py} $JDK_RESOURCE/bin/java $Args ${tool;hide:TOOL} ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} } -### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>]) +### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...]) ### ### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable. -### You may specify extra dependencies that output files bring using OUTPUT_INCLUDES. The change of these may e.g. lead to recompilation of .cpp files extracted from resource. +### You may specify extra dependencies that output files bring using OUTPUT_INCLUDES or INDUCED_DEPS. The change of these may e.g. lead to recompilation of .cpp files extracted from resource. ### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT. ### ### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system. @@ -7123,19 +7164,23 @@ macro _RUN_JAVA(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{outp ### ### RENAME RESOURCE allows to rename the resource without specifying its file name. ### +### OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them. +### INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain. +### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies +### ### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and ### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position, ### so you shall place it immediately after resource_id. -macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], FILE?"--copy-to-dir":"--untar-to", AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", SBR="sbr:") { - .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} +macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", SBR="sbr:") { + .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} ADD_CHECK(check.resource $Id) } -### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) +### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...]) ### ### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX). -macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") { - .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_mds.py"} --key $Key $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p MD"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} +macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") { + .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_mds.py"} --key $Key $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p MD"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} ADD_CHECK(check.mds $Key) } @@ -7143,8 +7188,8 @@ macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], FILE ### @usage: _FROM_EXTERNAL(ExtFile [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) #internal ### ### Use resource described as .external file as [FROM_SANDBOX()](#macro_FROM_SANDBOX)/[FROM_MDS()](#macro_FROM_MDS). -macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") { - .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$EXT;suf=.external:OutFile} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_external.py"} --external-file ${input:File} --resource-file $(RESOURCE_ROOT)/ext/$OutFile --copy-to-dir $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/fetch_from_sandbox.py"} ${input;hide:"build/scripts/fetch_from_mds.py"} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p XT"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} +macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") { + .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$EXT;suf=.external:OutFile} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_external.py"} --external-file ${input:File} --resource-file $(RESOURCE_ROOT)/ext/$OutFile --copy-to-dir $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/fetch_from_sandbox.py"} ${input;hide:"build/scripts/fetch_from_mds.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p XT"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} #FIXME: add '${resource;pre=$EXT:OutFile}' when support of the scheme is added to executors #FIXME: add 'ADD_CHECK(check.external $File)' when proper testing is implemented @@ -7161,11 +7206,11 @@ macro LARGE_FILES(AUTOUPDATED?, Files...) { } -### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) +### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...]) ### ### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX). -macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") { - .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_archive.py"} "--archive" ${input:Src} "--file-name" ${suf=-:Src} "--untar-to" $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${kv;hide:"p FA"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} +macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") { + .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_archive.py"} "--archive" ${input:Src} "--file-name" ${suf=-:Src} "--untar-to" $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${kv;hide:"p FA"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"} } when ($MSVC == "yes") { @@ -7413,18 +7458,18 @@ macro RUN_PYTHON(Args...) { ### @usage: RUN_ANTLR(Args...) ### ### Macro to invoke ANTLR3 generator (general case) -macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], CWD="", Args...) { +macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) { PEERDIR(build/external_resources/antlr3 build/platform/java/jdk $JDK_RESOURCE_PEERDIR) - .CMD=$_RUN_JAVA(-jar $ANTLR3_RESOURCE_GLOBAL/antlr-3.5.2-complete-no-st3.jar $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES ${pre=CWD :CWD}) + .CMD=$_RUN_JAVA(-jar $ANTLR3_RESOURCE_GLOBAL/antlr-3.5.2-complete-no-st3.jar $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD}) .SEM=run_antlr OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} DEPENDS ${input:IN} ${pre=WORKING_DIRECTORY :CWD} ANTLER_ARGS $Args } ### @usage: RUN_ANTLR4(Args...) ### ### Macro to invoke ANTLR4 generator (general case) -macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], CWD="", Args...) { +macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) { PEERDIR(build/external_resources/antlr4) - _RUN_JAVA(-jar $ANTLR4_RESOURCE_GLOBAL/antlr-4.9-complete.jar $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES ${pre=CWD :CWD}) + _RUN_JAVA(-jar $ANTLR4_RESOURCE_GLOBAL/antlr-4.9-complete.jar $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD}) } _ANTLR4_LISTENER_GRAMMAR=-listener |