Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Belle2018-08-29 05:41:30 -0400
committerJan Belle2018-08-31 05:11:08 -0400
commit99a2c70b13dc3713b7e63c1e1b15ce1e46085815 (patch)
tree3d775f801d558855c85880dc4f7408986524016e
parent0c4faa4761c9085523c8f51dac59106eb2fbda48 (diff)
downloadorg.eclipse.etrice-99a2c70b13dc3713b7e63c1e1b15ce1e46085815.tar.gz
org.eclipse.etrice-99a2c70b13dc3713b7e63c1e1b15ce1e46085815.tar.xz
org.eclipse.etrice-99a2c70b13dc3713b7e63c1e1b15ce1e46085815.zip
[generator] Refactor generators to implement common generator interface
* migrated to new generator options implementation Change-Id: I086b384d502fcd1576256a2afaf08df2538b3670
-rw-r--r--examples/my.etrice.generator.launch/META-INF/MANIFEST.MF3
-rw-r--r--examples/my.etrice.generator.launch/src/my/etrice/generator/launch/DerivedGeneratorLaunchConfigurationDelegate.java5
-rw-r--r--examples/my.etrice.generator/src/my/etrice/generator/DerivedGenerator.java3
-rw-r--r--features/org.eclipse.etrice.feature/feature.xml7
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java3
-rw-r--r--plugins/org.eclipse.etrice.core.etmap/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel.fsm/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel.fsm/build.gradle1
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.xtend1
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/ILogger.java45
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/NullLogger.java50
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/RoomGenmodelValidator.java2
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java2
-rw-r--r--plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java166
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend8
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/EnumerationTypeGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend10
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend8
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java5
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorOptions.java22
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorOptionsHelper.java22
-rw-r--r--plugins/org.eclipse.etrice.generator.config/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java10
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java148
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend12
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Validator.java4
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java5
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorOptions.java22
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorOptionsHelper.java22
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/Main.java100
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocGen.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/GlobalSettings.java32
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorModule.java5
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptions.java38
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptionsHelper.java26
-rw-r--r--plugins/org.eclipse.etrice.generator.fsm/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.etrice.generator.fsm/build.gradle1
-rw-r--r--plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/DefaultFSMTranslationProvider.java2
-rw-r--r--plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/Diagnostician.java46
-rw-r--r--plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/IGeneratorFileIo.java36
-rw-r--r--plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/ILineOutput.java25
-rw-r--r--plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/ILineOutputLogger.java30
-rw-r--r--plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/IncrementalGenerationFileIo.java119
-rw-r--r--plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/Logger.java78
-rw-r--r--plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/NullLogger.java29
-rw-r--r--plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/StdLineOutput.java31
-rw-r--r--plugins/org.eclipse.etrice.generator.gnuplot/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.gnuplot/src/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.java.mvn/.classpath2
-rw-r--r--plugins/org.eclipse.etrice.generator.java.mvn/src/main/java/org/eclipse/etrice/generator/java/mvn/JavaGeneratorWrapper.java2
-rw-r--r--plugins/org.eclipse.etrice.generator.java/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/Main.java180
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/GlobalSettings.java53
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/MainGen.xtend3
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.xtend6
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend12
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Validator.java4
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorModule.java11
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorOptions.java45
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorOptionsHelper.java30
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.c/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorLaunchConfigurationDelegate.java5
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java5
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.java/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.java/src/org/eclipse/etrice/generator/launch/java/JavaGeneratorLaunchConfigurationDelegate.java12
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/ConsoleOutput.java2
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java4
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java35
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectWizard.java4
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/internal/COptionsPage.java6
-rw-r--r--plugins/org.eclipse.etrice.generator/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.etrice.generator/build.gradle2
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java506
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorBaseModule.java34
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptions.java95
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptionsHelper.java54
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.xtend40
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/IDataConfiguration.java2
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/ModelLoader.java29
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/ModelValidator.java54
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/PrepareFileSystem.xtend7
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend2
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TestInstanceCreator.xtend8
-rw-r--r--plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/refactoring/DiagramReferenceUpdater.xtend30
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.fsm.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestCodeInheritance.xtend2
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestFlatFSM.xtend2
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestFlatInheritedFSM.xtend2
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierFSM.xtend2
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierInheritedFSM.xtend2
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestMultipleConnectedChoicepoint.xtend5
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestStatesInheritance.xtend2
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestStatesTriggers.xtend2
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestTrigger.xtend2
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java2
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestFSMGenModel.xtend2
125 files changed, 1031 insertions, 1611 deletions
diff --git a/examples/my.etrice.generator.launch/META-INF/MANIFEST.MF b/examples/my.etrice.generator.launch/META-INF/MANIFEST.MF
index d7010fc39..3136512f3 100644
--- a/examples/my.etrice.generator.launch/META-INF/MANIFEST.MF
+++ b/examples/my.etrice.generator.launch/META-INF/MANIFEST.MF
@@ -13,4 +13,5 @@ Require-Bundle: my.etrice.generator;bundle-version="2.0.0",
org.eclipse.debug.ui;bundle-version="3.8.1",
org.eclipse.swt;bundle-version="3.100.1",
org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.jdt.launching;bundle-version="3.6.100"
+ org.eclipse.jdt.launching;bundle-version="3.6.100",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
diff --git a/examples/my.etrice.generator.launch/src/my/etrice/generator/launch/DerivedGeneratorLaunchConfigurationDelegate.java b/examples/my.etrice.generator.launch/src/my/etrice/generator/launch/DerivedGeneratorLaunchConfigurationDelegate.java
index e0fbbf107..87231876a 100644
--- a/examples/my.etrice.generator.launch/src/my/etrice/generator/launch/DerivedGeneratorLaunchConfigurationDelegate.java
+++ b/examples/my.etrice.generator.launch/src/my/etrice/generator/launch/DerivedGeneratorLaunchConfigurationDelegate.java
@@ -14,7 +14,7 @@ package my.etrice.generator.launch;
import my.etrice.generator.DerivedGenerator;
-import org.eclipse.etrice.generator.fsm.base.ILineOutput;
+import org.eclipse.etrice.generator.base.io.ILineOutput;
import org.eclipse.etrice.generator.launch.java.JavaGeneratorLaunchConfigurationDelegate;
/**
@@ -40,8 +40,7 @@ public class DerivedGeneratorLaunchConfigurationDelegate extends
*/
protected void runGenerator(String[] args, ILineOutput out) {
DerivedGenerator.setOutput(out);
- DerivedGenerator.setTerminateOnError(false);
- DerivedGenerator.main(args);
+ DerivedGenerator.run(args);
}
}
diff --git a/examples/my.etrice.generator/src/my/etrice/generator/DerivedGenerator.java b/examples/my.etrice.generator/src/my/etrice/generator/DerivedGenerator.java
index b29998774..458e4077f 100644
--- a/examples/my.etrice.generator/src/my/etrice/generator/DerivedGenerator.java
+++ b/examples/my.etrice.generator/src/my/etrice/generator/DerivedGenerator.java
@@ -26,7 +26,6 @@ public class DerivedGenerator extends Main {
public static void main(String[] args) {
int ret = createAndRunGenerator(new DerivedGeneratorModule(), args);
- if (isTerminateOnError() && ret!=GENERATOR_OK)
- System.exit(ret);
+ System.exit(ret);
}
}
diff --git a/features/org.eclipse.etrice.feature/feature.xml b/features/org.eclipse.etrice.feature/feature.xml
index 3f60bd41e..858492162 100644
--- a/features/org.eclipse.etrice.feature/feature.xml
+++ b/features/org.eclipse.etrice.feature/feature.xml
@@ -345,4 +345,11 @@ http://www.eclipse.org/legal/epl-v10.html
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.etrice.generator.base"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
index 74297be5b..68fe8cc0b 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
@@ -11,7 +11,8 @@ Require-Bundle: org.eclipse.etrice.core.fsm;bundle-version="2.0.0",
org.eclipse.emf.ecore;bundle-version="2.7.0",
org.eclipse.xtext;bundle-version="2.6.0",
org.eclipse.core.runtime,
- org.eclipse.xtext.xbase.lib
+ org.eclipse.xtext.xbase.lib,
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Bundle-Activator: org.eclipse.etrice.abstractexec.behavior.Activator
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.etrice.abstractexec.behavior,
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
index f575cca20..d136a776a 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
@@ -1,4 +1,3 @@
-
/*******************************************************************************
* Copyright (c) 2012 Rohit Agrawal
* This program and the accompanying materials
@@ -30,11 +29,11 @@ import org.eclipse.etrice.core.genmodel.fsm.ExtendedFsmGenBuilder;
import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker;
import org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions;
import org.eclipse.etrice.core.genmodel.fsm.NullDiagnostician;
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger;
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer;
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphItem;
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Link;
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Node;
+import org.eclipse.etrice.generator.base.logging.NullLogger;
import org.eclipse.xtext.validation.ValidationMessageAcceptor;
import com.google.inject.Guice;
diff --git a/plugins/org.eclipse.etrice.core.etmap/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.core.etmap/META-INF/MANIFEST.MF
index 1a8a0012a..c82963397 100644
--- a/plugins/org.eclipse.etrice.core.etmap/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.core.etmap/META-INF/MANIFEST.MF
@@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.etrice.core.common;bundle-version="2.0.0",
org.eclipse.emf.ecore,
org.eclipse.emf.common,
org.antlr.runtime,
- org.eclipse.xtext.xbase.lib
+ org.eclipse.xtext.xbase.lib,
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Import-Package: org.apache.log4j,
org.eclipse.xtext.xbase.lib
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/org.eclipse.etrice.core.genmodel.fsm/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.core.genmodel.fsm/META-INF/MANIFEST.MF
index f544ec7fd..a76efaf33 100644
--- a/plugins/org.eclipse.etrice.core.genmodel.fsm/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.core.genmodel.fsm/META-INF/MANIFEST.MF
@@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.etrice.core.common;visibility:=reexport,
org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.emf.ecore.xmi;visibility:=reexport,
- org.eclipse.xtext.xbase.lib
+ org.eclipse.xtext.xbase.lib,
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.etrice.core.genmodel.fsm/build.gradle b/plugins/org.eclipse.etrice.core.genmodel.fsm/build.gradle
index e2610ee9d..2699fbe02 100644
--- a/plugins/org.eclipse.etrice.core.genmodel.fsm/build.gradle
+++ b/plugins/org.eclipse.etrice.core.genmodel.fsm/build.gradle
@@ -1,5 +1,6 @@
dependencies {
compile project(':plugins:org.eclipse.etrice.core.fsm')
+ compile project(':plugins:org.eclipse.etrice.generator.base')
compile "org.eclipse.xtext:org.eclipse.xtext:$versions.xtext"
}
diff --git a/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.xtend b/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.xtend
index 66f5adfff..4c9eebbd9 100644
--- a/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.xtend
+++ b/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.xtend
@@ -19,6 +19,7 @@ import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Link
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Node
import org.eclipse.etrice.core.fsm.fSM.TrPoint
import org.eclipse.etrice.core.fsm.fSM.State
+import org.eclipse.etrice.generator.base.logging.ILogger
class FsmGenChecker {
diff --git a/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/ILogger.java b/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/ILogger.java
deleted file mode 100644
index 64a6523fc..000000000
--- a/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/ILogger.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.genmodel.fsm;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * A simple logger interface for error messages during model validation and code generation.
- *
- * @author Henrik Rentz-Reichert
- *
- */
-public interface ILogger {
-
- /**
- * @param text informational text
- */
- void logInfo(String text);
-
- /**
- * @param text error text
- */
- void logError(String text);
-
- /**
- * @param text error text
- * @param obj {@link org.eclipse.emf.ecore.EObject EObject} (if available) where the error occurred
- */
- void logError(String text, EObject obj);
-
- /**
- * returns true if an error occurred
- */
- boolean hasErrors();
-}
diff --git a/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/NullLogger.java b/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/NullLogger.java
deleted file mode 100644
index 259f3dca9..000000000
--- a/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/NullLogger.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.genmodel.fsm;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class NullLogger implements ILogger {
-
- private int errors = 0;
-
- /* (non-Javadoc)
- * @see org.eclipse.etrice.core.genmodel.base.ILogger#logInfo(java.lang.String)
- */
- @Override
- public void logInfo(String text) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.etrice.core.genmodel.base.ILogger#logError(java.lang.String, org.eclipse.emf.ecore.EObject)
- */
- @Override
- public void logError(String text, EObject obj) {
- ++errors;
- }
-
- @Override
- public void logError(String text) {
- logError(text, null);
- }
-
- @Override
- public boolean hasErrors() {
- return errors!=0;
- }
-
-}
diff --git a/plugins/org.eclipse.etrice.core.genmodel/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.core.genmodel/META-INF/MANIFEST.MF
index da56a9f70..4a53a6937 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.core.genmodel/META-INF/MANIFEST.MF
@@ -19,5 +19,6 @@ Require-Bundle: org.eclipse.etrice.core.common;bundle-version="2.0.0";visibility
org.eclipse.etrice.core.genmodel.fsm;bundle-version="2.0.0";visibility:=reexport,
org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.emf.ecore.xmi;visibility:=reexport
+ org.eclipse.emf.ecore.xmi;visibility:=reexport,
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/RoomGenmodelValidator.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/RoomGenmodelValidator.java
index e8492bc73..73350287d 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/RoomGenmodelValidator.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/RoomGenmodelValidator.java
@@ -25,9 +25,9 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.etrice.core.common.validation.ICustomValidator;
import org.eclipse.etrice.core.genmodel.builder.GeneratorModelBuilder;
import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician;
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger;
import org.eclipse.etrice.core.room.RoomModel;
import org.eclipse.etrice.core.room.RoomPackage;
+import org.eclipse.etrice.generator.base.logging.NullLogger;
import org.eclipse.xtext.validation.CheckMode;
import org.eclipse.xtext.validation.ValidationMessageAcceptor;
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java
index aa84d3e58..6074cdbc3 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java
@@ -50,7 +50,6 @@ import org.eclipse.etrice.core.genmodel.etricegen.impl.AbstractInstanceImpl;
import org.eclipse.etrice.core.genmodel.etricegen.impl.StructureInstanceImpl;
import org.eclipse.etrice.core.genmodel.fsm.ExtendedFsmGenBuilder;
import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician;
-import org.eclipse.etrice.core.genmodel.fsm.ILogger;
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ActorContainerClass;
@@ -76,6 +75,7 @@ import org.eclipse.etrice.core.room.SubProtocol;
import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.core.room.SubSystemRef;
import org.eclipse.etrice.core.room.util.RoomHelpers;
+import org.eclipse.etrice.generator.base.logging.ILogger;
import com.google.inject.Injector;
diff --git a/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF
index 7b1a855b4..70922f8a2 100644
--- a/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.c/META-INF/MANIFEST.MF
@@ -15,7 +15,9 @@ Require-Bundle: org.eclipse.etrice.core.genmodel;bundle-version="2.0.0",
org.eclipse.xtend.lib;bundle-version="2.6.0",
org.eclipse.xtext.generator;bundle-version="2.6.0",
org.eclipse.xtext.util;bundle-version="2.6.0",
- org.eclipse.etrice.generator.gnuplot;bundle-version="2.0.0"
+ org.eclipse.etrice.generator.gnuplot;bundle-version="2.0.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0",
+ org.eclipse.etrice.generator.config
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.etrice.generator.c,
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java
index 00a434446..37404735f 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java
@@ -12,17 +12,19 @@
package org.eclipse.etrice.generator.c;
-import org.eclipse.emf.common.EMFPlugin;
-import org.eclipse.etrice.core.etmap.ETMapStandaloneSetup;
+import java.util.List;
+
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.etrice.core.etmap.util.ETMapUtil;
-import org.eclipse.etrice.core.etphys.ETPhysStandaloneSetup;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.generator.base.AbstractGenerator;
-import org.eclipse.etrice.generator.base.GlobalGeneratorSettings;
import org.eclipse.etrice.generator.base.IDataConfiguration;
+import org.eclipse.etrice.generator.base.args.Arguments;
+import org.eclipse.etrice.generator.base.logging.Loglevel;
import org.eclipse.etrice.generator.c.gen.MainGen;
import org.eclipse.etrice.generator.c.gen.Validator;
import org.eclipse.etrice.generator.c.setup.GeneratorModule;
+import org.eclipse.etrice.generator.c.setup.GeneratorOptions;
import com.google.inject.Inject;
@@ -65,28 +67,15 @@ import com.google.inject.Inject;
*/
public class Main extends AbstractGenerator {
- /**
- * print usage message to output/console
- */
- protected void printUsage() {
- output.println(this.getClass().getName()+getCommonOptions()
- +" <list of model file paths>");
- output.println(getCommonOptionDescriptions());
+ public static int run(String[] args) {
+ return createAndRunGenerator(new GeneratorModule(), args);
}
-
+
public static void main(String[] args) {
- int ret = createAndRunGenerator(new GeneratorModule(), args);
- if (isTerminateOnError() && ret!=GENERATOR_OK)
- System.exit(ret);
+ int ret = run(args);
+ System.exit(ret);
}
- /**
- * @return the unique {@link GlobalSettings}
- */
- public static GlobalGeneratorSettings getSettings() {
- return (GlobalGeneratorSettings) getInstance().getGeneratorSettings();
- }
-
@Inject
private MainGen mainGenerator;
@@ -110,101 +99,54 @@ public class Main extends AbstractGenerator {
public Root getGenModel() {
return genModelResult;
}
-
- /**
- * setup the eTrice mapping model plug-in
- */
- protected void setupMappingModel() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
- ETMapStandaloneSetup.doSetup();
- }
- }
-
- /**
- * setup the eTrice mapping model plug-in
- */
- protected void setupPhysicalModel() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING)
- ETPhysStandaloneSetup.doSetup();
- }
- protected int runGenerator() {
- setupRoomModel();
- dataConfig.doSetup();
- setupMappingModel();
- setupPhysicalModel();
+ protected int runGenerator(List<Resource> resources, Arguments arguments) {
+
+ if (!dataConfig.setResources(getResourceSet(), logger)) {
+ logger.logError("configuration errors");
+ return GENERATOR_ERROR;
+ }
+
+ Root genModel = createGeneratorModel(resources, arguments);
+ if (diagnostician.isFailed() || genModel==null) {
+ logger.logError("errors during build of generator model");
+ return GENERATOR_ERROR;
+ }
+
+ if (!validator.validate(genModel)) {
+ logger.logError("validation failed during build of generator model");
+ return GENERATOR_ERROR;
+ }
- try {
- activateModelLocator();
-
- if (!loadModels(getSettings().getInputModelURIs())) {
- logger.logInfo("loading of models failed");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- if (!validateModels()) {
- logger.logInfo("validation failed");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- if (!dataConfig.setResources(getResourceSet(), logger)) {
- logger.logInfo("configuration errors");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- Root genModel = createGeneratorModel(getSettings().isGenerateAsLibrary(), getSettings().getGeneratorModelPath());
- if (diagnostician.isFailed() || genModel==null) {
- logger.logInfo("errors during build of generator model");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- if (!validator.validate(genModel)) {
- logger.logInfo("validation failed during build of generator model");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- ETMapUtil.processModels(genModel, getResourceSet(), diagnostician);
- if (getSettings().isDebugMode()) {
- logger.logInfo("-- begin dump of mappings");
- logger.logInfo(ETMapUtil.dumpMappings());
- logger.logInfo("-- end dump of mappings");
- }
- if (diagnostician.isFailed() || genModel==null) {
- logger.logInfo("errors in mapping");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- logger.logInfo("-- starting code generation");
- mainGenerator.doGenerate(genModel.eResource());
-
- if (getSettings().isGenerateDocumentation()) {
- mainDocGenerator.doGenerate(genModel.eResource());
- }
-
- if(getSettings().isGenerateDataInstrumentation()){
- gnuPlotGenerator.doGenerate(genModel);
- }
-
- if (diagnostician.isFailed()) {
- logger.logInfo("errors during code generation");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- genModelResult = genModel;
-
- logger.logInfo("-- finished code generation");
+ ETMapUtil.processModels(genModel, getResourceSet(), diagnostician);
+ if (Loglevel.DEBUG.compareTo(logger.getLoglevel()) >= 0) {
+ logger.logDebug("-- begin dump of mappings");
+ logger.logDebug(ETMapUtil.dumpMappings());
+ logger.logDebug("-- end dump of mappings");
}
- finally {
- deactivateModelLocator();
+ if (diagnostician.isFailed() || genModel==null) {
+ logger.logError("errors in mapping");
+ return GENERATOR_ERROR;
}
+ logger.logInfo("-- starting code generation");
+ mainGenerator.doGenerate(genModel.eResource());
+
+ if (arguments.get(GeneratorOptions.DOCUMENTATION)) {
+ mainDocGenerator.doGenerate(genModel.eResource());
+ }
+
+ if(arguments.get(GeneratorOptions.DATA_INSTR)){
+ gnuPlotGenerator.doGenerate(genModel);
+ }
+
+ if (diagnostician.isFailed()) {
+ logger.logError("errors during code generation");
+ return GENERATOR_ERROR;
+ }
+
+ genModelResult = genModel;
+
return GENERATOR_OK;
}
}
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend
index 79a399520..499bcffe1 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ActorClassGen.xtend
@@ -19,17 +19,18 @@ import org.eclipse.etrice.core.fsm.fSM.ComponentCommunicationType
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass
import org.eclipse.etrice.core.genmodel.etricegen.Root
import org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
import org.eclipse.etrice.core.room.CommunicationType
import org.eclipse.etrice.core.room.Operation
import org.eclipse.etrice.core.room.ProtocolClass
import org.eclipse.etrice.core.room.RoomModel
import org.eclipse.etrice.generator.c.Main
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
import org.eclipse.etrice.generator.generic.GenericActorClassGenerator
import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
+import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
+import org.eclipse.etrice.generator.base.logging.ILogger
@Singleton
class ActorClassGen extends GenericActorClassGenerator {
@@ -38,9 +39,10 @@ class ActorClassGen extends GenericActorClassGenerator {
@Inject protected extension CExtensions
@Inject protected extension ProcedureHelpers
@Inject protected extension StateMachineGen
+ @Inject protected extension GeneratorOptionsHelper
@Inject protected ILanguageExtension langExt
- @Inject protected IGeneratorFileIo fileIO
+ @Inject protected IGeneratorFileIO fileIO
@Inject protected ILogger logger
def doGenerate(Root root) {
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend
index 7024481e3..ef31db721 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/DataClassGen.xtend
@@ -16,19 +16,19 @@ package org.eclipse.etrice.generator.c.gen
import com.google.inject.Inject
import com.google.inject.Singleton
import org.eclipse.etrice.core.genmodel.etricegen.Root
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.core.room.Operation
import org.eclipse.etrice.core.room.RoomModel
import org.eclipse.etrice.core.room.util.RoomHelpers
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
+import org.eclipse.etrice.generator.base.logging.ILogger
@Singleton
class DataClassGen {
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject extension RoomHelpers
@Inject extension CExtensions
@Inject extension RoomExtensions
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/EnumerationTypeGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/EnumerationTypeGen.xtend
index afdd44e88..5d350b496 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/EnumerationTypeGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/EnumerationTypeGen.xtend
@@ -12,11 +12,11 @@
package org.eclipse.etrice.generator.c.gen
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
import com.google.inject.Inject
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.core.genmodel.etricegen.Root
import org.eclipse.etrice.core.room.EnumerationType
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.TypeHelpers
/**
@@ -25,7 +25,7 @@ import org.eclipse.etrice.generator.generic.TypeHelpers
*/
class EnumerationTypeGen {
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject extension CExtensions
@Inject extension RoomExtensions
@Inject extension TypeHelpers
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend
index a48c066f8..deb4f2b5c 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend
@@ -30,8 +30,6 @@ import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance
import org.eclipse.etrice.core.genmodel.etricegen.PortInstance
import org.eclipse.etrice.core.genmodel.etricegen.Root
import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
-import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
import org.eclipse.etrice.core.room.CommunicationType
import org.eclipse.etrice.core.room.EnumerationType
import org.eclipse.etrice.core.room.Port
@@ -40,12 +38,14 @@ import org.eclipse.etrice.core.room.ProtocolClass
import org.eclipse.etrice.core.room.SAP
import org.eclipse.etrice.core.room.SPP
import org.eclipse.etrice.core.room.util.RoomHelpers
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
+import org.eclipse.etrice.generator.base.logging.ILogger
import org.eclipse.etrice.generator.c.Main
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
import org.eclipse.etrice.generator.fsm.base.IntelligentSeparator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
+import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
@Singleton
class NodeGen {
@@ -55,10 +55,10 @@ class NodeGen {
@Inject extension RoomExtensions
@Inject extension TypeHelpers
@Inject extension ProcedureHelpers helpers
+ @Inject protected extension GeneratorOptionsHelper
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject Initialization attrInitGenAddon
- @Inject IDiagnostician diagnostician
@Inject ILogger logger;
def doGenerate(Root root) {
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend
index e54711c4d..98490915d 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeRunnerGen.xtend
@@ -22,6 +22,7 @@ import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.core.etmap.util.ETMapUtil
import org.eclipse.etrice.core.common.base.util.BaseHelpers
import org.eclipse.etrice.generator.c.Main
+import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
@Singleton
class NodeRunnerGen {
@@ -30,6 +31,7 @@ class NodeRunnerGen {
@Inject extension JavaIoFileSystemAccess fileAccess
@Inject extension CExtensions
@Inject extension RoomExtensions
+ @Inject protected extension GeneratorOptionsHelper
def doGenerate(Root root) {
var first = true
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
index 143a1b249..a233ec690 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
@@ -16,27 +16,29 @@ package org.eclipse.etrice.generator.c.gen
import com.google.inject.Inject
import com.google.inject.Singleton
import org.eclipse.etrice.core.genmodel.etricegen.Root
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
import org.eclipse.etrice.core.room.CommunicationType
import org.eclipse.etrice.core.room.Operation
import org.eclipse.etrice.core.room.ProtocolClass
import org.eclipse.etrice.core.room.RoomModel
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
+import org.eclipse.etrice.generator.base.logging.ILogger
import org.eclipse.etrice.generator.base.AbstractGenerator
import org.eclipse.etrice.generator.c.Main
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
+import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
@Singleton
class ProtocolClassGen extends GenericProtocolClassGenerator {
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject extension CExtensions
@Inject extension RoomExtensions
@Inject extension ProcedureHelpers
@Inject extension TypeHelpers
+ @Inject protected extension GeneratorOptionsHelper
@Inject ILogger logger
def doGenerate(Root root) {
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
index abdeb3fac..d338dbc5f 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
@@ -22,11 +22,13 @@ import org.eclipse.etrice.generator.generic.RoomExtensions
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer
import org.eclipse.etrice.core.fsm.fSM.State
+import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
@Singleton
class StateMachineGen extends GenericStateMachineGenerator {
@Inject extension RoomExtensions
+ @Inject protected extension GeneratorOptionsHelper
def genHeaderConstants(ExpandedActorClass xpac) {
val ac = xpac.actorClass
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java
index 3eaa133a8..9794e2dc9 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java
@@ -14,6 +14,7 @@ package org.eclipse.etrice.generator.c.setup;
import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.AbstractGeneratorBaseModule;
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
import org.eclipse.etrice.generator.base.IDataConfiguration;
import org.eclipse.etrice.generator.base.ITranslationProvider;
import org.eclipse.etrice.generator.c.Main;
@@ -30,12 +31,14 @@ import com.google.inject.Binder;
public class GeneratorModule extends AbstractGeneratorBaseModule {
-// @Override
+ @Override
public void configure(Binder binder) {
super.configure(binder);
binder.bind(GenericProtocolClassGenerator.class).to(ProtocolClassGen.class);
binder.bind(GenericActorClassGenerator.class).to(ActorClassGen.class);
+
+ binder.bind(AbstractGeneratorOptions.class).to(GeneratorOptions.class);
}
@Override
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorOptions.java b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorOptions.java
new file mode 100644
index 000000000..14f436d44
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorOptions.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.c.setup;
+
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
+
+public class GeneratorOptions extends AbstractGeneratorOptions {
+
+}
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorOptionsHelper.java b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorOptionsHelper.java
new file mode 100644
index 000000000..36c5d9029
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorOptionsHelper.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.c.setup;
+
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptionsHelper;
+
+public class GeneratorOptionsHelper extends AbstractGeneratorOptionsHelper {
+
+}
diff --git a/plugins/org.eclipse.etrice.generator.config/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.config/META-INF/MANIFEST.MF
index df2d77df8..ac386c668 100644
--- a/plugins/org.eclipse.etrice.generator.config/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.config/META-INF/MANIFEST.MF
@@ -12,6 +12,7 @@ Require-Bundle: org.eclipse.etrice.core.common;bundle-version="2.0.0",
org.eclipse.etrice.core.config;bundle-version="2.0.0",
org.eclipse.etrice.core.genmodel;bundle-version="2.0.0",
org.eclipse.etrice.generator;bundle-version="2.0.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0",
org.eclipse.xtend.lib;bundle-version="2.6.0",
com.google.guava;bundle-version="8.0.0",
org.eclipse.xtext.xbase.lib;bundle-version="2.6.0"
diff --git a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
index 4bfdf1894..77e7fb747 100644
--- a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
+++ b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/DataConfiguration.xtend
@@ -30,7 +30,7 @@ import org.eclipse.etrice.core.config.LiteralConfigValue
import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance
import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance
import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
+import org.eclipse.etrice.generator.base.logging.ILogger
import org.eclipse.etrice.core.room.ActorClass
import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.ProtocolClass
diff --git a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java
index 63fd93b36..9ba7203e2 100644
--- a/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java
+++ b/plugins/org.eclipse.etrice.generator.config/src/org/eclipse/etrice/generator/config/util/DataConfigurationHelper.java
@@ -30,11 +30,11 @@ import org.eclipse.etrice.core.config.PortInstanceConfig;
import org.eclipse.etrice.core.config.ProtocolClassConfig;
import org.eclipse.etrice.core.config.SubSystemConfig;
import org.eclipse.etrice.core.config.util.ConfigUtil;
-import org.eclipse.etrice.core.genmodel.fsm.ILogger;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.ProtocolClass;
+import org.eclipse.etrice.generator.base.logging.ILogger;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -83,7 +83,7 @@ public class DataConfigurationHelper {
for (ActorClassConfig classConfig : config.getActorClassConfigs()) {
if (actorClasses.contains(classConfig.getActor())) {
logger.logError("Multiple configurations for actor class "
- + classConfig.getActor().getName() + " found", null);
+ + classConfig.getActor().getName() + " found");
error = true;
} else {
actorClasses.add(classConfig.getActor());
@@ -96,7 +96,7 @@ public class DataConfigurationHelper {
logger.logError(
"Multiple configurations for protocol class "
+ protocolConfig.getProtocol().getName()
- + " found", null);
+ + " found");
error = true;
} else {
protocolClasses.add(protocolConfig.getProtocol());
@@ -109,7 +109,7 @@ public class DataConfigurationHelper {
if (actorInstances.contains(path)) {
logger.logError(
"Multiple configurations for actor instance "
- + path + " found", null);
+ + path + " found");
} else {
actorInstances.add(path);
collectConfigs(instanceConfig, path, actorInstanceAttrMap);
@@ -119,7 +119,7 @@ public class DataConfigurationHelper {
String path = ConfigUtil.getPath(ssConfig);
if (subSystemConfigMap.containsKey(path)) {
logger.logError("Multiple configurations for subSystem"
- + path + " found", null);
+ + path + " found");
error = true;
} else
subSystemConfigMap.put(path, ssConfig);
diff --git a/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF
index b67aa4235..2fcdd3f15 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.cpp/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.etrice.core.genmodel;bundle-version="2.0.0",
org.eclipse.xtend.lib;bundle-version="2.6.0",
org.eclipse.xtext.generator;bundle-version="2.6.0",
org.eclipse.xtext.util;bundle-version="2.6.0",
- org.eclipse.etrice.core.genmodel.fsm
+ org.eclipse.etrice.core.genmodel.fsm,
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.etrice.generator.cpp,
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java
index 117bd9536..a36002ef0 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/Main.java
@@ -12,36 +12,31 @@
package org.eclipse.etrice.generator.cpp;
-import org.eclipse.emf.common.EMFPlugin;
-import org.eclipse.etrice.core.etmap.ETMapStandaloneSetup;
+import java.util.List;
+
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.etrice.core.etmap.util.ETMapUtil;
-import org.eclipse.etrice.core.etphys.ETPhysStandaloneSetup;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.generator.base.AbstractGenerator;
-import org.eclipse.etrice.generator.base.GlobalGeneratorSettings;
import org.eclipse.etrice.generator.base.IDataConfiguration;
+import org.eclipse.etrice.generator.base.args.Arguments;
+import org.eclipse.etrice.generator.base.logging.Loglevel;
import org.eclipse.etrice.generator.cpp.gen.MainGen;
import org.eclipse.etrice.generator.cpp.gen.Validator;
import org.eclipse.etrice.generator.cpp.setup.GeneratorModule;
-import org.eclipse.etrice.generator.doc.gen.GlobalSettings;
+import org.eclipse.etrice.generator.cpp.setup.GeneratorOptions;
import com.google.inject.Inject;
public class Main extends AbstractGenerator {
- /**
- * print usage message to output/console
- */
- protected void printUsage() {
- output.println(this.getClass().getName()+getCommonOptions()
- +" <list of model file paths>");
- output.println(getCommonOptionDescriptions());
+ public static int run(String[] args) {
+ return createAndRunGenerator(new GeneratorModule(), args);
}
-
+
public static void main(String[] args) {
- int ret = createAndRunGenerator(new GeneratorModule(), args);
- if (isTerminateOnError() && ret!=GENERATOR_OK)
- System.exit(ret);
+ int ret = run(args);
+ System.exit(ret);
}
@Inject
@@ -56,98 +51,45 @@ public class Main extends AbstractGenerator {
@Inject
protected IDataConfiguration dataConfig;
- /**
- * @return the unique {@link GlobalSettings}
- */
- public static GlobalGeneratorSettings getSettings() {
- return (GlobalGeneratorSettings) getInstance().getGeneratorSettings();
- }
+ protected int runGenerator(List<Resource> resources, Arguments arguments) {
- /**
- * setup the eTrice mapping model plug-in
- */
- protected void setupMappingModel() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
- ETMapStandaloneSetup.doSetup();
+ if (!dataConfig.setResources(getResourceSet(), logger)) {
+ logger.logError("configuration errors");
+ return GENERATOR_ERROR;
}
- }
- /**
- * setup the eTrice mapping model plug-in
- */
- protected void setupPhysicalModel() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING)
- ETPhysStandaloneSetup.doSetup();
- }
+ Root genModel = createGeneratorModel(resources, arguments);
+ if (diagnostician.isFailed() || genModel==null) {
+ logger.logError("errors during build of generator model");
+ return GENERATOR_ERROR;
+ }
- protected int runGenerator() {
- setupRoomModel();
- dataConfig.doSetup();
- setupMappingModel();
- setupPhysicalModel();
-
- try {
- activateModelLocator();
-
- if (!loadModels(getSettings().getInputModelURIs())) {
- logger.logInfo("loading of models failed");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- if (!validateModels()) {
- logger.logInfo("validation failed");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- if (!dataConfig.setResources(getResourceSet(), logger)) {
- logger.logInfo("configuration errors");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- Root genModel = createGeneratorModel(getSettings().isGenerateAsLibrary(), getSettings().getGeneratorModelPath());
- if (diagnostician.isFailed() || genModel==null) {
- logger.logInfo("errors during build of generator model");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- if (!validator.validate(genModel)) {
- logger.logInfo("validation failed during build of generator model");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- ETMapUtil.processModels(genModel, getResourceSet(), diagnostician);
- if (getSettings().isDebugMode()) {
- logger.logInfo("-- begin dump of mappings");
- logger.logInfo(ETMapUtil.dumpMappings());
- logger.logInfo("-- end dump of mappings");
- }
- if (diagnostician.isFailed() || genModel==null) {
- logger.logInfo("errors in mapping");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- logger.logInfo("-- starting code generation");
- mainGenerator.doGenerate(genModel.eResource());
-
- if (getSettings().isGenerateDocumentation()) {
- mainDocGenerator.doGenerate(genModel.eResource());
- }
-
- if (diagnostician.isFailed()) {
- logger.logInfo("errors during code generation");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
- logger.logInfo("-- finished code generation");
+ if (!validator.validate(genModel)) {
+ logger.logError("validation failed during build of generator model");
+ return GENERATOR_ERROR;
}
- finally {
- deactivateModelLocator();
+
+ ETMapUtil.processModels(genModel, getResourceSet(), diagnostician);
+ if (Loglevel.DEBUG.compareTo(logger.getLoglevel()) >= 0) {
+ logger.logInfo("-- begin dump of mappings");
+ logger.logInfo(ETMapUtil.dumpMappings());
+ logger.logInfo("-- end dump of mappings");
+ }
+ if (diagnostician.isFailed() || genModel==null) {
+ logger.logError("errors in mapping");
+ return GENERATOR_ERROR;
+ }
+
+ logger.logInfo("-- starting code generation");
+ mainGenerator.doGenerate(genModel.eResource());
+
+ if (arguments.get(GeneratorOptions.DOCUMENTATION)) {
+ mainDocGenerator.doGenerate(genModel.eResource());
+ }
+
+ if (diagnostician.isFailed()) {
+ logger.logError("errors during code generation");
+ return GENERATOR_ERROR;
}
return GENERATOR_OK;
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
index 2791ee88a..204a0bb9f 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ActorClassGen.xtend
@@ -23,15 +23,16 @@ import org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions
import org.eclipse.etrice.core.room.ActorClass
import org.eclipse.etrice.generator.cpp.Main
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.GenericActorClassGenerator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
+import org.eclipse.etrice.generator.cpp.setup.GeneratorOptionsHelper
@Singleton
class ActorClassGen extends GenericActorClassGenerator {
- @Inject protected IGeneratorFileIo fileIO
+ @Inject protected IGeneratorFileIO fileIO
@Inject protected extension CppExtensions
@Inject protected extension RoomExtensions
@@ -39,6 +40,7 @@ class ActorClassGen extends GenericActorClassGenerator {
@Inject protected Initialization initHelper
@Inject protected extension StateMachineGen
@Inject protected extension FileSystemHelpers
+ @Inject protected extension GeneratorOptionsHelper
def doGenerate(Root root) {
val Map<ActorClass, WiredActorClass> ac2wired = newHashMap
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
index c629ccef3..41a80ac80 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/DataClassGen.xtend
@@ -16,7 +16,7 @@ import com.google.inject.Inject
import com.google.inject.Singleton
import java.util.List
import org.eclipse.etrice.core.genmodel.etricegen.Root
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
+import org.eclipse.etrice.generator.base.logging.ILogger
import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.ComplexType
import org.eclipse.etrice.core.room.DataClass
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend
index bf05af6c7..f3d1e8c0f 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeGen.xtend
@@ -26,11 +26,12 @@ import org.eclipse.etrice.core.genmodel.etricegen.WiredSubSystemClass
import org.eclipse.etrice.core.room.SubSystemClass
import org.eclipse.etrice.generator.cpp.Main
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import static extension org.eclipse.etrice.generator.fsm.base.Indexed.*
+import org.eclipse.etrice.generator.cpp.setup.GeneratorOptionsHelper
@Singleton
class NodeGen {
@@ -39,8 +40,9 @@ class NodeGen {
@Inject extension RoomExtensions
@Inject extension ProcedureHelpers
@Inject extension FileSystemHelpers
+ @Inject extension GeneratorOptionsHelper
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject Initialization initHelper
def doGenerate(Root root) {
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend
index 181a815be..30b78c4b5 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/NodeRunnerGen.xtend
@@ -19,8 +19,9 @@ import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
import org.eclipse.etrice.core.genmodel.etricegen.SystemInstance
import org.eclipse.etrice.generator.cpp.Main
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.RoomExtensions
+import org.eclipse.etrice.generator.cpp.setup.GeneratorOptionsHelper
@Singleton
class NodeRunnerGen {
@@ -28,8 +29,9 @@ class NodeRunnerGen {
@Inject extension RoomExtensions roomExt
@Inject extension CppExtensions
@Inject extension FileSystemHelpers
+ @Inject extension GeneratorOptionsHelper
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
def doGenerate(Root root) {
for (nr : ETMapUtil::getNodeRefs()) {
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
index 561a2f69d..f4a757047 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/ProtocolClassGen.xtend
@@ -16,7 +16,6 @@ import com.google.inject.Inject
import com.google.inject.Singleton
import java.util.List
import org.eclipse.etrice.core.genmodel.etricegen.Root
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
import org.eclipse.etrice.core.room.CommunicationType
import org.eclipse.etrice.core.room.InterfaceItem
import org.eclipse.etrice.core.room.Message
@@ -27,24 +26,27 @@ import org.eclipse.etrice.core.room.SAP
import org.eclipse.etrice.core.room.SPP
import org.eclipse.etrice.generator.cpp.Main
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
import org.eclipse.etrice.generator.generic.ILanguageExtension
+import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician
+import org.eclipse.etrice.generator.cpp.setup.GeneratorOptionsHelper
@Singleton
class ProtocolClassGen extends GenericProtocolClassGenerator {
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject extension CppExtensions stdExt
@Inject extension RoomExtensions roomExt
@Inject extension ProcedureHelpers helpers
@Inject extension TypeHelpers
@Inject extension FileSystemHelpers
+ @Inject extension GeneratorOptionsHelper
@Inject Initialization initHelper
- @Inject ILogger logger
+ @Inject IDiagnostician diagnostician
def doGenerate(Root root) {
@@ -61,7 +63,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
fileIO.generateFile("generating ProtocolClass implementation", path, infopath, pc.cppSourceFileName, root.generateDataDrivenSourceFile(pc))
}
case CommunicationType::SYNCHRONOUS:
- logger.logError("synchronous protocols not supported yet", pc)
+ diagnostician.error("synchronous protocols not supported yet", pc, null)
}
}
}
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend
index 5af70d5a6..1658c8347 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/StateMachineGen.xtend
@@ -22,10 +22,14 @@ import org.eclipse.etrice.generator.cpp.Main
import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
+import com.google.inject.Inject
+import org.eclipse.etrice.generator.cpp.setup.GeneratorOptionsHelper
@Singleton
class StateMachineGen extends GenericStateMachineGenerator {
+ @Inject protected extension GeneratorOptionsHelper
+
val nodeComparator = new NodeComparator
override genExtra(GraphContainer gc, boolean generateImplementation) {
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Validator.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Validator.java
index 3d065a596..d6541d6c7 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Validator.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/Validator.java
@@ -13,7 +13,7 @@
package org.eclipse.etrice.generator.cpp.gen;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.genmodel.fsm.ILogger;
+import org.eclipse.etrice.generator.base.logging.ILogger;
import com.google.inject.Inject;
@@ -40,7 +40,7 @@ public class Validator {
// }
if (errorCount>0) {
- logger.logError("C++ generator detected "+errorCount+" error(s) - terminating", null);
+ logger.logError("C++ generator detected "+errorCount+" error(s) - terminating");
return false;
}
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java
index a2eba36af..90c99984d 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorModule.java
@@ -15,6 +15,7 @@ package org.eclipse.etrice.generator.cpp.setup;
import org.eclipse.etrice.core.common.scoping.ModelLocatorUriResolver;
import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.AbstractGeneratorBaseModule;
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
import org.eclipse.etrice.generator.base.IDataConfiguration;
import org.eclipse.etrice.generator.base.ITranslationProvider;
import org.eclipse.etrice.generator.cpp.Main;
@@ -33,7 +34,7 @@ import com.google.inject.Binder;
public class GeneratorModule extends AbstractGeneratorBaseModule {
-// @Override
+ @Override
public void configure(Binder binder) {
super.configure(binder);
@@ -42,6 +43,8 @@ public class GeneratorModule extends AbstractGeneratorBaseModule {
binder.bind(GenericActorClassGenerator.class).to(ActorClassGen.class);
binder.bind(ImportUriResolver.class).to(ModelLocatorUriResolver.class);
+
+ binder.bind(AbstractGeneratorOptions.class).to(GeneratorOptions.class);
}
@Override
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorOptions.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorOptions.java
new file mode 100644
index 000000000..cbcdbea33
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorOptions.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.cpp.setup;
+
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
+
+public class GeneratorOptions extends AbstractGeneratorOptions {
+
+}
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorOptionsHelper.java b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorOptionsHelper.java
new file mode 100644
index 000000000..8d0a97e54
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/setup/GeneratorOptionsHelper.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.cpp.setup;
+
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptionsHelper;
+
+public class GeneratorOptionsHelper extends AbstractGeneratorOptionsHelper {
+
+}
diff --git a/plugins/org.eclipse.etrice.generator.doc/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.doc/META-INF/MANIFEST.MF
index dbd1d5461..7181133d3 100644
--- a/plugins/org.eclipse.etrice.generator.doc/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.doc/META-INF/MANIFEST.MF
@@ -17,7 +17,8 @@ Require-Bundle: org.eclipse.etrice.core.genmodel;bundle-version="2.0.0",
org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.xtend.lib;bundle-version="2.6.0",
org.eclipse.xtext.util;bundle-version="2.6.0",
- org.eclipse.xtext.generator;bundle-version="2.6.0"
+ org.eclipse.xtext.generator;bundle-version="2.6.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.etrice.generator.doc;uses:="org.eclipse.etrice.generator.base",
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/Main.java b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/Main.java
index 88c6dccb3..aa4761942 100644
--- a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/Main.java
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/Main.java
@@ -12,55 +12,28 @@
package org.eclipse.etrice.generator.doc;
-import java.util.Iterator;
+import java.util.List;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.generator.base.AbstractGenerator;
-import org.eclipse.etrice.generator.doc.gen.GlobalSettings;
+import org.eclipse.etrice.generator.base.args.Arguments;
import org.eclipse.etrice.generator.doc.gen.InstanceDiagramGen;
import org.eclipse.etrice.generator.doc.gen.MainGen;
import org.eclipse.etrice.generator.doc.setup.GeneratorModule;
+import org.eclipse.etrice.generator.doc.setup.GeneratorOptions;
import com.google.inject.Inject;
public class Main extends AbstractGenerator {
- public static final String OPTION_GEN_INST_DIAG = "-genInstDiag";
-
- /**
- * print usage message to output/console
- */
- protected void printUsage() {
- output.println(this.getClass().getName()+getCommonOptions()
- +" <list of model file paths>");
- output.println(getCommonOptionDescriptions());
- output.println(" -genInstDiag # if specified then an instance diagram is created for each subsystem");
+ public static int run(String[] args) {
+ return createAndRunGenerator(new GeneratorModule(), args);
}
-
+
public static void main(String[] args) {
- int ret = createAndRunGenerator(new GeneratorModule(), args);
- if (isTerminateOnError() && ret!=GENERATOR_OK)
- System.exit(ret);
- }
-
- /**
- * @return the unique {@link GlobalSettings}
- */
- public static GlobalSettings getSettings() {
- return (GlobalSettings) getInstance().getGeneratorSettings();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.etrice.generator.base.AbstractGenerator#parseOption(java.lang.String, java.util.Iterator)
- */
- @Override
- protected boolean parseOption(String arg, Iterator<String> it) {
- if (arg.equals(OPTION_GEN_INST_DIAG)) {
- getSettings().setGenerateInstanceDiagram(true);
- return true;
- }
-
- return super.parseOption(arg, it);
+ int ret = run(args);
+ System.exit(ret);
}
@Inject
@@ -69,47 +42,24 @@ public class Main extends AbstractGenerator {
@Inject
protected InstanceDiagramGen instanceDiagramGenerator;
- protected int runGenerator() {
- setupRoomModel();
+ protected int runGenerator(List<Resource> resources, Arguments arguments) {
- try {
- activateModelLocator();
-
- if (!loadModels(getSettings().getInputModelURIs())) {
- logger.logInfo("loading of models failed");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- if (!validateModels()) {
- logger.logInfo("validation failed");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- Root genModel = createGeneratorModel(getSettings().isGenerateAsLibrary(), getSettings().getGeneratorModelPath());
- if (diagnostician.isFailed() || genModel==null) {
- logger.logInfo("errors during build of generator model");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- logger.logInfo("-- starting code generation");
- mainGenerator.doGenerate(genModel.eResource());
-
- if (getSettings().isGenerateInstanceDiagram()) {
- instanceDiagramGenerator.doGenerate(genModel);
- }
-
- if (diagnostician.isFailed()) {
- logger.logInfo("errors during code generation");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
- logger.logInfo("-- finished code generation");
+ Root genModel = createGeneratorModel(resources, arguments);
+ if (diagnostician.isFailed() || genModel==null) {
+ logger.logError("errors during build of generator model");
+ return GENERATOR_ERROR;
+ }
+
+ logger.logInfo("-- starting code generation");
+ mainGenerator.doGenerate(genModel.eResource());
+
+ if (arguments.get(GeneratorOptions.GEN_INST_DIAG)) {
+ instanceDiagramGenerator.doGenerate(genModel);
}
- finally {
- deactivateModelLocator();
+
+ if (diagnostician.isFailed()) {
+ logger.logError("errors during code generation");
+ return GENERATOR_ERROR;
}
return GENERATOR_OK;
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocGen.xtend b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocGen.xtend
index d41f3c632..eb0db923a 100644
--- a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocGen.xtend
@@ -37,7 +37,7 @@ import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.fsm.base.CodegenHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.xtext.generator.JavaIoFileSystemAccess
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
+import org.eclipse.etrice.generator.base.logging.ILogger
@Singleton
class DocGen {
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/GlobalSettings.java b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/GlobalSettings.java
deleted file mode 100644
index 346390009..000000000
--- a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/GlobalSettings.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.generator.doc.gen;
-
-import org.eclipse.etrice.generator.base.GlobalGeneratorSettings;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class GlobalSettings extends GlobalGeneratorSettings {
-
- private boolean generateInstanceDiagram = false;
-
- public boolean isGenerateInstanceDiagram() {
- return generateInstanceDiagram;
- }
-
- public void setGenerateInstanceDiagram(boolean generateInstanceDiagram) {
- this.generateInstanceDiagram = generateInstanceDiagram;
- }
-}
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.xtend b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.xtend
index 7c768618b..34aaa9fb7 100644
--- a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.xtend
@@ -26,7 +26,7 @@ import org.eclipse.xtext.generator.JavaIoFileSystemAccess
import static java.lang.Runtime.*
import org.eclipse.etrice.core.etmap.util.ETMapUtil
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
+import org.eclipse.etrice.generator.base.logging.ILogger
@Singleton
class InstanceDiagramGen {
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorModule.java b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorModule.java
index 4d0bcfdc1..2fd68ec7f 100644
--- a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorModule.java
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorModule.java
@@ -14,11 +14,10 @@ package org.eclipse.etrice.generator.doc.setup;
import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.AbstractGeneratorBaseModule;
-import org.eclipse.etrice.generator.base.GlobalGeneratorSettings;
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
import org.eclipse.etrice.generator.base.IDataConfiguration;
import org.eclipse.etrice.generator.base.ITranslationProvider;
import org.eclipse.etrice.generator.doc.Main;
-import org.eclipse.etrice.generator.doc.gen.GlobalSettings;
import org.eclipse.etrice.generator.generic.ILanguageExtension;
import com.google.inject.Binder;
@@ -29,7 +28,7 @@ public class GeneratorModule extends AbstractGeneratorBaseModule {
public void configure(Binder binder) {
super.configure(binder);
- binder.bind(GlobalGeneratorSettings.class).to(GlobalSettings.class);
+ binder.bind(AbstractGeneratorOptions.class).to(GeneratorOptions.class);
}
@Override
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptions.java b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptions.java
new file mode 100644
index 000000000..2e998e50e
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptions.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.doc.setup;
+
+import java.util.List;
+
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
+import org.eclipse.etrice.generator.base.args.BooleanOption;
+import org.eclipse.etrice.generator.base.args.Option;
+
+public class GeneratorOptions extends AbstractGeneratorOptions {
+
+ public static final BooleanOption GEN_INST_DIAG = new BooleanOption(
+ "genInstDiag",
+ "generateInstanceDiagram",
+ "if specified then an instance diagram is created for each subsystem",
+ false);
+
+ @Override
+ public void configure(List<Option<?>> options) {
+ super.configure(options);
+
+ options.add(GEN_INST_DIAG);
+ }
+}
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptionsHelper.java b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptionsHelper.java
new file mode 100644
index 000000000..e2fb6e74e
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptionsHelper.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.doc.setup;
+
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptionsHelper;
+import org.eclipse.etrice.generator.base.args.Arguments;
+
+public class GeneratorOptionsHelper extends AbstractGeneratorOptionsHelper {
+
+ public boolean isGenerateInstanceDiagram(Arguments args) {
+ return args.get(GeneratorOptions.GEN_INST_DIAG);
+ }
+}
diff --git a/plugins/org.eclipse.etrice.generator.fsm/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.fsm/META-INF/MANIFEST.MF
index 2665d4769..b5c00bd3e 100644
--- a/plugins/org.eclipse.etrice.generator.fsm/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.fsm/META-INF/MANIFEST.MF
@@ -9,8 +9,8 @@ Export-Package: org.eclipse.etrice.generator.fsm.base,
org.eclipse.etrice.generator.fsm.generic
Require-Bundle: org.eclipse.etrice.core.fsm;bundle-version="2.0.0",
org.eclipse.etrice.core.genmodel.fsm;bundle-version="2.0.0",
- org.apache.commons.io;bundle-version="2.0.1",
org.eclipse.core.resources,
org.eclipse.core.runtime,
- org.eclipse.xtend.lib;bundle-version="2.6.0"
+ org.eclipse.xtend.lib;bundle-version="2.6.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Import-Package: org.eclipse.core.runtime
diff --git a/plugins/org.eclipse.etrice.generator.fsm/build.gradle b/plugins/org.eclipse.etrice.generator.fsm/build.gradle
index 5a7136840..55a78efd9 100644
--- a/plugins/org.eclipse.etrice.generator.fsm/build.gradle
+++ b/plugins/org.eclipse.etrice.generator.fsm/build.gradle
@@ -5,5 +5,4 @@ dependencies {
compile "org.eclipse.xtend:org.eclipse.xtend.lib:$versions.xtext"
compile "org.eclipse.platform:org.eclipse.core.runtime:$versions.core_runtime"
compile "org.eclipse.platform:org.eclipse.core.resources:$versions.core_resources"
- compile "commons-io:commons-io:$versions.commons_io"
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/DefaultFSMTranslationProvider.java b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/DefaultFSMTranslationProvider.java
index 10fcc4dc5..d276f26d9 100644
--- a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/DefaultFSMTranslationProvider.java
+++ b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/DefaultFSMTranslationProvider.java
@@ -19,7 +19,7 @@ import org.eclipse.etrice.core.fsm.fSM.AbstractInterfaceItem;
import org.eclipse.etrice.core.fsm.fSM.DetailCode;
import org.eclipse.etrice.core.fsm.naming.FSMNameProvider;
import org.eclipse.etrice.core.fsm.util.FSMHelpers;
-import org.eclipse.etrice.core.genmodel.fsm.ILogger;
+import org.eclipse.etrice.generator.base.logging.ILogger;
import com.google.inject.Inject;
diff --git a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/Diagnostician.java b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/Diagnostician.java
index 832693c9e..37c043918 100644
--- a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/Diagnostician.java
+++ b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/Diagnostician.java
@@ -12,10 +12,13 @@
package org.eclipse.etrice.generator.fsm.base;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.etrice.core.fsm.naming.FSMNameProvider;
import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician;
+import org.eclipse.etrice.generator.base.logging.ILogger;
import com.google.inject.Inject;
@@ -29,12 +32,16 @@ public class Diagnostician implements IDiagnostician {
private boolean validationFailed = false;
- @Inject
- private ILineOutputLogger logger;
+ private ILogger logger;
- @Inject
private FSMNameProvider fsmNameProvider;
+ @Inject
+ public Diagnostician(ILogger logger, FSMNameProvider fsmNameProvider) {
+ this.logger = logger;
+ this.fsmNameProvider = fsmNameProvider;
+ }
+
public void warning(String msg, EObject source, EStructuralFeature feature) {
logger.logInfo("Validation warning: " + getMsgTxt(msg, source, feature, INSIGNIFICANT_INDEX));
}
@@ -45,12 +52,12 @@ public class Diagnostician implements IDiagnostician {
public void error(String msg, EObject source, EStructuralFeature feature) {
validationFailed = true;
- logger.logError("Validation error: "+ getMsgTxt(msg, source, feature, INSIGNIFICANT_INDEX), source);
+ logger.logError("Validation error: "+ getMsgTxt(msg, source, feature, INSIGNIFICANT_INDEX));
}
public void error(String msg, EObject source, EStructuralFeature feature, int idx) {
validationFailed = true;
- logger.logError("Validation error: " + getMsgTxt(msg, source, feature, idx), source);
+ logger.logError("Validation error: " + getMsgTxt(msg, source, feature, idx));
}
public boolean isFailed() {
@@ -58,15 +65,26 @@ public class Diagnostician implements IDiagnostician {
}
private String getMsgTxt(String msg, EObject source, EStructuralFeature feature, int idx) {
- if (source==null || feature==null)
- return msg;
-
- if (idx==INSIGNIFICANT_INDEX)
- return msg + " (" + fsmNameProvider.getName(source) + ", "
- + feature.getName()+")";
- else
- return msg + " (" + fsmNameProvider.getName(source) + ", "
- + feature.getName() + " at index "+idx+")";
+ StringBuilder result = new StringBuilder(msg);
+
+ if(source != null) {
+ result.append(" ");
+
+ if(feature != null) {
+ result.append("(" + fsmNameProvider.getName(source) + ", " + feature.getName());
+ if(idx != INSIGNIFICANT_INDEX) {
+ result.append(" at index " + idx);
+ }
+ result.append(")");
+ }
+
+ // prefer location to toString()
+ URI uri = EcoreUtil.getURI(source);
+ String objInfo = (uri != null && !source.eIsProxy()) ? uri.toString() : source.toString();
+ result.append(objInfo);
+ }
+
+ return result.toString();
}
}
diff --git a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/IGeneratorFileIo.java b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/IGeneratorFileIo.java
deleted file mode 100644
index 48c8adc2c..000000000
--- a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/IGeneratorFileIo.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.generator.fsm.base;
-
-import com.google.inject.ImplementedBy;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-@ImplementedBy(IncrementalGenerationFileIo.class)
-public interface IGeneratorFileIo {
-
- /**
- * This method saves the contents in a file in the given path.
- * Implementations may use the infopath for extra information like a hash key
- * for incremental generation.
- *
- * @param desc a description which is may be logged
- * @param path the file system path for the generated file
- * @param infopath the file system path for the generated info file (if used by the implementation)
- * @param file the file name of the generated file
- * @param contents the contents of the generated file
- */
- void generateFile(String desc, String path, String infopath, String file, CharSequence contents);
-}
diff --git a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/ILineOutput.java b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/ILineOutput.java
deleted file mode 100644
index 925ad84be..000000000
--- a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/ILineOutput.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.generator.fsm.base;
-
-/**
- * A simple interface for output with just a {@link #println(String)} method.
- * @author Henrik Rentz-Reichert
- */
-public interface ILineOutput {
-
- /**
- * @param txt the text to output
- */
- void println(String txt);
-}
diff --git a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/ILineOutputLogger.java b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/ILineOutputLogger.java
deleted file mode 100644
index 6c6379337..000000000
--- a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/ILineOutputLogger.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.generator.fsm.base;
-
-import org.eclipse.etrice.core.genmodel.fsm.ILogger;
-
-
-/**
- * An ILineOutputLogger will send its output to the specified {@link ILogger} if one is set.
- *
- * @author Henrik Rentz-Reichert
- *
- */
-public interface ILineOutputLogger extends ILogger {
-
- /**
- * @param lo a line output to be used by the logger
- */
- void setOutput(ILineOutput lo);
-}
diff --git a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/IncrementalGenerationFileIo.java b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/IncrementalGenerationFileIo.java
deleted file mode 100644
index fab85969a..000000000
--- a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/IncrementalGenerationFileIo.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.generator.fsm.base;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.zip.CRC32;
-
-import org.apache.commons.io.FileUtils;
-import org.eclipse.etrice.core.genmodel.fsm.ILogger;
-import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
-import org.eclipse.xtext.util.RuntimeIOException;
-
-import com.google.inject.Inject;
-
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class IncrementalGenerationFileIo implements IGeneratorFileIo {
-
- @Inject JavaIoFileSystemAccess fileAccess;
- @Inject ILogger logger;
-
- private static boolean generateIncremental = false;
-
- /**
- * @return {@code true} if incremental generation is chosen
- */
- public static boolean isGenerateIncremental() {
- return generateIncremental;
- }
-
- /**
- * @param generateIncremental select {@code true} if incremental generation is desired
- */
- public static void setGenerateIncremental(boolean generateIncremental) {
- IncrementalGenerationFileIo.generateIncremental = generateIncremental;
- }
-
- /**
- * This method computes a hash key (a {@link java.util.zip.CRC32 CRC32} value) for the file contents
- * and compares it to the
- * one stored in the {@code infopath} directory with an added extension ".info". If the values are equal
- * then the file stored in the {@code infopath} is copied to {@code path} while preserving the file data.
- * In the other case the key is stored and the file is stored to {@code infopath} and {@code path}.
- */
- @Override
- public void generateFile(String desc, String path, String infopath, String file, CharSequence contents) {
-
- long oldCRC = 0;
-
- // use local copy to avoid inconsistencies due to concurrent change
- boolean genInc = generateIncremental;
-
- if (genInc) {
- // read old CRC value
- fileAccess.setOutputPath(infopath);
- try {
- CharSequence val = fileAccess.readTextFile(file+".info", JavaIoFileSystemAccess.DEFAULT_OUTPUT);
- oldCRC = Long.parseLong(val.toString());
- }
- catch (RuntimeIOException e) {
- }
- catch (NumberFormatException e) {
- }
- }
-
- boolean write = true;
- long newCRC = 0;
-
- if (genInc) {
- CRC32 crc32 = new CRC32();
- crc32.update(contents.toString().getBytes());
- newCRC = crc32.getValue();
- if (oldCRC==newCRC) {
- write = false;
- }
- else {
- fileAccess.generateFile(file+".info", ""+newCRC);
- }
- }
-
- if (write) {
- logger.logInfo(desc+" '"+file+"' in '"+path+"'");
- fileAccess.setOutputPath(path);
- fileAccess.generateFile(file, contents);
-
- if (genInc) {
- // save a copy in the info directory which is not cleared (and not compiled)
- fileAccess.setOutputPath(infopath);
- fileAccess.generateFile(file + ".incgen.txt", contents);
- }
- }
- else {
- logger.logInfo(desc+" (unchanged) '"+file+"' in '"+path+"'");
- File src = new File(infopath+file + ".incgen.txt");
- File dst = new File(path+file);
- try {
- FileUtils.copyFile(src, dst, true);
- }
- catch (IOException e) {
- fileAccess.setOutputPath(path);
- fileAccess.generateFile(file, contents);
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/Logger.java b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/Logger.java
deleted file mode 100644
index 9eadc3c07..000000000
--- a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/Logger.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.generator.fsm.base;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-/**
- * a simple logger class implementing the
- * {@link org.eclipse.etrice.generator.fsm.base.ILineOutputLogger ILineOutputLogger}
- * interface. If no ILineOutputLogger is set then output is sent to
- * {@link java.lang.System#out System.out}.
- *
- * @author Henrik Rentz-Reichert
- *
- */
-public class Logger implements ILineOutputLogger {
-
- private int errors = 0;
- private ILineOutput output = null;
-
- @Override
- public boolean hasErrors() {
- return errors!=0;
- }
-
- public void logInfo(String text) {
- println("Info: " + text);
- }
-
- @Override
- public void logError(String text) {
- logError(text, null);
- }
-
- public void logError(String text, EObject obj) {
- ++errors;
- if (obj == null)
- println("Error: " + text);
- else {
- // prefer location to toString()
- URI uri = EcoreUtil.getURI(obj);
- String objInfo = (uri != null && !obj.eIsProxy()) ? uri.toString() : obj.toString();
- println("Error: " + text + " " + objInfo);
- }
- }
-
- private void println(String txt) {
- if (output != null)
- output.println(txt);
- else
- System.out.println(txt);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.etrice.generator.ILineOutputLogger#setOutput(org.eclipse.
- * etrice.generator.ILineOutput)
- */
- @Override
- public void setOutput(ILineOutput lo) {
- output = lo;
- }
-
-}
diff --git a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/NullLogger.java b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/NullLogger.java
deleted file mode 100644
index 2aec3f0e7..000000000
--- a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/NullLogger.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.etrice.generator.fsm.base;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.genmodel.fsm.ILogger;
-
-public class NullLogger implements ILogger {
-
- private int errors = 0;
-
- @Override
- public void logInfo(String text) {
- }
-
- @Override
- public void logError(String text, EObject obj) {
- ++errors;
- }
-
- @Override
- public void logError(String text) {
- ++errors;
- }
-
- @Override
- public boolean hasErrors() {
- return errors!=0;
- }
-
-}
diff --git a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/StdLineOutput.java b/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/StdLineOutput.java
deleted file mode 100644
index 083ee85d2..000000000
--- a/plugins/org.eclipse.etrice.generator.fsm/src/org/eclipse/etrice/generator/fsm/base/StdLineOutput.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.generator.fsm.base;
-
-/**
- * A line output that prints to {@link java.lang.System#out System.out}
- *
- * @author Henrik Rentz-Reichert
- *
- */
-public class StdLineOutput implements ILineOutput {
-
- /* (non-Javadoc)
- * @see org.eclipse.etrice.generator.ILineOutput#println(java.lang.String)
- */
- @Override
- public void println(String txt) {
- System.out.println(txt);
- }
-
-}
diff --git a/plugins/org.eclipse.etrice.generator.gnuplot/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.gnuplot/META-INF/MANIFEST.MF
index 73db4fd1d..ab705a699 100644
--- a/plugins/org.eclipse.etrice.generator.gnuplot/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.gnuplot/META-INF/MANIFEST.MF
@@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.xtext;bundle-version="2.6.0",
org.eclipse.etrice.core.etmap;bundle-version="2.0.0",
org.eclipse.core.runtime;bundle-version="3.10.0",
org.eclipse.etrice.generator.doc;bundle-version="2.0.0",
- org.eclipse.etrice.abstractexec.behavior;bundle-version="2.0.0"
+ org.eclipse.etrice.abstractexec.behavior;bundle-version="2.0.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.etrice.generator.gnuplot/src/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.xtend b/plugins/org.eclipse.etrice.generator.gnuplot/src/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.xtend
index 7b0ca83e4..02bbfbc0c 100644
--- a/plugins/org.eclipse.etrice.generator.gnuplot/src/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.xtend
+++ b/plugins/org.eclipse.etrice.generator.gnuplot/src/org/eclipse/etrice/generator/gnuplot/GnuplotScriptGenerator.xtend
@@ -21,14 +21,14 @@ import org.eclipse.etrice.core.common.base.RealLiteral
import org.eclipse.etrice.core.common.base.StringLiteral
import org.eclipse.etrice.core.genmodel.etricegen.Root
import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.RoomExtensions
import com.google.inject.Singleton
@Singleton
class GnuplotScriptGenerator {
@Inject
- IGeneratorFileIo fileIo
+ IGeneratorFileIO fileIo
@Inject
extension RoomExtensions roomExtensions
diff --git a/plugins/org.eclipse.etrice.generator.java.mvn/.classpath b/plugins/org.eclipse.etrice.generator.java.mvn/.classpath
index 9c8395b8f..0deffafd8 100644
--- a/plugins/org.eclipse.etrice.generator.java.mvn/.classpath
+++ b/plugins/org.eclipse.etrice.generator.java.mvn/.classpath
@@ -27,5 +27,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
+ <classpathentry kind="src" path="/org.eclipse.etrice.generator.base"/>
+ <classpathentry kind="src" path="/org.eclipse.etrice.generator.java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/plugins/org.eclipse.etrice.generator.java.mvn/src/main/java/org/eclipse/etrice/generator/java/mvn/JavaGeneratorWrapper.java b/plugins/org.eclipse.etrice.generator.java.mvn/src/main/java/org/eclipse/etrice/generator/java/mvn/JavaGeneratorWrapper.java
index 97abae61f..404440fa2 100644
--- a/plugins/org.eclipse.etrice.generator.java.mvn/src/main/java/org/eclipse/etrice/generator/java/mvn/JavaGeneratorWrapper.java
+++ b/plugins/org.eclipse.etrice.generator.java.mvn/src/main/java/org/eclipse/etrice/generator/java/mvn/JavaGeneratorWrapper.java
@@ -18,7 +18,7 @@ import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
-import org.eclipse.etrice.generator.fsm.base.ILineOutput;
+import org.eclipse.etrice.generator.base.io.ILineOutput;
import org.eclipse.etrice.generator.java.Main;
/**
diff --git a/plugins/org.eclipse.etrice.generator.java/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.java/META-INF/MANIFEST.MF
index b943077c1..8dca8ffc1 100644
--- a/plugins/org.eclipse.etrice.generator.java/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.java/META-INF/MANIFEST.MF
@@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.etrice.core.genmodel;bundle-version="2.0.0",
org.eclipse.etrice.generator.doc;bundle-version="2.0.0",
org.eclipse.xtend.lib;bundle-version="2.6.0",
org.eclipse.xtext.generator;bundle-version="2.6.0",
- org.eclipse.xtext.util;bundle-version="2.6.0"
+ org.eclipse.xtext.util;bundle-version="2.6.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.etrice.generator.java,
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/Main.java b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/Main.java
index fb70a68f0..c2ae07138 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/Main.java
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/Main.java
@@ -12,19 +12,19 @@
package org.eclipse.etrice.generator.java;
-import java.util.Iterator;
+import java.util.List;
-import org.eclipse.emf.common.EMFPlugin;
-import org.eclipse.etrice.core.etmap.ETMapStandaloneSetup;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.etrice.core.etmap.util.ETMapUtil;
-import org.eclipse.etrice.core.etphys.ETPhysStandaloneSetup;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.IDataConfiguration;
-import org.eclipse.etrice.generator.java.gen.GlobalSettings;
+import org.eclipse.etrice.generator.base.args.Arguments;
+import org.eclipse.etrice.generator.base.logging.Loglevel;
import org.eclipse.etrice.generator.java.gen.MainGen;
import org.eclipse.etrice.generator.java.gen.Validator;
import org.eclipse.etrice.generator.java.setup.GeneratorModule;
+import org.eclipse.etrice.generator.java.setup.GeneratorOptions;
import org.eclipse.xtext.scoping.impl.ImportUriResolver;
import com.google.inject.Inject;
@@ -32,23 +32,11 @@ import com.google.inject.Singleton;
@Singleton
public class Main extends AbstractGenerator {
-
- public static final String OPTION_GEN_PERSIST = "-persistable";
- public static final String OPTION_GEN_STORE_DATA_OBJ = "-storeDataObj";
-
- /**
- * print usage message to output/console
- */
- protected void printUsage() {
- output.println(this.getClass().getName()+getCommonOptions()
- +" ["+OPTION_GEN_PERSIST+"]"
- +" ["+OPTION_GEN_STORE_DATA_OBJ+"]"
- +" <list of model file paths>");
- output.println(getCommonOptionDescriptions());
- output.println(" -persistable # if specified make actor classes persistable");
- output.println(" -storeDataObj # if specified equip actor classes with store/restore using POJOs");
- }
+ public static int run(String[] args) {
+ return createAndRunGenerator(new GeneratorModule(), args);
+ }
+
/**
* The main method delegates to {@link #createAndRunGenerator(com.google.inject.Module, String[])}
* and calls {@link System#exit(int)} if an error occurred and {@link #isTerminateOnError()}.
@@ -56,9 +44,8 @@ public class Main extends AbstractGenerator {
* @param args the command line arguments
*/
public static void main(String[] args) {
- int ret = createAndRunGenerator(new GeneratorModule(), args);
- if (isTerminateOnError() && ret!=GENERATOR_OK)
- System.exit(ret);
+ int ret = run(args);
+ System.exit(ret);
}
@Inject
@@ -75,122 +62,49 @@ public class Main extends AbstractGenerator {
@Inject
protected ImportUriResolver uriResolver;
-
- /**
- * This method recognizes the option {@value #OPTION_GEN_PERSIST} and delegates all
- * other cases to super.
- *
- * @see org.eclipse.etrice.generator.base.AbstractGenerator#parseOption(java.util.Iterator)
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.generator.base.AbstractGenerator#runGenerator()
*/
- @Override
- protected boolean parseOption(String arg, Iterator<String> it) {
- if (arg.equals(OPTION_GEN_PERSIST)) {
- getSettings().setGeneratePersistenceInterface(true);
- return true;
+ protected int runGenerator(List<Resource> resources, Arguments arguments) {
+
+ if (!dataConfig.setResources(getResourceSet(), logger)) {
+ logger.logError("configuration errors");
+ return GENERATOR_ERROR;
}
- else if (arg.equals(OPTION_GEN_STORE_DATA_OBJ)) {
- getSettings().setGenerateStoreDataObj(true);
- return true;
+
+ Root genModel = createGeneratorModel(resources, arguments);
+ if (diagnostician.isFailed() || genModel==null) {
+ logger.logError("errors during build of generator model");
+ return GENERATOR_ERROR;
}
- return super.parseOption(arg, it);
- }
-
- /**
- * @return the unique {@link GlobalSettings}
- */
- public static GlobalSettings getSettings() {
- return (GlobalSettings) getInstance().getGeneratorSettings();
- }
-
- /**
- * setup the eTrice mapping model plug-in
- */
- protected void setupMappingModel() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
- ETMapStandaloneSetup.doSetup();
+ if (!validator.validate(genModel)) {
+ logger.logError("validation failed during build of generator model");
+ return GENERATOR_ERROR;
}
- }
-
- /**
- * setup the eTrice mapping model plug-in
- */
- protected void setupPhysicalModel() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING)
- ETPhysStandaloneSetup.doSetup();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.etrice.generator.base.AbstractGenerator#runGenerator()
- */
- protected int runGenerator() {
- setupRoomModel();
- dataConfig.doSetup();
- setupMappingModel();
- setupPhysicalModel();
- try {
- activateModelLocator();
-
- if (!loadModels(getSettings().getInputModelURIs())) {
- logger.logInfo("loading of models failed");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- if (!validateModels()) {
- logger.logInfo("validation failed");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- if (!dataConfig.setResources(getResourceSet(), logger)) {
- logger.logInfo("configuration errors");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- Root genModel = createGeneratorModel(getSettings().isGenerateAsLibrary(), getSettings().getGeneratorModelPath());
- if (diagnostician.isFailed() || genModel==null) {
- logger.logInfo("errors during build of generator model");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- if (!validator.validate(genModel)) {
- logger.logInfo("validation failed during build of generator model");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- ETMapUtil.processModels(genModel, getResourceSet(), diagnostician);
- if (getSettings().isDebugMode()) {
- logger.logInfo("-- begin dump of mappings");
- logger.logInfo(ETMapUtil.dumpMappings());
- logger.logInfo("-- end dump of mappings");
- }
- if (diagnostician.isFailed() || genModel==null) {
- logger.logInfo("errors in mapping");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
-
- logger.logInfo("-- starting code generation");
- mainGenerator.doGenerate(genModel.eResource());
-
- if (getSettings().isGenerateDocumentation()) {
- mainDocGenerator.doGenerate(genModel.eResource());
- }
-
- if (diagnostician.isFailed()) {
- logger.logInfo("errors during code generation");
- logger.logError("-- terminating", null);
- return GENERATOR_ERROR;
- }
- logger.logInfo("-- finished code generation");
+ ETMapUtil.processModels(genModel, getResourceSet(), diagnostician);
+ if (Loglevel.DEBUG.compareTo(logger.getLoglevel()) >= 0) {
+ logger.logInfo("-- begin dump of mappings");
+ logger.logInfo(ETMapUtil.dumpMappings());
+ logger.logInfo("-- end dump of mappings");
+ }
+ if (diagnostician.isFailed() || genModel==null) {
+ logger.logError("errors in mapping");
+ return GENERATOR_ERROR;
}
- finally {
- deactivateModelLocator();
+
+ logger.logInfo("-- starting code generation");
+ mainGenerator.doGenerate(genModel.eResource());
+
+ if (arguments.get(GeneratorOptions.DOCUMENTATION)) {
+ mainDocGenerator.doGenerate(genModel.eResource());
+ }
+
+ if (diagnostician.isFailed()) {
+ logger.logError("errors during code generation");
+ return GENERATOR_ERROR;
}
return GENERATOR_OK;
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.xtend
index 6d045f7f9..094481523 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassDataGen.xtend
@@ -20,7 +20,7 @@ import org.eclipse.etrice.core.genmodel.etricegen.Root
import org.eclipse.etrice.core.genmodel.etricegen.WiredActorClass
import org.eclipse.etrice.core.room.ActorClass
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
@@ -29,7 +29,7 @@ import org.eclipse.etrice.core.room.util.RoomHelpers
@Singleton
class ActorClassDataGen {
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject extension RoomHelpers
@Inject extension RoomExtensions
@Inject extension FileSystemHelpers
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend
index 4bef3f8b3..24316011b 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ActorClassGen.xtend
@@ -26,7 +26,7 @@ import org.eclipse.etrice.core.room.EnumerationType
import org.eclipse.etrice.core.room.ReferenceType
import org.eclipse.etrice.generator.base.IDataConfiguration
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.GenericActorClassGenerator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
@@ -34,11 +34,12 @@ import org.eclipse.etrice.generator.generic.TypeHelpers
import org.eclipse.etrice.generator.java.Main
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
import org.eclipse.etrice.generator.generic.ILanguageExtension
+import org.eclipse.etrice.generator.java.setup.GeneratorOptionsHelper
@Singleton
class ActorClassGen extends GenericActorClassGenerator {
- @Inject protected IGeneratorFileIo fileIO
+ @Inject protected IGeneratorFileIO fileIO
@Inject protected extension JavaExtensions
@Inject protected extension RoomExtensions
@Inject protected IDataConfiguration dataConfigExt
@@ -49,6 +50,7 @@ class ActorClassGen extends GenericActorClassGenerator {
@Inject protected extension StateMachineGen
@Inject protected extension TypeHelpers
@Inject protected extension FileSystemHelpers
+ @Inject protected extension GeneratorOptionsHelper
@Inject
new (ConfigGenAddon configGenAddon) {
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend
index a4530f774..5fe5a62a6 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/DataClassGen.xtend
@@ -21,14 +21,14 @@ import org.eclipse.etrice.core.room.ComplexType
import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
@Singleton
class DataClassGen {
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject extension JavaExtensions
@Inject extension RoomExtensions
@Inject extension ProcedureHelpers
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.xtend
index 49747db36..99a9f1cfb 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/EnumerationTypeGen.xtend
@@ -12,7 +12,7 @@
package org.eclipse.etrice.generator.java.gen
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import com.google.inject.Inject
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.core.genmodel.etricegen.Root
@@ -26,7 +26,7 @@ import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
*/
class EnumerationTypeGen {
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject extension JavaExtensions
@Inject extension RoomExtensions
@Inject extension FileSystemHelpers
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/GlobalSettings.java b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/GlobalSettings.java
deleted file mode 100644
index 5fef705c7..000000000
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/GlobalSettings.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.generator.java.gen;
-
-import org.eclipse.etrice.generator.base.GlobalGeneratorSettings;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class GlobalSettings extends GlobalGeneratorSettings {
-
- private boolean generatePersistenceInterface = false;
- private boolean generateStoreDataObj = false;
-
- /**
- * @return the generatePersistenceInterface
- */
- public boolean isGeneratePersistenceInterface() {
- return generatePersistenceInterface;
- }
-
- /**
- * @param generatePersistenceInterface the generatePersistenceInterface to set
- */
- public void setGeneratePersistenceInterface(boolean generatePersistenceInterface) {
- this.generatePersistenceInterface = generatePersistenceInterface;
- }
-
- /**
- * @return the generateStoreDataObj
- */
- public boolean isGenerateStoreDataObj() {
- return generateStoreDataObj;
- }
-
- /**
- * @param generateStoreDataObj the generateStoreDataObj to set
- */
- public void setGenerateStoreDataObj(boolean generateStoreDataObj) {
- this.generateStoreDataObj = generateStoreDataObj;
- }
-}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/MainGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/MainGen.xtend
index 152c2187f..d8554aa21 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/MainGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/MainGen.xtend
@@ -18,6 +18,7 @@ import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.etrice.core.genmodel.etricegen.Root
import org.eclipse.etrice.generator.generic.PrepareFileSystem
import org.eclipse.etrice.generator.java.Main
+import org.eclipse.etrice.generator.java.setup.GeneratorOptionsHelper
@Singleton
class MainGen {
@@ -33,6 +34,8 @@ class MainGen {
@Inject NodeRunnerGen nodeRunnerGen
@Inject PrepareFileSystem prepFS
+ @Inject protected extension GeneratorOptionsHelper
+
def void doGenerate(Resource resource) {
prepFS.prepareCodeTargetPaths(resource)
prepFS.prepareInfoTargetPaths(resource)
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend
index e77e89409..5e8024fe6 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeGen.xtend
@@ -32,7 +32,7 @@ import org.eclipse.etrice.core.room.CommunicationType
import org.eclipse.etrice.core.room.SubSystemClass
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
import org.eclipse.etrice.generator.base.IDataConfiguration
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.fsm.base.IntelligentSeparator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
@@ -43,6 +43,7 @@ import com.google.common.collect.Lists
import com.google.common.collect.Sets
import org.eclipse.etrice.core.genmodel.builder.GenmodelConstants
import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician
+import org.eclipse.etrice.generator.java.setup.GeneratorOptionsHelper
@Singleton
class NodeGen {
@@ -53,8 +54,9 @@ class NodeGen {
@Inject ConfigGenAddon configGenAddon
@Inject extension ProcedureHelpers
@Inject extension FileSystemHelpers
+ @Inject protected extension GeneratorOptionsHelper
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject VariableServiceGen varService
@Inject IDiagnostician diagnostician
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.xtend
index 987c01008..ca92125b7 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/NodeRunnerGen.xtend
@@ -17,7 +17,7 @@ import com.google.inject.Singleton
import org.eclipse.etrice.core.genmodel.etricegen.Root
import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance
import org.eclipse.etrice.core.genmodel.etricegen.SystemInstance
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.core.etmap.util.ETMapUtil
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
@@ -29,7 +29,7 @@ class NodeRunnerGen {
@Inject extension JavaExtensions
@Inject extension FileSystemHelpers
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
def doGenerate(Root root) {
for (nr : ETMapUtil::getNodeRefs()) {
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.xtend
index efefdedd3..ccf46358b 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorFactoryGen.xtend
@@ -8,13 +8,13 @@ import org.eclipse.etrice.core.genmodel.etricegen.WiredActorClass
import org.eclipse.etrice.core.room.ActorClass
import org.eclipse.etrice.core.room.CommunicationType
import org.eclipse.etrice.core.room.util.RoomHelpers
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
class OptionalActorFactoryGen {
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject extension RoomHelpers
@Inject extension JavaExtensions
@Inject extension RoomExtensions
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.xtend
index 95a8bc9ad..05db79641 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/OptionalActorInterfaceGen.xtend
@@ -17,18 +17,20 @@ import com.google.inject.Singleton
import org.eclipse.etrice.core.genmodel.etricegen.Root
import org.eclipse.etrice.core.room.ActorClass
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.GenericActorClassGenerator
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.java.Main
+import org.eclipse.etrice.generator.java.setup.GeneratorOptionsHelper
@Singleton
class OptionalActorInterfaceGen extends GenericActorClassGenerator {
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject extension JavaExtensions
@Inject extension RoomExtensions
@Inject extension FileSystemHelpers
+ @Inject protected extension GeneratorOptionsHelper
def doGenerate(Root root) {
for (ac: root.optionalActorClasses.filter(cl|cl.isValidGenerationLocation)) {
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
index 369d92c64..ca7de0fea 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
@@ -20,19 +20,20 @@ import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.core.room.Message
import org.eclipse.etrice.core.room.ProtocolClass
import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
import org.eclipse.etrice.generator.java.Main
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
import org.eclipse.etrice.generator.generic.ILanguageExtension
+import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician
+import org.eclipse.etrice.generator.java.setup.GeneratorOptionsHelper
@Singleton
class ProtocolClassGen extends GenericProtocolClassGenerator {
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject extension JavaExtensions
@Inject extension RoomExtensions
@Inject extension ProcedureHelpers
@@ -40,7 +41,8 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
@Inject extension TypeHelpers
@Inject extension DataClassGen
@Inject extension FileSystemHelpers
- @Inject ILogger logger
+ @Inject protected extension GeneratorOptionsHelper
+ @Inject IDiagnostician diagnostician
def doGenerate(Root root) {
for (pc: root.protocolClasses.filter(cl|cl.isValidGenerationLocation)) {
@@ -57,7 +59,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
""
}
if (contents.toString.empty)
- logger.logError("synchronous protocols not supported yet", pc)
+ diagnostician.error("synchronous protocols not supported yet", pc, null)
else
fileIO.generateFile("generating ProtocolClass implementation", path, infopath, file, contents)
}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend
index b2910ad5a..482032616 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/StateMachineGen.xtend
@@ -22,10 +22,14 @@ import org.eclipse.etrice.generator.generic.GenericStateMachineGenerator
import org.eclipse.etrice.generator.java.Main
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
+import com.google.inject.Inject
+import org.eclipse.etrice.generator.java.setup.GeneratorOptionsHelper
@Singleton
class StateMachineGen extends GenericStateMachineGenerator {
+ @Inject protected extension GeneratorOptionsHelper
+
val nodeComparator = new NodeComparator
/**
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Validator.java b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Validator.java
index 9a4b5e5c0..93c527c67 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Validator.java
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/Validator.java
@@ -13,7 +13,7 @@
package org.eclipse.etrice.generator.java.gen;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.genmodel.fsm.ILogger;
+import org.eclipse.etrice.generator.base.logging.ILogger;
import com.google.inject.Inject;
@@ -40,7 +40,7 @@ public class Validator {
// }
if (errorCount>0) {
- logger.logError("Java generator detected "+errorCount+" error(s) - terminating", null);
+ logger.logError("Java generator detected "+errorCount+" error(s) - terminating");
return false;
}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
index fe827aeac..51baa8e2b 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/VariableServiceGen.xtend
@@ -28,7 +28,7 @@ import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.DataClass
import org.eclipse.etrice.core.room.RoomModel
import org.eclipse.etrice.generator.base.IDataConfiguration
-import org.eclipse.etrice.generator.fsm.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
@@ -40,7 +40,7 @@ import org.eclipse.etrice.core.common.converter.TimeConverter
@Singleton
class VariableServiceGen {
- @Inject IGeneratorFileIo fileIO
+ @Inject IGeneratorFileIO fileIO
@Inject extension JavaExtensions stdExt
@Inject extension RoomExtensions roomExt
@Inject IDataConfiguration configExt
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorModule.java b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorModule.java
index 522c31e7f..aa7bace48 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorModule.java
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorModule.java
@@ -15,7 +15,7 @@ package org.eclipse.etrice.generator.java.setup;
import org.eclipse.etrice.core.common.scoping.ModelLocatorUriResolver;
import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.AbstractGeneratorBaseModule;
-import org.eclipse.etrice.generator.base.GlobalGeneratorSettings;
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
import org.eclipse.etrice.generator.base.IDataConfiguration;
import org.eclipse.etrice.generator.base.ITranslationProvider;
import org.eclipse.etrice.generator.generic.GenericActorClassGenerator;
@@ -23,7 +23,6 @@ import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator;
import org.eclipse.etrice.generator.generic.ILanguageExtension;
import org.eclipse.etrice.generator.java.Main;
import org.eclipse.etrice.generator.java.gen.ActorClassGen;
-import org.eclipse.etrice.generator.java.gen.GlobalSettings;
import org.eclipse.etrice.generator.java.gen.JavaExtensions;
import org.eclipse.etrice.generator.java.gen.JavaTranslationProvider;
import org.eclipse.etrice.generator.java.gen.ProtocolClassGen;
@@ -33,16 +32,16 @@ import com.google.inject.Binder;
public class GeneratorModule extends AbstractGeneratorBaseModule {
-// @Override
+ @Override
public void configure(Binder binder) {
super.configure(binder);
-
+
binder.bind(GenericProtocolClassGenerator.class).to(ProtocolClassGen.class);
binder.bind(GenericActorClassGenerator.class).to(ActorClassGen.class);
binder.bind(ImportUriResolver.class).to(ModelLocatorUriResolver.class);
-
- binder.bind(GlobalGeneratorSettings.class).to(GlobalSettings.class);
+
+ binder.bind(AbstractGeneratorOptions.class).to(GeneratorOptions.class);
}
@Override
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorOptions.java b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorOptions.java
new file mode 100644
index 000000000..279e33f0e
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorOptions.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.java.setup;
+
+import java.util.List;
+
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
+import org.eclipse.etrice.generator.base.args.BooleanOption;
+import org.eclipse.etrice.generator.base.args.Option;
+
+public class GeneratorOptions extends AbstractGeneratorOptions {
+
+ public static final BooleanOption GEN_PERSIST = new BooleanOption(
+ "persistable",
+ "generatePersistenceInterface",
+ "if specified make actor classes persistable",
+ false);
+
+ public static final BooleanOption GEN_STORE_DATA_OBJ = new BooleanOption(
+ "storeDataObj",
+ "generateStoreDataObj",
+ "if specified equip actor classes with store/restore using POJOs",
+ false);
+
+ @Override
+ public void configure(List<Option<?>> options) {
+ super.configure(options);
+
+ options.add(GEN_PERSIST);
+ options.add(GEN_STORE_DATA_OBJ);
+ }
+}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorOptionsHelper.java b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorOptionsHelper.java
new file mode 100644
index 000000000..d62ed8e6f
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/setup/GeneratorOptionsHelper.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.java.setup;
+
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptionsHelper;
+import org.eclipse.etrice.generator.base.args.Arguments;
+
+public class GeneratorOptionsHelper extends AbstractGeneratorOptionsHelper {
+
+ public boolean isGeneratePersistenceInterface(Arguments args) {
+ return args.get(GeneratorOptions.GEN_PERSIST);
+ }
+
+ public boolean isGenerateStoreDataObj(Arguments args) {
+ return args.get(GeneratorOptions.GEN_STORE_DATA_OBJ);
+ }
+}
diff --git a/plugins/org.eclipse.etrice.generator.launch.c/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.launch.c/META-INF/MANIFEST.MF
index 9ed3dab6f..27fb91787 100644
--- a/plugins/org.eclipse.etrice.generator.launch.c/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.launch.c/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.etrice.generator;bundle-version="2.0.0",
org.eclipse.jdt.ui;bundle-version="3.7.0",
org.eclipse.jdt.core;bundle-version="3.7.0",
org.eclipse.core.variables;bundle-version="3.2.500",
- org.eclipse.etrice.generator.ui;bundle-version="2.0.0"
+ org.eclipse.etrice.generator.ui;bundle-version="2.0.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.jdt.launching,
diff --git a/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorLaunchConfigurationDelegate.java b/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorLaunchConfigurationDelegate.java
index 8f4b0034b..4b770731e 100644
--- a/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorLaunchConfigurationDelegate.java
@@ -13,7 +13,7 @@
package org.eclipse.etrice.generator.launch.c;
import org.eclipse.etrice.generator.c.Main;
-import org.eclipse.etrice.generator.fsm.base.ILineOutput;
+import org.eclipse.etrice.generator.base.io.ILineOutput;
import org.eclipse.etrice.generator.launch.GeneratorLaunchConfigurationDelegate;
/**
@@ -28,8 +28,7 @@ public class CGeneratorLaunchConfigurationDelegate extends GeneratorLaunchConfig
@Override
protected void runGenerator(String[] args, ILineOutput out) {
Main.setOutput(out);
- Main.setTerminateOnError(false);
- Main.main(args);
+ Main.run(args);
}
/* (non-Javadoc)
diff --git a/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF
index 8b589ded0..6bd837ffb 100644
--- a/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.launch.cpp/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.etrice.generator;bundle-version="2.0.0",
org.eclipse.jdt.ui;bundle-version="3.7.0",
org.eclipse.jdt.core;bundle-version="3.7.0",
org.eclipse.core.variables;bundle-version="3.2.500",
- org.eclipse.etrice.core.genmodel;bundle-version="2.0.0"
+ org.eclipse.etrice.core.genmodel;bundle-version="2.0.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.jdt.launching,
diff --git a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java
index e39c69920..499066f03 100644
--- a/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.etrice.generator.launch.cpp/src/org/eclipse/etrice/generator/launch/cpp/CppGeneratorLaunchConfigurationDelegate.java
@@ -12,8 +12,8 @@
package org.eclipse.etrice.generator.launch.cpp;
+import org.eclipse.etrice.generator.base.io.ILineOutput;
import org.eclipse.etrice.generator.cpp.Main;
-import org.eclipse.etrice.generator.fsm.base.ILineOutput;
import org.eclipse.etrice.generator.launch.GeneratorLaunchConfigurationDelegate;
/**
@@ -28,8 +28,7 @@ public class CppGeneratorLaunchConfigurationDelegate extends GeneratorLaunchConf
@Override
protected void runGenerator(String[] args, ILineOutput out) {
Main.setOutput(out);
- Main.setTerminateOnError(false);
- Main.main(args);
+ Main.run(args);
}
/* (non-Javadoc)
diff --git a/plugins/org.eclipse.etrice.generator.launch.java/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.launch.java/META-INF/MANIFEST.MF
index 186e5f37c..56e5979ed 100644
--- a/plugins/org.eclipse.etrice.generator.launch.java/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.launch.java/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.etrice.generator;bundle-version="2.0.0",
org.eclipse.jdt.ui;bundle-version="3.7.0",
org.eclipse.jdt.core;bundle-version="3.7.0",
org.eclipse.core.variables;bundle-version="3.2.500",
- org.eclipse.etrice.generator.ui;bundle-version="2.0.0"
+ org.eclipse.etrice.generator.ui;bundle-version="2.0.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.jdt.launching,
diff --git a/plugins/org.eclipse.etrice.generator.launch.java/src/org/eclipse/etrice/generator/launch/java/JavaGeneratorLaunchConfigurationDelegate.java b/plugins/org.eclipse.etrice.generator.launch.java/src/org/eclipse/etrice/generator/launch/java/JavaGeneratorLaunchConfigurationDelegate.java
index 5417d0489..851907754 100644
--- a/plugins/org.eclipse.etrice.generator.launch.java/src/org/eclipse/etrice/generator/launch/java/JavaGeneratorLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.etrice.generator.launch.java/src/org/eclipse/etrice/generator/launch/java/JavaGeneratorLaunchConfigurationDelegate.java
@@ -14,8 +14,9 @@ package org.eclipse.etrice.generator.launch.java;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.etrice.generator.fsm.base.ILineOutput;
+import org.eclipse.etrice.generator.base.io.ILineOutput;
import org.eclipse.etrice.generator.java.Main;
+import org.eclipse.etrice.generator.java.setup.GeneratorOptions;
import org.eclipse.etrice.generator.launch.GeneratorLaunchConfigurationDelegate;
/**
@@ -32,11 +33,11 @@ public class JavaGeneratorLaunchConfigurationDelegate extends GeneratorLaunchCon
super.addArguments(configuration, argString);
if (configuration.getAttribute(JavaGeneratorConfigTab.PERSIST, false)) {
- argString.append(" "+Main.OPTION_GEN_PERSIST);
+ argString.append(" -"+GeneratorOptions.GEN_PERSIST.getName());
}
if (configuration.getAttribute(JavaGeneratorConfigTab.DATA_OBJ, false)) {
- argString.append(" "+Main.OPTION_GEN_STORE_DATA_OBJ);
+ argString.append(" -"+GeneratorOptions.GEN_STORE_DATA_OBJ.getName());
}
}
@@ -45,9 +46,8 @@ public class JavaGeneratorLaunchConfigurationDelegate extends GeneratorLaunchCon
*/
@Override
protected void runGenerator(String[] args, ILineOutput out) {
- org.eclipse.etrice.generator.java.Main.setOutput(out);
- org.eclipse.etrice.generator.java.Main.setTerminateOnError(false);
- org.eclipse.etrice.generator.java.Main.main(args);
+ Main.setOutput(out);
+ Main.run(args);
}
/* (non-Javadoc)
diff --git a/plugins/org.eclipse.etrice.generator.launch/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.launch/META-INF/MANIFEST.MF
index 621f70ed7..059c8ad61 100644
--- a/plugins/org.eclipse.etrice.generator.launch/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.launch/META-INF/MANIFEST.MF
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.etrice.generator;bundle-version="2.0.0",
org.eclipse.debug.ui,
org.eclipse.core.variables,
org.eclipse.jdt.launching,
- org.eclipse.ui.ide
+ org.eclipse.ui.ide,
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Import-Package: org.eclipse.xtext.xbase.lib
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/ConsoleOutput.java b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/ConsoleOutput.java
index a6f09cb96..e609dbc84 100644
--- a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/ConsoleOutput.java
+++ b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/ConsoleOutput.java
@@ -16,7 +16,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.etrice.generator.fsm.base.ILineOutput;
+import org.eclipse.etrice.generator.base.io.ILineOutput;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorPart;
diff --git a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
index 7d10593ba..fd1783414 100644
--- a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
+++ b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
@@ -20,7 +20,7 @@ import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
-import org.eclipse.etrice.generator.base.AbstractGenerator;
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
import org.eclipse.etrice.generator.ui.preferences.PreferenceConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -338,7 +338,7 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
genModelPath.setEnabled(save);
browsePath.setEnabled(save);
genModelPath.setText(configuration.getAttribute(GEN_MODEL_PATH, ""));
- mainMethodName.setText(configuration.getAttribute(MAIN_METHOD_NAME, AbstractGenerator.DEFAULT_MAIN_NAME));
+ mainMethodName.setText(configuration.getAttribute(MAIN_METHOD_NAME, AbstractGeneratorOptions.MAIN_NAME.getDefaultValue()));
boolean genDocu = configuration.getAttribute(GEN_DOCUMENTATION, false);
if (configuration.getAttribute(GEN_INSTANCE_DIAGRAM, false))
genDocu = true;
diff --git a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
index 06dfebd81..dd3cb3fe8 100644
--- a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
@@ -28,8 +28,8 @@ import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.ui.RefreshTab;
-import org.eclipse.etrice.generator.base.AbstractGenerator;
-import org.eclipse.etrice.generator.fsm.base.ILineOutput;
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
+import org.eclipse.etrice.generator.base.io.ILineOutput;
import org.eclipse.etrice.generator.ui.preferences.PreferenceConstants;
import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
import org.eclipse.swt.widgets.Display;
@@ -195,38 +195,39 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL
@SuppressWarnings("deprecation") // keep compatible
protected void addArguments(ILaunchConfiguration configuration, StringBuffer argString) throws CoreException {
if (configuration.getAttribute(GeneratorConfigTab.LIB, false)) {
- argString.append(" "+AbstractGenerator.OPTION_LIB);
+ argString.append(" -"+AbstractGeneratorOptions.LIB.getName());
}
if (configuration.getAttribute(GeneratorConfigTab.SAVE_GEN_MODEL, false)) {
- argString.append(" "+AbstractGenerator.OPTION_SAVE_GEN_MODEL);
+ argString.append(" -"+AbstractGeneratorOptions.SAVE_GEN_MODEL.getName());
argString.append(" "+configuration.getAttribute(GeneratorConfigTab.GEN_MODEL_PATH, "?"));
}
- if (!configuration.getAttribute(GeneratorConfigTab.MAIN_METHOD_NAME, AbstractGenerator.DEFAULT_MAIN_NAME).equals(AbstractGenerator.DEFAULT_MAIN_NAME)) {
- argString.append(" "+AbstractGenerator.OPTION_MAIN_NAME);
- argString.append(" "+configuration.getAttribute(GeneratorConfigTab.MAIN_METHOD_NAME, AbstractGenerator.DEFAULT_MAIN_NAME));
+ if (!configuration.getAttribute(GeneratorConfigTab.MAIN_METHOD_NAME, AbstractGeneratorOptions.MAIN_NAME.getDefaultValue()).equals(AbstractGeneratorOptions.MAIN_NAME.getDefaultValue())) {
+ argString.append(" -"+AbstractGeneratorOptions.MAIN_NAME.getName());
+ argString.append(" "+configuration.getAttribute(GeneratorConfigTab.MAIN_METHOD_NAME, AbstractGeneratorOptions.MAIN_NAME.getDefaultValue()));
}
if (configuration.getAttribute(GeneratorConfigTab.GEN_DOCUMENTATION, false)
|| configuration.getAttribute(GeneratorConfigTab.GEN_INSTANCE_DIAGRAM, false))
- argString.append(" "+AbstractGenerator.OPTION_DOCUMENTATION);
+ argString.append(" -"+AbstractGeneratorOptions.DOCUMENTATION.getName());
if (configuration.getAttribute(GeneratorConfigTab.DEBUG, false)) {
- argString.append(" "+AbstractGenerator.OPTION_DEBUG);
+ argString.append(" -"+AbstractGeneratorOptions.LOGLEVEL.getName());
+ argString.append(" debug");
}
if (configuration.getAttribute(GeneratorConfigTab.MSC_INSTR, false)) {
- argString.append(" "+AbstractGenerator.OPTION_MSC_INSTR);
+ argString.append(" -"+AbstractGeneratorOptions.MSC_INSTR.getName());
}
if (configuration.getAttribute(GeneratorConfigTab.DATA_INSTR, false)) {
- argString.append(" "+AbstractGenerator.OPTION_DATA_INSTR);
+ argString.append(" -"+AbstractGeneratorOptions.DATA_INSTR.getName());
}
if (configuration.getAttribute(GeneratorConfigTab.VERBOSE, false)) {
- argString.append(" "+AbstractGenerator.OPTION_VERBOSE_RT);
+ argString.append(" -"+AbstractGeneratorOptions.VERBOSE_RT.getName());
}
if (!configuration.getAttribute(GeneratorConfigTab.USE_TRAANSLATION, true)) {
- argString.append(" "+AbstractGenerator.OPTION_NOTRANSLATE);
+ argString.append(" -"+AbstractGeneratorOptions.NOTRANSLATE.getName());
}
ScopedPreferenceStore prefStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.generator.ui");
if (prefStore.getBoolean(PreferenceConstants.GEN_INCREMENTAL)) {
- argString.append(" "+AbstractGenerator.OPTION_GEN_INCREMENTAL);
+ argString.append(" -"+AbstractGeneratorOptions.GEN_INCREMENTAL.getName());
}
boolean override = configuration.getAttribute(GeneratorConfigTab.OVERRIDE_DIRECTORIES, false);
@@ -238,13 +239,13 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL
infoDir = configuration.getAttribute(GeneratorConfigTab.INFO_PATH, infoDir);
docDir = configuration.getAttribute(GeneratorConfigTab.DOC_PATH, docDir);
}
- argString.append(" "+AbstractGenerator.OPTION_GEN_DIR);
+ argString.append(" -"+AbstractGeneratorOptions.GEN_DIR.getName());
argString.append(" "+srcgenDir);
- argString.append(" "+AbstractGenerator.OPTION_GEN_INFO_DIR);
+ argString.append(" -"+AbstractGeneratorOptions.GEN_INFO_DIR.getName());
argString.append(" "+infoDir);
- argString.append(" "+AbstractGenerator.OPTION_GEN_DOC_DIR);
+ argString.append(" -"+AbstractGeneratorOptions.GEN_DOC_DIR.getName());
argString.append(" "+docDir);
}
diff --git a/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF
index eb9569a2a..7b4b95618 100644
--- a/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF
@@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.etrice.core.etmap;bundle-version="2.0.0",
org.eclipse.xtext.xbase.lib;bundle-version="2.6.0",
org.eclipse.xtext;bundle-version="2.6.0",
org.eclipse.xtext.ui;bundle-version="2.6.0",
- org.eclipse.etrice.generator;bundle-version="2.0.0"
+ org.eclipse.etrice.generator;bundle-version="2.0.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.etrice.generator.ui.Activator
Export-Package: org.eclipse.etrice.generator.ui.configurator,
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectWizard.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectWizard.java
index 31d5b1e80..da52f601a 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectWizard.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/EmptyProjectWizard.java
@@ -29,7 +29,7 @@ import org.eclipse.emf.common.ui.dialogs.DiagnosticDialog;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.etrice.generator.base.AbstractGenerator;
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
import org.eclipse.etrice.generator.ui.Activator;
import org.eclipse.jdt.core.IAccessRule;
import org.eclipse.jdt.core.IClasspathAttribute;
@@ -164,7 +164,7 @@ public class EmptyProjectWizard extends Wizard implements INewWizard {
ProjectCreator.createBuildProperties(projectURI.appendSegment("build.properties"), modelName);
ProjectCreator.createLaunchGeneratorConfig(projectURI.appendSegment("generate_Template.launch"),
- "java", "/" + projectName + "/model", "Mapping", AbstractGenerator.DEFAULT_MAIN_NAME, additionalLaunchConfigLines);
+ "java", "/" + projectName + "/model", "Mapping", AbstractGeneratorOptions.MAIN_NAME.getDefaultValue(), additionalLaunchConfigLines);
ProjectCreator.createLaunchJavaApplicationConfig(projectURI.appendSegment("run_Template.launch"),
projectName, MODEL_NAME, "Node_node_subSystemRefRunner");
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/internal/COptionsPage.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/internal/COptionsPage.java
index f7291a073..6583b5f55 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/internal/COptionsPage.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/internal/COptionsPage.java
@@ -23,7 +23,7 @@ import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.etrice.generator.base.AbstractGenerator;
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
import org.eclipse.etrice.generator.ui.wizard.WizardHelpers;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
@@ -93,7 +93,7 @@ public class COptionsPage extends WizardPage {
mainMethodName = new Text(buttonComposite, SWT.SINGLE | SWT.BORDER);
mainMethodName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- mainMethodName.setText(AbstractGenerator.DEFAULT_MAIN_NAME);
+ mainMethodName.setText(AbstractGeneratorOptions.MAIN_NAME.getDefaultValue());
setErrorMessage(null);
setMessage(null);
@@ -210,6 +210,6 @@ public class COptionsPage extends WizardPage {
return mainMethodName.getText();
}
- return AbstractGenerator.DEFAULT_MAIN_NAME;
+ return AbstractGeneratorOptions.MAIN_NAME.getDefaultValue();
}
}
diff --git a/plugins/org.eclipse.etrice.generator/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator/META-INF/MANIFEST.MF
index f217ae8b6..d7426c68f 100644
--- a/plugins/org.eclipse.etrice.generator/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator/META-INF/MANIFEST.MF
@@ -20,6 +20,8 @@ Require-Bundle: org.eclipse.etrice.core.room;bundle-version="2.0.0",
org.eclipse.xtext.generator;bundle-version="2.6.0",
org.eclipse.xtext;bundle-version="2.6.0",
org.eclipse.xtend.lib;bundle-version="2.3.0",
- org.apache.commons.io;bundle-version="2.0.1"
+ org.apache.commons.io;bundle-version="2.0.1",
+ org.eclipse.etrice.generator.base;bundle-version="1.0.0",
+ org.eclipse.etrice.core.config
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.etrice.generator.generic
diff --git a/plugins/org.eclipse.etrice.generator/build.gradle b/plugins/org.eclipse.etrice.generator/build.gradle
index bdb7e7a79..9d815ad33 100644
--- a/plugins/org.eclipse.etrice.generator/build.gradle
+++ b/plugins/org.eclipse.etrice.generator/build.gradle
@@ -1,10 +1,12 @@
dependencies {
compile project(':plugins:org.eclipse.etrice.core.common')
+ compile project(':plugins:org.eclipse.etrice.core.config')
compile project(':plugins:org.eclipse.etrice.core.fsm')
compile project(':plugins:org.eclipse.etrice.core.genmodel')
compile project(':plugins:org.eclipse.etrice.core.room')
compile project(':plugins:org.eclipse.etrice.core.etphys')
compile project(':plugins:org.eclipse.etrice.core.etmap')
+ compile project(':plugins:org.eclipse.etrice.generator.base')
compile project(':plugins:org.eclipse.etrice.generator.fsm')
compile "org.eclipse.xtend:org.eclipse.xtend.lib:$versions.xtext"
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java
index 77329bcc8..fca26029e 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java
@@ -14,21 +14,23 @@ package org.eclipse.etrice.generator.base;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
-import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.etrice.core.common.scoping.ModelLocatorUriResolver;
+import org.eclipse.etrice.core.ConfigStandaloneSetup;
+import org.eclipse.etrice.core.RoomStandaloneSetup;
+import org.eclipse.etrice.core.etmap.ETMapStandaloneSetup;
+import org.eclipse.etrice.core.etphys.ETPhysStandaloneSetup;
import org.eclipse.etrice.core.fsm.fSM.DetailCode;
+import org.eclipse.etrice.core.genmodel.SetupGenmodel;
import org.eclipse.etrice.core.genmodel.builder.GeneratorModelBuilder;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
@@ -37,24 +39,16 @@ import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician;
import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RoomModel;
-import org.eclipse.etrice.generator.fsm.base.ILineOutput;
-import org.eclipse.etrice.generator.fsm.base.ILineOutputLogger;
-import org.eclipse.etrice.generator.fsm.base.IncrementalGenerationFileIo;
-import org.eclipse.etrice.generator.fsm.base.StdLineOutput;
+import org.eclipse.etrice.generator.base.args.Arguments;
+import org.eclipse.etrice.generator.base.io.IGeneratorFileIO;
+import org.eclipse.etrice.generator.base.io.ILineOutput;
+import org.eclipse.etrice.generator.base.io.LineOutput;
+import org.eclipse.etrice.generator.base.logging.ILogger;
import org.eclipse.etrice.generator.fsm.generic.IDetailCodeTranslator;
import org.eclipse.etrice.generator.generic.RoomExtensions;
import org.eclipse.etrice.generator.generic.TestInstanceCreator;
-import org.eclipse.xtext.diagnostics.Severity;
-import org.eclipse.xtext.util.CancelIndicator;
-import org.eclipse.xtext.validation.CheckMode;
-import org.eclipse.xtext.validation.IResourceValidator;
-import org.eclipse.xtext.validation.Issue;
-
-import com.google.inject.Guice;
import com.google.inject.Inject;
-import com.google.inject.Injector;
import com.google.inject.Module;
-import com.google.inject.Provider;
/**
* A base class for generators of ROOM models.
@@ -71,71 +65,43 @@ import com.google.inject.Provider;
* @author Henrik Rentz-Reichert
*
*/
-public abstract class AbstractGenerator implements IDetailCodeTranslator {
-
- public static final String OPTION_LIB = "-lib";
- public static final String OPTION_NOEXIT = "-noexit";
- public static final String OPTION_DOCUMENTATION = "-genDocu";
- public static final String OPTION_SAVE_GEN_MODEL = "-saveGenModel";
- public static final String OPTION_MAIN_NAME = "-mainName";
- public static final String DEFAULT_MAIN_NAME = "main";
- public static final String OPTION_GEN_INCREMENTAL = "-inc";
- public static final String OPTION_GEN_DIR = "-genDir";
- public static final String OPTION_GEN_INFO_DIR = "-genInfoDir";
- public static final String OPTION_GEN_DOC_DIR = "-genDocDir";
- public static final String OPTION_MSC_INSTR = "-msc_instr";
- public static final String OPTION_DATA_INSTR = "-data_instr";
- public static final String OPTION_VERBOSE_RT = "-gen_as_verbose";
- public static final String OPTION_DEBUG = "-debug";
- public static final String OPTION_NOTRANSLATE = "-notranslate";
- public static final String OPTION_HELP = "-help";
+public abstract class AbstractGenerator implements IGenerator, IDetailCodeTranslator {
/**
* constant used as return value of {@link #runGenerator())}
* @see #GENERATOR_ERROR
*/
public static final int GENERATOR_OK = 0;
+
/**
* constant used as return value of {@link #runGenerator()}
* @see #GENERATOR_OK
*/
public static final int GENERATOR_ERROR = 1;
- private static boolean terminateOnError = true;
+ protected static ILineOutput output = new LineOutput();
private static AbstractGenerator instance = null;
-
- protected static ILineOutput output = new StdLineOutput();
- private static Injector injector;
+ private static Arguments settings = null;
- private HashMap<DetailCode, String> detailcode2string = new HashMap<DetailCode, String>();
-
/**
- * determines the behavior of the generator on exit
- *
- * @param terminateOnError a flag that determines shut down behavior
- * (this behavior is implemented in the concrete generator defining <code>main()</code>)
+ * It is assumed (though not enforced) that the generator is a singleton.
*
- * @see #isTerminateOnError()
+ * @return the singleton {@link AbstractGenerator}
*/
- public static void setTerminateOnError(boolean terminateOnError) {
- AbstractGenerator.terminateOnError = terminateOnError;
+ public static AbstractGenerator getInstance() {
+ return instance;
}
/**
- * If ran in stand alone mode in a separate JVM e.g. in a makefile then it is desirable to terminate
- * the JVM with an error code to let the make program fail.
- *
- * <p>
- * If ran inside Eclipse we better don't terminate the JVM in case of an error because this
- * would also shut down Eclipse.
- * </p>
+ * The generator settings can also be statically accessed using {@link #getInstance()} followed
+ * by a call to this method.
*
- * @return <code>true</code> if the JVM should be terminated on exit with an error code.
+ * @return the {@link #generatorSettings}
*/
- public static boolean isTerminateOnError() {
- return terminateOnError;
+ public static Arguments getSettings() {
+ return settings;
}
-
+
/**
* This method can be used to achieve different output behavior: in stand alone mode this might
* be just the console, inside Eclipse this rather would be the console view
@@ -143,256 +109,33 @@ public abstract class AbstractGenerator implements IDetailCodeTranslator {
* @param out an {@link ILineOutput}
*/
public static void setOutput(ILineOutput out) {
- if (out!=null)
+ if (out != null)
output = out;
}
/**
- * It is assumed (though not enforced) that the generator is a singleton.
- *
- * @return the singleton {@link AbstractGenerator}
- */
- public static AbstractGenerator getInstance() {
- return instance;
- }
-
- /**
- * The protected constructor is setting the {@link #instance} static member
- */
- protected AbstractGenerator() {
- instance = this;
- }
-
- /**
* creates an instance of the generator and invokes the {@link #runGenerator(String[])} method
* @param generatorModule a Guice module from which the {@link com.google.inject.Injector Injector} is created
* @param args the command line arguments
* @return GENERATOR_OK or GENERATOR_ERROR
*/
- protected static int createAndRunGenerator(Module generatorModule, String[] args) {
- injector = Guice.createInjector(generatorModule);
- AbstractGenerator generator = injector.getInstance(AbstractGenerator.class);
- generator.logger.setOutput(output);
-
- if (!generator.parseOptions(args))
- return GENERATOR_ERROR;
-
- return generator.runGenerator();
- }
-
- /**
- * Initialize {@link GlobalGeneratorSettings} and parse all options by calling
- * {@link #parseOption(String, Iterator)}.
- *
- * @param args the command line arguments
- * @return {@code true} if all options could be parsed successfully
- */
- protected boolean parseOptions(String[] args) {
- if (args.length == 0) {
- return usageError("no arguments!");
+ public static int createAndRunGenerator(Module generatorModule, String[] args) {
+ int ret = GENERATOR_OK;
+ GeneratorApplication genAppl = GeneratorApplication.create(generatorModule);
+ try {
+ genAppl.run(args, output);
}
-
- // default settings
- RoomExtensions.setDefaultGenDir();
- RoomExtensions.setDefaultGenInfoDir();
- RoomExtensions.setDefaultGenDocDir();
- IncrementalGenerationFileIo.setGenerateIncremental(false);
-
- List<String> argList = Arrays.asList(args);
- for (Iterator<String> it = argList.iterator(); it.hasNext();) {
- if (!parseOption(it.next(), it))
- return false;
- }
-
- return true;
- }
-
- /**
- * This method may be overridden by the concrete generator. After checking options super should be called
- * and its return value should be returned.
- *
- * <p>
- * The following options are recognized
- * <ul>
- * <li>{@value #OPTION_DEBUG}</li>
- * <li>{@value #OPTION_NOTRANSLATE}</li>
- * <li>{@value #OPTION_DOCUMENTATION}</li>
- * <li>{@value #OPTION_GEN_DIR}</li>
- * <li>{@value #OPTION_GEN_DOC_DIR}</li>
- * <li>{@value #OPTION_GEN_INCREMENTAL}</li>
- * <li>{@value #OPTION_GEN_INFO_DIR}</li>
- * <li>{@value #OPTION_LIB}</li>
- * <li>{@value #OPTION_MSC_INSTR}</li>
- * <li>{@value #OPTION_NOEXIT}</li>
- * <li>{@value #OPTION_SAVE_GEN_MODEL}</li>
- * <li>{@value #OPTION_MAIN_NAME}</li>
- * <li>{@value #OPTION_VERBOSE_RT}</li>
- * <li>{@value #OPTION_HELP}</li>
- * </ul>
- * </p>
- *
- * @param arg the current argument
- * @param it an iterator to retrieve subsequent arguments
- * @return {@code true} if the option was parsed successfully
- */
- protected boolean parseOption(String arg, Iterator<String> it) {
- if (arg.equals(OPTION_SAVE_GEN_MODEL)) {
- if (it.hasNext()) {
- generatorSettings.setGeneratorModelPath(it.next()+"/genmodel.egm");
- }
- else {
- return usageError(OPTION_SAVE_GEN_MODEL+" needs path");
- }
- }
- else if (arg.equals(OPTION_MAIN_NAME)) {
- if (it.hasNext()) {
- generatorSettings.setMainMethodName(it.next());
- }
- else {
- return usageError(OPTION_MAIN_NAME+" needs a name for the main method");
- }
- }
- else if (arg.equals(OPTION_GEN_DIR)) {
- if (it.hasNext()) {
- RoomExtensions.setGenDir(it.next());
- }
- else {
- return usageError(OPTION_GEN_DIR+" needs directory");
- }
- }
- else if (arg.equals(OPTION_GEN_INFO_DIR)) {
- if (it.hasNext()) {
- RoomExtensions.setGenInfoDir(it.next());
- }
- else {
- return usageError(OPTION_GEN_INFO_DIR+" needs directory");
- }
+ catch(GeneratorException e) {
+ ret = GENERATOR_ERROR;
}
- else if (arg.equals(OPTION_GEN_DOC_DIR)) {
- if (it.hasNext()) {
- RoomExtensions.setGenDocDir(it.next());
- }
- else {
- return usageError(OPTION_GEN_DOC_DIR+" needs directory");
- }
- }
- else if (arg.equals(OPTION_GEN_INCREMENTAL)) {
- IncrementalGenerationFileIo.setGenerateIncremental(true);
- }
- else if (arg.equals(OPTION_DOCUMENTATION)) {
- generatorSettings.setGenerateDocumentation(true);
- }
- else if (arg.equals(OPTION_LIB)) {
- generatorSettings.setGenerateAsLibrary(true);
- }
- else if (arg.equals(OPTION_NOEXIT)) {
- setTerminateOnError(false);
- }
- else if (arg.equals(OPTION_MSC_INSTR)) {
- generatorSettings.setGenerateMSCInstrumentation(true);
- }
- else if (arg.equals(OPTION_DATA_INSTR)) {
- generatorSettings.setGenerateDataInstrumentation(true);
- }
- else if (arg.equals(OPTION_NOTRANSLATE)) {
- generatorSettings.setNoTranslation(true);
- }
- else if (arg.equals(OPTION_VERBOSE_RT)) {
- generatorSettings.setGenerateWithVerboseOutput(true);
- }
- else if (arg.equals(OPTION_DEBUG)) {
- generatorSettings.setDebugMode(true);
- }
- else if (arg.equals(OPTION_HELP)) {
- printUsage();
- return false;
- }
- else if (arg.startsWith("-")) {
- return usageError("unrecognized option '"+arg+"'");
- }
- else if(!arg.isEmpty()){
- generatorSettings.getInputModelURIs().add(arg);
- }
-
- return true;
- }
-
- /**
- * This method logs an error followed by a call to {@link #printUsage()}.
- *
- * @param text the error text to be shown
- * @return {@code false}
- */
- protected boolean usageError(String text) {
- logger.logError(this.getClass().getName() + " - aborting: " + text, null);
- printUsage();
- return false;
- }
-
- /**
- * This method should show all possible command line options together with a
- * description. It is supposed to use {@link #getCommonOptions()} and
- * {@link #getCommonOptionDescriptions()}.
- */
- protected abstract void printUsage();
-
- protected String getCommonOptions() {
- return " ["+OPTION_SAVE_GEN_MODEL+" <genmodel path>]"
- +" ["+OPTION_DOCUMENTATION+"]"
- +" ["+OPTION_LIB+"]"
- +" ["+OPTION_NOEXIT+"]"
- +" ["+OPTION_SAVE_GEN_MODEL+" <genmodel path>]"
- +" ["+OPTION_GEN_INCREMENTAL
- +" ["+OPTION_GEN_DIR+" <generation directory>]"
- +" ["+OPTION_GEN_INFO_DIR+" <generation info directory>]"
- +" ["+OPTION_GEN_DOC_DIR+" <gen documentation directory>]"
- +" ["+OPTION_DEBUG+"]"
- +" ["+OPTION_MSC_INSTR+"]"
- +" ["+OPTION_VERBOSE_RT+"]"
- +" ["+OPTION_HELP+"]"
- ;
- }
-
- protected String getCommonOptionDescriptions() {
- return
- " <list of model file paths> # model file paths may be specified as\n"
- +" # e.g. C:\\path\\to\\model\\mymodel.room\n"
- +" -genDocu # if specified documentation is created\n"
- +" -lib # if specified all classes are generated and no instances\n"
- +" -noexit # if specified the JVM is not exited\n"
- +" -saveGenModel <genmodel path> # if specified the generator model will be saved to this location\n"
- +" -inc # if specified the generation is incremental\n"
- +" -genDir <generation directory> # the directory for generated files\n"
- +" -genInfoDir <generation info dir> # the directory for generated info files\n"
- +" -genDocDir <gen documentation dir> # the directory for generated documentation files\n"
- +" -debug # if specified create debug output\n"
- +" -msc_instr # generate instrumentation for MSC generation\n"
- +" -gen_as_verbose # generate instrumentation for verbose console output\n"
- +" -help # display this help text\n"
- ;
- }
-
- /**
- * Provides access to the Guice injector of the generator.
- * This is useful if classes with injected dependencies are instantiated manually.
- *
- * @return the Guice {@link com.google.inject.Injector Injector}
- */
- public static Injector getInjector() {
- return injector;
+ return ret;
}
/**
- * The injected resource set provider
- */
- @Inject
- protected Provider<ResourceSet> resourceSetProvider;
-
- /**
* The injected logger
*/
@Inject
- protected ILineOutputLogger logger;
+ protected ILogger logger;
/**
* The injected diagnostician
@@ -401,60 +144,89 @@ public abstract class AbstractGenerator implements IDetailCodeTranslator {
protected IDiagnostician diagnostician;
/**
- * The injected platform relative URI resolver
+ * The injected translation provider
*/
@Inject
- protected ModelLocatorUriResolver uriResolver;
+ protected ITranslationProvider translationProvider;
+
+ private HashMap<DetailCode, String> detailcode2string = new HashMap<DetailCode, String>();
+ private ResourceSet resourceSet = null;
/**
- * The injected translation provider
+ * The protected constructor is setting the {@link #instance} static member
*/
- @Inject
- protected ITranslationProvider translationProvider;
+ protected AbstractGenerator() {
+ instance = this;
+ }
- @Inject
- protected GlobalGeneratorSettings generatorSettings;
+ @Override
+ public void doEMFRegistration() {
+ RoomStandaloneSetup.doSetup();
+ SetupGenmodel.doSetup();
+ ConfigStandaloneSetup.doSetup();
+ ETMapStandaloneSetup.doSetup();
+ ETPhysStandaloneSetup.doSetup();
+ }
- @Inject
- protected ModelLoader modelLoader;
+ @Override
+ public void generate(List<Resource> resources, Arguments arguments, IGeneratorFileIO fileIO, ILogger logger) {
+ AbstractGenerator.settings = arguments;
+ RoomExtensions.setGenDir(arguments.get(AbstractGeneratorOptions.GEN_DIR));
+ RoomExtensions.setGenInfoDir(arguments.get(AbstractGeneratorOptions.GEN_INFO_DIR));
+ RoomExtensions.setGenDocDir(arguments.get(AbstractGeneratorOptions.GEN_DOC_DIR));
+
+ if(resources.isEmpty()) {
+ logger.logError("no input files");
+ logger.logInfo("-- terminating");
+ throw new GeneratorException("can't determine resource set without input files");
+ }
+ resourceSet = resources.get(0).getResourceSet();
+
+ int ret = runGenerator(resources, arguments);
+ if(ret == GENERATOR_OK) {
+ logger.logInfo("-- finished");
+ }
+ else {
+ logger.logInfo("-- terminating");
+ throw new GeneratorException("generator error");
+ }
+ }
- @Inject
- protected IResourceValidator validator;
+ /**
+ * abstract method which is finally called by {@link #createAndRunGenerator(Module, String[])}
+ * @param resources a list of the main models
+ * @param arguments the generator arguments
+ * @return GENERATOR_OK or GENERATOR_ERROR
+ */
+ protected abstract int runGenerator(List<Resource> resources, Arguments arguments);
/**
* This resource set combines all resources processed by the generator
* @return the resource set for the input models
*/
protected ResourceSet getResourceSet() {
- return modelLoader.getResourceSet();
- }
-
- /**
- * setup the ROOM core model plug-in and create a validator using injection
- */
- protected void setupRoomModel() {
- if (!EMFPlugin.IS_ECLIPSE_RUNNING)
- new org.eclipse.etrice.core.RoomStandaloneSetup().createInjectorAndDoEMFRegistration();
-
- org.eclipse.etrice.core.genmodel.SetupGenmodel.doSetup();
+ return resourceSet;
}
/**
- * @param genModelPath path to store the generator model (not stored if {@code null})
- *
+ * @param resources the list of models
+ * @param arguments the generator arguments
* @return the {@link Root} object of the generator model (is added to a new Resource also)
*/
- protected Root createGeneratorModel(boolean asLibrary, String genModelPath) {
+ protected Root createGeneratorModel(List<Resource> resources, Arguments arguments) {
+ boolean doTranslate = !arguments.get(AbstractGeneratorOptions.NOTRANSLATE);
+ boolean asLibrary = arguments.get(AbstractGeneratorOptions.LIB);
+ String genModelPath = arguments.get(AbstractGeneratorOptions.SAVE_GEN_MODEL);
+ Set<URI> mainModelURIs = resources.stream().map(m -> m.getURI()).collect(Collectors.toSet());
+
// create instance and mapping for test instances
- List<Resource> testInstanceResources = new TestInstanceCreator(logger).createInstancesAndMapping(
- modelLoader.getMainModelURIs(), getResourceSet());
+ List<Resource> testInstanceResources = new TestInstanceCreator(logger, diagnostician).createInstancesAndMapping(
+ mainModelURIs, getResourceSet());
if (testInstanceResources==null) {
- logger.logError("-- terminating", null);
return null;
}
// create a list of ROOM models
- HashSet<URI> mainModelURIs = modelLoader.getMainModelURIs();
List<RoomModel> mainModels = new ArrayList<RoomModel>();
List<RoomModel> importedModels = new ArrayList<RoomModel>();
for (Resource resource : getResourceSet().getResources()) {
@@ -480,8 +252,7 @@ public abstract class AbstractGenerator implements IDetailCodeTranslator {
}
}
if (importedModels.isEmpty() && mainModels.isEmpty()) {
- logger.logError("no ROOM models found", null);
- logger.logError("-- terminating", null);
+ logger.logError("no ROOM models found");
return null;
}
else {
@@ -489,24 +260,22 @@ public abstract class AbstractGenerator implements IDetailCodeTranslator {
GeneratorModelBuilder gmb = new GeneratorModelBuilder(logger, diagnostician);
Root gmRoot = gmb.createGeneratorModel(mainModels, importedModels, asLibrary);
if (diagnostician.isFailed()) {
- logger.logError("validation failed during build of generator model", null);
- logger.logError("-- terminating", null);
+ logger.logError("validation failed during build of generator model");
return null;
}
- translateDetailCodes(gmRoot);
+ translateDetailCodes(gmRoot, doTranslate);
- URI genModelURI = genModelPath!=null? URI.createFileURI(genModelPath) : URI.createFileURI("tmp.rim");
+ URI genModelURI = !genModelPath.isEmpty() ? URI.createFileURI(genModelPath) : URI.createFileURI("tmp.rim");
Resource genResource = getResourceSet().createResource(genModelURI);
genResource.getContents().add(gmRoot);
- if (genModelPath!=null) {
+ if (!genModelPath.isEmpty()) {
try {
logger.logInfo("saving genmodel to "+genModelPath);
genResource.save(Collections.EMPTY_MAP);
}
catch (IOException e) {
- logger.logError(e.getMessage(), null);
- logger.logError("-- terminating", null);
+ logger.logError(e.getMessage());
return null;
}
}
@@ -514,60 +283,6 @@ public abstract class AbstractGenerator implements IDetailCodeTranslator {
}
}
- protected void activateModelLocator() {
- }
-
- /**
- * validate the models
- *
- */
- protected boolean validateModels() {
- logger.logInfo("-- validating models");
-
- int errors = 0;
- int warnings = 0;
- ArrayList<Resource> resources = new ArrayList<Resource>(getResourceSet().getResources());
- for (Resource resource : resources) {
- List<Issue> list = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl);
- if (!list.isEmpty()) {
- for (Issue issue : list) {
- if (issue.getSeverity()==Severity.ERROR) {
- ++errors;
- logger.logError(issue.toString(), null);
- }
- else {
- ++warnings;
- logger.logInfo(issue.toString());
- }
- }
- }
- }
- logger.logInfo("validation finished with "+errors+" errors and "+warnings+" warnings");
- if (errors>0) {
- logger.logError("-- terminating", null);
- return false;
- }
-
- return true;
- }
-
-
- /**
- * load all models into a {@link ResourceSet} which is created by this method and
- * maintained in this object (cf. {@link #getResourceSet()})
- *
- * @param uriList a list of {@link URI}s as Strings
- *
- */
- protected boolean loadModels(List<String> uriList) {
- logger.logInfo("-- reading models");
-
- return modelLoader.loadModels(uriList, logger);
- }
-
- protected void deactivateModelLocator() {
- }
-
/**
* Create detail code translations once and for all.
* This method is called by {@link #createGeneratorModel(boolean, String)} after all models
@@ -580,8 +295,7 @@ public abstract class AbstractGenerator implements IDetailCodeTranslator {
*
* @param gmRoot
*/
- protected void translateDetailCodes(Root gmRoot) {
- boolean doTranslate = !generatorSettings.isNoTranslation();
+ protected void translateDetailCodes(Root gmRoot, boolean doTranslate) {
for (ExpandedActorClass xpac : gmRoot.getXpActorClasses()) {
DetailCodeTranslator dct = new DetailCodeTranslator(xpac.getActorClass(), translationProvider, doTranslate);
@@ -649,21 +363,5 @@ public abstract class AbstractGenerator implements IDetailCodeTranslator {
return "";
return code;
}
-
- /**
- * abstract method which is finally called by {@link #createAndRunGenerator(Module, String[])}
- * @return GENERATOR_OK or GENERATOR_ERROR
- */
- protected abstract int runGenerator();
-
- /**
- * The generator settings can also be statically accessed using {@link #getInstance()} followed
- * by a call to this method.
- *
- * @return the {@link #generatorSettings}
- */
- public GlobalGeneratorSettings getGeneratorSettings() {
- return generatorSettings;
- }
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorBaseModule.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorBaseModule.java
index ddd5703b0..3c80dce0f 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorBaseModule.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorBaseModule.java
@@ -15,10 +15,13 @@ package org.eclipse.etrice.generator.base;
import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician;
-import org.eclipse.etrice.core.genmodel.fsm.ILogger;
+import org.eclipse.etrice.generator.base.io.IGeneratorResourceLoader;
+import org.eclipse.etrice.generator.base.io.IncrementalGeneratorFileIO;
+import org.eclipse.etrice.generator.base.logging.Logger;
+import org.eclipse.etrice.generator.base.setup.GeneratorBaseModule;
+import org.eclipse.etrice.generator.base.setup.GeneratorBaseOptions;
+import org.eclipse.etrice.generator.base.validation.IGeneratorResourceValidator;
import org.eclipse.etrice.generator.fsm.base.Diagnostician;
-import org.eclipse.etrice.generator.fsm.base.ILineOutputLogger;
-import org.eclipse.etrice.generator.fsm.base.Logger;
import org.eclipse.etrice.generator.fsm.generic.IDetailCodeTranslator;
import org.eclipse.etrice.generator.fsm.generic.IIfItemIdGenerator;
import org.eclipse.etrice.generator.fsm.generic.ILanguageExtensionBase;
@@ -30,7 +33,6 @@ import org.eclipse.xtext.parser.IEncodingProvider;
import org.eclipse.xtext.resource.XtextResourceSet;
import com.google.inject.Binder;
-import com.google.inject.Module;
import com.google.inject.Singleton;
/**
@@ -39,7 +41,7 @@ import com.google.inject.Singleton;
*
* @author Henrik Rentz-Reichert
*/
-public abstract class AbstractGeneratorBaseModule implements Module {
+public abstract class AbstractGeneratorBaseModule extends GeneratorBaseModule {
/**
* Configuration of
@@ -56,11 +58,17 @@ public abstract class AbstractGeneratorBaseModule implements Module {
*/
@Override
public void configure(Binder binder) {
+ super.configure(binder);
+
binder.bind(ResourceSet.class).to(XtextResourceSet.class);
binder.bind(Logger.class).in(Singleton.class);
- binder.bind(ILineOutputLogger.class).to(Logger.class);
- binder.bind(ILogger.class).to(Logger.class);
+ binder.bind(IncrementalGeneratorFileIO.class).in(Singleton.class);
+
+ binder.bind(GeneratorBaseOptions.class).to(AbstractGeneratorOptions.class);
+
+ binder.bind(IGeneratorResourceLoader.class).to(ModelLoader.class);
+ binder.bind(IGeneratorResourceValidator.class).to(ModelValidator.class);
binder.bind(Diagnostician.class).in(Singleton.class);
binder.bind(IDiagnostician.class).to(Diagnostician.class);
@@ -70,10 +78,10 @@ public abstract class AbstractGeneratorBaseModule implements Module {
binder.bind(IMessageIdGenerator.class).to(GenericProtocolClassGenerator.class);
binder.bind(IIfItemIdGenerator.class).to(GenericActorClassGenerator.class);
- if(bindAbstractGenerator() != null)
- binder.bind(AbstractGenerator.class).to(bindAbstractGenerator());
binder.bind(IDetailCodeTranslator.class).to(AbstractGenerator.class);
+ if(bindAbstractGenerator() != null)
+ binder.bind(AbstractGenerator.class).to(bindAbstractGenerator());
binder.bind(ILanguageExtensionBase.class).to(ILanguageExtension.class);
if (bindILanguageExtension()!=null)
@@ -86,13 +94,19 @@ public abstract class AbstractGeneratorBaseModule implements Module {
binder.bind(EValidator.Registry.class).toInstance(EValidator.Registry.INSTANCE);
binder.bind(org.eclipse.emf.ecore.util.Diagnostician.class).to(GenerationEMFDiagnostician.class).asEagerSingleton();
}
+
+ @Override
+ public Class<? extends IGenerator> bindIGenerator() {
+ return AbstractGenerator.class;
+ }
/**
* Abstract method that retrieves a class to which {@link AbstractGenerator} is bound
* @return a Class extending {@link AbstractGenerator}
*/
public abstract Class<? extends AbstractGenerator> bindAbstractGenerator();
-
+
+
/**
* Abstract method that retrieves a class to which {@link ILanguageExtension} is bound
* @return a Class extending {@link ILanguageExtension}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptions.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptions.java
new file mode 100644
index 000000000..73fc6af5f
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptions.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.base;
+
+import java.util.List;
+
+import org.eclipse.etrice.generator.base.args.BooleanOption;
+import org.eclipse.etrice.generator.base.args.Option;
+import org.eclipse.etrice.generator.base.args.StringOption;
+import org.eclipse.etrice.generator.base.setup.GeneratorBaseOptions;
+
+public class AbstractGeneratorOptions extends GeneratorBaseOptions {
+
+ public static final BooleanOption LIB = new BooleanOption(
+ "lib",
+ "generateAsLibrary",
+ "if specified all classes are generated, not only instanciated ones",
+ false);
+
+ public static final BooleanOption DOCUMENTATION = new BooleanOption(
+ "genDocu",
+ "generateDocumentation",
+ "if specified documentation is created",
+ false);
+
+ public static final StringOption SAVE_GEN_MODEL = new StringOption(
+ "saveGenModel",
+ "genmodel path",
+ "if specified the generator model will be saved to this location",
+ "");
+
+ public static final StringOption MAIN_NAME = new StringOption(
+ "mainName",
+ "name",
+ "if specified the generated main method will be named as stated",
+ "main");
+
+ public static final StringOption GEN_DOC_DIR = new StringOption(
+ "genDocDir",
+ "directory",
+ "the directory for generated documentation files",
+ "doc-gen");
+
+ public static final BooleanOption MSC_INSTR = new BooleanOption(
+ "msc_instr",
+ "generateMSCInstrumentation",
+ "generate instrumentation for MSC generation",
+ false);
+
+ public static final BooleanOption DATA_INSTR = new BooleanOption(
+ "data_instr",
+ "generateDataInstrumentation",
+ "generate instrumentation for data logging",
+ false);
+
+ public static final BooleanOption VERBOSE_RT = new BooleanOption(
+ "gen_as_verbose",
+ "generateWithVerboseOutput",
+ "generate instrumentation for verbose console output",
+ false);
+
+ public static final BooleanOption NOTRANSLATE = new BooleanOption(
+ "notranslate",
+ "noTranslation",
+ "if specified the detail codes won't be translated",
+ false);
+
+ @Override
+ public void configure(List<Option<?>> options) {
+ super.configure(options);
+
+ options.add(LIB);
+ options.add(DOCUMENTATION);
+ options.add(SAVE_GEN_MODEL);
+ options.add(MAIN_NAME);
+ options.add(GEN_DOC_DIR);
+ options.add(MSC_INSTR);
+ options.add(DATA_INSTR);
+ options.add(VERBOSE_RT);
+ options.add(NOTRANSLATE);
+ }
+}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptionsHelper.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptionsHelper.java
new file mode 100644
index 000000000..7d0246481
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptionsHelper.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.base;
+
+import org.eclipse.etrice.generator.base.args.Arguments;
+import org.eclipse.etrice.generator.base.setup.GeneratorBaseOptionsHelper;
+
+public class AbstractGeneratorOptionsHelper extends GeneratorBaseOptionsHelper {
+
+ public boolean isGenerateAsLibrary(Arguments args) {
+ return args.get(AbstractGeneratorOptions.LIB);
+ }
+
+ public boolean isGenerateMSCInstrumentation(Arguments args) {
+ return args.get(AbstractGeneratorOptions.MSC_INSTR);
+ }
+
+ public boolean isGenerateDataInstrumentation(Arguments args) {
+ return args.get(AbstractGeneratorOptions.DATA_INSTR);
+ }
+
+ public boolean isNoTranslation(Arguments args) {
+ return args.get(AbstractGeneratorOptions.NOTRANSLATE);
+ }
+
+ public String getMainMethodName(Arguments args) {
+ return args.get(AbstractGeneratorOptions.MAIN_NAME);
+ }
+
+ public String getGeneratorModelPath(Arguments args) {
+ return args.get(AbstractGeneratorOptions.SAVE_GEN_MODEL);
+ }
+
+ public boolean isGenerateDocumentation(Arguments args) {
+ return args.get(AbstractGeneratorOptions.DOCUMENTATION);
+ }
+
+ public boolean isGenerateWithVerboseOutput(Arguments args) {
+ return args.get(AbstractGeneratorOptions.VERBOSE_RT);
+ }
+}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.xtend
deleted file mode 100644
index 5821bb7fd..000000000
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.xtend
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- * Juergen Haug
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.generator.base
-
-import java.util.List
-import org.eclipse.xtend.lib.annotations.Accessors
-
-@Accessors
-class GlobalGeneratorSettings {
-
- // all models from input
- val List<String> inputModelURIs = newArrayList
-
- // generation options
- boolean generateAsLibrary = false
- boolean generateMSCInstrumentation = false
- boolean generateDataInstrumentation = false
- boolean noTranslation = false
- String mainMethodName = "main"
-
- // extra generators
- String generatorModelPath = null
- boolean generateDocumentation = false
-
- // generator logging
- boolean generateWithVerboseOutput = false
- boolean debugMode = false
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/IDataConfiguration.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/IDataConfiguration.java
index c0de1ee43..c1cf3abfc 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/IDataConfiguration.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/IDataConfiguration.java
@@ -18,11 +18,11 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
import org.eclipse.etrice.core.genmodel.etricegen.InterfaceItemInstance;
import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
-import org.eclipse.etrice.core.genmodel.fsm.ILogger;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.PortClass;
import org.eclipse.etrice.core.room.ProtocolClass;
+import org.eclipse.etrice.generator.base.logging.ILogger;
/**
* A general interface used by the generator for data configuration.
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/ModelLoader.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/ModelLoader.java
index 841d6b17e..3b4e5e365 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/ModelLoader.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/ModelLoader.java
@@ -18,14 +18,17 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.stream.Collectors;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.etrice.core.common.scoping.ModelLocatorUriResolver;
-import org.eclipse.etrice.core.genmodel.fsm.ILogger;
-import org.eclipse.etrice.generator.fsm.base.NullLogger;
+import org.eclipse.etrice.generator.base.args.Arguments;
+import org.eclipse.etrice.generator.base.io.IGeneratorResourceLoader;
+import org.eclipse.etrice.generator.base.logging.ILogger;
+import org.eclipse.etrice.generator.base.logging.NullLogger;
import org.eclipse.xtext.EcoreUtil2;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.util.CancelIndicator;
@@ -38,7 +41,7 @@ import com.google.inject.Provider;
* @author Henrik Rentz-Reichert
*
*/
-public class ModelLoader {
+public class ModelLoader implements IGeneratorResourceLoader {
protected ILogger logger;
@@ -59,6 +62,20 @@ public class ModelLoader {
private HashSet<URI> mainModelURIs = new HashSet<URI>();
private HashSet<URI> loadedModelURIs = new HashSet<URI>();
+ @Override
+ public List<Resource> load(Arguments arguments, ILogger logger) {
+ logger.logInfo("-- reading models");
+
+ if(loadModels(arguments.getFiles(), logger)) {
+ List<Resource> resources = getResourceSet().getResources().stream()
+ .filter(r -> getMainModelURIs().contains(r.getURI())).collect(Collectors.toList());
+ return resources;
+ }
+ else {
+ throw new GeneratorException("reading models failed");
+ }
+ }
+
public boolean loadModels(List<String> uriList) {
return loadModels(uriList, null);
}
@@ -105,11 +122,11 @@ public class ModelLoader {
catch (Exception e) {
ok = false;
if (e instanceof FileNotFoundException)
- logger.logError("couldn't load '"+uri+"' (file not found)", null);
+ logger.logError("couldn't load '"+uri+"' (file not found)");
if(e instanceof SAXException)
- logger.logError("couldn't load '"+uri+"' (maybe unknown or wrong file extension, eTrice file extensions have to be lower case)", null);
+ logger.logError("couldn't load '"+uri+"' (maybe unknown or wrong file extension, eTrice file extensions have to be lower case)");
else
- logger.logError(e.getMessage(), null);
+ logger.logError(e.getMessage());
}
modelURIs.remove(uri);
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/ModelValidator.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/ModelValidator.java
new file mode 100644
index 000000000..ce905492f
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/ModelValidator.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.base;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.etrice.generator.base.args.Arguments;
+import org.eclipse.etrice.generator.base.logging.ILogger;
+import org.eclipse.etrice.generator.base.validation.GeneratorResourceValidator;
+import org.eclipse.xtext.validation.IResourceValidator;
+
+import com.google.inject.Inject;
+
+/**
+ * Tries to validate all contents of the underlying resource set of the resources.
+ */
+public class ModelValidator extends GeneratorResourceValidator {
+
+ @Inject
+ public ModelValidator(IResourceValidator validator) {
+ super(validator);
+ }
+
+ @Override
+ public void validate(List<Resource> resources, Arguments arguments, ILogger logger) {
+ logger.logInfo("-- validating models");
+
+ if(!resources.isEmpty()) {
+ ResourceSet rs = resources.get(0).getResourceSet();
+ if(rs != null) {
+ super.validate(rs.getResources(), arguments, logger);
+ return;
+ }
+ }
+
+ super.validate(resources, arguments, logger);
+ }
+
+}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/PrepareFileSystem.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/PrepareFileSystem.xtend
index 59c6ce46c..603943706 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/PrepareFileSystem.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/PrepareFileSystem.xtend
@@ -20,9 +20,10 @@ import java.util.HashSet
import java.util.Set
import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.etrice.core.genmodel.etricegen.Root
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
-import org.eclipse.etrice.generator.fsm.base.IncrementalGenerationFileIo
import org.eclipse.xtext.generator.JavaIoFileSystemAccess
+import org.eclipse.etrice.generator.base.logging.ILogger
+import org.eclipse.etrice.generator.base.AbstractGenerator
+import org.eclipse.etrice.generator.base.AbstractGeneratorOptions
/**
* A class that is used to recursively erase all folders receiving generated code
@@ -50,7 +51,7 @@ class PrepareFileSystem {
}
def void prepareInfoTargetPaths(Resource resource) {
- if(!IncrementalGenerationFileIo.generateIncremental)
+ if(!AbstractGenerator.settings.get(AbstractGeneratorOptions.GEN_INCREMENTAL))
return;
var Set<String> pathes = new HashSet<String>();
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
index c22b7784b..e7efdc83b 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
@@ -17,7 +17,6 @@ import com.google.inject.Inject
import com.google.inject.Singleton
import java.util.List
import org.eclipse.etrice.core.fsm.fSM.DetailCode
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
import org.eclipse.etrice.core.room.ActorClass
import org.eclipse.etrice.core.room.ActorContainerClass
import org.eclipse.etrice.core.room.Attribute
@@ -28,6 +27,7 @@ import org.eclipse.etrice.core.room.RefableType
import org.eclipse.etrice.core.room.RoomClass
import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.base.AbstractGenerator
+import org.eclipse.etrice.generator.base.logging.ILogger
/**
* A collection of methods for generation of user code, attributes with getters and setters
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TestInstanceCreator.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TestInstanceCreator.xtend
index 53a4977aa..13042d44e 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TestInstanceCreator.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/TestInstanceCreator.xtend
@@ -6,13 +6,14 @@ import org.eclipse.emf.ecore.resource.ResourceSet
import org.eclipse.etrice.core.etmap.eTMap.ETMapFactory
import org.eclipse.etrice.core.etphys.eTPhys.PhysicalModel
import org.eclipse.etrice.core.etphys.eTPhys.PhysicalSystem
-import org.eclipse.etrice.core.genmodel.fsm.ILogger
import org.eclipse.etrice.core.room.RoomFactory
import org.eclipse.etrice.core.room.RoomModel
import org.eclipse.etrice.core.room.StructureClass
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
import java.util.Collection
import org.eclipse.emf.common.util.URI
+import org.eclipse.etrice.generator.base.logging.ILogger
+import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician
@FinalFieldsConstructor
class TestInstanceCreator {
@@ -24,6 +25,7 @@ class TestInstanceCreator {
// ctor
val ILogger logger
+ val IDiagnostician diagnostician
/**
* Creates instance and mapping for classes having <code>@TestInstance</code> annotation:
@@ -82,14 +84,14 @@ class TestInstanceCreator {
// validation
if (allAnnotatedClasses.size > 1) {
allAnnotatedClasses.forEach[roomCls|
- logger.logError('''TestInstanceCreator: mapping failed, multiple test instances present''', roomCls)]
+ diagnostician.error('''TestInstanceCreator: mapping failed, multiple test instances present''', roomCls, null)]
return null
}
// get physical system
val List<PhysicalSystem> allPhysSystems = physModels.fold(newArrayList,[list, model|list += model.systems return list])
if (allPhysSystems.size != 1) {
- logger.logError('''TestInstanceCreator: mapping failed, found «allPhysSystems.size» physical systems''', null)
+ logger.logError('''TestInstanceCreator: mapping failed, found «allPhysSystems.size» physical systems''')
return null
}
diff --git a/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/refactoring/DiagramReferenceUpdater.xtend b/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/refactoring/DiagramReferenceUpdater.xtend
index d2502b191..d62b94b55 100644
--- a/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/refactoring/DiagramReferenceUpdater.xtend
+++ b/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/refactoring/DiagramReferenceUpdater.xtend
@@ -12,31 +12,23 @@
package org.eclipse.etrice.ui.common.base.refactoring
-import org.eclipse.core.runtime.IProgressMonitor
-import org.eclipse.xtext.resource.IReferenceDescription
-import org.eclipse.xtext.ui.refactoring.ElementRenameArguments
-import org.eclipse.xtext.ui.refactoring.IRefactoringUpdateAcceptor
-import org.eclipse.xtext.ui.refactoring.impl.EmfResourceReferenceUpdater
+import com.google.common.collect.ArrayListMultimap
import com.google.common.collect.Multimap
+import com.google.inject.Inject
+import org.eclipse.core.resources.ResourcesPlugin
+import org.eclipse.core.runtime.IProgressMonitor
+import org.eclipse.core.runtime.Path
import org.eclipse.emf.common.util.URI
import org.eclipse.emf.ecore.resource.ResourceSet
-import org.eclipse.graphiti.mm.pictograms.Diagram
-import org.eclipse.graphiti.services.Graphiti
-import org.eclipse.emf.ecore.util.EcoreUtil
import org.eclipse.etrice.core.fsm.fSM.ModelComponent
-import com.google.inject.Inject
import org.eclipse.etrice.ui.common.base.support.DiagramAccessBase
-import org.eclipse.graphiti.ui.internal.GraphitiUIPlugin
-import org.eclipse.graphiti.internal.GraphitiPlugin
-import org.eclipse.xtext.ui.refactoring.impl.EmfResourceChangeUtil
+import org.eclipse.graphiti.mm.pictograms.Diagram
import org.eclipse.ltk.core.refactoring.resource.RenameResourceChange
-import org.eclipse.etrice.core.common.scoping.StandardModelLocator
-import org.eclipse.core.runtime.Path
-import org.eclipse.core.runtime.Platform
-import org.eclipse.core.resources.ResourcesPlugin
-import com.google.common.collect.Multimaps
-import com.google.common.collect.MultimapBuilder
-import com.google.common.collect.ArrayListMultimap
+import org.eclipse.xtext.resource.IReferenceDescription
+import org.eclipse.xtext.ui.refactoring.ElementRenameArguments
+import org.eclipse.xtext.ui.refactoring.IRefactoringUpdateAcceptor
+import org.eclipse.xtext.ui.refactoring.impl.EmfResourceChangeUtil
+import org.eclipse.xtext.ui.refactoring.impl.EmfResourceReferenceUpdater
/**
* Update diagrams in case of xtext rename refactoring
diff --git a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/META-INF/MANIFEST.MF
index d17cf4a2f..1222539d9 100644
--- a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Require-Bundle: org.junit;bundle-version="4.12.0",
org.eclipse.core.runtime;bundle-version="3.12.0",
org.eclipse.etrice.core.room;bundle-version="2.0.0",
org.eclipse.etrice.core.room.tests;bundle-version="2.0.0",
- org.eclipse.etrice.core.genmodel.fsm;bundle-version="2.0.0"
+ org.eclipse.etrice.core.genmodel.fsm;bundle-version="2.0.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Bundle-Activator: org.eclipse.etrice.core.genmodel.fsm.tests.FSMGenModelTestsActivator
Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestCodeInheritance.xtend b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestCodeInheritance.xtend
index ace7fa309..5131fed79 100644
--- a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestCodeInheritance.xtend
+++ b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestCodeInheritance.xtend
@@ -15,7 +15,6 @@ package org.eclipse.etrice.core.genmodel.fsm.tests
import org.eclipse.etrice.core.fsm.fSM.RefinedState
import org.eclipse.etrice.core.fsm.util.FSMHelpers
import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer
import org.junit.Before
import org.junit.Test
@@ -27,6 +26,7 @@ import static org.junit.Assert.assertNull
import static org.junit.Assert.assertTrue
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
+import org.eclipse.etrice.generator.base.logging.NullLogger
class TestCodeInheritance extends FsmGenTestBase {
diff --git a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestFlatFSM.xtend b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestFlatFSM.xtend
index 977a8b0ea..5952a71d0 100644
--- a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestFlatFSM.xtend
+++ b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestFlatFSM.xtend
@@ -16,7 +16,6 @@ import org.eclipse.etrice.core.fsm.fSM.ChoicePoint
import org.eclipse.etrice.core.fsm.fSM.State
import org.eclipse.etrice.core.fsm.fSM.TrPoint
import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer
import org.junit.Before
import org.junit.Test
@@ -26,6 +25,7 @@ import static org.junit.Assert.assertFalse
import static org.junit.Assert.assertNotNull
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
+import org.eclipse.etrice.generator.base.logging.NullLogger
class TestFlatFSM extends FsmGenTestBase {
diff --git a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestFlatInheritedFSM.xtend b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestFlatInheritedFSM.xtend
index fadf00a4d..faa88e2b6 100644
--- a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestFlatInheritedFSM.xtend
+++ b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestFlatInheritedFSM.xtend
@@ -23,8 +23,8 @@ import static org.junit.Assert.assertTrue
import static org.junit.Assert.assertFalse
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger
import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker
+import org.eclipse.etrice.generator.base.logging.NullLogger
class TestFlatInheritedFSM extends FsmGenTestBase {
diff --git a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierFSM.xtend b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierFSM.xtend
index db3793243..944642f49 100644
--- a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierFSM.xtend
+++ b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierFSM.xtend
@@ -14,7 +14,6 @@ package org.eclipse.etrice.core.genmodel.fsm.tests
import org.eclipse.etrice.core.fsm.fSM.SimpleState
import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer
import org.junit.Before
import org.junit.Test
@@ -25,6 +24,7 @@ import static org.junit.Assert.assertNotNull
import static org.junit.Assert.assertTrue
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
+import org.eclipse.etrice.generator.base.logging.NullLogger
class TestHierFSM extends FsmGenTestBase {
diff --git a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierInheritedFSM.xtend b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierInheritedFSM.xtend
index bb12a3ab7..9e1073fe2 100644
--- a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierInheritedFSM.xtend
+++ b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestHierInheritedFSM.xtend
@@ -14,7 +14,6 @@ package org.eclipse.etrice.core.genmodel.fsm.tests
import org.eclipse.emf.ecore.util.EcoreUtil
import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer
import org.junit.Before
import org.junit.Test
@@ -24,6 +23,7 @@ import static org.junit.Assert.assertFalse
import static org.junit.Assert.assertNotNull
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
+import org.eclipse.etrice.generator.base.logging.NullLogger
class TestHierInheritedFSM extends FsmGenTestBase {
diff --git a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestMultipleConnectedChoicepoint.xtend b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestMultipleConnectedChoicepoint.xtend
index ed0bf18b5..6334b13ec 100644
--- a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestMultipleConnectedChoicepoint.xtend
+++ b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestMultipleConnectedChoicepoint.xtend
@@ -17,10 +17,10 @@ import org.eclipse.etrice.core.fsm.fSM.ContinuationTransition
import org.eclipse.etrice.core.fsm.fSM.Transition
import org.eclipse.etrice.core.fsm.fSM.TriggeredTransition
import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer
import org.eclipse.etrice.core.room.DataClass
-import org.eclipse.etrice.core.room.VarDecl
+import org.eclipse.etrice.core.room.MessageData
+import org.eclipse.etrice.generator.base.logging.NullLogger
import org.junit.Before
import org.junit.Test
@@ -30,7 +30,6 @@ import static org.junit.Assert.assertNotNull
import static org.junit.Assert.assertTrue
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
-import org.eclipse.etrice.core.room.MessageData
class TestMultipleConnectedChoicepoint extends FsmGenTestBase {
diff --git a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestStatesInheritance.xtend b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestStatesInheritance.xtend
index 08a01feb0..ba1b7d8b9 100644
--- a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestStatesInheritance.xtend
+++ b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestStatesInheritance.xtend
@@ -14,7 +14,6 @@ package org.eclipse.etrice.core.genmodel.fsm.tests
import org.eclipse.etrice.core.fsm.fSM.ContinuationTransition
import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer
import org.eclipse.etrice.core.naming.RoomNameProvider
import org.junit.Before
@@ -27,6 +26,7 @@ import static org.junit.Assert.assertNotNull
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
import org.eclipse.etrice.core.fsm.fSM.Transition
import org.eclipse.etrice.core.fsm.fSM.SimpleState
+import org.eclipse.etrice.generator.base.logging.NullLogger
class TestStatesInheritance extends FsmGenTestBase {
diff --git a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestStatesTriggers.xtend b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestStatesTriggers.xtend
index 7a1c204be..d2cfd8f04 100644
--- a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestStatesTriggers.xtend
+++ b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestStatesTriggers.xtend
@@ -14,7 +14,6 @@ package org.eclipse.etrice.core.genmodel.fsm.tests
import org.eclipse.etrice.core.fsm.fSM.ContinuationTransition
import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer
import org.eclipse.etrice.core.naming.RoomNameProvider
import org.junit.Before
@@ -26,6 +25,7 @@ import static org.junit.Assert.assertNotNull
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
import org.eclipse.etrice.core.fsm.fSM.Transition
+import org.eclipse.etrice.generator.base.logging.NullLogger
class TestStatesTriggers extends FsmGenTestBase {
diff --git a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestTrigger.xtend b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestTrigger.xtend
index 13831a137..2edb62c13 100644
--- a/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestTrigger.xtend
+++ b/tests/org.eclipse.etrice.core.genmodel.fsm.tests/src/org/eclipse/etrice/core/genmodel/fsm/tests/TestTrigger.xtend
@@ -13,7 +13,6 @@
package org.eclipse.etrice.core.genmodel.fsm.tests
import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger
import org.eclipse.etrice.core.genmodel.fsm.TriggerExtensions
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer
import org.junit.Before
@@ -24,6 +23,7 @@ import static org.junit.Assert.assertFalse
import static org.junit.Assert.assertNotNull
import static extension org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions.*
+import org.eclipse.etrice.generator.base.logging.NullLogger
class TestTrigger extends FsmGenTestBase {
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.core.genmodel.tests/META-INF/MANIFEST.MF
index 4f4c59f89..ddfe2f980 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/META-INF/MANIFEST.MF
@@ -9,6 +9,7 @@ Require-Bundle: org.eclipse.etrice.core.room;bundle-version="2.0.0",
org.eclipse.etrice.core.genmodel;bundle-version="2.0.0",
org.junit;bundle-version="4.8.1",
org.eclipse.xtext;bundle-version="2.6.0",
- org.eclipse.core.runtime;bundle-version="3.7.0"
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0"
Bundle-Activator: org.eclipse.etrice.core.genmodel.GenmodelTestsActivator
Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java
index dd88aaab5..17c9b0802 100644
--- a/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java
+++ b/tests/org.eclipse.etrice.core.genmodel.tests/src/org/eclipse/etrice/core/genmodel/TestInstanceModelBuilderBase.java
@@ -34,9 +34,9 @@ import org.eclipse.etrice.core.genmodel.builder.GeneratorModelBuilder;
import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician;
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger;
import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.RoomModel;
+import org.eclipse.etrice.generator.base.logging.NullLogger;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.XtextResourceSet;
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF
index 5fbd441ee..00cd13711 100644
--- a/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF
@@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.etrice.core.fsm;bundle-version="2.0.0",
org.eclipse.xtext;bundle-version="2.6.0",
org.eclipse.graphiti;bundle-version="0.8.0",
org.eclipse.etrice.core.room.tests;bundle-version="2.0.0",
- org.eclipse.etrice.core.genmodel.fsm;bundle-version="2.0.0"
+ org.eclipse.etrice.core.genmodel.fsm;bundle-version="2.0.0",
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0
Import-Package: org.eclipse.xtext.xbase.lib
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestFSMGenModel.xtend b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestFSMGenModel.xtend
index 455c952e4..1cddaed7f 100644
--- a/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestFSMGenModel.xtend
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/behavior/commands/TestFSMGenModel.xtend
@@ -24,7 +24,6 @@ import org.eclipse.etrice.core.genmodel.fsm.ExtendedFsmGenBuilder
import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker
import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician
import org.eclipse.etrice.core.genmodel.fsm.NullDiagnostician
-import org.eclipse.etrice.core.genmodel.fsm.NullLogger
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Link
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Node
@@ -37,6 +36,7 @@ import static org.junit.Assert.assertEquals
import static org.junit.Assert.assertFalse
import static org.junit.Assert.assertNotNull
import static org.junit.Assert.assertTrue
+import org.eclipse.etrice.generator.base.logging.NullLogger
class TestFSMGenModel extends TestBase {

Back to the top