Example #1
0
  /** The main method for ProGuard. */
  public static void main(String[] args) {
    if (args.length == 0) {
      System.out.println(VERSION);
      System.out.println("Usage: java proguard.ProGuard [options ...]");
      System.exit(1);
    }

    // Create the default options.
    Configuration configuration = new Configuration();

    try {
      // Parse the options specified in the command line arguments.
      ConfigurationParser parser = new ConfigurationParser(args);

      try {
        parser.parse(configuration);
      } finally {
        parser.close();
      }

      // Execute ProGuard with these options.
      new ProGuard(configuration).execute();
    } catch (Exception ex) {
      if (configuration.verbose) {
        // Print a verbose stack trace.
        ex.printStackTrace();
      } else {
        // Print just the stack trace message.
        System.err.println("Error: " + ex.getMessage());
      }

      System.exit(1);
    }

    System.exit(0);
  }