1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-27 02:05:21 +03:00

Fix release chromeos

This commit is contained in:
Miguel Angel Mulero Martinez 2018-01-08 11:37:32 +01:00
parent bad1a8b70b
commit 6b6a49a39a

View file

@ -30,18 +30,14 @@ var releaseDir = './release/';
// # // #
// # gulp <task> [<platform>]+ Run only for platform(s) (with <platform> one of --linux64, --linux32, --osx64, --win32, --win64, or --chromeos) // # gulp <task> [<platform>]+ Run only for platform(s) (with <platform> one of --linux64, --linux32, --osx64, --win32, --win64, or --chromeos)
// # // #
function getPlatforms(includeChromeOs) { function getPlatforms() {
var supportedPlatforms = ['linux64', 'linux32', 'osx64', 'win32','win64']; var supportedPlatforms = ['linux64', 'linux32', 'osx64', 'win32','win64', 'chromeos'];
var platforms = []; var platforms = [];
var regEx = /--(\w+)/; var regEx = /--(\w+)/;
for (var i = 3; i < process.argv.length; i++) { for (var i = 3; i < process.argv.length; i++) {
var arg = process.argv[i].match(regEx)[1]; var arg = process.argv[i].match(regEx)[1];
if (supportedPlatforms.indexOf(arg) > -1) { if (supportedPlatforms.indexOf(arg) > -1) {
platforms.push(arg); platforms.push(arg);
} else if (arg === 'chromeos') {
if (includeChromeOs) {
platforms.push(arg);
}
} else { } else {
console.log('Unknown platform: ' + arg); console.log('Unknown platform: ' + arg);
process.exit(); process.exit();
@ -53,12 +49,17 @@ function getPlatforms(includeChromeOs) {
if (supportedPlatforms.indexOf(defaultPlatform) > -1) { if (supportedPlatforms.indexOf(defaultPlatform) > -1) {
platforms.push(defaultPlatform); platforms.push(defaultPlatform);
} else { } else {
console.log(`Your current platform (${os.platform()}) is not a supported build platform. Please specify platform to build for on the command line.`); console.error(`Your current platform (${os.platform()}) is not a supported build platform. Please specify platform to build for on the command line.`);
process.exit(); process.exit();
} }
} }
if (platforms.length > 0) {
console.log('Building for platform(s): ' + platforms + '.'); console.log('Building for platform(s): ' + platforms + '.');
} else {
console.error('No suitables platforms found.');
process.exit();
}
return platforms; return platforms;
} }
@ -88,6 +89,13 @@ function getDefaultPlatform() {
return defaultPlatform; return defaultPlatform;
} }
function removeItem(platforms, item) {
var index = platforms.indexOf(item);
if (index >= 0) {
platforms.splice(index, 1);
}
}
function getRunDebugAppCommand(arch) { function getRunDebugAppCommand(arch) {
switch (arch) { switch (arch) {
case 'osx64': case 'osx64':
@ -282,8 +290,10 @@ gulp.task('dist', ['clean-dist'], function () {
// Create runable app directories in ./apps // Create runable app directories in ./apps
gulp.task('apps', ['dist', 'clean-apps'], function (done) { gulp.task('apps', ['dist', 'clean-apps'], function (done) {
var platforms = getPlatforms(); var platforms = getPlatforms();
console.log('Release build.'); removeItem(platforms, 'chromeos');
console.log('Apps build.');
if (platforms.length > 0) {
var builder = new NwBuilder({ var builder = new NwBuilder({
files: './dist/**/*', files: './dist/**/*',
buildDir: appsDir, buildDir: appsDir,
@ -303,13 +313,19 @@ gulp.task('apps', ['dist', 'clean-apps'], function (done) {
} }
done(); done();
}); });
} else {
console.log('No platform suitable for the apps task')
done();
}
}); });
// Create debug app directories in ./debug // Create debug app directories in ./debug
gulp.task('debug', ['dist', 'clean-debug'], function (done) { gulp.task('debug', ['dist', 'clean-debug'], function (done) {
var platforms = getPlatforms(); var platforms = getPlatforms();
removeItem(platforms, 'chromeos');
console.log('Debug build.'); console.log('Debug build.');
if (platforms.length > 0) {
var builder = new NwBuilder({ var builder = new NwBuilder({
files: './dist/**/*', files: './dist/**/*',
buildDir: debugDir, buildDir: debugDir,
@ -337,6 +353,10 @@ gulp.task('debug', ['dist', 'clean-debug'], function (done) {
} }
done(); done();
}); });
} else {
console.error('No platform suitable for the debug task')
done();
}
}); });
// Create installer package for windows platforms // Create installer package for windows platforms
@ -434,7 +454,7 @@ gulp.task('release', ['apps', 'clean-release'], function () {
} }
}); });
var platforms = getPlatforms(true); var platforms = getPlatforms();
console.log('Packing release.'); console.log('Packing release.');
if (platforms.indexOf('chromeos') !== -1) { if (platforms.indexOf('chromeos') !== -1) {