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/plugins/nots.py | |
parent | 264b87d167603339a09fc58cd7ba5437e844542c (diff) | |
download | ydb-fc10bc7b48b6bb61048459a18c0341f0bb483add.tar.gz |
feat(nots/cli): build env support
15835b7dc46959ac79a57b0c0ec84f500dc839aa
Diffstat (limited to 'build/plugins/nots.py')
-rw-r--r-- | build/plugins/nots.py | 19 |
1 files changed, 19 insertions, 0 deletions
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 """ |