Commit 6a3d92b2 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko

Merge branch 'VersionUp' into 'master'

Version up

See merge request !3
parents 50d2b601 c0972ed5
Pipeline #95529 passed with stage
in 10 minutes and 46 seconds
......@@ -9,25 +9,15 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-opt-generator</artifactId>
<version>0.1.1-SNAPSHOT</version>
<version>0.1.2-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<!-- .. SE-Libraries .................................................. -->
<monticore.version>5.0.0</monticore.version>
<se-commons.version>1.7.8</se-commons.version>
<mc.grammars.assembly.version>0.0.6-SNAPSHOT</mc.grammars.assembly.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.19-SNAPSHOT</Math.version>
<MathOpt.version>0.1.0</MathOpt.version>
<Embedded-MontiArc-Math.version>0.0.19-SNAPSHOT</Embedded-MontiArc-Math.version>
<Embedded-MontiArc-Math-Opt.version>0.1.0</Embedded-MontiArc-Math-Opt.version>
<Embedded-montiarc-math-generator.version>0.0.25-SNAPSHOT</Embedded-montiarc-math-generator.version>
<Embedded-montiarc-math-middleware-generator.version>0.0.4-SNAPSHOT</Embedded-montiarc-math-middleware-generator.version>
<Embedded-MontiArc-Math-Opt.version>0.1.3-SNAPSHOT</Embedded-MontiArc-Math-Opt.version>
<Embedded-montiarc-math-generator.version>0.1.3-SNAPSHOT</Embedded-montiarc-math-generator.version>
<!-- .. Libraries .................................................. -->
<guava.version>18.0</guava.version>
<junit.version>4.12</junit.version>
......@@ -35,7 +25,6 @@
<jscience.version>4.3.1</jscience.version>
<!-- .. Plugins ....................................................... -->
<monticore.plugin>5.0.0</monticore.plugin>
<assembly.plugin>2.5.4</assembly.plugin>
<compiler.plugin>3.3</compiler.plugin>
<source.plugin>2.4</source.plugin>
......@@ -60,12 +49,6 @@
<version>4.7.1</version>
</dependency>
<dependency>
<groupId>de.se_rwth.commons</groupId>
<artifactId>se-commons-logging</artifactId>
<version>${se-commons.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
......@@ -78,95 +61,7 @@
<version>${Embedded-montiarc-math-generator.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-middleware-generator</artifactId>
<version>${Embedded-montiarc-math-middleware-generator.version}</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.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>
<version>${Embedded-MontiArc-Math.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math</artifactId>
<version>${Embedded-MontiArc-Math.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
......@@ -182,20 +77,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>
......@@ -214,20 +95,6 @@
<version>1.4</version>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>math-opt</artifactId>
<version>${MathOpt.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>math-opt</artifactId>
<version>${MathOpt.version}</version>
<classifier>${grammars.classifier}</classifier>
<scope>provided</scope>
</dependency>
<!-- .. Test Libraries ............................................... -->
<dependency>
<groupId>junit</groupId>
......@@ -236,14 +103,6 @@
<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>
......@@ -256,14 +115,6 @@
<version>${jscience.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math</artifactId>
<version>${Embedded-MontiArc-Math.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-opt</artifactId>
......@@ -384,6 +235,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
......
package de.monticore.lang.monticar.generator;
import de.monticore.lang.monticar.generator.cpp.GeneratorEMAMOpt2CPP;
import de.monticore.lang.monticar.generator.middleware.CMakeGenerator;
/**
* EMAMOpt to C++ generator
*
* @author Christoph Richter
*/
public class GeneratorEMAMOpt2CMake extends CMakeGenerator {
public GeneratorEMAMOpt2CMake() {
super();
// set generator to EMAM2CppOpt
GeneratorEMAMOpt2CPP generatorEMAMOpt2CPP = new GeneratorEMAMOpt2CPP();
generatorEMAMOpt2CPP.setGenerateCMake(true);
// add implementation
add(generatorEMAMOpt2CPP, "cpp");
}
}
package de.monticore.lang.monticar.generator.cpp;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.cpp.converter.ExecuteMethodGenerator;
import de.monticore.lang.monticar.generator.cpp.converter.OptimizationSymbolHandler;
import de.monticore.lang.monticar.generator.cpp.optimizationSolver.solver.Solver;
import de.monticore.lang.monticar.generator.cpp.optimizationSolver.solver.SolverOptions;
import de.monticore.lang.monticar.generator.middleware.impls.GeneratorImpl;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import java.io.File;
......@@ -18,7 +17,7 @@ import java.util.List;
*
* @author Christoph Richter
*/
public class GeneratorEMAMOpt2CPP extends GeneratorCPP implements GeneratorImpl {
public class GeneratorEMAMOpt2CPP extends GeneratorCPP{
// fields
private OptimizationSymbolHandler executeMethodGeneratorOpt = new OptimizationSymbolHandler();
......@@ -41,8 +40,7 @@ public class GeneratorEMAMOpt2CPP extends GeneratorCPP implements GeneratorImpl
mathOptFunctionFixer.setSuccessor(MathFunctionFixer.getInstance());
}
@Override
public List<File> generate(ExpandedComponentInstanceSymbol componentInstanceSymbol, TaggingResolver taggingResolver) throws IOException {
public List<File> generate(EMAComponentInstanceSymbol componentInstanceSymbol, TaggingResolver taggingResolver) throws IOException {
List<File> files = new ArrayList<>();
files.addAll(generateFiles(componentInstanceSymbol, taggingResolver));
if (isGenerateCMakeEnabled())
......@@ -50,8 +48,7 @@ public class GeneratorEMAMOpt2CPP extends GeneratorCPP implements GeneratorImpl
return files;
}
@Override
public boolean willAccept(ExpandedComponentInstanceSymbol componentInstanceSymbol) {
public boolean willAccept(EMAComponentInstanceSymbol componentInstanceSymbol) {
return true;
}
......
package de.monticore.lang.monticar.generator.cpp;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.cpp.optimizationSolver.solver.Solver;
import de.monticore.lang.monticar.generator.cpp.resolver.Resolver;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
......@@ -76,7 +76,7 @@ public class GeneratorEMAMOpt2CppCli {
String outputPath = cliArgs.getOptionValue(OPTION_OUTPUT_PATH.getOpt());
TaggingResolver symTab = EMAMOpt2CPPSymbolTableHelper.getInstance().createSymTabAndTaggingResolver(new String[]{modelsDirPath.toString()});
Resolver resolver = new Resolver(symTab);
ExpandedComponentInstanceSymbol componentSymbol = resolveSymbol(resolver, rootModelName);
EMAComponentInstanceSymbol componentSymbol = resolveSymbol(resolver, rootModelName);
GeneratorEMAMOpt2CPP g = new GeneratorEMAMOpt2CPP();
g.setUseAlgebraicOptimizations(false);
g.setUseThreadingOptimization(false);
......@@ -116,8 +116,8 @@ public class GeneratorEMAMOpt2CppCli {
}
}
private static ExpandedComponentInstanceSymbol resolveSymbol(Resolver resolver, String rootModelName) {
ExpandedComponentInstanceSymbol componentSymbol = (ExpandedComponentInstanceSymbol) resolver.getExpandedComponentInstanceSymbol(rootModelName).orElse(null);
private static EMAComponentInstanceSymbol resolveSymbol(Resolver resolver, String rootModelName) {
EMAComponentInstanceSymbol componentSymbol = (EMAComponentInstanceSymbol) resolver.getEMAComponentInstanceSymbol(rootModelName).orElse(null);
if (componentSymbol == null) {
Log.error("could not resolve component " + rootModelName);
return null;
......
package de.monticore.lang.monticar.generator;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.cpp.EMAMOpt2CPPSymbolTableHelper;
import de.monticore.lang.monticar.generator.cpp.GeneratorEMAMOpt2CPP;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import org.junit.Test;
......@@ -16,9 +17,10 @@ public class CarModelGenerationTest extends BasicGenerationTest {
private static TaggingResolver symtab = EMAMOpt2CPPSymbolTableHelper.getInstance().createSymTabAndTaggingResolver("src/test/resources");
protected static List<File> doGenerateModel(String fullModelName) throws IOException {
ExpandedComponentInstanceSymbol componentInstanceSymbol = symtab.<ExpandedComponentInstanceSymbol>resolve(fullModelName, ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol componentInstanceSymbol = symtab.<EMAComponentInstanceSymbol>resolve(fullModelName, EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
GeneratorEMAMOpt2CMake generator = new GeneratorEMAMOpt2CMake();
GeneratorEMAMOpt2CPP generator = new GeneratorEMAMOpt2CPP();
generator.setGenerateCMake(true);
generator.setGenerationTargetPath("./target/generated-sources-cmake/" + fullModelName.substring(fullModelName.lastIndexOf(".") + 1, fullModelName.length()) + "/src/");
return generator.generate(componentInstanceSymbol, symtab);
}
......
package de.monticore.lang.monticar.generator;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.cpp.EMAMOpt2CPPSymbolTableHelper;
import de.monticore.lang.monticar.generator.cpp.GeneratorEMAMOpt2CPP;
import de.monticore.lang.monticar.generator.cpp.optimizationSolver.solver.Solver;
import de.monticore.lang.monticar.generator.middleware.impls.GeneratorImpl;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import org.junit.Test;
......@@ -27,16 +26,12 @@ public class GeneratorCplexSolverTest {
private static TaggingResolver symtab = EMAMOpt2CPPSymbolTableHelper.getInstance().createSymTabAndTaggingResolver("src/test/resources");
protected static List<File> doGenerateModel(String fullModelName) throws IOException {
ExpandedComponentInstanceSymbol componentInstanceSymbol = symtab.<ExpandedComponentInstanceSymbol>resolve(fullModelName, ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol componentInstanceSymbol = symtab.<EMAComponentInstanceSymbol>resolve(fullModelName, EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
GeneratorEMAMOpt2CMake generator = new GeneratorEMAMOpt2CMake();
for (GeneratorImpl gi : generator.getGeneratorImpls()) {
if (gi instanceof GeneratorEMAMOpt2CPP) {
GeneratorEMAMOpt2CPP g = (GeneratorEMAMOpt2CPP) gi;
g.setPreferedSolver(Solver.Cplex);
g.setForceUsePreferredSolver(true);
}
}
GeneratorEMAMOpt2CPP generator = new GeneratorEMAMOpt2CPP();
generator.setGenerateCMake(true);
generator.setPreferedSolver(Solver.Cplex);
generator.setForceUsePreferredSolver(true);
generator.setGenerationTargetPath("./target/generated-sources-cmake/cplex/" + fullModelName.substring(fullModelName.lastIndexOf(".") + 1, fullModelName.length()) + "/src/");
return generator.generate(componentInstanceSymbol, symtab);
}
......
package de.monticore.lang.monticar.generator;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.cpp.EMAMOpt2CPPSymbolTableHelper;
import de.monticore.lang.monticar.generator.cpp.GeneratorEMAMOpt2CPP;
import de.monticore.lang.monticar.generator.middleware.impls.GeneratorImpl;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import org.junit.Test;
......@@ -26,17 +25,14 @@ public class GeneratorEMAMOpt2CMakeTest extends BasicGenerationTest {
private static TaggingResolver symtab = EMAMOpt2CPPSymbolTableHelper.getInstance().createSymTabAndTaggingResolver("src/test/resources");
protected static List<File> doGenerateModel(String fullModelName) throws IOException {
ExpandedComponentInstanceSymbol componentInstanceSymbol = symtab.<ExpandedComponentInstanceSymbol>resolve(fullModelName, ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol componentInstanceSymbol = symtab.<EMAComponentInstanceSymbol>resolve(fullModelName, EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
GeneratorEMAMOpt2CMake generator = new GeneratorEMAMOpt2CMake();
GeneratorEMAMOpt2CPP generator = new GeneratorEMAMOpt2CPP();
generator.setGenerationTargetPath("./target/generated-sources-cmake/" + fullModelName.substring(fullModelName.lastIndexOf(".") + 1, fullModelName.length()) + "/src/");
for (GeneratorImpl g : generator.getGeneratorImpls()) {
GeneratorEMAMOpt2CPP gen = (GeneratorEMAMOpt2CPP) g;
gen.setGenerateCMake(true);
gen.setGenerateTests(true);
gen.setCheckModelDir(true);
gen.setModelsDirPath(Paths.get("src/test/resources"));
}
generator.setGenerateCMake(true);
generator.setGenerateTests(true);
generator.setCheckModelDir(true);
generator.setModelsDirPath(Paths.get("src/test/resources"));
return generator.generate(componentInstanceSymbol, symtab);
}
......
package de.monticore.lang.monticar.generator;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.cpp.EMAMOpt2CPPSymbolTableHelper;
import de.monticore.lang.monticar.generator.cpp.GeneratorCPP;
import de.monticore.lang.monticar.generator.cpp.GeneratorEMAMOpt2CPP;
......@@ -29,7 +29,7 @@ public class GeneratorEMAMOpt2CPPTest extends BasicGenerationTest {
* helper method to generate optimization models in CPP code
*/
protected static List<File> doGenerateOptimizationModel(String modelName) throws IOException {
ExpandedComponentInstanceSymbol componentSymbol = symtab.<ExpandedComponentInstanceSymbol>resolve(String.format("de.rwth.monticar.optimization.%s", modelName), ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol componentSymbol = symtab.<EMAComponentInstanceSymbol>resolve(String.format("de.rwth.monticar.optimization.%s", modelName), EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentSymbol);
GeneratorCPP generator = new GeneratorEMAMOpt2CPP();
generator.setGenerationTargetPath("./target/generated-sources-cpp/testMath/optimizationSolver/" + modelName);
......
package de.monticore.lang.monticar.generator;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.cpp.EMAMOpt2CPPSymbolTableHelper;
import de.monticore.lang.monticar.generator.cpp.GeneratorEMAMOpt2CPP;
import de.monticore.lang.monticar.generator.cpp.optimizationSolver.solver.Solver;
......@@ -18,7 +18,7 @@ public class TrajectoryControllerTest extends BasicGenerationTest {
@Test
public void generateTrajectoryControllerMPCBicycle() throws IOException {
TaggingResolver symtab = EMAMOpt2CPPSymbolTableHelper.getInstance().createSymTabAndTaggingResolver("src/test/resources");
ExpandedComponentInstanceSymbol componentInstanceSymbol = symtab.<ExpandedComponentInstanceSymbol>resolve("de.rwth.monticar.mpc.trajectoryControllerMPC", ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol componentInstanceSymbol = symtab.<EMAComponentInstanceSymbol>resolve("de.rwth.monticar.mpc.trajectoryControllerMPC", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(componentInstanceSymbol);
GeneratorEMAMOpt2CPP generator = new GeneratorEMAMOpt2CPP();
generator.setGenerateAutopilotAdapter(true);
......
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