Adds better buildtool errors when using byond 514 or older (#81129)

Every time someone asks what -DCBT means i lose sleep so here's a
slightly invasive solution.
Build will now check if the dm version is at least 515.1597 (first
version with -D switch), at the cost of having to run dry dm.exe run.
This commit is contained in:
AnturK
2024-01-28 23:46:10 +01:00
committed by GitHub
parent f92528d0ae
commit 4fdf458d40
+21 -2
View File
@@ -145,10 +145,29 @@ export const DreamMaker = async (dmeFile, options = {}) => {
throw err;
}
};
const testDmVersion = async (dmPath) => {
const execReturn = await Juke.exec(dmPath, [], { silent: true, throw: false });
const version = execReturn.combined.match(`DM compiler version (\\d+)\\.(\\d+)`)
if(version == null){
Juke.logger.error(`Unexpected DreamMaker return, ensure "${dmPath}" is correct DM path.`)
throw new Juke.ExitCode(1);
}
const requiredMajorVersion = 515;
const requiredMinorVersion = 1597 // First with -D switch functionality
const major = Number(version[1]);
const minor = Number(version[2]);
if(major < requiredMajorVersion || major == requiredMajorVersion && minor < requiredMinorVersion){
Juke.logger.error(`${requiredMajorVersion}.${requiredMinorVersion} DM version required`)
throw new Juke.ExitCode(1);
}
}
await testDmVersion(dmPath);
testOutputFile(`${dmeBaseName}.dmb`);
testOutputFile(`${dmeBaseName}.rsc`);
const runWithWarningChecks = async (dmeFile, args) => {
const execReturn = await Juke.exec(dmeFile, args);
const runWithWarningChecks = async (dmPath, args) => {
const execReturn = await Juke.exec(dmPath, args);
const ignoredWarningCodes = options.ignoreWarningCodes ?? [];
const reg = ignoredWarningCodes.length > 0 ? new RegExp(`\d+:warning: (?!(${ignoredWarningCodes.join('|')}))`) : /\d+:warning: /;
if (options.warningsAsErrors && execReturn.combined.match(reg)) {