...
 
Commits (15)
File added
......@@ -33,6 +33,14 @@ DeployJobLinux:
only:
- master
MqttIntegrationJob:
stage: integration
image: registry.git.rwth-aachen.de/monticore/embeddedmontiarc/generators/emam2mqtt:latest
dependencies:
- CompileJobLinux
script:
- ./src/test/bash/integrationTestMqtt.sh
RosIntegrationJob:
stage: integration
image: registry.git.rwth-aachen.de/monticore/embeddedmontiarc/generators/emam2middleware/ema-ros-kinetic
......
......@@ -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 ============================================= -->
......@@ -19,11 +19,12 @@
<!-- .. SE-Libraries .................................................. -->
<se-commons.version>1.7.7</se-commons.version>
<embedded-montiarc.version>0.1.9-SNAPSHOT</embedded-montiarc.version>
<embedded-montiarc.version>0.1.12-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>
<EMADL2CPP.version>0.2.8</EMADL2CPP.version>
<EMADL.version>0.2.7-SNAPSHOT</EMADL.version>
<MQTT.version>1.4-SNAPSHOT</MQTT.version>
<embedded-montiarc-component-clustering.version>0.0.2-SNAPSHOT</embedded-montiarc-component-clustering.version>
<!-- .. Libraries .................................................. -->
......@@ -106,6 +107,12 @@
<version>${Embedded-montiarc-math-roscpp-generator.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-mqtt-generator</artifactId>
<version>${MQTT.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
......
......@@ -3,15 +3,13 @@ package de.monticore.lang.monticar.generator.middleware.cli;
import com.google.gson.Gson;
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.MqttToEmamTagSchema;
import de.monticore.lang.monticar.emadl.generator.EMADLAbstractSymtab;
import de.monticore.lang.monticar.generator.middleware.DistributedTargetGenerator;
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.*;
import de.monticore.lang.monticar.generator.order.simulator.AbstractSymtab;
import de.monticore.lang.monticar.generator.roscpp.helper.TagHelper;
import de.monticore.lang.monticar.generator.mqtt.helper.MqttTagHelper;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import de.se_rwth.commons.logging.Log;
......@@ -45,6 +43,7 @@ public final class DistributedTargetGeneratorCli {
public static final String GENERATOR_CPP = "cpp";
public static final String GENERATOR_EMADL = "emadlcpp";
public static final String GENERATOR_ROSCPP = "roscpp";
public static final String GENERATOR_MQTT = "mqtt";
public static final String GENERATOR_ODV = "odv";
//ros2cpp is an alias for rclcpp
public static final String GENERATOR_RCLCPP = "rclcpp";
......@@ -84,6 +83,7 @@ public final class DistributedTargetGeneratorCli {
res.add(GENERATOR_CPP);
res.add(GENERATOR_EMADL);
res.add(GENERATOR_ROSCPP);
res.add(GENERATOR_MQTT);
res.add(GENERATOR_ODV);
res.add(GENERATOR_ROS2CPP);
res.add(GENERATOR_RCLCPP);
......@@ -166,6 +166,12 @@ public final class DistributedTargetGeneratorCli {
RosToEmamTagSchema.registerTagTypes(taggingResolver);
TagHelper.resolveTags(taggingResolver, componentInstanceSymbol);
}
if (generators.contains(GENERATOR_MQTT)) {
generator.add(new MqttGenImpl(), "mqtt");
MqttToEmamTagSchema.registerTagTypes(taggingResolver);
MqttTagHelper.resolveTags(taggingResolver, componentInstanceSymbol);
}
if (generators.contains(GENERATOR_RCLCPP) || generators.contains(GENERATOR_ROS2CPP)) {
generator.add(new RclCppGenImpl(), "rclcpp");
......
package de.monticore.lang.monticar.generator.middleware.impls;
import java.io.File;
import java.io.IOException;
import java.util.List;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAPortInstanceSymbol;
import de.monticore.lang.monticar.generator.mqtt.GeneratorMqtt;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import de.se_rwth.commons.logging.Log;
public class MqttGenImpl implements GeneratorImpl {
private String generationTargetPath;
private GeneratorMqtt generatorMqtt;
public MqttGenImpl(){
generatorMqtt = new GeneratorMqtt();
}
public void setGeneratorMqttCpp(GeneratorMqtt generatorMqttCpp) {
this.generatorMqtt = generatorMqttCpp;
}
@Override
public List<File> generate(EMAComponentInstanceSymbol componentInstanceSymbol, TaggingResolver taggingResolver)
throws IOException {
generatorMqtt.setGenerationTargetPath(generationTargetPath);
return generatorMqtt.generateMqttAdapter(componentInstanceSymbol);
}
@Override
public void setGenerationTargetPath(String path) {
this.generationTargetPath = path;
}
@Override
public boolean willAccept(EMAComponentInstanceSymbol componentInstanceSymbol) {
boolean result = componentInstanceSymbol.getPortInstanceList().stream().anyMatch(EMAPortInstanceSymbol::isMqttPort);
if(!result){
Log.warn("GeneratorMqttCpp: No MQTT 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-mqtt/ -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.mqtt.MqttToEmamTagSchema;
import de.monticore.lang.monticar.generator.middleware.impls.CPPGenImpl;
import de.monticore.lang.monticar.generator.middleware.impls.MqttGenImpl;
import de.monticore.lang.monticar.generator.mqtt.helper.MqttTagHelper;
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 MqttGenerationTest extends AbstractSymtabTest {
private static final String TEST_PATH = "src/test/resources/";
private static final String OUT_BASE = "./target/generated-sources-mqtt/";
@Test
public void testMqttGeneration() throws IOException {
TaggingResolver taggingResolver = createSymTabAndTaggingResolver(TEST_PATH);
MqttToEmamTagSchema.registerTagTypes(taggingResolver);
EMAComponentInstanceSymbol componentInstanceSymbol = taggingResolver.<EMAComponentInstanceSymbol>resolve("tests.mqtt.testComp", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
MqttTagHelper.resolveTags(taggingResolver, componentInstanceSymbol);
DistributedTargetGenerator distributedTargetGenerator = new DistributedTargetGenerator();
distributedTargetGenerator.setGenerationTargetPath(OUT_BASE + "compA/src");
distributedTargetGenerator.add(new CPPGenImpl(TEST_PATH),"cpp"); // Cpp implementation for the component
distributedTargetGenerator.add(new MqttGenImpl(), "mqtt");
List<File> files = distributedTargetGenerator.generate(componentInstanceSymbol, taggingResolver);
}
}
......@@ -2,6 +2,7 @@ package tests.a;
component CompA{
port in Q rosIn;
port in Q portA;
port in Q noRosIn;
port out Q rosOut;
port out Q noRosOut;
......
package tests.mqtt;
conforms to de.monticore.lang.embeddedmontiarc.tagging.middleware.mqtt.MqttToEmamTagSchema;
tags Test {
tag testComp.in1 with MqttConnection = {topic = /clock, msgField = clock.toSec()};
}
package tests.mqtt;
component TestComp{
ports in Q in1,
in Q in2,
out Q out1;
}
\ No newline at end of file