org.hisrc.jsonix.compilation.ModulesCompiler Maven / Gradle / Ivy
package org.hisrc.jsonix.compilation;
import org.apache.commons.lang3.Validate;
import org.hisrc.jscm.codemodel.JSCodeModel;
import org.hisrc.jscm.codemodel.JSProgram;
import org.hisrc.jscm.codemodel.impl.CodeModelImpl;
import org.hisrc.jsonix.definition.Module;
import org.hisrc.jsonix.definition.Modules;
import org.hisrc.jsonix.definition.Output;
public class ModulesCompiler {
private final Modules modules;
public ModulesCompiler(Modules modules) {
Validate.notNull(modules);
this.modules = modules;
}
public void compile(ProgramWriter programWriter) {
final JSCodeModel codeModel = new CodeModelImpl();
for (Module module : this.modules.getModules()) {
if (!module.isEmpty()) {
for (Output output : module.getOutputs()) {
final ModuleCompiler moduleCompiler = new ModuleCompiler(
codeModel, modules, module, output);
final JSProgram program = moduleCompiler.compile();
programWriter.writeProgram(module, program, output);
}
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy