MPS 2022.2 Help

Module Cloning

You may run into situations when you need to create a copy of a language or a solution. Module cloning gives you a quick way to create copies of modules.

If you want to clone a module, select it in the Project tool window. Right-click on the module and in the context menu choose the Clone Solution/Language action in the context menu.

Cm 1

In the dialog that pops up you then choose the name and the location for the new module.

Cm 2

After pressing OK, the module will be cloned and ready to use. The new module will contain all the code and properties from the old one. If you are cloning a language then its generator will be also cloned.

Cm 3

As you know every module contains lots of references to other instances (model/module dependencies, generator priority rules, node references in the code, etc). So if an instance and a reference to it are both cloned, it's preferred that the new reference refers to the new instance. The cloning engine takes care about such situations and so you do not have to do it manually.

There are some cases when you cannot clone a module. First of all, you can clone only solutions and languages. It also matters, how models are stored in a module. In short, if all model roots in the module support cloning then the module can be cloned. 

Currently, there are three model root types that are provided by MPS out of the box: default, javaclasses and javasource_stubs. All these model roots support cloning, except for one case - when the model files are stored outside of the module directory. By default, this is not the case, so you rarely encounter any obstacles in module cloning.

Last modified: 31 March 2022