Skip to content

Commit

Permalink
Improve commandline output
Browse files Browse the repository at this point in the history
  • Loading branch information
dziegel committed Aug 6, 2024
1 parent 215fb9d commit 3289ade
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ project(cpp_statemachine_generator)
include(ExternalProject)
include(GNUInstallDirs REQUIRED)

set(CMAKE_EXPORT_COMPILE_COMMANDS true)

add_executable(${CMAKE_PROJECT_NAME}
"test/XmiFsm.cxx"
"test/XmiFsmImpl.cxx"
Expand Down
2 changes: 0 additions & 2 deletions generator/.settings/org.eclipse.core.resources.prefs

This file was deleted.

26 changes: 15 additions & 11 deletions generator/src/generator/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ public static void main(String[] args) throws Exception {
factory.setDefaultFormatter(new JavaFormatter());

if (filename.endsWith(".uml") || filename.endsWith(".xmi")) {
System.out.println("Loading XMI/UML model " + filename);
var uml = new UmlModel();
uml.setModelFile(filename);
uml.setName("UML");
uml.load();

var uml_module = new EgxModule(factory);
uml_module.parse(loader.getResource("generator/XmiProgram.egx"));
if (!uml_module.getParseProblems().isEmpty()) {
Expand All @@ -36,20 +42,21 @@ public static void main(String[] args) throws Exception {
}
return;
}

var uml = new UmlModel();
uml.setModelFile(filename);
uml.setName("UML");
uml.load();
uml_module.getContext().getModelRepository().addModel(uml);
uml_module.getContext().setUserInput(new UserInput());

System.out.println("Generating XMI/UML model " + filename + " to " + out_path);
System.out.println("Generating to " + out_path);

uml_module.execute();
}

if (filename.endsWith(".scxml")) {
System.out.println("Generating SCXML model " + filename);
var scxml = new PlainXmlModel();
scxml.setFile(new File(filename));
scxml.setName("SCXML");
scxml.load();

var scxml_module = new EgxModule(factory);
scxml_module.parse(loader.getResource("generator/ScxmlProgram.egx"));
if (!scxml_module.getParseProblems().isEmpty()) {
Expand All @@ -60,17 +67,14 @@ public static void main(String[] args) throws Exception {
return;
}

var scxml = new PlainXmlModel();
scxml.setFile(new File(filename));
scxml.setName("SCXML");
scxml.load();
scxml_module.getContext().getModelRepository().addModel(scxml);
scxml_module.getContext().setUserInput(new UserInput());

System.out.println("Generating SCXML model " + filename + " to " + out_path);
System.out.println("Generating to " + out_path);

scxml_module.execute();
}
System.out.println("Successful");
} catch (Exception ex) {
ex.printStackTrace();
}
Expand Down

0 comments on commit 3289ade

Please sign in to comment.