diff options
author | zaverden <zaverden@yandex-team.com> | 2023-06-22 12:08:37 +0300 |
---|---|---|
committer | zaverden <zaverden@yandex-team.com> | 2023-06-22 12:08:37 +0300 |
commit | 94c5063a1ccbeca127882728abbdc95b03a4c320 (patch) | |
tree | 01050692a0342a31e79b62387e4ae19e383b181d /build | |
parent | d7d69ab087c2d0a9b644b74dcfa3fa69c0ef215b (diff) | |
download | ydb-94c5063a1ccbeca127882728abbdc95b03a4c320.tar.gz |
feat(conf): set resource's vars in _PEERDIR_TS_RESOURCE
Diffstat (limited to 'build')
-rw-r--r-- | build/conf/ts/node_modules.conf | 2 | ||||
-rw-r--r-- | build/conf/ts/ts.conf | 2 | ||||
-rw-r--r-- | build/conf/ts/ts_bundle.conf | 2 | ||||
-rw-r--r-- | build/conf/ts/ts_library.conf | 2 | ||||
-rw-r--r-- | build/conf/ts/ts_next.conf | 2 | ||||
-rw-r--r-- | build/conf/ts/ts_test.conf | 2 | ||||
-rw-r--r-- | build/plugins/nots.py | 32 |
7 files changed, 9 insertions, 35 deletions
diff --git a/build/conf/ts/node_modules.conf b/build/conf/ts/node_modules.conf index aa14b514a2..6ea452ae20 100644 --- a/build/conf/ts/node_modules.conf +++ b/build/conf/ts/node_modules.conf @@ -39,8 +39,6 @@ module _NODE_MODULES_BASE: _BARE_UNIT { PEERDIR($NPM_CONTRIBS_PATH) # PEERDIR to the right version of nodejs and pnpm _PEERDIR_TS_RESOURCE(nodejs pnpm) - # setup toolchain vars - _SET_EXTERNAL_RESOURCES() # run py logic _NODE_MODULES_CONFIGURE() diff --git a/build/conf/ts/ts.conf b/build/conf/ts/ts.conf index 701761e5bd..27214f9d2c 100644 --- a/build/conf/ts/ts.conf +++ b/build/conf/ts/ts.conf @@ -28,8 +28,6 @@ module _TS_BASE_UNIT: _BARE_UNIT { # PEERDIR that reads required version of tool from package.json _PEERDIR_TS_RESOURCE(nodejs pnpm typescript eslint) - # setup toolchain vars - _SET_EXTERNAL_RESOURCES() } diff --git a/build/conf/ts/ts_bundle.conf b/build/conf/ts/ts_bundle.conf index a0fbf0fdd1..95cb4d9561 100644 --- a/build/conf/ts/ts_bundle.conf +++ b/build/conf/ts/ts_bundle.conf @@ -1,4 +1,4 @@ -# WEBPACK_ROOT is redefined in /build/plugins/nots.py _set_resource_vars() +# WEBPACK_ROOT is defined by _PEERDIR_TS_RESOURCE(webpack) WEBPACK_ROOT= WEBPACK_CONFIG_PATH=webpack.config.js TS_BUNDLE_WEBPACK=$TOUCH_UNIT \ diff --git a/build/conf/ts/ts_library.conf b/build/conf/ts/ts_library.conf index 6cc4442885..6dd20851c0 100644 --- a/build/conf/ts/ts_library.conf +++ b/build/conf/ts/ts_library.conf @@ -1,4 +1,4 @@ -# TYPESCRIPT_ROOT is redefined in /build/plugins/nots.py _set_resource_vars() +# TYPESCRIPT_ROOT is defined by _PEERDIR_TS_RESOURCE(typescript) TYPESCRIPT_ROOT= TS_CONFIG_PATH=tsconfig.json TS_COMPILE=$TOUCH_UNIT \ diff --git a/build/conf/ts/ts_next.conf b/build/conf/ts/ts_next.conf index 8863ccc015..5117dab2bb 100644 --- a/build/conf/ts/ts_next.conf +++ b/build/conf/ts/ts_next.conf @@ -1,4 +1,4 @@ -# NEXT_ROOT is redefined in /build/plugins/nots.py _set_resource_vars() +# NEXT_ROOT is defined by _PEERDIR_TS_RESOURCE(next) NEXT_ROOT= TS_NEXT_CONFIG_PATH=next.config.js TS_NEXT_SRC_FILES= diff --git a/build/conf/ts/ts_test.conf b/build/conf/ts/ts_test.conf index e1b3352a4e..c47e240548 100644 --- a/build/conf/ts/ts_test.conf +++ b/build/conf/ts/ts_test.conf @@ -54,8 +54,6 @@ module _TS_TEST_BASE: _BARE_UNIT { # parse module args _TS_TEST_FOR_ARGS($MODULE_ARGS_RAW) - # setup toolchain vars - _SET_EXTERNAL_RESOURCES() # we don't want to have TS outputs for tests DISABLE(TS_CONFIG_DEDUCE_OUT) diff --git a/build/plugins/nots.py b/build/plugins/nots.py index 5157afc526..cab3b34c92 100644 --- a/build/plugins/nots.py +++ b/build/plugins/nots.py @@ -137,6 +137,7 @@ def on_peerdir_ts_resource(unit, *resources): for tool in resources: if tool == "nodejs": dirs.append(os.path.join("build", "platform", tool, str(nodejs_version))) + _set_resource_vars(unit, erm_json, "nodejs", nodejs_version) elif erm_json.is_resource_multiplatform(tool): v = _select_matching_version(erm_json, tool, pj.get_dep_specifier(tool)) sb_resources = [ @@ -145,11 +146,14 @@ def on_peerdir_ts_resource(unit, *resources): nodejs_dir = "NODEJS_{}".format(nodejs_version.major) if len(sb_resources) > 0: dirs.append(os.path.join("build", "external_resources", tool, str(v), nodejs_dir)) + _set_resource_vars(unit, erm_json, tool, v, nodejs_version.major) else: unit.message(["WARN", "Missing {}@{} for {}".format(tool, str(v), nodejs_dir)]) else: v = _select_matching_version(erm_json, tool, pj.get_dep_specifier(tool)) dirs.append(os.path.join("build", "external_resources", tool, str(v))) + _set_resource_vars(unit, erm_json, tool, v, nodejs_version.major) + unit.onpeerdir(dirs) @@ -185,11 +189,6 @@ def on_ts_configure(unit, tsconfig_path): _setup_eslint(unit) -@_with_report_configure_error -def on_set_external_resources(unit): - _setup_external_resources(unit) - - def _get_ts_test_data_dirs(unit): return list( set( @@ -377,27 +376,8 @@ def _add_test(unit, test_type, test_files, deps=None, test_record=None, test_cwd unit.set_property(["DART_DATA", data]) -def _setup_external_resources(unit): - pm = _create_pm(unit) - pj = pm.load_package_json_from_dir(pm.sources_path) - erm_json = _create_erm_json(unit) - - nodejs_version = _select_matching_version(erm_json, "nodejs", pj.get_nodejs_version()) - - # Add NodeJS vars - _set_resource_vars(unit, erm_json, "nodejs", pj.get_nodejs_version()) - - # Add NPM-packages vars - for tool in erm_json.list_npm_packages(): - version_range = pj.get_dep_specifier(tool) - _set_resource_vars(unit, erm_json, tool, version_range, nodejs_version.major) - - -def _set_resource_vars(unit, erm_json, resource_name, version_range, nodejs_major=None): - # type: (any, ErmJsonLite, str, str|None, int|None) -> None - - # example: Version(12, 18, 4) | Version(7, 0, 4) - version = _select_matching_version(erm_json, resource_name, version_range) +def _set_resource_vars(unit, erm_json, resource_name, version, nodejs_major=None): + # type: (any, ErmJsonLite, Version, str|None, int|None) -> None # example: hermione -> HERMIONE, super-package -> SUPER_PACKAGE canon_resource_name = _canonize_resource_name(resource_name) |