aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordimdim11 <dimdim11@yandex-team.com>2025-02-07 21:02:37 +0300
committerdimdim11 <dimdim11@yandex-team.com>2025-02-07 21:29:47 +0300
commitcf8f9833929b938f683b622c78d004913425ebb9 (patch)
treeef0f081895a1274031a2bea70d7de2d45e609724
parente03b1a04aa003f6a276de71e07538899a57ab07c (diff)
downloadydb-cf8f9833929b938f683b622c78d004913425ebb9.tar.gz
Refactor add_custom_command semantics
Refactor add_custom_command semantics commit_hash:73a5ba36c91c0fc40b58b3ef770545e7cf651e07
-rw-r--r--build/conf/opensource_export.conf2
-rw-r--r--build/ymake.core.conf72
2 files changed, 27 insertions, 47 deletions
diff --git a/build/conf/opensource_export.conf b/build/conf/opensource_export.conf
index cfc449906d..cf48e5ea65 100644
--- a/build/conf/opensource_export.conf
+++ b/build/conf/opensource_export.conf
@@ -1,4 +1,4 @@
-when ($OPENSOURCE_PROJECT) {
+when ($OPENSOURCE_PROJECT != "") {
select ($OPENSOURCE_PROJECT) {
"catboost" ? {
OPENSOURCE_REPLACE_OPENSSL="1.1.1t"
diff --git a/build/ymake.core.conf b/build/ymake.core.conf
index dccb35fe3d..b66dae5507 100644
--- a/build/ymake.core.conf
+++ b/build/ymake.core.conf
@@ -4377,15 +4377,13 @@ macro SYMLINK(From, To) {
# tag:internal
### @usage: _SEM_TARGET_SOURCES_FOR_HEADERS(Args...) # internal
### Generate prefix if Args is not empty
-when ($EXPORT_CMAKE) {
+_SEM_TARGET_SOURCES_FOR_HEADERS_PRE=
+when ($EXPORT_CMAKE == "yes") {
_SEM_TARGET_SOURCES_FOR_HEADERS_PRE=&& target_options-privates-ITEM && target_options-privates-option target_sources && target_options-privates-args
}
-elsewhen ($EXPORT_GRADLE) {
+elsewhen ($EXPORT_GRADLE == "yes") {
_SEM_TARGET_SOURCES_FOR_HEADERS_PRE=&& custom_runs-outputs
}
-otherwise {
- _SEM_TARGET_SOURCES_FOR_HEADERS_PRE=
-}
macro _SEM_TARGET_SOURCES_FOR_HEADERS_IMPL(Args...) {
.SEM=${pre=$_SEM_TARGET_SOURCES_FOR_HEADERS_PRE :Args}
}
@@ -4396,15 +4394,13 @@ macro _SEM_TARGET_SOURCES_FOR_HEADERS(Args...) {
# tag:internal
### @usage: _SEM_SET_ENV_FOR_CUSTOM_COMMAND(Args...) # internal
### Generate prefix before $Args if Args is not empty
-when ($EXPORT_CMAKE) {
+_SEM_SET_ENV_FOR_CUSTOM_COMMAND_PRE=
+when ($EXPORT_CMAKE == "yes") {
_SEM_SET_ENV_FOR_CUSTOM_COMMAND_PRE=${CMAKE_COMMAND} -E env
}
-elsewhen ($EXPORT_GRADLE) {
+elsewhen ($EXPORT_GRADLE == "yes") {
_SEM_SET_ENV_FOR_CUSTOM_COMMAND_PRE=&& custom_runs-env
}
-otherwise {
- _SEM_SET_ENV_FOR_CUSTOM_COMMAND_PRE=
-}
macro _SEM_SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
.SEM=${pre=$_SEM_SET_ENV_FOR_CUSTOM_COMMAND_PRE :Args}
}
@@ -4412,15 +4408,13 @@ macro _SEM_SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
# tag:internal
### @usage: _SEM_SET_CWD(Args...) # internal
### Generate prefix before $Args if Args is not empty
-when ($EXPORT_CMAKE) {
+_SEM_SET_CWD_SEM=
+when ($EXPORT_CMAKE == "yes") {
_SEM_SET_CWD_PRE=WORKING_DIRECTORY
}
-elsewhen ($EXPORT_GRADLE) {
+elsewhen ($EXPORT_GRADLE == "yes") {
_SEM_SET_CWD_PRE=&& custom_runs-cwd
}
-otherwise {
- _SEM_SET_CWD_SEM=
-}
macro _SEM_SET_CWD(Args...) {
.SEM=${pre=$_SEM_SET_CWD_PRE :Args}
}
@@ -4553,7 +4547,8 @@ macro DECLARE_IN_DIRS(var_prefix, PATTERN, SRCDIR="", RECURSIVE?"**/":"", EXCLUD
### 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).
-when ($EXPORT_CMAKE) {
+_RUN_PROGRAM_SEM=
+when ($EXPORT_CMAKE == "yes") {
_RUN_PROGRAM_SEM=target_commands-ITEM \
&& target_commands-macro add_custom_command \
&& target_commands-args \
@@ -4564,7 +4559,7 @@ when ($EXPORT_CMAKE) {
COMMAND ${tool:Tool} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} \
$_SEM_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
}
-elsewhen ($EXPORT_GRADLE) {
+elsewhen ($EXPORT_GRADLE == "yes") {
_RUN_PROGRAM_SEM=custom_runs-ITEM \
&& custom_runs-depends ${input:IN} ${context=TEXT;input:IN_NOPARSE} ${tool:Tool} ${tool:TOOL} \
$_SEM_SET_ENV_FOR_CUSTOM_COMMAND($ENV) \
@@ -4573,9 +4568,6 @@ elsewhen ($EXPORT_GRADLE) {
$_SEM_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO) \
$_SEM_SET_CWD($CWD)
}
-otherwise {
- _RUN_PROGRAM_SEM=
-}
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 ${hide;input:IN} ${hide;context=TEXT;input:IN_NOPARSE} ${hide;input:IN_DEPS} ${hide;output_include:OUTPUT_INCLUDES} $INDUCED_DEPS ${hide;tool:TOOL} ${hide;output:OUT} ${hide;noauto;output:OUT_NOAUTO} ${stdout;output:STDOUT} ${stdout;noauto;output:STDOUT_NOAUTO} ${hide;kv:"p PR"} ${hide;kv:"pc yellow"} ${hide;kv:"show_out"}
.SEM=${hide;tool:Tool} ${hide;tool:TOOL} $_RUN_PROGRAM_SEM
@@ -4627,7 +4619,8 @@ macro RUN_LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_N
###
### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
-when ($EXPORT_CMAKE) {
+_RUN_PYTHON3_SEM=
+when ($EXPORT_CMAKE == "yes") {
_RUN_PYTHON3_SEM=packages-ITEM \
&& packages-name Python3 \
&& mpackages-ITEM \
@@ -4642,7 +4635,7 @@ when ($EXPORT_CMAKE) {
COMMAND Python3::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} \
$_SEM_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
}
-elsewhen ($EXPORT_GRADLE) {
+elsewhen ($EXPORT_GRADLE == "yes") {
_RUN_PYTHON3_SEM=custom_runs-ITEM \
&& custom_runs-depends ${input:IN} ${context=TEXT;input:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} \
$_SEM_SET_ENV_FOR_CUSTOM_COMMAND($ENV) \
@@ -4651,16 +4644,14 @@ elsewhen ($EXPORT_GRADLE) {
$_SEM_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO) \
$_SEM_SET_CWD($CWD)
}
-otherwise {
- _RUN_PYTHON3_SEM=
-}
macro RUN_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 ${hide;input:IN} ${hide;context=TEXT;input:IN_NOPARSE} ${hide;output_include:OUTPUT_INCLUDES} $INDUCED_DEPS ${hide;tool:TOOL} ${hide;output:OUT} ${hide;noauto;output:OUT_NOAUTO} ${stdout;output:STDOUT} ${stdout;noauto;output:STDOUT_NOAUTO} ${hide;kv:"p PY"} ${hide;kv:"pc yellow"} ${hide;kv:"show_out"}
.SEM=$_RUN_PYTHON3_SEM
}
# tag:java-specific
-when ($EXPORT_CMAKE) {
+_RUN_ANTLR_BASE_SEM=
+when ($EXPORT_CMAKE == "yes") {
_RUN_ANTLR_BASE_SEM=target_commands-ITEM \
&& target_commands-macro $SEM \
&& target_commands-args \
@@ -4669,16 +4660,13 @@ when ($EXPORT_CMAKE) {
$_SEM_SET_CWD($CWD) \
$SEM_ARGS_PREFIX $Args
}
-elsewhen ($EXPORT_GRADLE) {
+elsewhen ($EXPORT_GRADLE == "yes") {
_RUN_ANTLR_BASE_SEM=custom_runs-ITEM \
&& custom_runs-depends ${input:IN} \
&& custom_runs-command $SEM $Args \
&& custom_runs-outputs ${output:OUT} ${noauto;output:OUT_NOAUTO} \
$_SEM_SET_CWD($CWD)
}
-otherwise {
- _RUN_ANTLR_BASE_SEM=
-}
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...) {
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 $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"}
@@ -4845,7 +4833,8 @@ macro BPF_STATIC(Input, Output, Opts...) {
###
### Compile LLVM bytecode to object representation.
### Note: Output name is used as is, no extension added.
-when ($EXPORT_CMAKE) {
+_LLVM_COMPILE_LL_SEM=
+when ($EXPORT_CMAKE == "yes") {
_LLVM_COMPILE_LL_SEM=target_commands-ITEM \
&& target_commands-macro add_custom_command \
&& target_commands-args \
@@ -4853,9 +4842,6 @@ when ($EXPORT_CMAKE) {
DEPENDS ${input:Input} \
COMMAND ${LLVMAS} ${input:Input} -o ${noauto;output:Output}
}
-otherwise {
- _LLVM_COMPILE_LL_SEM=
-}
macro LLVM_COMPILE_LL(Input, Output, Opts...) {
.CMD=${CLANG_BC_ROOT}/bin/llvm-as ${input:Input} -o ${noauto;output:Output} ${hide;kv:"p BC"} ${hide;kv:"pc light-green"}
.SEM=$_LLVM_COMPILE_LL_SEM
@@ -4866,7 +4852,8 @@ macro LLVM_COMPILE_LL(Input, Output, Opts...) {
###
### Call llvm-link on set of Inputs to produce Output.
### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
-when ($EXPORT_CMAKE) {
+_LLVM_LINK_SEM=
+when ($EXPORT_CMAKE == "yes") {
_LLVM_LINK_SEM=target_commands-ITEM \
&& target_commands-macro add_custom_command \
&& target_commands-args \
@@ -4874,9 +4861,6 @@ when ($EXPORT_CMAKE) {
DEPENDS ${input:Inputs} \
COMMAND ${LLVMLINK} ${input:Inputs} -o ${noauto;output:Output}
}
-otherwise {
- _LLVM_LINK_SEM=
-}
macro LLVM_LINK(Output, Inputs...) {
.CMD=${CLANG_BC_ROOT}/bin/llvm-link ${input:Inputs} -o ${noauto;output:Output} ${hide;kv:"p LD"} ${hide;kv:"pc light-red"}
.SEM=$_LLVM_LINK_SEM
@@ -4887,7 +4871,8 @@ macro LLVM_LINK(Output, Inputs...) {
###
### Call llvm-opt with set of Opts on Input to produce Output.
### Note: Output name is used as is, no extension added.
-when ($EXPORT_CMAKE) {
+_LLVM_OPT_SEM=
+when ($EXPORT_CMAKE == "yes") {
_LLVM_OPT_SEM=target_commands-ITEM \
&& target_commands-macro add_custom_command \
&& target_commands-args \
@@ -4895,9 +4880,6 @@ when ($EXPORT_CMAKE) {
DEPENDS ${input:Input} \
COMMAND ${LLVMOPT} ${input:Input} -o ${noauto;output:Output} $Opts
}
-otherwise {
- _LLVM_OPT_SEM=
-}
macro LLVM_OPT(Input, Output, Opts...) {
.CMD=$YMAKE_PYTHON ${input:"build/scripts/llvm_opt_wrapper.py"} ${CLANG_BC_ROOT}/bin/opt ${input:Input} -o ${noauto;output:Output} $Opts ${hide;kv:"p OP"} ${hide;kv:"pc yellow"}
.SEM=$_LLVM_OPT_SEM
@@ -4909,7 +4891,8 @@ macro LLVM_OPT(Input, Output, Opts...) {
### Call llvm-llc with set of Opts on Src to produce object file.
###
### Note: Output name is calculated as concatenation of Src name and platform specific object file extension.
-when ($EXPORT_CMAKE) {
+_LLVM_LLC_SEM=
+when ($EXPORT_CMAKE == "yes") {
_LLVM_LLC_SEM=target_commands-ITEM \
&& target_commands-macro add_custom_command \
&& target_commands-args \
@@ -4917,9 +4900,6 @@ when ($EXPORT_CMAKE) {
DEPENDS ${input:Src} \
COMMAND ${LLVMLLC} --filetype obj ${input:Src} -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts
}
-otherwise {
- _LLVM_LLC_SEM=
-}
macro LLVM_LLC(Src, Opts...) {
.CMD=${tool:LLVM_LLC_TOOL} ${input:Src} --filetype obj -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts ${hide;kv:"p LC"} ${hide;kv:"pc yellow"}
.SEM=$_LLVM_LLC_SEM