aboutsummaryrefslogtreecommitdiffstats
path: root/build/plugins/nots.py
diff options
context:
space:
mode:
authorzaverden <zaverden@yandex-team.com>2024-04-22 08:48:33 +0300
committerzaverden <zaverden@yandex-team.com>2024-04-22 08:58:08 +0300
commit1d77668624e2483b5664ae4999537d7086be576b (patch)
treec49b3ba06de3f542cd62a7eb4b0a19eb8ba578ac /build/plugins/nots.py
parent55f0e9fe0e7fe7ccba9365d822352dec9cf5332c (diff)
downloadydb-1d77668624e2483b5664ae4999537d7086be576b.tar.gz
feat(conf): support prebuilder v1 in conf validation (with fallback to v0 logic)
Integration is added in backward-compatible manner with `v0.x.x` 1f45f7b3235314fb1ee8d2051ff6d592c95813f0
Diffstat (limited to 'build/plugins/nots.py')
-rw-r--r--build/plugins/nots.py49
1 files changed, 34 insertions, 15 deletions
diff --git a/build/plugins/nots.py b/build/plugins/nots.py
index 9b0f854e17..49f003ace9 100644
--- a/build/plugins/nots.py
+++ b/build/plugins/nots.py
@@ -204,7 +204,7 @@ def on_peerdir_ts_resource(unit, *resources):
@_with_report_configure_error
def on_ts_configure(unit):
- # type: (Unit, *str) -> None
+ # type: (Unit) -> None
from lib.nots.package_manager.base import PackageJson
from lib.nots.package_manager.base.utils import build_pj_path
from lib.nots.typescript import TsConfig
@@ -575,20 +575,6 @@ def on_node_modules_configure(unit):
__set_append(unit, "_NODE_MODULES_INOUTS", _build_directives("output", ["hide"], sorted(outs)))
if pj.get_use_prebuilder():
- lf = pm.load_lockfile_from_dir(pm.sources_path)
- is_valid, invalid_keys = lf.validate_has_addons_flags()
-
- if not is_valid:
- ymake.report_configure_error(
- "Project is configured to use @yatool/prebuilder. \n"
- + "Some packages in the pnpm-lock.yaml are misconfigured.\n"
- + "Run `ya tool nots update-lockfile` to fix lockfile.\n"
- + "All packages with `requiresBuild:true` have to be marked with `hasAddons:true/false`.\n"
- + "Misconfigured keys: \n"
- + " - "
- + "\n - ".join(invalid_keys)
- )
-
unit.on_peerdir_ts_resource("@yatool/prebuilder")
unit.set(
[
@@ -597,6 +583,39 @@ def on_node_modules_configure(unit):
]
)
+ # YATOOL_PREBUILDER_0_7_0_RESOURCE_GLOBAL
+ prebuilder_major = unit.get("YATOOL_PREBUILDER-ROOT-VAR-NAME").split("_")[2]
+ logger.info(f"Detected prebuilder \033[0;32mv{prebuilder_major}.x.x\033[0;49m")
+
+ if prebuilder_major == "0":
+ # TODO: FBP-1408
+ lf = pm.load_lockfile_from_dir(pm.sources_path)
+ is_valid, invalid_keys = lf.validate_has_addons_flags()
+
+ if not is_valid:
+ ymake.report_configure_error(
+ "Project is configured to use @yatool/prebuilder. \n"
+ + "Some packages in the pnpm-lock.yaml are misconfigured.\n"
+ + "Run \033[0;32m`ya tool nots update-lockfile`\033[0;49m to fix lockfile.\n"
+ + "All packages with `requiresBuild:true` have to be marked with `hasAddons:true/false`.\n"
+ + "Misconfigured keys: \n"
+ + " - "
+ + "\n - ".join(invalid_keys)
+ )
+ else:
+ lf = pm.load_lockfile_from_dir(pm.sources_path)
+ requires_build_packages = lf.get_requires_build_packages()
+ is_valid, validation_messages = pj.validate_prebuilds(requires_build_packages)
+
+ if not is_valid:
+ ymake.report_configure_error(
+ "Project is configured to use @yatool/prebuilder. \n"
+ + "Some packages are misconfigured.\n"
+ + "Run \033[0;32m`ya tool nots update-lockfile`\033[0;49m to fix pnpm-lock.yaml and package.json.\n"
+ + "Validation details: \n"
+ + "\n".join(validation_messages)
+ )
+
@_with_report_configure_error
def on_ts_test_for_configure(unit, test_runner, default_config, node_modules_filename):