aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/ts/ts_proto.conf
blob: 78cf3285d5f3f045c7d9cfa17c866727db0288e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
_TS_PROTO_OPT=
_TS_PROTO_IMPL_CMD=$TOUCH_UNIT \
    && $_TS_FILES_COPY_CMD \
    && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-ts-proto $NOTS_TOOL_COMMON_BUILDER_ARGS \
        ${_TS_PROTO_OPT} \
        --protoc-bin $PROTOC \
        --proto-srcs $_TS_PROTO_SRCS_FILES \
        --proto-paths ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE $_PROTO__INCLUDE $ARCADIA_BUILD_ROOT $PROTOBUF_INCLUDE_PATH \
        $_NODE_MODULES_INOUTS \
        ${hide;input:"package.json"} ${TS_CONFIG_FILES} $_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES) \
        ${hide;output:"package.json"} \
        ${hide:PROTO_FAKEID} \
        ${hide;kv:"pc magenta"} ${hide;kv:"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
    # 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()

    SET(MODULE_LANG TS)

    _PEERDIR_TS_RESOURCE(typescript)

    DISABLE(TS_CONFIG_DEDUCE_OUT)
    ENABLE(TS_CONFIG_USE_OUTDIR)

    _TS_CONFIGURE()

    SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
    _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)
}

### @usage: TS_PROTO_OPT(key1=value1 key2=value2)
###
### Overrides default options for `--ts_proto_opt`
### ([supported options](https://github.com/stephenh/ts-proto?tab=readme-ov-file#supported-options)).
###
### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/PROTO_LIBRARY#ts_proto_opt
###
### @example
###
###     TS_PROTO_OPT(env=browser)
###     TS_PROTO_OPT(
###         useJsonName=true
###         useJsonWireFormat=true
###     )
###
macro TS_PROTO_OPT(OPTS...) {
    SET_APPEND(_TS_PROTO_OPT ${pre=--ts-proto-opt :OPTS})
}