diff options
author | vturov <vturov@yandex-team.com> | 2024-03-15 15:40:30 +0300 |
---|---|---|
committer | vturov <vturov@yandex-team.com> | 2024-03-15 15:53:46 +0300 |
commit | 14748f7f24c945a87f157646e28a2ef551b6dcd6 (patch) | |
tree | 558ec7297324761a6b29856a3430517d985d6402 /build | |
parent | d9e005ea601f166350c1c0825c94e28827d5420f (diff) | |
download | ydb-14748f7f24c945a87f157646e28a2ef551b6dcd6.tar.gz |
пример Frontend-модуля с зависимостью по коду от нативной библиотеки
Пример зависимости frontend-пакета по коду от нативной библиотеки.
Позволяет работать с пакетом в автосборке (в том числе автоматически тестировать при изменении кода нативной библиотеки), а также автоматически публиковать новые версии пакета при коммите обновлений в транк.
2aabdc0101c80711721e6797490f9b2ad3cd598b
Diffstat (limited to 'build')
-rw-r--r-- | build/conf/ts/node_modules.conf | 2 | ||||
-rw-r--r-- | build/conf/ts/ts_test.conf | 19 | ||||
-rw-r--r-- | build/plugins/nots.py | 7 |
3 files changed, 21 insertions, 7 deletions
diff --git a/build/conf/ts/node_modules.conf b/build/conf/ts/node_modules.conf index 115579711d..ac718d338d 100644 --- a/build/conf/ts/node_modules.conf +++ b/build/conf/ts/node_modules.conf @@ -68,7 +68,7 @@ _PREPARE_NO_DEPS_CMD=$TOUCH_UNIT \ module _PREPARE_DEPS_BASE: _BARE_UNIT { .CMD=_PREPARE_DEPS_CMD - .IGNORED=SRCS FILES TS_FILES + .IGNORED=SRCS FILES TS_FILES COPY_FILE # Propagates peers to related modules .PEERDIR_POLICY=as_build_from .NODE_TYPE=Bundle diff --git a/build/conf/ts/ts_test.conf b/build/conf/ts/ts_test.conf index 613c17039f..273a8a5687 100644 --- a/build/conf/ts/ts_test.conf +++ b/build/conf/ts/ts_test.conf @@ -4,6 +4,8 @@ TS_TEST_EXTRA_SRCS_MASK= TS_TEST_CONFIG_PATH= TS_TEST_NM= +_TS_TEST_DEPENDS_ON_BUILD= + # We have to rename node_modules.tar to workspace_node_modules.tar, # so TS_TEST_JEST module has it's own unique output. # TS_TEST_JEST_FOR module has to output all files required for test run. @@ -34,6 +36,8 @@ module TS_TEST_JEST_FOR: _TS_TEST_BASE { SET(TS_TEST_EXTENSION test.(ts|tsx|js|jsx)) SET(TS_TEST_EXTRA_SRCS_MASK /**/__mocks__/*) + # nots.py will decide if we need to depend on the testing target module output + _DEPENDS_ON_MOD() _PEERDIR_TS_RESOURCE(nodejs pnpm jest) _TS_TEST_FOR_CONFIGURE(jest jest.config.js workspace_node_modules.tar) @@ -64,6 +68,7 @@ module TS_TEST_HERMIONE_FOR: _TS_TEST_BASE { # compatibility with old TS_TEST_SRCS SET(TS_TEST_EXTENSION hermione.(ts|js)) + TS_TEST_DEPENDS_ON_BUILD() _DEPENDS_ON_MOD() _PEERDIR_TS_RESOURCE(nodejs pnpm typescript hermione) _TS_TEST_FOR_CONFIGURE(hermione .hermione.conf.js workspace_node_modules.tar) @@ -104,9 +109,9 @@ macro _SETUP_EXTRACT_NODE_MODULES_RECIPE(FOR_PATH) { USE_RECIPE(devtools/frontend_build_platform/nots/recipes/extract_node_modules/recipe $FOR_PATH workspace_node_modules.tar) } -macro _SETUP_EXTRACT_PEER_TARS_RECIPE(FOR_PATH) { - DEPENDS(devtools/frontend_build_platform/nots/recipes/extract_peer_tars) - USE_RECIPE(devtools/frontend_build_platform/nots/recipes/extract_peer_tars/recipe $FOR_PATH) +macro _SETUP_EXTRACT_OUTPUT_TARS_RECIPE(FOR_PATH) { + DEPENDS(devtools/frontend_build_platform/nots/recipes/extract_output_tars) + USE_RECIPE(devtools/frontend_build_platform/nots/recipes/extract_output_tars/recipe $FOR_PATH) } @@ -154,3 +159,11 @@ macro TS_TEST_DATA(RENAME="", GLOBS...) { _GLOB(_TS_TEST_DATA_VALUE $GLOBS) SET(_TS_TEST_DATA_DIRS_RENAME_VALUE $RENAME) } + +### @usage: TS_TEST_DEPENDS_ON_BUILD() +### +### Macro enables build and results unpacking for the module test is targeting. +### It is not required for most of the tests, but it might be needeed in some special cases. +macro TS_TEST_DEPENDS_ON_BUILD() { + ENABLE(_TS_TEST_DEPENDS_ON_BUILD) +} diff --git a/build/plugins/nots.py b/build/plugins/nots.py index 6a8d825bd2..d9c951f54e 100644 --- a/build/plugins/nots.py +++ b/build/plugins/nots.py @@ -546,7 +546,7 @@ def on_ts_test_for_configure(unit, test_runner, default_config, node_modules_fil for_mod_path = unit.get("TS_TEST_FOR_PATH") unit.onpeerdir([for_mod_path]) unit.on_setup_extract_node_modules_recipe([for_mod_path]) - unit.on_setup_extract_peer_tars_recipe([for_mod_path]) + unit.on_setup_extract_output_tars_recipe([for_mod_path]) root = "$B" if test_runner == "hermione" else "$(BUILD_ROOT)" unit.set(["TS_TEST_NM", os.path.join(root, for_mod_path, node_modules_filename)]) @@ -617,5 +617,6 @@ def on_ts_files(unit, *files): @_with_report_configure_error def on_depends_on_mod(unit): - for_mod_path = unit.get("TS_TEST_FOR_PATH") - unit.ondepends([for_mod_path]) + if unit.get("_TS_TEST_DEPENDS_ON_BUILD"): + for_mod_path = unit.get("TS_TEST_FOR_PATH") + unit.ondepends([for_mod_path]) |