com.android.dx.command.UsageException Java Examples
The following examples show how to use
com.android.dx.command.UsageException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Main.java From Box with Apache License 2.0 | 5 votes |
/** * Checks the current argument against the given prefix. * If prefix is in the form '--name=', an extra value is expected. * The argument can then be in the form '--name=value' or as a 2-argument * form '--name value'. */ public boolean isArg(String prefix) { int n = prefix.length(); if (n > 0 && prefix.charAt(n-1) == '=') { // Argument accepts a value. Capture it. if (current.startsWith(prefix)) { // Argument is in the form --name=value, split the value out lastValue = current.substring(n); return true; } else { // Check whether we have "--name value" as 2 arguments prefix = prefix.substring(0, n-1); if (current.equals(prefix)) { if (getNextValue()) { lastValue = current; return true; } else { System.err.println("Missing value after parameter " + prefix); throw new UsageException(); } } return false; } } else { // Argument does not accept a value. return current.equals(prefix); } }
Example #2
Source File: Main.java From Box with Apache License 2.0 | 5 votes |
/** * Checks the current argument against the given prefix. * If prefix is in the form '--name=', an extra value is expected. * The argument can then be in the form '--name=value' or as a 2-argument * form '--name value'. */ public boolean isArg(String prefix) { int n = prefix.length(); if (n > 0 && prefix.charAt(n-1) == '=') { // Argument accepts a value. Capture it. if (current.startsWith(prefix)) { // Argument is in the form --name=value, split the value out lastValue = current.substring(n); return true; } else { // Check whether we have "--name value" as 2 arguments prefix = prefix.substring(0, n-1); if (current.equals(prefix)) { if (getNextValue()) { lastValue = current; return true; } else { System.err.println("Missing value after parameter " + prefix); throw new UsageException(); } } return false; } } else { // Argument does not accept a value. return current.equals(prefix); } }
Example #3
Source File: Main.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** * Checks the current argument against the given prefix. * If prefix is in the form '--name=', an extra value is expected. * The argument can then be in the form '--name=value' or as a 2-argument * form '--name value'. */ public boolean isArg(String prefix) { int n = prefix.length(); if (n > 0 && prefix.charAt(n-1) == '=') { // Argument accepts a value. Capture it. if (current.startsWith(prefix)) { // Argument is in the form --name=value, split the value out lastValue = current.substring(n); return true; } else { // Check whether we have "--name value" as 2 arguments prefix = prefix.substring(0, n-1); if (current.equals(prefix)) { if (getNextValue()) { lastValue = current; return true; } else { System.err.println("Missing value after parameter " + prefix); throw new UsageException(); } } return false; } } else { // Argument does not accept a value. return current.equals(prefix); } }
Example #4
Source File: Main.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** * Parses all command-line arguments and updates the state of the {@code Arguments} object * accordingly. * * @param args {@code non-null;} the arguments */ private void parse(String[] args) { ArgumentsParser parser = new ArgumentsParser(args); parseFlags(parser); fileNames = parser.getRemaining(); if(inputList != null && !inputList.isEmpty()) { // append the file names to the end of the input list inputList.addAll(Arrays.asList(fileNames)); fileNames = inputList.toArray(new String[inputList.size()]); } if (fileNames.length == 0) { if (!emptyOk) { context.err.println("no input files specified"); throw new UsageException(); } } else if (emptyOk) { context.out.println("ignoring input files"); } if ((humanOutName == null) && (methodToDump != null)) { humanOutName = "-"; } if (outputIsDirectory) { outName = new File(outName, DexFormat.DEX_IN_JAR_NAME).getPath(); } makeOptionsObjects(); }
Example #5
Source File: Main.java From buck with Apache License 2.0 | 5 votes |
/** * Checks the current argument against the given prefix. * If prefix is in the form '--name=', an extra value is expected. * The argument can then be in the form '--name=value' or as a 2-argument * form '--name value'. */ public boolean isArg(String prefix) { int n = prefix.length(); if (n > 0 && prefix.charAt(n-1) == '=') { // Argument accepts a value. Capture it. if (current.startsWith(prefix)) { // Argument is in the form --name=value, split the value out lastValue = current.substring(n); return true; } else { // Check whether we have "--name value" as 2 arguments prefix = prefix.substring(0, n-1); if (current.equals(prefix)) { if (getNextValue()) { lastValue = current; return true; } else { err.println("Missing value after parameter " + prefix); throw new UsageException(); } } return false; } } else { // Argument does not accept a value. return current.equals(prefix); } }
Example #6
Source File: Main.java From Box with Apache License 2.0 | 4 votes |
/** * Parses all command-line arguments and updates the state of the {@code Arguments} object * accordingly. * * @param args {@code non-null;} the arguments */ private void parse(String[] args) { ArgumentsParser parser = new ArgumentsParser(args); parseFlags(parser); fileNames = parser.getRemaining(); if(inputList != null && !inputList.isEmpty()) { // append the file names to the end of the input list inputList.addAll(Arrays.asList(fileNames)); fileNames = inputList.toArray(new String[inputList.size()]); } if (fileNames.length == 0) { if (!emptyOk) { context.err.println("no input files specified"); throw new UsageException(); } } else if (emptyOk) { context.out.println("ignoring input files"); } if ((humanOutName == null) && (methodToDump != null)) { humanOutName = "-"; } if (mainDexListFile != null && !multiDex) { context.err.println(MAIN_DEX_LIST_OPTION + " is only supported in combination with " + MULTI_DEX_OPTION); throw new UsageException(); } if (minimalMainDex && (mainDexListFile == null || !multiDex)) { context.err.println(MINIMAL_MAIN_DEX_OPTION + " is only supported in combination with " + MULTI_DEX_OPTION + " and " + MAIN_DEX_LIST_OPTION); throw new UsageException(); } if (multiDex && incremental) { context.err.println(INCREMENTAL_OPTION + " is not supported with " + MULTI_DEX_OPTION); throw new UsageException(); } if (multiDex && outputIsDirectDex) { context.err.println("Unsupported output \"" + outName +"\". " + MULTI_DEX_OPTION + " supports only archive or directory output"); throw new UsageException(); } if (outputIsDirectory && !multiDex) { outName = new File(outName, DexFormat.DEX_IN_JAR_NAME).getPath(); } makeOptionsObjects(); }
Example #7
Source File: Main.java From Box with Apache License 2.0 | 4 votes |
/** * Parses all command-line arguments and updates the state of the {@code Arguments} object * accordingly. * * @param args {@code non-null;} the arguments */ private void parse(String[] args) { ArgumentsParser parser = new ArgumentsParser(args); parseFlags(parser); fileNames = parser.getRemaining(); if(inputList != null && !inputList.isEmpty()) { // append the file names to the end of the input list inputList.addAll(Arrays.asList(fileNames)); fileNames = inputList.toArray(new String[inputList.size()]); } if (fileNames.length == 0) { if (!emptyOk) { context.err.println("no input files specified"); throw new UsageException(); } } else if (emptyOk) { context.out.println("ignoring input files"); } if ((humanOutName == null) && (methodToDump != null)) { humanOutName = "-"; } if (mainDexListFile != null && !multiDex) { context.err.println(MAIN_DEX_LIST_OPTION + " is only supported in combination with " + MULTI_DEX_OPTION); throw new UsageException(); } if (minimalMainDex && (mainDexListFile == null || !multiDex)) { context.err.println(MINIMAL_MAIN_DEX_OPTION + " is only supported in combination with " + MULTI_DEX_OPTION + " and " + MAIN_DEX_LIST_OPTION); throw new UsageException(); } if (multiDex && incremental) { context.err.println(INCREMENTAL_OPTION + " is not supported with " + MULTI_DEX_OPTION); throw new UsageException(); } if (multiDex && outputIsDirectDex) { context.err.println("Unsupported output \"" + outName +"\". " + MULTI_DEX_OPTION + " supports only archive or directory output"); throw new UsageException(); } if (outputIsDirectory && !multiDex) { outName = new File(outName, DexFormat.DEX_IN_JAR_NAME).getPath(); } makeOptionsObjects(); }
Example #8
Source File: Main.java From buck with Apache License 2.0 | 4 votes |
/** * Parses all command-line arguments. * * @param args {@code non-null;} the arguments * @param context */ public void parseCommandLine(String[] args, DxContext context) { ArgumentsParser parser = new ArgumentsParser(args); OutputOptions outputOptions = parseFlags(parser); fileNames = parser.getRemaining(); if(inputList != null && !inputList.isEmpty()) { // append the file names to the end of the input list inputList.addAll(Arrays.asList(fileNames)); fileNames = inputList.toArray(new String[0]); } if (fileNames.length == 0) { if (!emptyOk) { err.println("no input files specified"); throw new UsageException(); } } else if (emptyOk) { out.println("ignoring input files"); } if ((humanOutName == null) && (methodToDump != null)) { humanOutName = "-"; } if (mainDexListFile != null && !multiDex) { err.println(MAIN_DEX_LIST_OPTION + " is only supported in combination with " + MULTI_DEX_OPTION); throw new UsageException(); } if (minimalMainDex && (mainDexListFile == null || !multiDex)) { err.println(MINIMAL_MAIN_DEX_OPTION + " is only supported in combination with " + MULTI_DEX_OPTION + " and " + MAIN_DEX_LIST_OPTION); throw new UsageException(); } if (multiDex && incremental) { err.println(INCREMENTAL_OPTION + " is not supported with " + MULTI_DEX_OPTION); throw new UsageException(); } if (multiDex && outputOptions.outputIsDirectDex) { err.println("Unsupported output \"" + outName +"\". " + MULTI_DEX_OPTION + " supports only archive or directory output"); throw new UsageException(); } if (outputOptions.outputIsDirectory && !multiDex) { outName = new File(outName, DexFormat.DEX_IN_JAR_NAME).getPath(); } makeOptionsObjects(context); }