Commit 622877f4 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko
Browse files

Merge branch 'BreakingSymbolUpdate' into 'master'

Breaking symbol update

See merge request !5
parents fa8a1340 98633596
Pipeline #67824 passed with stages
in 1 minute and 20 seconds
......@@ -6,7 +6,7 @@ masterJobLinux:
stage: linux
image: maven:3-jdk-8
script:
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean deploy --settings settings.xml
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean deploy --settings settings.xml -U
- cat target/site/jacoco/index.html
only:
- master
......@@ -14,7 +14,7 @@ masterJobLinux:
masterJobWindows:
stage: windows
script:
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean install --settings settings.xml
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean install --settings settings.xml -U
tags:
- Windows10
......@@ -22,7 +22,7 @@ BranchJobLinux:
stage: linux
image: maven:3-jdk-8
script:
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean install --settings settings.xml
- mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean install --settings settings.xml -U
- cat target/site/jacoco/index.html
except:
- master
......@@ -9,31 +9,21 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-rosmsg-generator</artifactId>
<version>0.0.3-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<!-- .. SE-Libraries .................................................. -->
<monticore.version>5.0.0</monticore.version>
<se-commons.version>1.7.7</se-commons.version>
<mc.grammars.assembly.version>0.0.6-SNAPSHOT</mc.grammars.assembly.version>
<SIUnit.version>0.0.10-SNAPSHOT</SIUnit.version>
<Common-MontiCar.version>0.0.14-SNAPSHOT</Common-MontiCar.version>
<Embedded-MontiArc.version>0.0.18-SNAPSHOT</Embedded-MontiArc.version>
<Embedded-MontiArc-Behaviour.version>0.0.14-SNAPSHOT</Embedded-MontiArc-Behaviour.version>
<Math.version>0.0.14-SNAPSHOT</Math.version>
<Embedded-MontiArc-Math.version>0.0.15-SNAPSHOT</Embedded-MontiArc-Math.version>
<Embedded-montiarc-math-generator.version>0.0.15-SNAPSHOT</Embedded-montiarc-math-generator.version>
<Embedded-MontiArc-Math.version>0.1.0-SNAPSHOT</Embedded-MontiArc-Math.version>
<!-- .. Libraries .................................................. -->
<guava.version>18.0</guava.version>
<junit.version>4.12</junit.version>
<logback.version>1.1.2</logback.version>
<jscience.version>4.3.1</jscience.version>
<!-- .. Plugins ....................................................... -->
<monticore.plugin>4.5.3-SNAPSHOT</monticore.plugin>
<assembly.plugin>2.5.4</assembly.plugin>
<compiler.plugin>3.3</compiler.plugin>
<source.plugin>2.4</source.plugin>
......@@ -70,103 +60,12 @@
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-generator</artifactId>
<version>${Embedded-montiarc-math-generator.version}</version>
</dependency>
<dependency>
<groupId>com.esotericsoftware.yamlbeans</groupId>
<artifactId>yamlbeans</artifactId>
<version>1.12</version>
</dependency>
<!-- MontiCore Dependencies -->
<dependency>
<groupId>de.monticore</groupId>
<artifactId>monticore-runtime</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>monticore-grammar</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>monticore-grammar</artifactId>
<version>${monticore.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.se_rwth.commons</groupId>
<artifactId>se-commons-groovy</artifactId>
<version>${se-commons.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>NumberUnit</artifactId>
<version>${SIUnit.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>NumberUnit</artifactId>
<version>${SIUnit.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>common-monticar</artifactId>
<version>${Common-MontiCar.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>common-monticar</artifactId>
<version>${Common-MontiCar.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc</artifactId>
<version>${Embedded-MontiArc.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc</artifactId>
<version>${Embedded-MontiArc.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-behaviour</artifactId>
<version>${Embedded-MontiArc-Behaviour.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-behaviour</artifactId>
<version>${Embedded-MontiArc-Behaviour.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math</artifactId>
......@@ -181,22 +80,6 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>math</artifactId>
<version>${Math.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>math</artifactId>
<version>${Math.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>montiarc.verification</groupId>
<artifactId>montiarc-execution-order</artifactId>
......@@ -223,26 +106,12 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>monticore-runtime</artifactId>
<version>${monticore.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.jscience</groupId>
<artifactId>jscience</artifactId>
<version>${jscience.version}</version>
</dependency>
</dependencies>
......@@ -255,20 +124,6 @@
<version>2.8.1</version>
</plugin>
<!-- MontiCore Generation -->
<plugin>
<groupId>de.monticore.mojo</groupId>
<artifactId>monticore-maven-plugin</artifactId>
<version>${monticore.plugin}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Other Configuration -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
......
package de.monticore.lang.monticar.generator.rosmsg;
import de.monticore.lang.monticar.common2._ast.ASTCommonMatrixType;
import de.monticore.lang.monticar.generator.FileContent;
import de.monticore.lang.monticar.generator.rosmsg.util.FileContent;
import de.monticore.lang.monticar.struct._symboltable.StructFieldDefinitionSymbol;
import de.monticore.lang.monticar.struct._symboltable.StructSymbol;
import de.monticore.lang.monticar.ts.MCASTTypeSymbol;
......
package de.monticore.lang.monticar.generator.rosmsg.util;
public class FileContent {
private String fileName;
private String fileContent;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileContent() {
return fileContent;
}
public void setFileContent(String fileContent) {
this.fileContent = fileContent;
}
}
......@@ -5,7 +5,17 @@
*/
package de.monticore.lang.monticar.generator.rosmsg;
import de.monticore.lang.monticar.generator.order.simulator.AbstractSymtab;
import de.monticore.ModelingLanguageFamily;
import de.monticore.io.paths.ModelPath;
import de.monticore.lang.embeddedmontiarc.LogConfig;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._symboltable.EmbeddedMontiArcMathLanguage;
import de.monticore.lang.monticar.Utils;
import de.monticore.lang.monticar.enumlang._symboltable.EnumLangLanguage;
import de.monticore.lang.monticar.streamunits._symboltable.StreamUnitsLanguage;
import de.monticore.lang.monticar.struct._symboltable.StructLanguage;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import de.monticore.symboltable.GlobalScope;
import de.monticore.symboltable.Scope;
import de.se_rwth.commons.logging.Log;
import org.junit.Assert;
......@@ -13,6 +23,8 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
......@@ -21,7 +33,35 @@ import static org.junit.Assert.assertTrue;
/**
* Common methods for symboltable tests
*/
public class AbstractSymtabTest extends AbstractSymtab {
public class AbstractSymtabTest {
public static TaggingResolver createSymTabAndTaggingResolver(String... modelPath) {
Scope scope = createSymTab(modelPath);
return new TaggingResolver(scope, Arrays.asList(modelPath));
}
public static Scope createSymTab(String... modelPath) {
ModelingLanguageFamily fam = new ModelingLanguageFamily();
EmbeddedMontiArcMathLanguage montiArcLanguage = new EmbeddedMontiArcMathLanguage();
fam.addModelingLanguage(montiArcLanguage);
fam.addModelingLanguage(new StreamUnitsLanguage());
fam.addModelingLanguage(new StructLanguage());
fam.addModelingLanguage(new EnumLangLanguage());
ModelPath mp = new ModelPath(new Path[0]);
String[] var4 = modelPath;
int var5 = modelPath.length;
for(int var6 = 0; var6 < var5; ++var6) {
String m = var4[var6];
mp.addEntry(Paths.get(m));
}
LogConfig.init();
GlobalScope scope = new GlobalScope(mp, fam);
Utils.addBuiltInTypes(scope);
return scope;
}
public static void testFilesAreEqual(List<File> files, String restPath) {
for (File f : files) {
File fileTarget = new File("./src/test/resources/results/" + restPath + f.getName());
......
package de.monticore.lang.monticar.generator.rosmsg;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol;
import de.monticore.symboltable.CommonSymbol;
import de.monticore.symboltable.Scope;
import org.junit.Test;
......@@ -20,12 +20,12 @@ public class BasicTypesTest extends AbstractSymtabTest {
@Test
public void testBasicTypes() throws IOException {
Scope symtab = createSymTab("src/test/resources/");
ExpandedComponentInstanceSymbol component = symtab.<ExpandedComponentInstanceSymbol>resolve("tests.basicTypesComp", ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol component = symtab.<EMAComponentInstanceSymbol>resolve("tests.basicTypesComp", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(component);
PortSymbol inQ = component.getPort("inQ").orElse(null);
PortSymbol inZ = component.getPort("inZ").orElse(null);
PortSymbol inB = component.getPort("inB").orElse(null);
EMAPortSymbol inQ = component.getPortInstance("inQ").orElse(null);
EMAPortSymbol inZ = component.getPortInstance("inZ").orElse(null);
EMAPortSymbol inB = component.getPortInstance("inB").orElse(null);
assertNotNull(inQ);
assertNotNull(inZ);
......@@ -56,10 +56,10 @@ public class BasicTypesTest extends AbstractSymtabTest {
@Test
public void testMatrixTypes() {
Scope symtab = createSymTab("src/test/resources/");
ExpandedComponentInstanceSymbol component = symtab.<ExpandedComponentInstanceSymbol>resolve("tests.matrixTypesComp", ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol component = symtab.<EMAComponentInstanceSymbol>resolve("tests.matrixTypesComp", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(component);
Map<String, RosMsg> portToMsg = component.getPortsList().stream()
Map<String, RosMsg> portToMsg = component.getPortInstanceList().stream()
.collect(Collectors.toMap(CommonSymbol::getName, p -> GeneratorRosMsg.getRosType("std_msgs", p.getTypeReference())));
assertTrue(portToMsg.get("in1").getName().equals("std_msgs/Float64MultiArray"));
......@@ -72,15 +72,15 @@ public class BasicTypesTest extends AbstractSymtabTest {
public void testBasicStructComp() throws IOException {
Scope symtab = createSymTab("src/test/resources/");
ExpandedComponentInstanceSymbol component = symtab.<ExpandedComponentInstanceSymbol>resolve("tests.basicStructComp", ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol component = symtab.<EMAComponentInstanceSymbol>resolve("tests.basicStructComp", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(component);
GeneratorRosMsg generatorRosMsg = new GeneratorRosMsg();
String packageName = "basic";
generatorRosMsg.setTarget("target/generated-sources-rosmsg/basic", packageName);
PortSymbol in1 = component.getPort("in1").orElse(null);
PortSymbol out1 = component.getPort("out1").orElse(null);
EMAPortSymbol in1 = component.getPortInstance("in1").orElse(null);
EMAPortSymbol out1 = component.getPortInstance("out1").orElse(null);
assertNotNull(in1);
assertNotNull(out1);
......@@ -102,14 +102,14 @@ public class BasicTypesTest extends AbstractSymtabTest {
public void testNestedStructComp() throws IOException {
Scope symtab = createSymTab("src/test/resources/");
ExpandedComponentInstanceSymbol component = symtab.<ExpandedComponentInstanceSymbol>resolve("tests.nestedStructComp", ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol component = symtab.<EMAComponentInstanceSymbol>resolve("tests.nestedStructComp", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(component);
GeneratorRosMsg generatorRosMsg = new GeneratorRosMsg();
String packageName = "nested";
generatorRosMsg.setTarget("target/generated-sources-rosmsg/nested", packageName);
PortSymbol inNested = component.getPort("inNested").orElse(null);
EMAPortSymbol inNested = component.getPortInstance("inNested").orElse(null);
assertNotNull(inNested);
......@@ -127,14 +127,14 @@ public class BasicTypesTest extends AbstractSymtabTest {
public void testMultiNestedStructComp() throws IOException {
Scope symtab = createSymTab("src/test/resources/");
ExpandedComponentInstanceSymbol component = symtab.<ExpandedComponentInstanceSymbol>resolve("tests.multiNestedStructComp", ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol component = symtab.<EMAComponentInstanceSymbol>resolve("tests.multiNestedStructComp", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(component);
GeneratorRosMsg generatorRosMsg = new GeneratorRosMsg();
String packageName = "multinested";
generatorRosMsg.setTarget("target/generated-sources-rosmsg/multinested", packageName);
PortSymbol inMultiNested = component.getPort("inMultiNested").orElse(null);
EMAPortSymbol inMultiNested = component.getPortInstance("inMultiNested").orElse(null);
assertNotNull(inMultiNested);
......@@ -147,12 +147,12 @@ public class BasicTypesTest extends AbstractSymtabTest {
@Test
public void testGenericCompInstance() {
Scope symtab = createSymTab("src/test/resources/");
ExpandedComponentInstanceSymbol component = symtab.<ExpandedComponentInstanceSymbol>resolve("tests.genericCompInstance", ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol component = symtab.<EMAComponentInstanceSymbol>resolve("tests.genericCompInstance", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(component);
RosMsg typeB = GeneratorRosMsg.getRosType("struct_msgs", component.getSubComponent("instB").get().getPort("in1").get().getTypeReference());
RosMsg typeQ = GeneratorRosMsg.getRosType("struct_msgs", component.getSubComponent("instQ").get().getPort("in1").get().getTypeReference());
RosMsg typeZ = GeneratorRosMsg.getRosType("struct_msgs", component.getSubComponent("instZ").get().getPort("in1").get().getTypeReference());
RosMsg typeB = GeneratorRosMsg.getRosType("struct_msgs", component.getSubComponent("instB").get().getPortInstance("in1").get().getTypeReference());
RosMsg typeQ = GeneratorRosMsg.getRosType("struct_msgs", component.getSubComponent("instQ").get().getPortInstance("in1").get().getTypeReference());
RosMsg typeZ = GeneratorRosMsg.getRosType("struct_msgs", component.getSubComponent("instZ").get().getPortInstance("in1").get().getTypeReference());
assertTrue(typeB.getName().equals("std_msgs/Bool"));
assertTrue(typeQ.getName().equals("std_msgs/Float64"));
......
Supports Markdown
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