blob: 308ec8d6d924d59a77b2c626f3dc7b2da128e22f [file] [log] [blame]
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var args = process.argv;
var Api = require('./Api');
var nopt = require('nopt');
var path = require('path');
// Handle help flag
if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) > -1) {
console.log('\nUsage: run [ --device | --emulator | --target=<id> ] [ --debug | --release | --nobuild ]');
console.log(' [ --x86 | --x64 | --arm | --archs="list" ] [--bundle] [--phone | --win]');
console.log(' --device : Deploys and runs the project on the connected device.');
console.log(' --emulator : Deploys and runs the project on an emulator.');
console.log(' --target=<id> : Deploys and runs the project on the specified target.');
console.log(' --debug : Builds project in debug mode.');
console.log(' --release : Builds project in release mode.');
console.log(' --nobuild : Uses pre-built package, or errors if project is not built.');
console.log(' --archs : Specific chip architectures (`anycpu`, `arm`, `x86`, `x64`).');
console.log(' Separate multiple choices with a space and, if choosing');
console.log(' multiple choices, enclose in quotes (").');
console.log(' --bundle : Generates an .appxbundle. Not valid if anycpu AND chip-specific');
console.log(' architectures are used.');
console.log(' --phone, --win');
console.log(' : Specifies project type to deploy');
console.log(' --appx=<8.1-win|8.1-phone|uap|uwp>');
console.log(' : Overrides windows-target-version to build Windows 8.1, ');
console.log(' Windows Phone 8.1, or Windows 10.');
console.log(' --win10tools : Uses Windows 10 deployment tools (used for a Windows 8.1 app when');
console.log(' being deployed to a Windows 10 device)');
console.log('Examples:');
console.log(' run');
console.log(' run --emulator');
console.log(' run --device');
console.log(' run --target=7988B8C3-3ADE-488d-BA3E-D052AC9DC710');
console.log(' run --device --release');
console.log(' run --emulator --debug');
console.log(' run --archs="x64 x86 arm" --no-bundle');
console.log(' run --device --appx=phone-8.1');
console.log(' run --device --archs="x64 x86 arm"');
console.log('');
process.exit(0);
}
// Do some basic argument parsing
var runOpts = nopt({
silent: Boolean,
verbose: Boolean,
debug: Boolean,
release: Boolean,
nobuild: Boolean,
device: Boolean,
emulator: Boolean,
target: String,
buildConfig: path
}, { d: '--verbose', r: '--release' });
// Make buildOptions compatible with PlatformApi build method spec
runOpts.argv = runOpts.argv.original;
require('./lib/loggingHelper').adjustLoggerLevel(runOpts);
new Api().run(runOpts).catch(err => {
console.error(err);
process.exit(2);
});