Making dependency display optional.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@4375 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/tools/soyc-vis/src/com/google/gwt/soyc/GlobalInformation.java b/tools/soyc-vis/src/com/google/gwt/soyc/GlobalInformation.java
index 0107569..bdba9be 100644
--- a/tools/soyc-vis/src/com/google/gwt/soyc/GlobalInformation.java
+++ b/tools/soyc-vis/src/com/google/gwt/soyc/GlobalInformation.java
@@ -24,6 +24,8 @@
public class GlobalInformation {
+ public static Boolean displayDependencies = false;
+
public static int allOtherFragmentsPartialSize = 0;
public static HashMap<String, String> classToPackage = new HashMap<String, String>();
public static HashMap<String, Float> classToPartialSize = new HashMap<String, Float>();
diff --git a/tools/soyc-vis/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java b/tools/soyc-vis/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java
index 1d1a58c..7712e0b 100644
--- a/tools/soyc-vis/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java
+++ b/tools/soyc-vis/src/com/google/gwt/soyc/MakeTopLevelHtmlForPerm.java
@@ -1286,8 +1286,9 @@
}
for (String classOrMethod : sortedClassesAndMethods){
+
//if it's a method
- if ((classOrMethod.contains("("))&&(classOrMethod.contains(")"))){
+ if ((GlobalInformation.displayDependencies == true)&&(classOrMethod.contains("("))&&(classOrMethod.contains(")"))){
//get the package
String packageName = classOrMethod;
packageName = packageName.replaceAll("\\.\\p{Upper}.*", "");
@@ -1361,7 +1362,7 @@
for (String classOrMethod : sortedClassesAndMethodsAllOtherFragments){
//if it's a method
- if ((classOrMethod.contains("("))&&(classOrMethod.contains(")"))){
+ if ((GlobalInformation.displayDependencies == true)&&(classOrMethod.contains("("))&&(classOrMethod.contains(")"))){
//get the package
String packageName = classOrMethod;
packageName = packageName.replaceAll("\\.\\p{Upper}.*", "");
diff --git a/tools/soyc-vis/src/com/google/gwt/soyc/SoycDashboard.java b/tools/soyc-vis/src/com/google/gwt/soyc/SoycDashboard.java
index 5953fa4..4afe351 100644
--- a/tools/soyc-vis/src/com/google/gwt/soyc/SoycDashboard.java
+++ b/tools/soyc-vis/src/com/google/gwt/soyc/SoycDashboard.java
@@ -39,49 +39,62 @@
*/
public static void main(String[] args) {
- if (args.length != 2){
- System.err.println("Usage: java com/google/gwt/soyc/SoycDashboard soyc-report0.xml[.gz] soyc-dependencies0.xml[.gz]");
+ String inFileName = "";
+ String depInFileName = "";
+ if ((args.length != 1) && (args.length != 2)){
+
+ if (args.length == 1){
+ GlobalInformation.displayDependencies = false;
+ }
+ else{
+ GlobalInformation.displayDependencies = true;
+ depInFileName = args[1];
+ }
+
+ System.err.println("Usage: java com/google/gwt/soyc/SoycDashboard soyc-report0.xml[.gz] soyc-dependencies0.xml[.gz] OR java com/google/gwt/soyc/SoycDashboard soyc-report0.xml[.gz]");
System.exit(1);
}
- String inFileName = args[0];
- String depInFileName = args[1];
+ inFileName = args[0];
- /**
- * handle dependencies
- */
-
- Map<String, ArrayList<String>> dependencies = new TreeMap<String, ArrayList<String>>();
- DefaultHandler depHandler = parseXMLDocumentDependencies(dependencies);
- // start parsing
- SAXParserFactory depFactoryMain = SAXParserFactory.newInstance();
- depFactoryMain.setNamespaceAware(true);
- try {
- SAXParser saxParser = depFactoryMain.newSAXParser();
- InputStream in = new FileInputStream(depInFileName);
- if (depInFileName.endsWith(".gz")) {
- in = new GZIPInputStream(in);
+
+ if (GlobalInformation.displayDependencies == true){
+ /**
+ * handle dependencies
+ */
+
+ Map<String, ArrayList<String>> dependencies = new TreeMap<String, ArrayList<String>>();
+ DefaultHandler depHandler = parseXMLDocumentDependencies(dependencies);
+
+ // start parsing
+ SAXParserFactory depFactoryMain = SAXParserFactory.newInstance();
+ depFactoryMain.setNamespaceAware(true);
+ try {
+ SAXParser saxParser = depFactoryMain.newSAXParser();
+ InputStream in = new FileInputStream(depInFileName);
+ if (depInFileName.endsWith(".gz")) {
+ in = new GZIPInputStream(in);
+ }
+ in = new BufferedInputStream(in);
+ saxParser.parse(in,depHandler);
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException("Could not parse document. ", e);
+ } catch (SAXException e) {
+ throw new RuntimeException("Could not create SAX parser. ", e);
+ } catch (FileNotFoundException e) {
+ throw new RuntimeException("Could not open file. ", e);
+ } catch (IOException e) {
+ throw new RuntimeException("Could not open file. ", e);
}
- in = new BufferedInputStream(in);
- saxParser.parse(in,depHandler);
- } catch (ParserConfigurationException e) {
- throw new RuntimeException("Could not parse document. ", e);
- } catch (SAXException e) {
- throw new RuntimeException("Could not create SAX parser. ", e);
- } catch (FileNotFoundException e) {
- throw new RuntimeException("Could not open file. ", e);
- } catch (IOException e) {
- throw new RuntimeException("Could not open file. ", e);
+
+ try{
+ MakeTopLevelHtmlForPerm.makeDependenciesHtml(dependencies);
+ } catch (IOException e) {
+ throw new RuntimeException("Cannot open file. ", e);
+ }
}
- try{
- MakeTopLevelHtmlForPerm.makeDependenciesHtml(dependencies);
- } catch (IOException e) {
- throw new RuntimeException("Cannot open file. ", e);
- }
-
-
/**
* handle everything else
*/