From bbe108e55e0adb8ac794fd07c75a7ec23f68cb15 Mon Sep 17 00:00:00 2001 From: Paul Stresow Date: Wed, 9 Jan 2019 09:39:46 +0100 Subject: [PATCH] added error handling version bump to 1.0.1 --- package.json | 2 +- plugin.xml | 2 +- scripts/apply.js | 34 +++++++++++++++++++--------------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index a488bbc..db6d3eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-abi-filter", - "version": "1.0.0", + "version": "1.0.1", "description": "Specify supported platform ABIs for your android build", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/plugin.xml b/plugin.xml index 13bd256..df1c1df 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ - + cordova-plugin-abi-filter Filter desired platform ABIs from your project build. Apache 2.0 License diff --git a/scripts/apply.js b/scripts/apply.js index 576913d..820d462 100644 --- a/scripts/apply.js +++ b/scripts/apply.js @@ -48,23 +48,27 @@ module.exports = function (context) { //Variables can come from 3 different places - //plugin.xml - //Prio 3 - default if user did not specify cli args or if plugin is just added - if (context.opts.plugin.pluginInfo.getPreferences().ABI_FILTER) { - abi_values = context.opts.plugin.pluginInfo.getPreferences().ABI_FILTER - } + try{ + //plugin.xml + //Prio 3 - default if user did not specify cli args or if plugin is just added + if (context.opts.plugin.pluginInfo.getPreferences().ABI_FILTER) { + abi_values = context.opts.plugin.pluginInfo.getPreferences().ABI_FILTER + } - //CLI Arg - //Prio 2 - is present when plugin is added with --variable ABI_FILTER="a|b|c" - if (context.opts.cli_variables && context.opts.cli_variables.ABI_FILTER) { - abi_values = context.opts.cli_variables.ABI_FILTER - } + //CLI Arg + //Prio 2 - is present when plugin is added with --variable ABI_FILTER="a|b|c" + if (context.opts.cli_variables && context.opts.cli_variables.ABI_FILTER) { + abi_values = context.opts.cli_variables.ABI_FILTER + } - //config.xml - //Prio 1 - plugin was already added or user added key to config.xml manually - const configFile = new common.ConfigParser(utils.projectConfig(projectRoot)) - if (configFile.getPlugin(context.opts.plugin.id).variables.ABI_FILTER) { - abi_values = configFile.getPlugin(context.opts.plugin.id).variables.ABI_FILTER + //config.xml + //Prio 1 - plugin was already added or user added key to config.xml manually + const configFile = new common.ConfigParser(utils.projectConfig(projectRoot)) + if (configFile.getPlugin(context.opts.plugin.id).variables.ABI_FILTER) { + abi_values = configFile.getPlugin(context.opts.plugin.id).variables.ABI_FILTER + } + } catch(error){ + console.warn("Using defaults: " + abi_values); } //parse them values to a gradle readable string