Search in sources :

Example 1 with ClsSet

use of jadx.core.clsp.ClsSet in project jadx by skylot.

the class ConvertToClsSet method main.

public static void main(String[] args) throws Exception {
    if (args.length < 2) {
        usage();
        System.exit(1);
    }
    List<Path> inputPaths = Stream.of(args).map(Paths::get).collect(Collectors.toList());
    Path output = inputPaths.remove(0);
    JadxPluginManager pluginManager = new JadxPluginManager();
    pluginManager.load();
    List<ILoadResult> loadedInputs = new ArrayList<>();
    for (JadxInputPlugin inputPlugin : pluginManager.getInputPlugins()) {
        loadedInputs.add(inputPlugin.loadFiles(inputPaths));
    }
    JadxArgs jadxArgs = new JadxArgs();
    jadxArgs.setRenameFlags(EnumSet.noneOf(JadxArgs.RenameEnum.class));
    RootNode root = new RootNode(jadxArgs);
    root.loadClasses(loadedInputs);
    // from pre-decompilation stage run only SignatureProcessor
    SignatureProcessor signatureProcessor = new SignatureProcessor();
    signatureProcessor.init(root);
    for (ClassNode classNode : root.getClasses()) {
        signatureProcessor.visit(classNode);
    }
    ClsSet set = new ClsSet(root);
    set.loadFrom(root);
    set.save(output);
    LOG.info("Output: {}", output);
    LOG.info("done");
}
Also used : Path(java.nio.file.Path) RootNode(jadx.core.dex.nodes.RootNode) ClassNode(jadx.core.dex.nodes.ClassNode) ClsSet(jadx.core.clsp.ClsSet) ILoadResult(jadx.api.plugins.input.data.ILoadResult) ArrayList(java.util.ArrayList) SignatureProcessor(jadx.core.dex.visitors.SignatureProcessor) JadxPluginManager(jadx.api.plugins.JadxPluginManager) JadxArgs(jadx.api.JadxArgs) JadxInputPlugin(jadx.api.plugins.input.JadxInputPlugin)

Aggregations

JadxArgs (jadx.api.JadxArgs)1 JadxPluginManager (jadx.api.plugins.JadxPluginManager)1 JadxInputPlugin (jadx.api.plugins.input.JadxInputPlugin)1 ILoadResult (jadx.api.plugins.input.data.ILoadResult)1 ClsSet (jadx.core.clsp.ClsSet)1 ClassNode (jadx.core.dex.nodes.ClassNode)1 RootNode (jadx.core.dex.nodes.RootNode)1 SignatureProcessor (jadx.core.dex.visitors.SignatureProcessor)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1