Home | History | Annotate | Download | only in doclava
      1 /*
      2  * Copyright (C) 2011 Google Inc.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  * http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.google.doclava;
     18 
     19 import java.io.BufferedReader;
     20 import java.io.FileReader;
     21 import java.util.ArrayList;
     22 
     23 public class Doclava2 {
     24     private static final boolean DEBUG_MODE = false;
     25     public static void main(String args[]) throws Exception {
     26         if (DEBUG_MODE) {
     27             ArrayList<String> files = new ArrayList<String>();
     28             files.add("frameworks/base/core/java/android/preference/VolumePreference.java");
     29             files.add("frameworks/base/core/java/android/preference/SeekBarDialogPreference.java");
     30             files.add("frameworks/base/core/java/android/view/ViewGroup.java");
     31             files.add("frameworks/base/core/java/android/widget/FrameLayout.java");
     32             files.add("frameworks/base/core/java/android/widget/DatePicker.java");
     33             files.add("frameworks/base/core/java/android/widget/GridLayout.java");
     34 
     35             for (String filename : files) {
     36                 InfoBuilder infoBuilder = new InfoBuilder(filename);
     37                 System.out.println(filename);
     38                 infoBuilder.parseFile();
     39             }
     40 
     41             ClassInfo cl = InfoBuilder.Caches.getClass("android.preference.VolumePreference");
     42             if (cl != null) {
     43                 InfoBuilder.printClassInfo(cl);
     44 
     45                 InfoBuilder.resolve();
     46                 cl.printResolutions();
     47             } else {
     48                 System.out.println("You're looking for a class that does not exist.");
     49             }
     50         } else {
     51             BufferedReader buf = new BufferedReader(new FileReader(args[0]));
     52 
     53             String line = buf.readLine();
     54 
     55             ArrayList<String> files = new ArrayList<String>();
     56             while (line != null) {
     57                 String[] names = line.split(" ");
     58 
     59                 for (String name : names) {
     60                     files.add(name);
     61                 }
     62 
     63                 line = buf.readLine();
     64             }
     65 
     66             for (String filename : files) {
     67                 InfoBuilder infoBuilder = new InfoBuilder(filename);
     68                 System.out.println(filename);
     69                 infoBuilder.parseFile();
     70             }
     71 
     72             InfoBuilder.resolve();
     73 
     74 
     75             System.out.println("\n\n\n\n\n\n\n");
     76             System.out.println("************************************************");
     77 
     78             InfoBuilder.Caches.printResolutions();
     79 
     80             System.out.println("************************************************");
     81 
     82             InfoBuilder.resolve();
     83             InfoBuilder.Caches.printResolutions();
     84         }
     85     }
     86 }