Commit a48e9efa authored by Sascha Niklas Schneiders's avatar Sascha Niklas Schneiders
Browse files

publish to github for travis builds

parents
target
nppBackup
.project
.settings
.classpath
.idea
.git
*.iml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- == PROJECT COORDINATES ============================================= -->
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-generator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<!-- .. SE-Libraries .................................................. -->
<monticore.version>4.5.3-SNAPSHOT</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.4-SNAPSHOT</SIUnit.version>
<Common-MontiCar.version>0.0.3-SNAPSHOT</Common-MontiCar.version>
<Embedded-MontiArc.version>0.0.3-SNAPSHOT</Embedded-MontiArc.version>
<Embedded-MontiArc-Behaviour.version>0.0.3-SNAPSHOT</Embedded-MontiArc-Behaviour.version>
<Math.version>0.0.3-SNAPSHOT-REWORK</Math.version>
<Embedded-MontiArc-Math.version>0.0.3-SNAPSHOT-REWORK</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>
<shade.plugin>2.4.3</shade.plugin>
<!-- Classifiers -->
<grammars.classifier>grammars</grammars.classifier>
<cli.classifier>cli</cli.classifier>
<!-- .. Misc .......................................................... -->
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
</properties>
<dependencies>
<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>
<version>${guava.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</groupId>
<artifactId>SIUnit</artifactId>
<version>${SIUnit.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>SIUnit</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>
<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</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>
<version>4.0.1-SNAPSHOT</version>
</dependency>
<!-- .. Test Libraries ............................................... -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<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>
<!-- == PROJECT BUILD SETTINGS =========================================== -->
<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<altDeploymentRepository>internal.repo::default::file://${project.build.directory}/external-dependencies</altDeploymentRepository>
</configuration>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
<configuration>
<server>github</server>
<message>Maven artifacts for ${project.version} ${project.artifactId}</message> <!-- git commit message -->
<noJekyll>true</noJekyll> <!-- disable webpage processing -->
<outputDirectory>${project.build.directory}/external-dependencies</outputDirectory> <!-- matches distribution management repository url above -->
<branch>refs/heads/master</branch> <!-- remote branch name -->
<includes><include>**/*</include></includes>
<repositoryName>external-dependencies</repositoryName> <!-- github repo name -->
<repositoryOwner>EmbeddedMontiArc</repositoryOwner> <!-- github username -->
<merge>true</merge>
</configuration>
<executions>
<!-- run site-maven-plugin's 'site' target as part of the build's normal 'deploy' phase -->
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</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>
<version>${compiler.plugin}</version>
<configuration>
<useIncrementalCompilation>true</useIncrementalCompilation>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<!--plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${assembly.plugin}</version>
<dependencies>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>mc-assemblies</artifactId>
<version>${mc.grammars.assembly.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>grammars</id>
<configuration>
<finalName>${project.artifactId}-${project.version}</finalName>
<descriptorRefs>
<descriptorRef>grammars-assembly</descriptorRef>
</descriptorRefs>
<formats>
<format>jar</format>
</formats>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin -->
<!-- Source Jar Configuration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${source.plugin}</version>
<executions>
<execution>
<id>create source jar</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
<configuration>
<excludeResources>false</excludeResources>
<includes>
<include>**/*.java</include>
<include>**/*.ftl</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>Temporary Staging Repository</name>
<url>file://${project.build.directory}/external-dependencies</url>
</repository>
<snapshotRepository>
<id>internal.repo</id>
<url>file://${project.build.directory}/external-dependencies</url>
</snapshotRepository>
</distributionManagement>
</project>
package de.monticore.lang.monticar.generator;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceBuilder;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.optimization.MathInformationRegister;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
* @author Sascha Schneiders
*/
public class BluePrint {
protected Generator generator;//currentGeneratorInstance
protected List<Variable> variables = new ArrayList<>();
protected List<Method> methods = new ArrayList<>();
protected List<Variable> genericsVariableList = new ArrayList<>();
protected List<ConstantMatrix> constantMatrices = new ArrayList();
MathInformationRegister mathInformationRegister = new MathInformationRegister(this);
protected String name;
protected String packageName;
protected ExpandedComponentInstanceSymbol originalSymbol;
public BluePrint(String name) {
this.name = name;
}
public void setVariables(List<Variable> variables) {
this.variables = variables;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setPackageName(String name) {
this.packageName = name;
}
public String getPackageName() {
return packageName;
}
public List<Variable> getVariables() {
return variables;
}
public int howManyVariables() {
return variables.size();
}
public Optional<Variable> getVariable(String variableName) {
for (Variable v : variables)
if (v.getName().equals(variableName))
return Optional.of(v);
return Optional.empty();
}
public void addVariable(Variable v) {
variables.add(v);
}
public void removeVariable(Variable v) {
variables.remove(v);
}
public void addMethod(Method method) {
methods.add(method);
}
public List<Method> getMethods() {
return methods;
}
public MathInformationRegister getMathInformationRegister() {
return mathInformationRegister;
}
public void setMathInformationRegister(MathInformationRegister mathInformationRegister) {
this.mathInformationRegister = mathInformationRegister;
}
public void addGenericVariable(Variable genericVariable) {
genericsVariableList.add(genericVariable);
}
public List<Variable> getGenericsVariableList() {
return genericsVariableList;
}
public ExpandedComponentInstanceSymbol getOriginalSymbol() {
return originalSymbol;
}
public void setOriginalSymbol(ExpandedComponentInstanceSymbol originalSymbol) {
this.originalSymbol = originalSymbol;
}
public Optional<Method> getMethod(String name) {
for (Method method : getMethods()) {
if (method.getName().equals(name))
return Optional.of(method);
}
return Optional.empty();
}
public Generator getGenerator() {
return generator;
}
public void setGenerator(Generator generator) {
this.generator = generator;
}
public List<ConstantMatrix> getConstantMatrices() {
return constantMatrices;
}
public void setConstantMatrices(List<ConstantMatrix> constantMatrices) {
this.constantMatrices = constantMatrices;
}
public void addConstantMatrix(ConstantMatrix constantMatrix) {
this.constantMatrices.add(constantMatrix);
}
public MathCommandRegister getMathCommandRegister() {
return generator.getMathCommandRegister();
}
}
package de.monticore.lang.monticar.generator;
/**
* @author Sascha Schneiders
*/
public abstract class ConnectInstruction implements Instruction {
Variable variable1, variable2;
boolean useThis1 = false, useThis2 = false;
public ConnectInstruction() {
}
public ConnectInstruction(Variable variable1, Variable variable2) {
this.variable1 = variable1;
this.variable2 = variable2;
}
public ConnectInstruction(Variable variable1, boolean useThis1, Variable variable2, boolean useThis2) {
this.variable1 = variable1;
this.variable2 = variable2;
this.useThis1 = useThis1;
this.useThis2 = useThis2;
}
public Variable getVariable1() {
return variable1;
}
public Variable getVariable2() {
return variable2;
}
public boolean isUseThis1() {
return useThis1;
}
public boolean isUseThis2() {
return useThis2;
}
public void setVariable1(Variable variable1) {
this.variable1 = variable1;
}
public void setVariable2(Variable variable2) {
this.variable2 = variable2;
}
public void setUseThis1(boolean useThis1) {
this.useThis1 = useThis1;
}
public void setUseThis2(boolean useThis2) {
this.useThis2 = useThis2;
}
@Override
public boolean isConnectInstruction() {
return true;
}
}
package de.monticore.lang.monticar.generator;
import de.monticore.lang.math.math._symboltable.expression.MathExpressionSymbol;
/**
* @author Sascha Schneiders
*/
public class ConstantMatrix {
public static int LASTID = 0;
protected String name;
protected MathExpressionSymbol mathExpressionSymbol;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public MathExpressionSymbol getMathExpressionSymbol() {
return mathExpressionSymbol;
}
public void setMathExpressionSymbol(MathExpressionSymbol mathExpressionSymbol) {
this.mathExpressionSymbol = mathExpressionSymbol;
}
}
package de.monticore.lang.monticar.generator;
import de.monticore.lang.monticar.generator.cpp.converter.ComponentConverter;
/**
* @author Sascha Schneiders
*/
public class ExecuteInstruction implements Instruction {
String componentName;
BluePrint bluePrint;
String threadName = null;
boolean canBeThreaded = false;
public static int threadCounter = 0;
public ExecuteInstruction(String componentName, BluePrint bluePrint, boolean canBeThreaded) {
this.bluePrint = bluePrint;
this.canBeThreaded = canBeThreaded;
while (!bluePrint.getVariable(componentName).isPresent() && componentName.contains("_")) {
componentName = componentName.replaceFirst("\\_", "[");
componentName = componentName.replaceFirst("\\_", "]");
}
this.componentName = ComponentConverter.getTargetLanguageVariableInstanceName(componentName);
if (canBeThreaded)
this.threadName = "thread" + ++threadCounter;
}
public String getComponentName() {
return componentName;
}