diff options
author | zaverden <zaverden@yandex-team.com> | 2024-06-13 13:19:39 +0300 |
---|---|---|
committer | zaverden <zaverden@yandex-team.com> | 2024-06-13 13:35:14 +0300 |
commit | fc10bc7b48b6bb61048459a18c0341f0bb483add (patch) | |
tree | 2bcdf2c3ff221bf1f961123d1576212da0300dd4 /build | |
parent | 264b87d167603339a09fc58cd7ba5437e844542c (diff) | |
download | ydb-fc10bc7b48b6bb61048459a18c0341f0bb483add.tar.gz |
feat(nots/cli): build env support
15835b7dc46959ac79a57b0c0ec84f500dc839aa
Diffstat (limited to 'build')
-rw-r--r-- | build/conf/ts/ts.conf | 7 | ||||
-rw-r--r-- | build/plugins/nots.py | 19 |
2 files changed, 25 insertions, 1 deletions
diff --git a/build/conf/ts/ts.conf b/build/conf/ts/ts.conf index 513d8b100d..78221c6de3 100644 --- a/build/conf/ts/ts.conf +++ b/build/conf/ts/ts.conf @@ -34,11 +34,14 @@ NOTS_TOOL_BASE_ARGS=\ --verbose $TS_LOG \ $_YATOOL_PREBUILDER_ARG +NOTS_TOOL_BUILD_ENV= + # Arguments for builders' commands, passed after the command NOTS_TOOL_COMMON_BUILDER_ARGS=\ --output-file ${output:TS_OUTPUT_FILE} ${output;hide:TS_OUTPUT_FILE_UUID} \ --tsconfigs $TS_CONFIG_PATH \ - --vcs-info "${VCS_INFO_FILE}" + --vcs-info "${VCS_INFO_FILE}" \ + $NOTS_TOOL_BUILD_ENV ERM_PACKAGES_PATH=devtools/frontend_build_platform/erm/erm-packages.json @@ -109,6 +112,8 @@ macro _TS_CONFIG_EPILOGUE() { _GLOB(TS_GLOB_FILES $TS_GLOB_INCLUDE EXCLUDE $TS_GLOB_EXCLUDE) _GLOB(_TS_LINT_SRCS_VALUE **/*.(ts|tsx|js|jsx) EXCLUDE $TS_EXCLUDE_DIR_GLOB $TS_COMMON_OUTDIR_GLOB $TS_GLOB_EXCLUDE_ADDITIONAL) + + _SETUP_BUILD_ENV() } # Used as inputs in TS_COMPILE through `$_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES)` diff --git a/build/plugins/nots.py b/build/plugins/nots.py index 0d233ff835..5140eebb86 100644 --- a/build/plugins/nots.py +++ b/build/plugins/nots.py @@ -255,6 +255,25 @@ def on_ts_configure(unit): _setup_tsc_typecheck(unit, tsconfig_paths) +@_with_report_configure_error +def on_setup_build_env(unit): # type: (Unit) -> None + build_env_var = unit.get("TS_BUILD_ENV") # type: str + if not build_env_var: + return + + options = [] + for name in build_env_var.split(","): + options.append("--env") + value = unit.get(f"TS_ENV_{name}") + if value is None: + logger.warn(f"Env var '{name}' is provided in a list, but var value is not provided") + continue + double_quote_escaped_value = value.replace('"', '\\"') + options.append(f'"{name}={double_quote_escaped_value}"') + + unit.set(["NOTS_TOOL_BUILD_ENV", " ".join(options)]) + + def __set_append(unit, var_name, value): # type: (Unit, str, str|list[str]|tuple[str]) -> None """ |