use of org.mariotaku.patchlib.common.model.ProcessingRules in project PatchLib by mariotaku.
the class PatchLibApplication method startProcess.
private boolean startProcess(File inFile, File outFile, CommandLine cmdLine) throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
final ProcessingRules conf = new ProcessingRules();
conf.setRules(new HashMap<String, PatchClassInfo>());
for (File rulesFile : getFiles(cmdLine.getOptionValue("rules"))) {
final Map<String, PatchClassInfo> rulesMap = mapper.readValue(rulesFile, new TypeReference<Map<String, PatchClassInfo>>() {
});
conf.addRules(rulesMap);
}
try (InputStream is = new FileInputStream(inFile);
OutputStream os = new FileOutputStream(outFile)) {
final LibraryProcessor.CommandLineOptions options = getOptions(cmdLine);
options.setSourceFilePath(inFile.getAbsolutePath());
final LibraryProcessor processor = LibraryProcessor.get(is, os, inFile.getName(), conf, options);
if (processor == null) {
throw new UnsupportedOperationException("Unsupported library " + inFile);
}
return processor.process();
}
}
Aggregations