MPS 2020.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, you select it in the project menu and click on the Clone Solution/Language action in the context menu. 

CM 1 png

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

CM 2 png

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 png

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: 08 May 2020