@@ -42,6 +42,11 @@ const DEFAULT_NDK_VERSION = "27.1.12297006";
4242
4343// TODO: Add automatic ccache support
4444
45+ const verboseOption = new Option (
46+ "--verbose" ,
47+ "Print more output during the build"
48+ ) . default ( process . env . CI === "true" ) ;
49+
4550const sourcePathOption = new Option (
4651 "--source <path>" ,
4752 "Specify the source directory containing a CMakeLists.txt file"
@@ -163,6 +168,7 @@ export const program = new Command("cmake-rn")
163168 // Configure every triplet project
164169 await oraPromise ( Promise . all ( tripletContext . map ( configureProject ) ) , {
165170 text : "Configuring projects" ,
171+ isSilent : globalContext . verbose ,
166172 successText : "Configured projects" ,
167173 failText : ( { message } ) => `Failed to configure projects: ${ message } ` ,
168174 } ) ;
@@ -182,6 +188,7 @@ export const program = new Command("cmake-rn")
182188 ) ,
183189 {
184190 text : "Building projects" ,
191+ isSilent : globalContext . verbose ,
185192 successText : "Built projects" ,
186193 failText : ( { message } ) => `Failed to build projects: ${ message } ` ,
187194 }
@@ -365,8 +372,14 @@ function getBuildArgs(triplet: SupportedTriplet) {
365372}
366373
367374async function configureProject ( context : TripletScopedContext ) {
368- const { triplet, tripletBuildPath, source, ndkVersion, weakNodeApiLinkage } =
369- context ;
375+ const {
376+ verbose,
377+ triplet,
378+ tripletBuildPath,
379+ source,
380+ ndkVersion,
381+ weakNodeApiLinkage,
382+ } = context ;
370383 await spawn (
371384 "cmake" ,
372385 [
@@ -381,13 +394,14 @@ async function configureProject(context: TripletScopedContext) {
381394 } ) ,
382395 ] ,
383396 {
384- outputMode : "buffered" ,
397+ outputMode : verbose ? "inherit" : "buffered" ,
398+ outputPrefix : verbose ? chalk . dim ( `[${ triplet } ] ` ) : undefined ,
385399 }
386400 ) ;
387401}
388402
389403async function buildProject ( context : TripletScopedContext ) {
390- const { triplet, tripletBuildPath, configuration } = context ;
404+ const { verbose , triplet, tripletBuildPath, configuration } = context ;
391405 await spawn (
392406 "cmake" ,
393407 [
@@ -399,7 +413,8 @@ async function buildProject(context: TripletScopedContext) {
399413 ...getBuildArgs ( triplet ) ,
400414 ] ,
401415 {
402- outputMode : "buffered" ,
416+ outputMode : verbose ? "inherit" : "buffered" ,
417+ outputPrefix : verbose ? chalk . dim ( `[${ triplet } ] ` ) : undefined ,
403418 }
404419 ) ;
405420}
0 commit comments