diff options
author | zaverden <zaverden@yandex-team.com> | 2024-04-22 08:48:33 +0300 |
---|---|---|
committer | zaverden <zaverden@yandex-team.com> | 2024-04-22 08:58:08 +0300 |
commit | 1d77668624e2483b5664ae4999537d7086be576b (patch) | |
tree | c49b3ba06de3f542cd62a7eb4b0a19eb8ba578ac /build/plugins/lib/nots/package_manager/base/package_json.py | |
parent | 55f0e9fe0e7fe7ccba9365d822352dec9cf5332c (diff) | |
download | ydb-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/lib/nots/package_manager/base/package_json.py')
-rw-r--r-- | build/plugins/lib/nots/package_manager/base/package_json.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/build/plugins/lib/nots/package_manager/base/package_json.py b/build/plugins/lib/nots/package_manager/base/package_json.py index 2438511800..449b386556 100644 --- a/build/plugins/lib/nots/package_manager/base/package_json.py +++ b/build/plugins/lib/nots/package_manager/base/package_json.py @@ -222,3 +222,28 @@ class PackageJson(object): """ ws_map = self.get_workspace_map() return {pj.get_name(): path for path, (pj, _) in ws_map.items()} + + def validate_prebuilds(self, requires_build_packages: list[str]): + pnpm_overrides: dict[str, str] = self.data.get("pnpm", {}).get("overrides", {}) + use_prebuild_flags: dict[str, bool] = self.data.get("@yatool/prebuilder", {}).get("usePrebuild", {}) + + def covered(k: str) -> bool: + if k.startswith("@yandex-prebuild/"): + return True + return k in use_prebuild_flags + + not_covered = [key for key in requires_build_packages if not covered(key)] + use_prebuild_keys = [key for key in use_prebuild_flags if use_prebuild_flags[key]] + missing_overrides = [key for key in use_prebuild_keys if key not in pnpm_overrides] + + messages = [] + + if not_covered: + messages.append("These packages possibly have addons but are not checked yet:") + messages.extend([f" - {key}" for key in not_covered]) + + if missing_overrides: + messages.append("These packages have addons but overrides are not set:") + messages.extend([f" - {key}" for key in missing_overrides]) + + return (not messages, messages) |