forked from holepunchto/bare-make
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbin.js
More file actions
executable file
·178 lines (166 loc) · 4.33 KB
/
Copy pathbin.js
File metadata and controls
executable file
·178 lines (166 loc) · 4.33 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/usr/bin/env node
const process = require('process')
const { command, flag, summary } = require('paparam')
const pkg = require('./package')
const make = require('.')
const generate = command(
'generate',
summary('Generate a build tree'),
flag('--source|-s <path>', 'The path to the source tree'),
flag('--build|-b <path>', 'The path to the build tree'),
flag('--platform|-p <name>', 'The operating system platform to build for'),
flag('--arch|-a <name>', 'The operating system architecture to build for'),
flag('--simulator', 'Build for a simulator'),
flag('--environment|-e <name>', 'The environment to build for'),
flag('--no-cache', 'Disregard the build variable cache'),
flag('--debug|-d', 'Configure a debug build'),
flag('--with-debug-symbols', 'Configure a release build with debug symbols'),
flag('--with-minimal-size', 'Configure a release build with minimal size'),
flag('--sanitize <name>', 'Enable a sanitizer'),
flag(
'--define|-D <var>[:<type>]=<value>',
'Create or update a build variable cache entry'
).multiple(),
flag('--color', 'Enable colored output').default(process.stdout.isTTY),
flag('--no-color', 'Disable colored output'),
flag('--verbose', 'Enable verbose output'),
async (cmd) => {
const {
source,
build,
platform,
arch,
simulator,
environment,
cache,
debug,
withDebugSymbols,
withMinimalSize,
sanitize,
define,
color,
verbose
} = cmd.flags
try {
await make.generate({
source,
build,
platform,
arch,
simulator,
environment,
cache,
debug,
withDebugSymbols,
withMinimalSize,
sanitize,
define,
color,
verbose,
stdio: 'inherit'
})
} catch (err) {
if (err && err.code === 'UNKNOWN_TOOLCHAIN') console.error(err)
process.exitCode = 1
}
}
)
const build = command(
'build',
summary('Build a generated build tree'),
flag('--build|-b <path>', 'The path to the build tree'),
flag('--target|-t <name>', 'The target to build'),
flag('--clean|-c', 'Clean before building'),
flag(
'--parallel|-j <number>',
'Build in parallel using the given number of jobs'
),
flag('--verbose', 'Enable verbose output'),
async (cmd) => {
const { build, target, clean, parallel, verbose } = cmd.flags
try {
await make.build({
build,
target,
clean,
parallel,
verbose,
stdio: 'inherit'
})
} catch {
process.exitCode = 1
}
}
)
const install = command(
'install',
summary('Install a generated build tree'),
flag('--build|-b <path>', 'The path to the build tree'),
flag('--prefix|-p <path>', 'The prefix to install to'),
flag('--component|-c <name>', 'The component to install'),
flag('--link|-l', 'Link rather than copy the files'),
flag('--strip|-s', 'Strip before installing'),
flag(
'--parallel|-j <number>',
'Install in parallel using the given number of jobs'
),
flag('--verbose', 'Enable verbose output'),
async (cmd) => {
const { build, prefix, component, link, strip, parallel, verbose } =
cmd.flags
try {
await make.install({
build,
prefix,
component,
link,
strip,
parallel,
verbose,
stdio: 'inherit'
})
} catch {
process.exitCode = 1
}
}
)
const test = command(
'test',
summary('Run tests for a generated build tree'),
flag('--build|-b <path>', 'The path to the build tree'),
flag('--timeout <seconds>', 'The default test timeout'),
flag(
'--parallel|-j <number>',
'Run tests in parallel using the given number of jobs'
),
flag('--verbose', 'Enable verbose output'),
async (cmd) => {
const { build, timeout, parallel, verbose } = cmd.flags
try {
await make.test({
build,
timeout,
parallel,
verbose,
stdio: 'inherit'
})
} catch {
process.exitCode = 1
}
}
)
const cmd = command(
pkg.name,
summary(pkg.description),
flag('--version|-v', 'Print the current version'),
generate,
build,
install,
test,
async (cmd) => {
const { version } = cmd.flags
if (version) return console.log(`v${pkg.version}`)
console.log(cmd.command.help())
}
)
cmd.parse()