refactor: unify target resolution for devices & emulators (#1101)

* refactor: unify target resolution for devices & emulators
* fix: use unified target methods in platform-centric bins
This commit is contained in:
Raphael von der Grün
2021-04-09 08:37:56 +02:00
committed by GitHub
parent c774bf3311
commit c04ea9b1c0
11 changed files with 339 additions and 466 deletions
+5 -5
View File
@@ -19,21 +19,21 @@
under the License.
*/
const { install } = require('./target');
var device = require('./device');
const { resolve, install } = require('./target');
var args = process.argv;
const targetSpec = { type: 'device' };
if (args.length > 2) {
var install_target;
if (args[2].substring(0, 9) === '--target=') {
install_target = args[2].substring(9, args[2].length);
targetSpec.id = args[2].substring(9, args[2].length);
} else {
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
process.exit(2);
}
}
device.resolveTarget(install_target).then(install).catch(err => {
resolve(targetSpec).then(install).catch(err => {
console.error('ERROR: ' + err);
process.exit(2);
});