diff options
author | zaverden <zaverden@yandex-team.com> | 2024-02-26 11:58:12 +0300 |
---|---|---|
committer | zaverden <zaverden@yandex-team.com> | 2024-02-26 12:16:26 +0300 |
commit | d180f9b302f71970d2e5cf0bf7cd26bdaa5aef12 (patch) | |
tree | 8a4b8a497a7296e4ff6977dd4dfa768b479aa647 /build/conf | |
parent | 2c831425e3b8e6331c6ed07081cd0111db18bf9d (diff) | |
download | ydb-d180f9b302f71970d2e5cf0bf7cd26bdaa5aef12.tar.gz |
feat(conf): configure used tarballs by own pnpm-lock.yaml
b61ff371d6ad2f8c646f2a04e4a7d0fa178a6541
Diffstat (limited to 'build/conf')
-rw-r--r-- | build/conf/proto.conf | 6 | ||||
-rw-r--r-- | build/conf/ts/node_modules.conf | 109 | ||||
-rw-r--r-- | build/conf/ts/ts_next.conf | 5 | ||||
-rw-r--r-- | build/conf/ts/ts_package.conf | 5 | ||||
-rw-r--r-- | build/conf/ts/ts_proto.conf | 3 | ||||
-rw-r--r-- | build/conf/ts/ts_tsc.conf | 5 | ||||
-rw-r--r-- | build/conf/ts/ts_vite.conf | 5 | ||||
-rw-r--r-- | build/conf/ts/ts_webpack.conf | 5 |
8 files changed, 79 insertions, 64 deletions
diff --git a/build/conf/proto.conf b/build/conf/proto.conf index b3fc5bc0a7..4d867c45df 100644 --- a/build/conf/proto.conf +++ b/build/conf/proto.conf @@ -759,6 +759,12 @@ multimodule PROTO_LIBRARY { # To include TS_PROTO user have to set INCLUDE_TAGS(TS_PROTO) in ya.make .INCLUDE_TAG=no .EPILOGUE=_TS_CONFIG_EPILOGUE + .PEERDIRSELF=TS_PREPARE_DEPS + } + + module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE { + .INCLUDE_TAG=no + .IGNORED=PEERDIR } module DESC_PROTO: _BARE_UNIT { diff --git a/build/conf/ts/node_modules.conf b/build/conf/ts/node_modules.conf index 13953e3c67..b50f6d8f15 100644 --- a/build/conf/ts/node_modules.conf +++ b/build/conf/ts/node_modules.conf @@ -1,70 +1,10 @@ PNPM_ROOT= PNPM_SCRIPT=$PNPM_ROOT/node_modules/pnpm/dist/pnpm.cjs NPM_CONTRIBS_PATH=contrib/typescript -# inputs list, just paths, deprecated (use _NODE_MODULES_INOUTS instead), used only for eslint/jest/hermione -_NODE_MODULES_INS= -# outputs list, just paths, deprecated (use _NODE_MODULES_INOUTS instead), used only for eslint/jest/hermione -_NODE_MODULES_OUTS= # combined input/outputs records as list of directives ${input;hide:<path>} ${output;hide:<path>}, used in builders _NODE_MODULES_INOUTS= _YATOOL_PREBUILDER_ARG= -# TOUCH_UNIT is required to create module identity file. -# We can "call" macro as `$_GET_NODE_MODULES_INS_OUTS(...)`. in this case we will get .CMD from it. -# This is the only way to process a variable data as an array. -# ${output;hide:_NODE_MODULES_OUTS} does not produce list of paths, but a single value (space-separeted paths) -_NODE_MODULES_CMD=$TOUCH_UNIT \ - && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS create-node-modules \ - $_GET_NODE_MODULES_INS_OUTS(IN $_NODE_MODULES_INS OUT $_NODE_MODULES_OUTS) \ - ${kv;hide:"pc magenta"} ${kv;hide:"p TS_NM"} - - -module _NODE_MODULES_BASE: _BARE_UNIT { - .CMD=_NODE_MODULES_CMD - # ignore SRCS macro, use TS_FILES instead of FILES - .ALIASES=SRCS=_NOOP_MACRO FILES=TS_FILES - # Propagates peers to related modules - .PEERDIR_POLICY=as_build_from - .NODE_TYPE=Bundle - - # TODO: remove this. YMAKE-1096 / FBP-1184 - _NEVERCACHE() - - # we have several modules in the same dir (.PEERDIRSELF=NODE_MODULES in BUILD) - # we need different names for module identity file - # .fake tells builder to not materialize it in results - SET(MODULE_SUFFIX .n_m.fake) - # .NODE_TYPE=Bundle is required for peers propagation, but it also affects - # how merging of pic/nopic graphs. Here we can override this merging behaviour - SET(MODULE_TYPE LIBRARY) - # define own tag - SET(MODULE_TAG NODE_MODULES) - # what modules it can PEERDIR to - SET(PEERDIR_TAGS TS TS_PROTO NPM_CONTRIBS) - # do not include it into "results" of graph - DISABLE(START_TARGET) - - # we read package.json and erm-packages.json during configuration - SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/pnpm-lock.yaml ${CURDIR}/package.json ${ARCADIA_ROOT}/$ERM_PACKAGES_PATH) - - PEERDIR($NPM_CONTRIBS_PATH) - # PEERDIR to the right version of nodejs and pnpm - _PEERDIR_TS_RESOURCE(nodejs pnpm) - - # run py logic - _NODE_MODULES_CONFIGURE() -} - -# called in on_node_modules_configure -macro _SET_NODE_MODULES_INS_OUTS(IN{input}[], OUT{output}[]) { - SET(_NODE_MODULES_INS $IN) - SET(_NODE_MODULES_OUTS $OUT) -} - -macro _GET_NODE_MODULES_INS_OUTS(IN{input}[], OUT{output}[]) { - .CMD=${input;hide:IN} ${output;hide:OUT} -} - ### @usage: NPM_CONTRIBS() # internal ### @@ -105,9 +45,52 @@ macro _FROM_NPM(TARBALL_URL, SKY_ID, INTEGRITY, INTEGRITY_ALGO, TARBALL_PATH) { } macro _TS_ADD_NODE_MODULES_FOR_BUILDER() { - # Provide downloaded dependencies in `/contrib/typescript/-` - PEERDIR($NPM_CONTRIBS_PATH) - # Calculate inputs and outputs of node_modules, fill `_NODE_MODULES_INOUTS` variable _NODE_MODULES_CONFIGURE() } + +_TARBALLS_STORE=__tarballs__ +_PREPARE_DEPS_INOUTS= +_PREPARE_DEPS_CMD=$TOUCH_UNIT \ + && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS prepare-deps \ + --tarballs-store $_TARBALLS_STORE \ + $_PREPARE_DEPS_INOUTS \ + ${kv;hide:"pc magenta"} ${kv;hide:"p TS_DEP"} + +# In case of no deps we need to create empty outputs for graph connectivity +_PREPARE_NO_DEPS_CMD=$TOUCH_UNIT \ + && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} \ + $_PREPARE_DEPS_INOUTS \ + ${kv;hide:"pc magenta"} ${kv;hide:"p TS_NODEP"} + +module _PREPARE_DEPS_BASE: _BARE_UNIT { + .CMD=_PREPARE_DEPS_CMD + .IGNORED=SRCS FILES TS_FILES + # Propagates peers to related modules + .PEERDIR_POLICY=as_build_from + .NODE_TYPE=Bundle + .INCLUDE_TAG=no + + # we have several modules in the same dir (.PEERDIRSELF=TS_PREPARE_DEPS in BUILD) + # we need different names for module identity file + # .fake tells builder to not materialize it in results + SET(MODULE_SUFFIX .prepare_deps.fake) + # .NODE_TYPE=Bundle is required for peers propagation, but it also affects + # how merging of pic/nopic graphs. Here we can override this merging behaviour + SET(MODULE_TYPE LIBRARY) + # define own tag + SET(MODULE_TAG TS_PREPARE_DEPS) + # what modules it can PEERDIR to + SET(PEERDIR_TAGS TS_PREPARE_DEPS) + # do not include it into "results" of graph + DISABLE(START_TARGET) + + # we read pnpm-lock.yaml and package.json during configuration + SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/pnpm-lock.yaml ${CURDIR}/package.json) + + PEERDIR($NPM_CONTRIBS_PATH) + + _PREPARE_DEPS_CONFIGURE() +} + + diff --git a/build/conf/ts/ts_next.conf b/build/conf/ts/ts_next.conf index 0bf65e3e2d..58465b3a0d 100644 --- a/build/conf/ts/ts_next.conf +++ b/build/conf/ts/ts_next.conf @@ -27,6 +27,7 @@ multimodule TS_NEXT { module BUILD: _TS_BASE_UNIT { .CMD=TS_NEXT_CMD .EPILOGUE=_TS_CONFIG_EPILOGUE + .PEERDIRSELF=TS_PREPARE_DEPS # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case) # but we have to set it to TS for include processor to work @@ -42,6 +43,10 @@ multimodule TS_NEXT { SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH}) _TS_ADD_NODE_MODULES_FOR_BUILDER() } + + module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE { + + } } macro TS_NEXT_CONFIG(Path) { diff --git a/build/conf/ts/ts_package.conf b/build/conf/ts/ts_package.conf index bad2085a62..135e41a39e 100644 --- a/build/conf/ts/ts_package.conf +++ b/build/conf/ts/ts_package.conf @@ -25,6 +25,7 @@ multimodule TS_PACKAGE { .CMD=TS_PACK .ALLOWED=TS_FILES .ALIASES=FILES=TS_FILES SRCS=TS_FILES + .PEERDIRSELF=TS_PREPARE_DEPS # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case) # but we have to set it to TS for include processor to work @@ -33,4 +34,8 @@ multimodule TS_PACKAGE { SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml) _TS_ADD_NODE_MODULES_FOR_BUILDER() } + + module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE { + + } } diff --git a/build/conf/ts/ts_proto.conf b/build/conf/ts/ts_proto.conf index dc8e83e43a..115ec0f498 100644 --- a/build/conf/ts/ts_proto.conf +++ b/build/conf/ts/ts_proto.conf @@ -12,7 +12,7 @@ _TS_PROTO_IMPL_CMD=$TOUCH_UNIT \ ${kv;hide:"pc magenta"} ${kv;hide:"p TS_PRO"} - +### # internal module _TS_PROTO_IMPL: _TS_BASE_UNIT { .CMD=_TS_PROTO_IMPL_CMD .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_SKIFF CPP_PROTO_PLUGIN2 PY_PROTO_PLUGIN YMAPS_SPROTO RESOURCE @@ -39,6 +39,7 @@ module _TS_PROTO_IMPL: _TS_BASE_UNIT { _TS_ADD_NODE_MODULES_FOR_BUILDER() } +### @usage: _TS_PROTO_SRCS(path1 path2) # internal macro _TS_PROTO_SRCS(FILES...) { _SET_APPEND_WITH_DIRECTIVE(_TS_PROTO_SRCS_FILES input $FILES) }
\ No newline at end of file diff --git a/build/conf/ts/ts_tsc.conf b/build/conf/ts/ts_tsc.conf index bb7fb3bbef..cba05e44a8 100644 --- a/build/conf/ts/ts_tsc.conf +++ b/build/conf/ts/ts_tsc.conf @@ -21,6 +21,7 @@ multimodule TS_TSC { module BUILD: _TS_BASE_UNIT { .CMD=TS_TSC_CMD .EPILOGUE=_TS_CONFIG_EPILOGUE + .PEERDIRSELF=TS_PREPARE_DEPS # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case) # but we have to set it to TS for include processor to work @@ -36,4 +37,8 @@ multimodule TS_TSC { SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH}) _TS_ADD_NODE_MODULES_FOR_BUILDER() } + + module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE { + + } } diff --git a/build/conf/ts/ts_vite.conf b/build/conf/ts/ts_vite.conf index 95e6ac8c62..04ee37227e 100644 --- a/build/conf/ts/ts_vite.conf +++ b/build/conf/ts/ts_vite.conf @@ -35,6 +35,7 @@ multimodule TS_VITE { module BUILD: _TS_BASE_UNIT { .CMD=TS_VITE_CMD .EPILOGUE=_TS_CONFIG_EPILOGUE + .PEERDIRSELF=TS_PREPARE_DEPS # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case) # but we have to set it to TS for include processor to work @@ -50,4 +51,8 @@ multimodule TS_VITE { SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH}) _TS_ADD_NODE_MODULES_FOR_BUILDER() } + + module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE { + + } } diff --git a/build/conf/ts/ts_webpack.conf b/build/conf/ts/ts_webpack.conf index 6438147c4f..6e9e0571cf 100644 --- a/build/conf/ts/ts_webpack.conf +++ b/build/conf/ts/ts_webpack.conf @@ -35,6 +35,7 @@ multimodule TS_WEBPACK { module BUILD: _TS_BASE_UNIT { .CMD=TS_WEBPACK_CMD .EPILOGUE=_TS_CONFIG_EPILOGUE + .PEERDIRSELF=TS_PREPARE_DEPS # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case) # but we have to set it to TS for include processor to work @@ -50,4 +51,8 @@ multimodule TS_WEBPACK { SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH}) _TS_ADD_NODE_MODULES_FOR_BUILDER() } + + module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE { + + } } |