Commit 3ddc6f84 authored by Maurice's avatar Maurice
Browse files

Added temporary Bash Script to compile the trained Model

parent be963637
Pipeline #99165 passed with stages
in 4 minutes and 41 seconds
......@@ -117,10 +117,54 @@ 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.println("./a.out");
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