aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzaverden <zaverden@yandex-team.com>2024-02-15 08:00:49 +0300
committerzaverden <zaverden@yandex-team.com>2024-02-15 08:17:36 +0300
commit9560d6f3fed643e8b4c9bff8bae66b5917ecaf6c (patch)
treebe786989005ee77f6c98c5d2d180301c3a9b7f4a
parent93edb3c33a4916a84c97ca81e688575a1c2a5e0e (diff)
downloadydb-9560d6f3fed643e8b4c9bff8bae66b5917ecaf6c.tar.gz
feat(TS_PROTO): basic TS_PROTO implementation
398e9820bbfd2c0ed45e74bf152431910ead2c4c
-rw-r--r--build/conf/proto.conf7
-rw-r--r--build/conf/ts/node_modules.conf2
-rw-r--r--build/conf/ts/ts.conf3
-rw-r--r--build/conf/ts/ts_proto.conf44
-rw-r--r--build/plugins/nots.py10
5 files changed, 62 insertions, 4 deletions
diff --git a/build/conf/proto.conf b/build/conf/proto.conf
index ef6cf8ee15..b3fc5bc0a7 100644
--- a/build/conf/proto.conf
+++ b/build/conf/proto.conf
@@ -754,6 +754,13 @@ multimodule PROTO_LIBRARY {
}
}
+ module TS_PROTO: _TS_PROTO_IMPL {
+ # opt-in. We don't want to have TS_PROTO by default
+ # To include TS_PROTO user have to set INCLUDE_TAGS(TS_PROTO) in ya.make
+ .INCLUDE_TAG=no
+ .EPILOGUE=_TS_CONFIG_EPILOGUE
+ }
+
module DESC_PROTO: _BARE_UNIT {
.CMD=_PROTO_DESC_MERGE_CMD
.SEM=IGNORED
diff --git a/build/conf/ts/node_modules.conf b/build/conf/ts/node_modules.conf
index dd4aaaf0e4..13953e3c67 100644
--- a/build/conf/ts/node_modules.conf
+++ b/build/conf/ts/node_modules.conf
@@ -40,7 +40,7 @@ module _NODE_MODULES_BASE: _BARE_UNIT {
# define own tag
SET(MODULE_TAG NODE_MODULES)
# what modules it can PEERDIR to
- SET(PEERDIR_TAGS TS NPM_CONTRIBS)
+ SET(PEERDIR_TAGS TS TS_PROTO NPM_CONTRIBS)
# do not include it into "results" of graph
DISABLE(START_TARGET)
diff --git a/build/conf/ts/ts.conf b/build/conf/ts/ts.conf
index c76f115d28..c97de73232 100644
--- a/build/conf/ts/ts.conf
+++ b/build/conf/ts/ts.conf
@@ -54,7 +54,7 @@ module _TS_BASE_UNIT: _BARE_UNIT {
# Include processor works only for TS tag
SET(MODULE_TAG TS)
# TS should peer to TS
- SET(PEERDIR_TAGS TS)
+ SET(PEERDIR_TAGS TS TS_PROTO)
# .fake tells builder to not materialize it in results
SET(MODULE_SUFFIX .ts.fake)
@@ -120,6 +120,7 @@ macro TS_FILES(Files...) {
@import "${CONF_ROOT}/conf/ts/node_modules.conf"
@import "${CONF_ROOT}/conf/ts/ts_next.conf"
@import "${CONF_ROOT}/conf/ts/ts_package.conf"
+@import "${CONF_ROOT}/conf/ts/ts_proto.conf"
@import "${CONF_ROOT}/conf/ts/ts_test.conf"
@import "${CONF_ROOT}/conf/ts/ts_tsc.conf"
@import "${CONF_ROOT}/conf/ts/ts_vite.conf"
diff --git a/build/conf/ts/ts_proto.conf b/build/conf/ts/ts_proto.conf
new file mode 100644
index 0000000000..dc8e83e43a
--- /dev/null
+++ b/build/conf/ts/ts_proto.conf
@@ -0,0 +1,44 @@
+_TS_PROTO_SRCS_FILES=
+_TS_PROTO_IMPL_CMD=$TOUCH_UNIT \
+ && $_TS_FILES_COPY_CMD \
+ && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-ts-proto $NOTS_TOOL_COMMON_BUILDER_ARGS \
+ --protoc-bin $PROTOC \
+ --proto-srcs $_TS_PROTO_SRCS_FILES \
+ --proto-paths ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE $_PROTO__INCLUDE $ARCADIA_BUILD_ROOT $PROTOBUF_PATH \
+ $_NODE_MODULES_INOUTS \
+ ${input;hide:"package.json"} ${TS_CONFIG_FILES} $_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES) \
+ ${output;hide:"package.json"} \
+ ${hide:PROTO_FAKEID} \
+ ${kv;hide:"pc magenta"} ${kv;hide:"p TS_PRO"}
+
+
+
+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
+ # We need to collect SRCS paths into list to pass to command
+ .ALIASES=SRCS=_TS_PROTO_SRCS
+
+ # PEERDIR should be resolved to DESC_PROTO submodule
+ SET(PEERDIR_TAGS DESC_PROTO)
+ # For users to add some conditional config for TS_PROTO, like
+ # IF (TS_PROTO)
+ # MESSAGE(Building TS_PROTO!!!)
+ ENABLE(TS_PROTO)
+ # Disable linting
+ NO_LINT()
+
+ _PEERDIR_TS_RESOURCE(typescript)
+
+ DISABLE(TS_CONFIG_DEDUCE_OUT)
+ ENABLE(TS_CONFIG_USE_OUTDIR)
+
+ _TS_CONFIGURE($TS_CONFIG_PATH)
+
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
+ _TS_ADD_NODE_MODULES_FOR_BUILDER()
+}
+
+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/plugins/nots.py b/build/plugins/nots.py
index d9c0249b13..6e99f5c10b 100644
--- a/build/plugins/nots.py
+++ b/build/plugins/nots.py
@@ -78,8 +78,8 @@ def _build_directives(name, flags, paths):
# type: (str, list[str]|tuple[str], list[str]) -> str
parts = [p for p in [name] + (flags or []) if p]
-
- expressions = ["${{{parts}:\"{path}\"}}".format(parts=";".join(parts), path=path) for path in paths]
+ parts_str = ";".join(parts)
+ expressions = ['${{{parts}:"{path}"}}'.format(parts=parts_str, path=path) for path in paths]
return " ".join(expressions)
@@ -122,6 +122,12 @@ def _create_erm_json(unit):
@_with_report_configure_error
+def on_set_append_with_directive(unit, var_name, dir, *values):
+ wrapped = ['${{{dir}:"{v}"}}'.format(dir=dir, v=v) for v in values]
+ __set_append(unit, var_name, " ".join(wrapped))
+
+
+@_with_report_configure_error
def on_from_npm_lockfiles(unit, *args):
from lib.nots.package_manager.base import PackageManagerError