use of com.ibm.uma.om.parser.Parser in project openj9 by eclipse.
the class UMA method generate.
public void generate() throws UMAException {
Parser parser = new Parser(this);
if (!parser.parse()) {
return;
}
modules = parser.getModules();
platform.decorateModules(modules);
try {
Map<String, TemplateModel> map = new HashMap<String, TemplateModel>();
map.put(FREEMARKER_UMA, new com.ibm.uma.freemarker.UMA());
for (String tmp : templateLoader.getTemplates()) {
Template template = freemarkerConfig.getTemplate(tmp);
String filename = tmp.substring(0, tmp.lastIndexOf(".ftl"));
StringWriter writer = new StringWriter();
template.process(map, writer);
new FileAssistant(this.rootDirectory + filename, writer.getBuffer()).writeToDisk();
}
} catch (IOException e) {
throw new UMAException(e);
} catch (TemplateException e) {
throw new UMAException(e);
}
writeTargetInformationMacrosFile();
// top level module is the first in the list.
Module rootModule = null;
for (Module module : modules) {
if (module.isTopLevel()) {
if (rootModule != null) {
throw new UMAException("Error: more than one root module " + rootModule.getFullName() + " and " + module.getFullName());
}
rootModule = module;
}
}
if (rootModule == null) {
throw new UMAException("Error: no " + configuration.getMetadataFilename() + " found in the root directory " + getRootDirectory());
}
writeDirectoryMakefile(rootModule);
Logger.getLogger().println(Logger.InformationL1Log, "Complete");
}
Aggregations