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