blob: e270d973bce5e5bd2b10fb9a6bfcc4009916bcdd [file] [log] [blame]
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.anttargetprint;
import java.io.File;
import java.util.List;
import java.util.Map.Entry;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
if (args.length != 1) {
System.err.println("USAGE: <prog> [FILE]");
System.exit(1);
}
try {
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
BuildXmlHandler handler = new BuildXmlHandler();
parser.parse(new File(args[0]), handler);
for (Entry<String, List<String>> entry : handler.processTargets().entrySet()) {
String name = entry.getKey();
if (name.charAt(0) != '-') {
System.out.print(entry.getKey());
System.out.print(" : ");
for (String v : entry.getValue()) {
System.out.print(v);
System.out.print(" > ");
}
System.out.println();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}