Commit 79766203 authored by René Schöne's avatar René Schöne
Browse files

Merge branch 'release-0.3.1' into 'master'

Version 0.3.1

See merge request !8
parents 1f7396a9 3f1eb2a9
Pipeline #9913 passed with stages
in 8 minutes and 28 seconds
......@@ -32,7 +32,7 @@ test:
image: openjdk:11
stage: test
services:
- name: "eclipse-mosquitto:1.6.9"
- name: "eclipse-mosquitto:1.6"
alias: "mqtt"
needs:
- build
......
[submodule "relast-preprocessor"]
path = relast-preprocessor
url = ../relast-preprocessor.git
branch = jastadd-fix-inc-param-debug
[submodule "ragconnect.base/src/main/jastadd/mustache"]
path = ragconnect.base/src/main/jastadd/mustache
url = ../mustache
branch = develop
# Changelog
## 0.3.1
- Full support for incremental dependency tracking
- Full support for subtree endpoint definitions ([#9](https://git-st.inf.tu-dresden.de/jastadd/ragconnect/-/issues/9))
- Internal: Use updated gradle plugin for tests ([#18](https://git-st.inf.tu-dresden.de/jastadd/ragconnect/-/issues/18))
- Bugfix [#22](https://git-st.inf.tu-dresden.de/jastadd/ragconnect/-/issues/22): Correct handling of malformed URIs passed when connecting an endpoint
- Bugfix [#23](https://git-st.inf.tu-dresden.de/jastadd/ragconnect/-/issues/23): Correct handling of OptComponents as endpoints
- Bugfix [#27](https://git-st.inf.tu-dresden.de/jastadd/ragconnect/-/issues/27): Correctly handle whitespaces in grammars
## 0.3.0
- Added [API documentation](ragdoc/index.html) to documentation
- Add methods to `disconnect` an endpoint
- Internal: PoC for incremental dependency tracking and subtree endpoint definitions ([#14](https://git-st.inf.tu-dresden.de/jastadd/ragconnect/-/issues/14))
- Bugfix [#17](https://git-st.inf.tu-dresden.de/jastadd/ragconnect/-/issues/17): Added missing support for `boolean`
......@@ -5,6 +5,7 @@ nav:
- inner-workings.md
- using.md
- extending.md
- changelog.md
- API documentation: ragdoc/index.html
theme:
name: readthedocs
......
......@@ -27,11 +27,9 @@ repositories {
dependencies {
implementation project(':relast-preprocessor')
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: "${log4j_version}"
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: "${log4j_version}"
implementation group: 'org.apache.logging.log4j', name: 'log4j-jul', version: "${log4j_version}"
implementation group: 'com.github.spullara.mustache.java', name: 'compiler', version: "${mustache_java_version}"
runtimeOnly group: 'org.jastadd', name: 'jastadd', version: '2.3.5'
// runtimeOnly group: 'org.jastadd', name: 'jastadd', version: '2.3.5'
runtimeOnly fileTree(include: ['jastadd2.jar'], dir: '../libs')
api group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
}
......@@ -67,14 +65,12 @@ idea.module.generatedSourceDirs += genSrc
jar {
manifest {
attributes "Main-Class": 'org.jastadd.ragconnect.compiler.Compiler'
// Log4J + Java 11 compatibility, see https://stackoverflow.com/q/53049346/2493208
attributes "Multi-Release": true
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveBaseName = 'ragconnect'
}
......@@ -82,7 +78,7 @@ jar {
File preprocessorGrammar = file('../relast-preprocessor/src/main/jastadd/RelAst.relast')
File ragConnectGrammar = file('./src/main/jastadd/RagConnect.relast')
File intermediateGrammar = file('./src/main/jastadd/intermediate/MustacheNodes.relast')
File mustacheGrammar = file('./src/main/jastadd/mustache/Mustache.relast')
File mustacheGrammar = file('../relast-preprocessor/src/main/jastadd/mustache/Mustache.relast')
task relast(type: JavaExec) {
group = 'Build'
main = "-jar"
......@@ -224,3 +220,4 @@ publishing {
}
publish.dependsOn jar
jar.dependsOn ":relast-preprocessor:jar"
aspect Analysis {
// --- lookupTokenEndpointDefinition ---
inh java.util.List<TokenEndpointDefinition> TokenEndpointDefinition.lookupTokenEndpointDefinitions(TokenComponent token);
eq RagConnect.getEndpointDefinition().lookupTokenEndpointDefinitions(TokenComponent token) = lookupTokenEndpointDefinitions(token);
eq RagConnect.getConnectSpecificationFile().lookupTokenEndpointDefinitions(TokenComponent token) = lookupTokenEndpointDefinitions(token);
syn java.util.List<TokenEndpointDefinition> RagConnect.lookupTokenEndpointDefinitions(TokenComponent token) {
java.util.List<TokenEndpointDefinition> result = new java.util.ArrayList<>();
for (EndpointDefinition def : getEndpointDefinitionList()) {
for (EndpointDefinition def : allEndpointDefinitionList()) {
if (def.isTokenEndpointDefinition() && def.asTokenEndpointDefinition().getToken().equals(token)) {
result.add(def.asTokenEndpointDefinition());
}
......@@ -14,10 +14,10 @@ aspect Analysis {
// --- lookupTypeEndpointDefinition ---
inh java.util.List<TypeEndpointDefinition> TypeEndpointDefinition.lookupTypeEndpointDefinitions(TypeComponent type);
eq RagConnect.getEndpointDefinition().lookupTypeEndpointDefinitions(TypeComponent type) = lookupTypeEndpointDefinitions(type);
eq RagConnect.getConnectSpecificationFile().lookupTypeEndpointDefinitions(TypeComponent type) = lookupTypeEndpointDefinitions(type);
syn java.util.List<TypeEndpointDefinition> RagConnect.lookupTypeEndpointDefinitions(TypeComponent type) {
java.util.List<TypeEndpointDefinition> result = new java.util.ArrayList<>();
for (EndpointDefinition def : getEndpointDefinitionList()) {
for (EndpointDefinition def : allEndpointDefinitionList()) {
if (def.isTypeEndpointDefinition() && def.asTypeEndpointDefinition().getType().equals(type)) {
result.add(def.asTypeEndpointDefinition());
}
......@@ -27,8 +27,8 @@ aspect Analysis {
// --- lookupDependencyDefinition ---
inh DependencyDefinition DependencyDefinition.lookupDependencyDefinition(TypeDecl source, String id);
eq RagConnect.getDependencyDefinition().lookupDependencyDefinition(TypeDecl source, String id) {
for (DependencyDefinition def : getDependencyDefinitionList()) {
eq RagConnect.getConnectSpecificationFile().lookupDependencyDefinition(TypeDecl source, String id) {
for (DependencyDefinition def : allDependencyDefinitionList()) {
if (def.getID().equals(id) && def.getSource().containingTypeDecl().equals(source)) {
return def;
}
......
aspect Configuration {
public static boolean ASTNode.loggingEnabledForReads = false;
public static boolean ASTNode.loggingEnabledForWrites = false;
public static boolean ASTNode.loggingEnabledForIncremental = false;
public static TypeDecl ASTNode.rootNode;
public static boolean ASTNode.usesMqtt;
public static boolean ASTNode.usesRest;
public static boolean ASTNode.incrementalOptionActive;
public static boolean ASTNode.experimentalJastAdd329;
}
......@@ -2,7 +2,7 @@ aspect NameResolution {
refine RefResolverStubs eq EndpointDefinition.resolveMappingByToken(String id, int position) {
// return a MappingDefinition
for (MappingDefinition mappingDefinition : ragconnect().getMappingDefinitionList()) {
for (MappingDefinition mappingDefinition : ragconnect().allMappingDefinitionList()) {
if (mappingDefinition.getID().equals(id)) {
return mappingDefinition;
}
......
aspect Navigation {
import java.util.List;
import java.util.ArrayList;
aspect RagConnectNavigation {
// --- program ---
eq RagConnect.getChild().program() = getProgram();
......@@ -9,15 +12,54 @@ aspect Navigation {
eq RagConnect.getChild().ragconnect() = this;
eq MRagConnect.getChild().ragconnect() = getRagConnect();
// --- containedConnectSpecification ---
inh ConnectSpecification ASTNode.containedConnectSpecification();
eq RagConnect.getChild().containedConnectSpecification() = null;
eq MRagConnect.getChild().containedConnectSpecification() = null;
eq Document.getChild().containedConnectSpecification() = null;
eq Program.getChild().containedConnectSpecification() = null;
eq ConnectSpecification.getChild().containedConnectSpecification() = this;
// --- containedFile
eq Grammar.getChild().containedFile() = null;
eq RagConnect.getChild().containedFile() = null;
eq MRagConnect.getChild().containedFile() = null;
// --- containedFileName ---
eq Grammar.getChild().containedFileName() = null; // should be in PP
eq RagConnect.getChild().containedFileName() = getFileName();
eq MRagConnect.getChild().containedFileName() = null;
eq ConnectSpecificationFile.containedFileName() = getFileName();
refine Navigation eq ASTNode.containedFileName() {
if (containedFile() == null) {
return containedConnectSpecification().containedFileName();
}
return refined();
// return containedFile().getFileName();
}
//--- allEndpointDefinitionList ---
syn List<EndpointDefinition> RagConnect.allEndpointDefinitionList() {
List<EndpointDefinition> result = new ArrayList<>();
for (var spec : getConnectSpecificationFileList()) {
spec.getEndpointDefinitionList().forEach(result::add);
}
return result;
}
//--- allDependencyDefinitionList ---
syn List<DependencyDefinition> RagConnect.allDependencyDefinitionList() {
List<DependencyDefinition> result = new ArrayList<>();
for (var spec : getConnectSpecificationFileList()) {
spec.getDependencyDefinitionList().forEach(result::add);
}
return result;
}
//--- allMappingDefinitionList ---
syn List<MappingDefinition> RagConnect.allMappingDefinitionList() {
List<MappingDefinition> result = new ArrayList<>();
for (var spec : getConnectSpecificationFileList()) {
spec.getMappingDefinitionList().forEach(result::add);
}
return result;
}
// --- isTokenEndpointDefinition ---
syn boolean EndpointDefinition.isTokenEndpointDefinition() = false;
......@@ -70,7 +112,7 @@ aspect Navigation {
// --- targetEndpointDefinition ---
syn EndpointDefinition DependencyDefinition.targetEndpointDefinition() {
// resolve definition in here, as we do not need resolveMethod in any other place (yet)
for (EndpointDefinition endpointDefinition : ragconnect().getEndpointDefinitionList()) {
for (EndpointDefinition endpointDefinition : ragconnect().allEndpointDefinitionList()) {
if (endpointDefinition.isSendTokenEndpointDefinition() &&
endpointDefinition.asSendTokenEndpointDefinition().getToken().equals(this.getTarget())) {
return endpointDefinition;
......@@ -96,4 +138,7 @@ aspect Navigation {
// --- rootTypeComponents ---
syn JastAddList<MTypeComponent> MHandler.rootTypeComponents() = mragconnect().getRootTypeComponents();
// --- isListComponent --- (defined in PP, but only on TypeComponent)
syn boolean Component.isListComponent() = false;
}
RagConnect ::= EndpointDefinition* DependencyDefinition* MappingDefinition* Program <FileName> ;
RagConnect ::= ConnectSpecificationFile* Program ;
abstract ConnectSpecification ::= EndpointDefinition* DependencyDefinition* MappingDefinition* ;
ConnectSpecificationFile : ConnectSpecification ::= <FileName> ;
abstract EndpointDefinition ::= <AlwaysApply:boolean> ;
......
......@@ -62,12 +62,17 @@ aspect AttributesForMustache {
syn String MEndpointDefinition.lastDefinitionToType() = lastDefinition().toType();
syn String MEndpointDefinition.lastResult() = lastDefinition().outputVarName();
syn String MEndpointDefinition.condition() {
// TODO probably, this has to be structured in a better way
if (lastDefinition().mappingDef().getToType().isArray()) {
return "java.util.Arrays.equals(" + preemptiveExpectedValue() + ", " + lastResult() + ")";
}
if (endpointDef().isTokenEndpointDefinition() && token().isPrimitiveType() && lastDefinition().mappingDef().getToType().isPrimitiveType()) {
return preemptiveExpectedValue() + " == " + lastResult();
}
if (endpointDef().isTypeEndpointDefinition() && type().isOptComponent()) {
// use "hasX()" instead of "getX() != null" for optionals
return "has" + typeName() + "()" + " && " + preemptiveExpectedValue() + ".equals(" + lastResult() + ")";
}
if (lastDefinition().mappingDef().getToType().isPrimitiveType() || lastDefinition().mappingDef().isDefaultMappingDefinition()) {
return preemptiveExpectedValue() + " != null && " + preemptiveExpectedValue() + ".equals(" + lastResult() + ")";
}
......@@ -172,7 +177,7 @@ aspect AttributesForMustache {
syn lazy MRagConnect RagConnect.toMustache() {
MRagConnect result = new MRagConnect();
result.setRagConnect(this);
for (EndpointDefinition def : getEndpointDefinitionList()) {
for (EndpointDefinition def : allEndpointDefinitionList()) {
if (def.isReceiveTokenEndpointDefinition()) {
result.addTokenReceiveDefinition(def.asReceiveTokenEndpointDefinition().toMustache());
} else if (def.isSendTokenEndpointDefinition()) {
......@@ -188,7 +193,7 @@ aspect AttributesForMustache {
for (MappingDefinition def : allMappingDefinitions()) {
result.addMappingDefinition(def.toMustache());
}
for (DependencyDefinition def : getDependencyDefinitionList()) {
for (DependencyDefinition def : allDependencyDefinitionList()) {
result.addDependencyDefinition(def.toMustache());
}
for (TokenComponent token : getProgram().allTokenComponents()) {
......@@ -311,7 +316,7 @@ aspect AspectGeneration {
aspect RelationGeneration {
syn java.util.List<Relation> RagConnect.additionalRelations() {
java.util.List<Relation> result = new java.util.ArrayList<>();
for (DependencyDefinition dd : getDependencyDefinitionList()) {
for (DependencyDefinition dd : allDependencyDefinitionList()) {
result.add(dd.getRelationToCreate());
}
return result;
......
......@@ -298,7 +298,7 @@ aspect Mappings {
syn java.util.List<MappingDefinition> RagConnect.allMappingDefinitions() {
java.util.List<MappingDefinition> result = new java.util.ArrayList<>();
// user-defined mappings
getMappingDefinitionList().iterator().forEachRemaining(result::add);
allMappingDefinitionList().iterator().forEachRemaining(result::add);
// byte[] <-> primitive conversion
result.add(defaultBytesToBooleanMapping());
result.add(defaultBytesToIntMapping());
......
......@@ -206,5 +206,5 @@ aspect Navigation {
eq Document.getChild().program() = null;
eq Document.getChild().ragconnect() = null;
eq Document.getChild().containedFile() = null;
eq Document.getChild().containedFileName() = getFileName();
eq Document.containedFileName() = getFileName();
}
Subproject commit c10bed0d03e3fa18b8133ce1de48de7646899615
......@@ -4,4 +4,4 @@ import org.jastadd.ragconnect.ast.*;
:};
%goal goal;
%goal ragconnect;
%goal connect_specification_file;
RagConnect ragconnect
= endpoint_definition.d ragconnect.r {: r.getEndpointDefinitionList().insertChild(d, 0); return r; :}
| dependency_definition.d ragconnect.r {: r.getDependencyDefinitionList().insertChild(d, 0); return r; :}
| mapping_definition.d ragconnect.r {: r.getMappingDefinitionList().insertChild(d, 0); return r; :}
| comment ragconnect.r {: return r; :}
| {: return new RagConnect(); :}
ConnectSpecificationFile connect_specification_file
= endpoint_definition.d connect_specification_file.r
{:
r.getEndpointDefinitionList().insertChild(d, 0); return r;
:}
| dependency_definition.d connect_specification_file.r
{:
r.getDependencyDefinitionList().insertChild(d, 0); return r;
:}
| mapping_definition.d connect_specification_file.r
{:
r.getMappingDefinitionList().insertChild(d, 0); return r;
:}
| comment connect_specification_file.r
{:
return r;
:}
| {: return new ConnectSpecificationFile(); :}
;
%embed {:
......
......@@ -3,11 +3,11 @@ package org.jastadd.ragconnect.compiler;
import beaver.Parser;
import org.jastadd.option.BooleanOption;
import org.jastadd.option.ValueOption;
import org.jastadd.relast.compiler.AbstractCompiler;
import org.jastadd.relast.compiler.CompilerException;
import org.jastadd.ragconnect.ast.*;
import org.jastadd.ragconnect.parser.RagConnectParser;
import org.jastadd.ragconnect.scanner.RagConnectScanner;
import org.jastadd.relast.compiler.AbstractCompiler;
import org.jastadd.relast.compiler.CompilerException;
import java.io.*;
import java.nio.file.Files;
......@@ -15,6 +15,8 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Compiler extends AbstractCompiler {
......@@ -25,10 +27,14 @@ public class Compiler extends AbstractCompiler {
private BooleanOption optionVerbose;
private BooleanOption optionLogReads;
private BooleanOption optionLogWrites;
private BooleanOption optionLogIncremental;
private BooleanOption optionExperimentalJastAdd329;
private static final String OPTION_PROTOCOL_MQTT = "mqtt";
private static final String OPTION_PROTOCOL_REST = "rest";
private final static Logger LOGGER = Logger.getLogger(Compiler.class.getName());
public Compiler() {
super("ragconnect", true);
}
......@@ -43,8 +49,11 @@ public class Compiler extends AbstractCompiler {
getConfiguration().printHelp(System.out);
return 0;
}
if (optionVerbose.value()) {
LOGGER.setLevel(Level.FINE);
}
printMessage("Running RagConnect " + readVersion());
LOGGER.info(() -> "Running RagConnect " + readVersion());
if (!getConfiguration().outputDir().exists()) {
try {
......@@ -61,10 +70,11 @@ public class Compiler extends AbstractCompiler {
RagConnect ragConnect = parseProgram(getConfiguration().getFiles());
if (!ragConnect.errors().isEmpty()) {
System.err.println("Errors:");
StringBuilder sb = new StringBuilder("Errors:\n");
for (ErrorMessage e : ragConnect.errors()) {
System.err.println(e);
sb.append(e).append("\n");
}
LOGGER.severe(sb::toString);
System.exit(1);
}
......@@ -76,7 +86,7 @@ public class Compiler extends AbstractCompiler {
return 0;
}
printMessage("Writing output files");
LOGGER.fine("Writing output files");
final List<String> handlers = new ArrayList<>();
if (ASTNode.usesMqtt) {
handlers.add("MqttHandler.jadd");
......@@ -107,12 +117,11 @@ public class Compiler extends AbstractCompiler {
}
public static void main(String[] args) {
System.setProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager");
System.setProperty("mustache.debug", "true");
try {
new Compiler().run(args);
} catch (CompilerException e) {
e.printStackTrace();
LOGGER.log(Level.SEVERE, e.getMessage(), e);
System.exit(1);
}
}
......@@ -137,12 +146,6 @@ public class Compiler extends AbstractCompiler {
}
}
private void printMessage(String message) {
if (optionVerbose.value()) {
System.out.println(message);
}
}
private void writeToFile(Path path, String str) throws CompilerException {
try (BufferedWriter writer = Files.newBufferedWriter(path)) {
writer.append(str);
......@@ -175,6 +178,12 @@ public class Compiler extends AbstractCompiler {
optionLogWrites = addOption(
new BooleanOption("logWrites", "Enable logging for every write.")
.defaultValue(false));
optionLogIncremental = addOption(
new BooleanOption("logIncremental", "Enable logging for observer in incremental dependency tracking.")
.defaultValue(false));
optionExperimentalJastAdd329 = addOption(
new BooleanOption("experimental-jastadd-329", "Use trace events INC_FLUSH_START and INC_FLUSH_END (JastAdd issue #329).")
.defaultValue(false));
}
private RagConnect parseProgram(Collection<String> files) throws CompilerException {
......@@ -195,14 +204,13 @@ public class Compiler extends AbstractCompiler {
case "ast":
case "relast":
// processGrammar
parseGrammar(program, filename);
program.addGrammarFile(parseGrammar(filename));
atLeastOneGrammar = true;
break;
case "connect":
case "ragconnect":
// process ragConnect
RagConnect parsedRagConnect = parseRagConnect(program, filename);
mergeRagConnectDefinitions(ragConnect, parsedRagConnect);
ragConnect.addConnectSpecificationFile(parseConnectSpec(filename));
atLeastOneRagConnect = true;
break;
default:
......@@ -210,10 +218,10 @@ public class Compiler extends AbstractCompiler {
}
}
if (!atLeastOneGrammar) {
System.err.println("No grammar file specified! (*.ast, *.relast)");
LOGGER.severe(() -> "No grammar file specified! (*.ast, *.relast)");
}
if (!atLeastOneRagConnect) {
System.err.println("No ragconnect file specified! (*.connect, *.ragconnect)");
LOGGER.severe(() -> "No ragconnect file specified! (*.connect, *.ragconnect)");
}
if (!atLeastOneGrammar && !atLeastOneRagConnect) {
System.exit(1);
......@@ -226,39 +234,40 @@ public class Compiler extends AbstractCompiler {
ragConnect.additionalRelations().forEach(ragConnectGrammarPart::addDeclaration);
ASTNode.loggingEnabledForReads = optionLogReads.value();
ASTNode.loggingEnabledForWrites = optionLogWrites.value();
ASTNode.loggingEnabledForIncremental = optionLogIncremental.value();
ASTNode.experimentalJastAdd329 = optionExperimentalJastAdd329.value();
// reuse "--incremental" option of JastAdd
ASTNode.incrementalOptionActive = getConfiguration().incremental() && getConfiguration().traceFlush();
printMessage("ASTNode.incrementalOptionActive = " + ASTNode.incrementalOptionActive);
LOGGER.fine(() -> "ASTNode.incrementalOptionActive = " + ASTNode.incrementalOptionActive);
ASTNode.usesMqtt = optionProtocols.hasValue(OPTION_PROTOCOL_MQTT);
ASTNode.usesRest = optionProtocols.hasValue(OPTION_PROTOCOL_REST);
return ragConnect;
}
private void parseGrammar(Program program, String filename) throws CompilerException {
private GrammarFile parseGrammar(String filename) throws CompilerException {
try (BufferedReader reader = Files.newBufferedReader(Paths.get(filename))) {
RagConnectScanner scanner = new RagConnectScanner(reader);
RagConnectParser parser = new RagConnectParser();
GrammarFile grammarFile = (GrammarFile) parser.parse(scanner);
if (optionVerbose.value()) {
grammarFile.dumpTree(System.out);
LOGGER.fine(grammarFile::dumpTree);
}
program.addGrammarFile(grammarFile);
grammarFile.setFileName(toBaseName(filename));
return grammarFile;
} catch (IOException | Parser.Exception e) {
throw new CompilerException("Could not parse grammar file " + filename, e);
}
}
private RagConnect parseRagConnect(Program program, String filename) throws CompilerException {
private ConnectSpecificationFile parseConnectSpec(String filename) throws CompilerException {
try (BufferedReader reader = Files.newBufferedReader(Paths.get(filename))) {
RagConnectScanner scanner = new RagConnectScanner(reader);
RagConnectParser parser = new RagConnectParser();
RagConnect ragConnect = (RagConnect) parser.parse(scanner, RagConnectParser.AltGoals.ragconnect);
ragConnect.setProgram(program);
ragConnect.setFileName(toBaseName(filename));
return ragConnect;
ConnectSpecificationFile specificationFile = (ConnectSpecificationFile) parser.parse(scanner, RagConnectParser.AltGoals.connect_specification_file);
specificationFile.setFileName(toBaseName(filename));
return specificationFile;
} catch (IOException | Parser.Exception e) {
throw new CompilerException("Could not parse connect file " + filename, e);
}
......@@ -273,13 +282,6 @@ public class Compiler extends AbstractCompiler {
return new File(filename).getName();
}
private void mergeRagConnectDefinitions(RagConnect ragConnect, RagConnect ragConnectToIntegrate) {
ragConnectToIntegrate.getEndpointDefinitionList().forEach(ragConnect::addEndpointDefinition);
ragConnectToIntegrate.getMappingDefinitionList().forEach(ragConnect::addMappingDefinition);
ragConnectToIntegrate.getDependencyDefinitionList().forEach(ragConnect::addDependencyDefinition);
ragConnect.setFileName(ragConnect.getFileName().isEmpty() ? ragConnectToIntegrate.getFileName() : ragConnect.getFileName() + " + " + ragConnectToIntegrate.getFileName());
}
// protected void printUsage() {
// System.out.println("Usage: java -jar ragconnect.jar [--option1] [--option2=value] ... <filename1> <filename2> ... ");
// System.out.println("Options:");
......
package org.jastadd.ragconnect.compiler;
import org.jastadd.ragconnect.ast.Document;
import org.jastadd.ragconnect.ast.ListElement;
import org.jastadd.ragconnect.ast.MappingElement;
/**
* Testing Ros2Rag without parser.
*
* @author rschoene - Initial contribution
*/
public class SimpleMain {
private static void printManualYAML() {
Document doc = new Document();
MappingElement root = new MappingElement();
MappingElement firstLevel = new MappingElement();
firstLevel.put("server", "tcp://localhost:1883");
firstLevel.put("robot_speed_factor", ".7");
MappingElement theTopics = new MappingElement();
theTopics.put("robotConfig", "robotconfig");
theTopics.put("trajectory", "trajectory");
theTopics.put("nextStep", "ros2rag/nextStep");
firstLevel.put("topics", theTopics);
firstLevel.put("zone_size", "0.5");
ListElement theZones = new ListElement();
theZones.add("1 1");
theZones.add("0 1");
theZones.add("-1 1");
firstLevel.put("zones", theZones);
MappingElement pandaParts = new MappingElement();
MappingElement thePanda = new MappingElement();
thePanda.put("Link0", "panda_link0");
thePanda.put("Link1", "panda_link1");
thePanda.put("Link2", "panda_link2");
thePanda.put("Link3", "panda_link3");
thePanda.put("Link4", "panda_link4");
thePanda.put("Link5", "panda_link5");
thePanda.put("Link6", "panda_link6");
thePanda.put("RightFinger", "panda_rightfinger");