blob: 0a6310d8b3d9419957cccc4ff8c5f364ab9d79b2 (
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
|
NODEJS_ROOT=$NODEJS_RESOURCE_GLOBAL
NODEJS_BIN=$NODEJS_ROOT/node
PNPM_ROOT=$PNPM_RESOURCE_GLOBAL
PNPM_SCRIPT=$PNPM_ROOT/pnpm.js
TSC_ROOT=$TS_COMPILER_RESOURCE_GLOBAL/typescript
TSC_SCRIPT=$TSC_ROOT/lib/tsc.js
NOTS_TOOL=${tool:"tools/nots"}
NOTS_TOOL_BASE_ARGS=--build-root $ARCADIA_BUILD_ROOT --bindir $BINDIR --curdir $CURDIR --nodejs-bin $NODEJS_BIN
NPM_CONTRIBS_PATH=devtools/dummy_arcadia/ts/contribs
### @usage: NPM_CONTRIBS() # internal
###
### Defines special module that provides contrib tarballs from internal npm registry.
### Should be used only with `NODE_MODULES` macro.
###
### @see [FROM_NPM_LOCKFILES()](#macro_FROM_NPM_LOCKFILES)
### @see [NODE_MODULES()](#macro_NODE_MODULES)
module NPM_CONTRIBS: _BASE_UNIT {
.CMD=TOUCH_UNIT
.PEERDIR_POLICY=as_build_from
.FINAL_TARGET=no
.ALLOWED=FROM_NPM_LOCKFILES
.RESTRICTED=PEERDIR
SET(MODULE_TAG NPM_CONTRIBS)
MODULE_SUFFIX=.fake
_BARE_MODULE()
}
### @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)
}
### @usage: FROM_NPM(NAME VERSION SKY_ID INTEGRITY INTEGRITY_ALGO TARBALL_PATH)
macro FROM_NPM(NAME, VERSION, SKY_ID, INTEGRITY, INTEGRITY_ALGO, TARBALL_PATH) {
.CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_npm.py"} ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/sky.py"} --name $NAME --version $VERSION --sky-id $SKY_ID --integrity $INTEGRITY --integrity-algorithm $INTEGRITY_ALGO --copy-to ${output:TARBALL_PATH} ${requirements;hide:"network:full"} ${kv;hide:"p NP"} ${kv;hide:"pc yellow"}
}
### @usage: NODE_MODULES()
###
### Materializes `node_modules.tar` bundle according to the module's lockfile.
###
### @see [NPM_CONTRIBS()](#module_NPM_CONTRIBS)
macro NODE_MODULES() {
# See implementation in build/plugins/nots.py
}
_NODE_MODULES_INPUTS=
macro _NODE_MODULES(IN{input}[], OUT{output}[]) {
PEERDIR($NPM_CONTRIBS_PATH)
SET(_NODE_MODULES_INPUTS \${input;hide:node_modules.tar})
.CMD=${cwd:BINDIR} $NOTS_TOOL create-node-modules $NOTS_TOOL_BASE_ARGS --pnpm-script $PNPM_SCRIPT --contribs $NPM_CONTRIBS_PATH ${input;hide:IN} ${output;global;hide:OUT} ${kv;hide:"p NM"} ${kv;hide:"pc yellow"}
}
module _TS_BASE_UNIT: _BASE_UNIT {
SET(MODULE_TAG TS)
SET(PEERDIR_TAGS TS NPM_CONTRIBS)
PEERDIR(build/platform/nodejs)
PEERDIR(build/external_resources/pnpm)
PEERDIR(build/external_resources/typescript)
MODULE_SUFFIX=.fake
_BARE_MODULE()
}
TS_CONFIG_PATH=tsconfig.json
TS_COMPILE=${cwd:BINDIR} $NOTS_TOOL compile-ts $NOTS_TOOL_BASE_ARGS --tsc-script $TSC_SCRIPT --config ${input:TS_CONFIG_PATH} $_NODE_MODULES_INPUTS ${output;hide:"package.json"} ${kv;hide:"p FE"} ${kv;hide:"pc yellow"} && $TOUCH_UNIT
### @usage: TS_LIBRARY([name])
###
### The TypeScript/JavaScript library module, compiles TypeScript sources to JavaScript.
### Build results are JavaScript files, typings and source mappings (depending on local tsconfig.json settings).
###
### @see [NODE_MODULES()](#macro_NODE_MODULES)
### @example
###
### TS_LIBRARY()
### SRCS(src/index.ts)
### NODE_MODULES()
### END()
###
module TS_LIBRARY : _TS_BASE_UNIT {
.CMD=TS_COMPILE
.FINAL_TARGET=yes
.PEERDIR_POLICY=as_build_from
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/${TS_CONFIG_PATH} ${CURDIR}/package.json)
_TS_CONFIGURE($TS_CONFIG_PATH)
}
|