Commit 0e2bc9d7 authored by Markus Georg Bendel's avatar Markus Georg Bendel

Make generator methods public

parent 4d4a1a40
Pipeline #166800 passed with stages
in 1 minute and 55 seconds
# EMAM2SomeIP
A project that generates a SomeIP-Adapter for EmbeddedMontiArcMath components.
### Install SOME/IP:
Get vsomeip from: https://github.com/GENIVI/vsomeip
......@@ -9,7 +11,7 @@ Build instruction is in the readme on the site, short summary:
- vsomeip uses CMake as buildsystem.
- vsomeip uses Boost (boost.org), version has to be >= 1.55 and < 1.66:
#### Linux:
#### Install SOME/IP on Linux:
Installing boost 1.65 on ubuntu 18.10:
```bash
......@@ -28,8 +30,8 @@ If build fails, try to apply this fix:
https://github.com/GENIVI/vsomeip/issues/25
Summary of the fix:
Replace "return &sockaddr;" with "return reinterpret_cast<struct sockaddr*>(&sockaddr);"
Summary of the fix:
Replace "return &sockaddr;" with "return reinterpret_cast<struct sockaddr*>(&sockaddr);"
in the file: implementation/endpoints/include/netlink_connector.hpp
##### Build the documentation:
......@@ -39,9 +41,3 @@ To build the documentation asciidoc, source-highlight, doxygen and graphviz is n
sudo apt-get install asciidoc source-highlight doxygen graphviz
make doc
```
#### Windows:
- get cmake: https://cmake.org/download/
- get boost (e.g. v.1.65): https://www.boost.org/doc/libs/1_65_0/more/getting_started/windows.html
- use cmake and visual studio to build vsomeip
......@@ -6,7 +6,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-emam2someip-generator</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.1-SNAPSHOT</version>
<name>emam2someip</name>
......
......@@ -15,7 +15,14 @@ import java.util.List;
public class GeneratorSomeIP {
List<File> generateSomeIPAdapter(EMAComponentInstanceSymbol component) {
private String generationTargetPath;
public void setGenerationTargetPath(String generationTargetPath) {
this.generationTargetPath = generationTargetPath.endsWith("/") ? generationTargetPath : generationTargetPath + "/";
}
public List<File> generateSomeIPAdapter(EMAComponentInstanceSymbol component) {
List<File> files = new ArrayList<>();
List<String> contents = new ArrayList<String>();
List<FileWriter> frs = new ArrayList<FileWriter>();
......@@ -27,9 +34,9 @@ public class GeneratorSomeIP {
//Generate files and write to project
contents.add(SomeIPTemplates.generateSomeIPAdapterH(model));
files.add(new File("./target/generated-sources/SomeIPAdapter_"+model.getEscapedCompName()+".h"));
files.add(new File(generationTargetPath + "SomeIPAdapter_" + model.getEscapedCompName() + ".h"));
contents.add(SomeIPTemplates.generateSomeIPAdapterCPP(model));
files.add(new File("./target/generated-sources/SomeIPAdapter_"+model.getEscapedCompName()+".cpp"));
files.add(new File(generationTargetPath + "SomeIPAdapter_" + model.getEscapedCompName() + ".cpp"));
try {
int counter = 0;
......@@ -57,7 +64,7 @@ public class GeneratorSomeIP {
}
File generateCMake(EMAComponentInstanceSymbol component) {
public File generateCMake(EMAComponentInstanceSymbol component) {
// Create and fill model
SomeIPAdapterModel model = new SomeIPAdapterModel(component.getFullName());
......@@ -65,7 +72,7 @@ public class GeneratorSomeIP {
//Generate files and write to project
String content = SomeIPTemplates.generateSomeIPCMakeLists(model);
File file = new File("./target/generated-sources/CMakeLists.txt");
File file = new File(generationTargetPath + "CMakeLists.txt");
FileWriter fr = null;
try {
......@@ -85,7 +92,7 @@ public class GeneratorSomeIP {
return file;
}
List<File> generatePrettyPrint(EMAComponentInstanceSymbol component)
public List<File> generatePrettyPrint(EMAComponentInstanceSymbol component)
{
List<File> files = new ArrayList<>();
......@@ -100,7 +107,7 @@ public class GeneratorSomeIP {
//Generate files and write to project
String content = SomeIPTemplates.generatePrettyPrint(model);
File file = new File("./target/generated-sources/ports.txt");
File file = new File(generationTargetPath + "ports.txt");
files.add(file);
FileWriter fr = null;
......
......@@ -30,6 +30,8 @@ public class AdapterGenerationTest extends AbstractSymtabTest {
GeneratorSomeIP generatorSomeIP = new GeneratorSomeIP();
generatorSomeIP.setGenerationTargetPath("./target/generated-sources/");
// Connect component's ports to topics
componentInstanceSymbol.getPortInstance("in1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(1,2,3));
......
......@@ -31,8 +31,7 @@ public class CMakeGenerationTest extends AbstractSymtabTest {
GeneratorSomeIP generatorSomeIP = new GeneratorSomeIP();
// Connect component's ports to topics
componentInstanceSymbol.getPortInstance("in1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(1,2,3));
generatorSomeIP.setGenerationTargetPath("./target/generated-sources/");
List<File> files = new ArrayList<>();
......
......@@ -30,6 +30,8 @@ public class PrettyPrintGenerationTest extends AbstractSymtabTest {
GeneratorSomeIP generatorSomeIP = new GeneratorSomeIP();
generatorSomeIP.setGenerationTargetPath("./target/generated-sources/");
// Connect component's ports to topics
componentInstanceSymbol.getPortInstance("in1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(1,2,3));
......
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