Search in sources :

Example 1 with JsonMapping

use of jadx.core.codegen.json.mapping.JsonMapping in project jadx by skylot.

the class JsonMappingGen method dump.

public static void dump(RootNode root) {
    JsonMapping mapping = new JsonMapping();
    fillMapping(mapping, root);
    JadxArgs args = root.getArgs();
    File outDirSrc = args.getOutDirSrc().getAbsoluteFile();
    File mappingFile = new File(outDirSrc, "mapping.json");
    FileUtils.makeDirsForFile(mappingFile);
    try (Writer writer = new FileWriter(mappingFile)) {
        GSON.toJson(mapping, writer);
        LOG.info("Save mappings to {}", mappingFile.getAbsolutePath());
    } catch (Exception e) {
        throw new JadxRuntimeException("Failed to save mapping json", e);
    }
}
Also used : FileWriter(java.io.FileWriter) JadxArgs(jadx.api.JadxArgs) JadxRuntimeException(jadx.core.utils.exceptions.JadxRuntimeException) JsonMapping(jadx.core.codegen.json.mapping.JsonMapping) File(java.io.File) FileWriter(java.io.FileWriter) Writer(java.io.Writer) JadxRuntimeException(jadx.core.utils.exceptions.JadxRuntimeException)

Aggregations

JadxArgs (jadx.api.JadxArgs)1 JsonMapping (jadx.core.codegen.json.mapping.JsonMapping)1 JadxRuntimeException (jadx.core.utils.exceptions.JadxRuntimeException)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1 Writer (java.io.Writer)1