@@ -42,6 +42,11 @@ const DEFAULT_NDK_VERSION = "27.1.12297006";
42
42
43
43
// TODO: Add automatic ccache support
44
44
45
+ const verboseOption = new Option (
46
+ "--verbose" ,
47
+ "Print more output during the build"
48
+ ) . default ( process . env . CI === "true" ) ;
49
+
45
50
const sourcePathOption = new Option (
46
51
"--source <path>" ,
47
52
"Specify the source directory containing a CMakeLists.txt file"
@@ -100,6 +105,7 @@ const xcframeworkExtensionOption = new Option(
100
105
101
106
export const program = new Command ( "cmake-rn" )
102
107
. description ( "Build React Native Node API modules with CMake" )
108
+ . addOption ( verboseOption )
103
109
. addOption ( sourcePathOption )
104
110
. addOption ( configurationOption )
105
111
. addOption ( tripletOption )
@@ -163,6 +169,7 @@ export const program = new Command("cmake-rn")
163
169
// Configure every triplet project
164
170
await oraPromise ( Promise . all ( tripletContext . map ( configureProject ) ) , {
165
171
text : "Configuring projects" ,
172
+ isSilent : globalContext . verbose ,
166
173
successText : "Configured projects" ,
167
174
failText : ( { message } ) => `Failed to configure projects: ${ message } ` ,
168
175
} ) ;
@@ -182,6 +189,7 @@ export const program = new Command("cmake-rn")
182
189
) ,
183
190
{
184
191
text : "Building projects" ,
192
+ isSilent : globalContext . verbose ,
185
193
successText : "Built projects" ,
186
194
failText : ( { message } ) => `Failed to build projects: ${ message } ` ,
187
195
}
@@ -365,8 +373,14 @@ function getBuildArgs(triplet: SupportedTriplet) {
365
373
}
366
374
367
375
async function configureProject ( context : TripletScopedContext ) {
368
- const { triplet, tripletBuildPath, source, ndkVersion, weakNodeApiLinkage } =
369
- context ;
376
+ const {
377
+ verbose,
378
+ triplet,
379
+ tripletBuildPath,
380
+ source,
381
+ ndkVersion,
382
+ weakNodeApiLinkage,
383
+ } = context ;
370
384
await spawn (
371
385
"cmake" ,
372
386
[
@@ -381,13 +395,14 @@ async function configureProject(context: TripletScopedContext) {
381
395
} ) ,
382
396
] ,
383
397
{
384
- outputMode : "buffered" ,
398
+ outputMode : verbose ? "inherit" : "buffered" ,
399
+ outputPrefix : verbose ? chalk . dim ( `[${ triplet } ] ` ) : undefined ,
385
400
}
386
401
) ;
387
402
}
388
403
389
404
async function buildProject ( context : TripletScopedContext ) {
390
- const { triplet, tripletBuildPath, configuration } = context ;
405
+ const { verbose , triplet, tripletBuildPath, configuration } = context ;
391
406
await spawn (
392
407
"cmake" ,
393
408
[
@@ -399,7 +414,8 @@ async function buildProject(context: TripletScopedContext) {
399
414
...getBuildArgs ( triplet ) ,
400
415
] ,
401
416
{
402
- outputMode : "buffered" ,
417
+ outputMode : verbose ? "inherit" : "buffered" ,
418
+ outputPrefix : verbose ? chalk . dim ( `[${ triplet } ] ` ) : undefined ,
403
419
}
404
420
) ;
405
421
}
0 commit comments