blob: 6c73cd17dfbd2f4dbedeabc549e3b97268f04822 (
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
PNPM_ROOT=
PNPM_SCRIPT=$PNPM_ROOT/node_modules/pnpm/dist/pnpm.cjs
NPM_ROOT=
NPM_SCRIPT=$NPM_ROOT/node_modules/npm/bin/npm-cli.js
PM_SCRIPT=
PM_TYPE=
NPM_CONTRIBS_PATH=-
# combined input/outputs records as list of directives ${input;hide:<path>} ${output;hide:<path>}, used in builders
_NODE_MODULES_INOUTS=
_YATOOL_PREBUILDER_ARG=
macro CUSTOM_CONTRIB_TYPESCRIPT(P) {
SET(NPM_CONTRIBS_PATH -)
}
macro NO_CONTRIB_TYPESCRIPT() {
SET(NPM_CONTRIBS_PATH -)
}
### @usage: NPM_CONTRIBS() # internal
###
### Defines special module that provides contrib tarballs from internal npm registry.
###
### @see [FROM_NPM_LOCKFILES()](#macro_FROM_NPM_LOCKFILES)
module NPM_CONTRIBS: _BARE_UNIT {
.CMD=TOUCH_UNIT
.PEERDIR_POLICY=as_build_from
.FINAL_TARGET=no
.ALLOWED=FROM_NPM_LOCKFILES
.RESTRICTED=PEERDIR
.EXTS=_ # Ignore all files, so module is not affected by FROM_NPM output (.EXTS=* is inherited from _BARE_UNIT)
SET(MODULE_TAG NPM_CONTRIBS)
SET(MODULE_LANG TS)
# .fake tells builder to not materialize it in results
SET(MODULE_SUFFIX .fake)
}
### @usage: FROM_NPM_LOCKFILES(LOCKFILES...) # internal
###
### Defines lockfile list for `NPM_CONTRIBS` module.
###
### @see [NPM_CONTRIBS()](#module_NPM_CONTRIBS)
macro FROM_NPM_LOCKFILES(LOCKFILES...) {
# SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS $LOCKFILES)
# See implementation in build/plugins/nots.py
# _FROM_NPM_LOCKFILES($LOCKFILES)
MESSAGE("NPM_CONTRIBS and FROM_NPM_LOCKFILES are disabled. Please exclude them from your build process")
}
FROM_NPM_CWD=$ARCADIA_BUILD_ROOT/$NPM_CONTRIBS_PATH
macro _FROM_NPM(TARBALL_URL, SKY_ID, INTEGRITY, INTEGRITY_ALGO, TARBALL_PATH) {
.CMD=${cwd:FROM_NPM_CWD} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_npm.py"} ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/sky.py"} --tarball-url $TARBALL_URL --sky-id $SKY_ID --integrity $INTEGRITY --integrity-algorithm $INTEGRITY_ALGO --copy-to ${output;noauto:TARBALL_PATH} ${requirements;hide:"network:full"} ${kv;hide:"p TS_FNPM"} ${kv;hide:"pc magenta"}
# we want output to be available for other modules without affecting NPM_CONTRIBS
# we need to expose it (some details in https://st.yandex-team.ru/YMAKE-34)
_EXPOSE($TARBALL_PATH)
}
macro _TS_ADD_NODE_MODULES_FOR_BUILDER() {
# Calculate inputs and outputs of node_modules, fill `_NODE_MODULES_INOUTS` variable
_NODE_MODULES_CONFIGURE()
}
_TARBALLS_STORE=__tarballs__
_PREPARE_DEPS_INOUTS=
_PREPARE_DEPS_RESOURCES=
_PREPARE_DEPS_USE_RESOURCES_FLAG=
_PREPARE_DEPS_CMD=$TOUCH_UNIT \
&& $NOTS_TOOL $NOTS_TOOL_BASE_ARGS prepare-deps \
--tarballs-store $_TARBALLS_STORE \
$_PREPARE_DEPS_INOUTS \
$_PREPARE_DEPS_RESOURCES \
$_PREPARE_DEPS_USE_RESOURCES_FLAG \
${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 COPY_FILE
# 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)
SET(MODULE_LANG TS)
# 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-lock.json ${CURDIR}/package.json)
_SET_PACKAGE_MANAGER()
_PREPARE_DEPS_CONFIGURE()
}
|