Commit 57197410 authored by Markus Georg Bendel's avatar Markus Georg Bendel

SomeIP Integration into EMAM2Middleware

parent beebefcd
Pipeline #166423 failed with stages
in 1 minute and 54 seconds
......@@ -41,6 +41,14 @@ RosIntegrationJob:
script:
- ./src/test/bash/integrationTestRos.sh
SomeIPIntegrationJob:
stage: integration
image: registry.git.rwth-aachen.de/monticore/embeddedmontiarc/generators/emam2someip
dependencies:
- CompileJobLinux
script:
- ./src/test/bash/integrationTestSomeIP.sh
Ros2IntegrationJob:
stage: integration
image: registry.git.rwth-aachen.de/monticore/embeddedmontiarc/generators/emam2middleware/ema-ros-crystal
......
......@@ -9,7 +9,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-middleware-generator</artifactId>
<version>0.0.25-SNAPSHOT</version>
<version>0.0.26-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
......@@ -22,6 +22,7 @@
<embedded-montiarc.version>0.1.9-SNAPSHOT</embedded-montiarc.version>
<Embedded-montiarc-math-generator.version>0.1.12-SNAPSHOT</Embedded-montiarc-math-generator.version>
<Embedded-montiarc-math-roscpp-generator.version>0.1.6-SNAPSHOT</Embedded-montiarc-math-roscpp-generator.version>
<Embedded-montiarc-math-emam2someip-generator.version>0.1.6-SNAPSHOT</Embedded-montiarc-math-emam2someip-generator.version>
<EMADL2CPP.version>0.2.8</EMADL2CPP.version>
<EMADL.version>0.2.7-SNAPSHOT</EMADL.version>
<embedded-montiarc-component-clustering.version>0.0.2-SNAPSHOT</embedded-montiarc-component-clustering.version>
......@@ -106,6 +107,13 @@
<version>${Embedded-montiarc-math-roscpp-generator.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-emam2someip-generator</artifactId>
<version>${Embedded-montiarc-math-emam2someip-generator.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
......
......@@ -9,6 +9,7 @@ import de.monticore.lang.monticar.generator.middleware.impls.CPPGenImpl;
import de.monticore.lang.monticar.generator.middleware.impls.EMADLGeneratorImpl;
import de.monticore.lang.monticar.generator.middleware.impls.ODVGenImpl;
import de.monticore.lang.monticar.generator.middleware.impls.RosCppGenImpl;
import de.monticore.lang.monticar.generator.middleware.impls.SomeIPImpl;
import de.monticore.lang.monticar.generator.middleware.impls.*;
import de.monticore.lang.monticar.generator.order.simulator.AbstractSymtab;
import de.monticore.lang.monticar.generator.roscpp.helper.TagHelper;
......@@ -49,6 +50,7 @@ public final class DistributedTargetGeneratorCli {
//ros2cpp is an alias for rclcpp
public static final String GENERATOR_RCLCPP = "rclcpp";
public static final String GENERATOR_ROS2CPP = "ros2cpp";
public static final String GENERATOR_SOMEIP = "someip";
private DistributedTargetGeneratorCli() {}
......@@ -87,6 +89,7 @@ public final class DistributedTargetGeneratorCli {
res.add(GENERATOR_ODV);
res.add(GENERATOR_ROS2CPP);
res.add(GENERATOR_RCLCPP);
res.add(GENERATOR_SOMEIP);
return res;
}
......@@ -177,6 +180,10 @@ public final class DistributedTargetGeneratorCli {
generator.add(new ODVGenImpl(), "odv");
}
if (generators.contains(GENERATOR_SOMEIP)) {
generator.add(new SomeIPGenImpl(), "someip");
}
if (cliParameters.getClusteringParameters().isPresent()) {
ClusteringParameters clusteringParameters = cliParameters.getClusteringParameters().get();
generator.setClusteringParameters(clusteringParameters);
......
package de.monticore.lang.monticar.generator.middleware.impls;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAPortInstanceSymbol;
import de.monticore.lang.monticar.generator.someip.GeneratorSomeIP;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import de.se_rwth.commons.logging.Log;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class SomeIPGenImpl implements GeneratorImpl {
private String generationTargetPath;
private GeneratorSomeIP generatorSomeIP;
public SomeIPGenImpl(){
generatorSomeIP = new GeneratorSomeIP();
}
public void setGeneratorSomeIP(GeneratorSomeIP generatorSomeIP) {
this.generatorSomeIP = generatorSomeIP;
}
@Override
public List<File> generate(EMAComponentInstanceSymbol componentInstanceSymbol, TaggingResolver taggingResolver) throws IOException {
generatorSomeIP.setGenerationTargetPath(generationTargetPath);
return generatorSomeIP.generateFiles(componentInstanceSymbol, taggingResolver);
}
@Override
public void setGenerationTargetPath(String path) {
this.generationTargetPath = path;
}
@Override
public boolean willAccept(EMAComponentInstanceSymbol componentInstanceSymbol) {
boolean result = componentInstanceSymbol.getPortInstanceList().stream().anyMatch(EMAPortInstanceSymbol::isSomeIPPort);
if(!result){
Log.warn("GeneratorSomeIP: No SomeIP Ports found! Ignoring component " + componentInstanceSymbol.getName());
}
return result;
}
}
#!/bin/bash
set -e
baseDir=$(readlink -f `dirname $0`/../../..)
for f in `find $baseDir/target/generated-sources-someip/ -name compile.sh`
do
bash -H $f
done
package de.monticore.lang.monticar.generator.middleware;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.ros.RosToEmamTagSchema;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.mqtt.SomeIPConnectionSymbol;
import de.monticore.lang.monticar.generator.middleware.impls.CPPGenImpl;
import de.monticore.lang.monticar.generator.middleware.impls.SomeIPGenImpl;
import de.monticore.lang.monticar.generator.roscpp.helper.TagHelper;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.util.List;
import static org.junit.Assert.assertNotNull;
public class Ros2GenerationTest extends AbstractSymtabTest {
private static final String TEST_PATH = "src/test/resources/";
private static final String OUT_BASE = "./target/generated-sources-someip/";
@Test
public void testSomeIPGeneration() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver(TEST_PATH);
EMAComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<EMAComponentInstanceSymbol>resolve("tests.a.addComp", EMAComponentInstanceSymbol.KIND).orElse(null);
RosToEmamTagSchema.registerTagTypes(taggingResolver);
assertNotNull(componentInstanceSymbol);
GeneratorSomeIP generatorSomeIP = new GeneratorSomeIP();
componentInstanceSymbol.getPortInstance("in1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(1,2,3));
componentInstanceSymbol.getPortInstance("in2").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(4,5,6));
componentInstanceSymbol.getPortInstance("out1").orElse(null).setMiddlewareSymbol(new SomeIPConnectionSymbol(7,8,9));
DistributedTargetGenerator distributedTargetGenerator = new DistributedTargetGenerator();
distributedTargetGenerator.setGenerationTargetPath(OUT_BASE + "addComp/src");
distributedTargetGenerator.add(new CPPGenImpl(TEST_PATH),"cpp");
distributedTargetGenerator.add(new SomeIPGenImpl(), "someip");
List<File> files = generatorSomeIP.generateSomeIPAdapter(componentInstanceSymbol);
}
}
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