public static void main(String[] args) { CFGViewer viewer = new CFGViewer(); Transform printTransform = new Transform(phaseFullname, viewer); printTransform.setDeclaredOptions("enabled " + altClassPathOptionName + ' ' + graphTypeOptionName + ' ' + irOptionName + ' ' + multipageOptionName + ' ' + briefLabelOptionName + ' '); printTransform.setDefaultOptions( "enabled " + altClassPathOptionName + ": " + graphTypeOptionName + ':' + defaultGraph + ' ' + irOptionName + ':' + defaultIR + ' ' + multipageOptionName + ":false " + ' ' + briefLabelOptionName + ":false "); PackManager.v().getPack("jtp").add(printTransform); args = viewer.parse_options(args); if (args.length == 0) { usage(); } else { soot.Main.main(args); } }
/** * Loads the phase plugin and adds it to PackManager. * * @param pluginDescription * the plugin description instance read from configuration file. */ private static void handlePhasePlugin(final PhasePluginDescription pluginDescription) { try { final Object instance = PluginLoader.loadStrategy.create(pluginDescription.getClassName()); if (!(instance instanceof SootPhasePlugin)) { throw new RuntimeException( "The plugin class '" + pluginDescription.getClassName() + "' does not implement SootPhasePlugin."); } final SootPhasePlugin phasePlugin = (SootPhasePlugin) instance; phasePlugin.setDescription(pluginDescription); final String packName = getPackName(pluginDescription.getPhaseName()); Transform transform = new Transform(pluginDescription.getPhaseName(), phasePlugin.getTransformer()); transform.setDeclaredOptions(concat(appendEnabled(phasePlugin.getDeclaredOptions()))); transform.setDefaultOptions(concat(phasePlugin.getDefaultOptions())); PackManager.v().getPack(packName).add(transform); } catch (final ClassNotFoundException e) { throw new RuntimeException("Failed to load plugin class for " + pluginDescription + ".", e); } catch (final InstantiationException e) { throw new RuntimeException("Failed to instanciate plugin class for " + pluginDescription + ".", e); } }