@@ -0,0 +1,1752 @@
+// Copyright 2014 Google Inc. All rights reserved.%0A//%0A// Licensed under the Apache License, Version 2.0 (the %22License%22);%0A// you may not use this file except in compliance with the License.%0A// You may obtain a copy of the License at%0A//%0A//    http://www.apache.org/licenses/LICENSE-2.0%0A//%0A// Unless required by applicable law or agreed to in writing, software%0A// distributed under the License is distributed on an %22AS IS%22 BASIS,%0A// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A// See the License for the specific language governing permissions and%0A// limitations under the License.%0Apackage com.google.devtools.build.docgen;%0A%0Aimport com.google.devtools.build.lib.Constants;%0Aimport com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider;%0Aimport com.google.devtools.build.lib.packages.RuleClass;%0Aimport com.google.devtools.build.lib.packages.RuleClassProvider;%0A%0Aimport java.lang.reflect.InvocationTargetException;%0Aimport java.lang.reflect.Method;%0Aimport java.util.Map;%0A%0A/**%0A * Prints out list of known rules.%0A */%0Apublic class ListRuleMain %7B%0A%0A  private static ConfiguredRuleClassProvider createRuleClassProvider()%0A      throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,%0A          IllegalAccessException %7B%0A    Class%3C?%3E providerClass = Class.forName(Constants.MAIN_RULE_CLASS_PROVIDER);%0A    Method createMethod = providerClass.getMethod(%22create%22);%0A    return (ConfiguredRuleClassProvider) createMethod.invoke(null);%0A  %7D%0A%0A  public static void main(String%5B%5D args) throws Exception %7B%0A    RuleClassProvider provider = createRuleClassProvider();%0A    Map%3CString, RuleClass%3E rcMap = provider.getRuleClassMap();%0A    for (String name : rcMap.keySet()) %7B%0A      System.out.println(name);%0A    %7D%0A  %7D%0A%7D%0A

Add main to print list of rules.