Commit 2e237637 authored by Christopher Jan-Steffen Brix's avatar Christopher Jan-Steffen Brix
Browse files

Merge branch 'oneclick_nn_training' of...

Merge branch 'oneclick_nn_training' of git.rwth-aachen.de:monticore/EmbeddedMontiArc/generators/EMADL2CPP into oneclick_nn_training
parents 6b1f034b 9d153272
Pipeline #99171 passed with stages
in 4 minutes and 36 seconds
......@@ -117,10 +117,53 @@ public class EMADLGenerator {
}
ExpandedComponentInstanceSymbol instance = component.getEnclosingScope().<ExpandedComponentInstanceSymbol>resolve(instanceName, ExpandedComponentInstanceSymbol.KIND).get();
generateFiles(symtab, instance, symtab, forced);
try{
executeCommands();
}catch(Exception e){
System.out.println(e);
}
}
public void executeCommands() throws IOException {
File tempScript = createTempScript();
try {
ProcessBuilder pb = new ProcessBuilder("bash", tempScript.toString());
pb.inheritIO();
Process process = pb.start();
process.waitFor();
}catch(Exception e){
System.out.println(e);
} finally {
tempScript.delete();
}
}
public File createTempScript() throws IOException{
File tempScript = File.createTempFile("script", null);
try{
Writer streamWriter = new OutputStreamWriter(new FileOutputStream(
tempScript));
PrintWriter printWriter = new PrintWriter(streamWriter);
printWriter.println("#!/bin/bash");
printWriter.println("cd " + getGenerationTargetPath());
printWriter.println("mkdir build | cd build");
printWriter.println("cmake ..");
printWriter.println("make");
printWriter.println("cd CMakeFiles");
printWriter.println("g++ feature_tests.cxx");
printWriter.close();
}catch(Exception e){
System.out.println(e);
}
return tempScript;
}
public void generateFiles(TaggingResolver taggingResolver, ExpandedComponentInstanceSymbol componentSymbol, Scope symtab, String forced) throws IOException {
......
......@@ -24,6 +24,7 @@ import de.se_rwth.commons.logging.Log;
import freemarker.template.TemplateException;
import org.apache.commons.cli.*;
import java.io.File;
import java.io.IOException;
import java.util.Optional;
......@@ -148,6 +149,5 @@ public class EMADLGeneratorCli {
Log.error("template error during generation", e);
System.exit(1);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment