Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMADL2CPP
Commits
3ddc6f84
Commit
3ddc6f84
authored
Jan 22, 2019
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/emadl/generator/EMADLGenerator.java
View file @
3ddc6f84
...
...
@@ -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
{
...
...
src/main/java/de/monticore/lang/monticar/emadl/generator/EMADLGeneratorCli.java
View file @
3ddc6f84
...
...
@@ -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
);
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment