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.
- package/dist/tcbuild.js +29 -16
- 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
|
|
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
|
-
|
|
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
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
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'])
|