stop when incompatible platform or unknown arch

This commit is contained in:
Igor Klopov 2016-09-04 16:09:48 +03:00
parent ba9c8eb483
commit c965ffe7fd

View File

@ -1,6 +1,6 @@
import * as system from './system.js';
import { abiToNodeRange, // eslint-disable-line no-duplicate-imports
toFancyArch, toFancyPlatform } from './system.js';
hostPlatform, knownArchs, toFancyArch, toFancyPlatform } from './system.js';
import { localPlace, remotePlace } from './places.js';
import { log, wasReported } from './log.js';
import build from './build.js';
@ -54,8 +54,15 @@ export async function need ({
if (await download(remote, downloaded)) return downloaded;
downloadFailed = true;
}
if (downloadFailed) log.info('Not found in GitHub releases. Building from source...');
if (forceBuild) log.info('Building base binary from source:', path.basename(built));
if (downloadFailed) log.info('Not found in GitHub releases');
log.info('Building base binary from source:', path.basename(built));
if (hostPlatform !== platform) {
throw wasReported(`Not able to build for '${platform}' here, only for '${hostPlatform}'`);
}
if (knownArchs.indexOf(arch) < 0) {
throw wasReported(`Unknown arch '${arch}'. Specify ${knownArchs.join(', ')}`);
}
await build(nodeVersion, arch, built);
return built;
}