Skip to content

Command Line Actions

Bence Beothy edited this page Jul 23, 2019 · 4 revisions

MD Command Line Actions

MagicDraw API gives an opportunity to define MagicDraw Command Line Actions.

Create a Command Line Action

To define a Command Line Action the class needs to implement CommandLineAction interface and it should be registered in the CommandLineActionManager.

The registered Command Line Action is executable from the command line in headless mode and it can handle command line arguments as well.

Python Code Generation Example

There is a Command Line Action example in the repository called CodeGenRunner. It runs the Plugin's code generation Action.

It is runnable from a Gradle task. The Gradle task is called runCodeGen. It is executable on Jenkins as well with a parametrized build. Check the related wiki page for more detail.

The task has a parameter called codeGenInput. The default value of it is the file path of an example MD Project from the repository. This project is the Python_Codegen_Example project from the resources folder. To add another path from the workspace run the task the following way.

./gradlew -PcodeGenInput='<path>/<something>.mdzip' runCodeGen