tcbuilder 2.12.1 → 2.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/tcbuild.js +29 -16
  2. package/package.json +1 -1
package/dist/tcbuild.js CHANGED
@@ -22,7 +22,7 @@ import path from 'node:path';
22
22
  import url from 'node:url';
23
23
  import { execSync } from 'node:child_process';
24
24
  import * as glob from 'glob';
25
- import * as commander from "commander";
25
+ import * as commander from 'commander';
26
26
  // @ts-ignore
27
27
  global.commander = commander;
28
28
  const contextStack = [];
@@ -498,6 +498,7 @@ function findExecutable(map, exts, depth = -1) {
498
498
  }
499
499
  process.once('beforeExit', async () => {
500
500
  for (const [name, group] of Object.entries(groups)) {
501
+ let failure = false;
501
502
  const compileCommandsFiles = [];
502
503
  const groupBuildDir = group.buildDir ?? globalBuildDir;
503
504
  if (!groupBuildDir)
@@ -546,26 +547,36 @@ process.once('beforeExit', async () => {
546
547
  continue;
547
548
  }
548
549
  console.log(cmd);
549
- execSync(cmd, { stdio: 'inherit' });
550
+ try {
551
+ execSync(cmd, { stdio: 'inherit' });
552
+ }
553
+ catch (err) {
554
+ console.error(`Exit code: ${err.status}`);
555
+ failure = true;
556
+ }
550
557
  }
551
558
  if (fs.existsSync(obj + '_compile_commands.json'))
552
559
  compileCommandsFiles.push(obj + '_compile_commands.json');
560
+ if (failure)
561
+ break;
553
562
  }
554
563
  }
555
- const finalOutName = `${groupBuildDir}/${name}${group.finalExeSuffix ? `.${group.finalExeSuffix}` : ``}`;
556
- if (group.finalExe.length > 0 && linkNeedsRebuild(finalOutName, objects)) {
557
- let finalFlags = group.finalFlags
558
- .sort((a, b) => a.sort - b.sort)
559
- .map(x => x.flag)
560
- .join(' ');
561
- /*if (group.finalFlagsToBeRemoved.length > 0)
562
- for (const remove of group.finalFlagsToBeRemoved)
563
- finalFlags = finalFlags.replaceAll(remove, '')*/
564
- const cmd = `${group.finalExe} ${(group.finalFlagsGenCb ? group.finalFlagsGenCb(group, objects, finalFlags) : finalFlags).replaceAll('{out}', finalOutName).replaceAll('{in}', objects.map(x => group.finalInputPattern.replaceAll('{in}', x)).join(' '))}`;
565
- console.log(cmd);
566
- execSync(cmd, {
567
- stdio: 'inherit'
568
- });
564
+ if (!failure) {
565
+ const finalOutName = `${groupBuildDir}/${name}${group.finalExeSuffix ? `.${group.finalExeSuffix}` : ``}`;
566
+ if (group.finalExe.length > 0 && linkNeedsRebuild(finalOutName, objects)) {
567
+ let finalFlags = group.finalFlags
568
+ .sort((a, b) => a.sort - b.sort)
569
+ .map(x => x.flag)
570
+ .join(' ');
571
+ /*if (group.finalFlagsToBeRemoved.length > 0)
572
+ for (const remove of group.finalFlagsToBeRemoved)
573
+ finalFlags = finalFlags.replaceAll(remove, '')*/
574
+ const cmd = `${group.finalExe} ${(group.finalFlagsGenCb ? group.finalFlagsGenCb(group, objects, finalFlags) : finalFlags).replaceAll('{out}', finalOutName).replaceAll('{in}', objects.map(x => group.finalInputPattern.replaceAll('{in}', x)).join(' '))}`;
575
+ console.log(cmd);
576
+ execSync(cmd, {
577
+ stdio: 'inherit'
578
+ });
579
+ }
569
580
  }
570
581
  if (compileCommandsFiles.length > 0) {
571
582
  let compileCommands = '[';
@@ -574,6 +585,8 @@ process.once('beforeExit', async () => {
574
585
  compileCommands += ']';
575
586
  fs.writeFileSync(path.join(process.cwd(), groupBuildDir, 'compile_commands.json'), compileCommands);
576
587
  }
588
+ if (failure)
589
+ process.exit();
577
590
  }
578
591
  // @ts-ignore
579
592
  if (global['post_compile'])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tcbuilder",
3
- "version": "2.12.1",
3
+ "version": "2.12.2",
4
4
  "description": "Build System",
5
5
  "homepage": "https://github.com/umutfahriozkan/tcbuild#readme",
6
6
  "bugs": {