blob: 58766b3198afdfc8efd1756f18019b3b4a4dbb66 (
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
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
WEBPACK_ROOT=$WEBPACK_RESOURCE_GLOBAL/node_modules
WEBPACK_SCRIPT=$WEBPACK_ROOT/.bin/webpack
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} ${hide:PEERS} $_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)
SET(TS_CONFIG_DEDUCE_OUT yes)
_TS_CONFIGURE($TS_CONFIG_PATH)
}
WEBPACK_CONFIG_PATH=webpack.config.js
TS_BUNDLE_WEBPACK=${cwd:BINDIR} $NOTS_TOOL bundle-webpack $NOTS_TOOL_BASE_ARGS --webpack-root $WEBPACK_ROOT --webpack-script $WEBPACK_SCRIPT --config ${input:WEBPACK_CONFIG_PATH} ${hide:PEERS} $_NODE_MODULES_INPUTS ${output;hide:"bundle.tar"} ${kv;hide:"p FE"} ${kv;hide:"pc yellow"} && $TOUCH_UNIT
### @usage: TS_BUNDLE([name])
###
### The Webpack bundle, bundles JavaScript code.
### Build results are bundle.tar, typings and source mappings (depending on local tsconfig.json settings).
###
### @see [NODE_MODULES()](#macro_NODE_MODULES)
### @example
###
### TS_BUNDLE()
### SRCS(src/index.ts)
### NODE_MODULES()
### END()
###
module TS_BUNDLE : _TS_BASE_UNIT {
.CMD=TS_BUNDLE_WEBPACK
.FINAL_TARGET=yes
.PEERDIR_POLICY=as_build_from
DECLARE_EXTERNAL_RESOURCE(WEBPACK sbr:2815569512)
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/${WEBPACK_CONFIG_PATH} ${CURDIR}/package.json)
SET(TS_CONFIG_DEDUCE_OUT no)
_TS_CONFIGURE($TS_CONFIG_PATH)
}
|