Methods Summary |
---|
public java.util.Set | getMainDexList()Returns a list of classes to keep. This can be passed to dx as a file with --main-dex-list.
return filesToKeep;
|
private boolean | hasRuntimeVisibleAnnotation(com.android.dx.cf.iface.HasAttribute element)
Attribute att = element.getAttributes().findFirst(
AttRuntimeVisibleAnnotations.ATTRIBUTE_NAME);
return (att != null && ((AttRuntimeVisibleAnnotations)att).getAnnotations().size()>0);
|
private void | keepAnnotated(Path path)Keep classes annotated with runtime annotations.
for (ClassPathElement element : path.getElements()) {
forClazz:
for (String name : element.list()) {
if (name.endsWith(CLASS_EXTENSION)) {
DirectClassFile clazz = path.getClass(name);
if (hasRuntimeVisibleAnnotation(clazz)) {
filesToKeep.add(name);
} else {
MethodList methods = clazz.getMethods();
for (int i = 0; i<methods.size(); i++) {
if (hasRuntimeVisibleAnnotation(methods.get(i))) {
filesToKeep.add(name);
continue forClazz;
}
}
FieldList fields = clazz.getFields();
for (int i = 0; i<fields.size(); i++) {
if (hasRuntimeVisibleAnnotation(fields.get(i))) {
filesToKeep.add(name);
continue forClazz;
}
}
}
}
}
}
|
public static void | main(java.lang.String[] args)
if (args.length != 2) {
printUsage();
System.exit(STATUS_ERROR);
}
try {
MainDexListBuilder builder = new MainDexListBuilder(args[0], args[1]);
Set<String> toKeep = builder.getMainDexList();
printList(toKeep);
} catch (IOException e) {
System.err.println("A fatal error occured: " + e.getMessage());
System.exit(STATUS_ERROR);
return;
}
|
private static void | printList(java.util.Set fileNames)
for (String fileName : fileNames) {
System.out.println(fileName);
}
|
private static void | printUsage()
System.err.print(USAGE_MESSAGE);
|