Migrate MPS project (run Language migration) programmatically

Hello.

I would like to ask for some help for project migration from the code.

My aim is to check from the code that passed MPS project should be migrated and run the migration. At the best case it will be nice to have a list of required migration scripts and have some kind of result at the end. Unfortunately, I can't find any API to do so. 

I've found some API via chatgpt, but it's not enough. I've found ProjectMigrationsRegistry, but I can't find API to work with Language migration. Also, I've found AbstractMigrationScriptHelper, but it was marked as deprecated and it will be removed. I expect that there can be a specific API that allows us to do it by the code. Also, I've found ä MigrationManager , but I don't see any way to use it for my purpose. And also I have an issue when I try to invoke “new  MigrationManager(ProjectHelper.toIdeaProject(#project)).getMigrationsMap().getMaps()" > “Missing extension point: com.intellij.predefinedMigrationMapProvider in container Application  (containerState PRE_INIT)  (WA inProgress allowed) (RA allowed)”. Anyway, I don't see any methods to apply scripts.

I will appreciate any hints and any additional information how can I do it.

Thank you.

0
1 comment

Hello,

there is an Ant task to execute migrations. After collecting the necessary parameters and opening the project, it calls the method AntTaskExecutionUtil.migrate. You could look at the sources of this method to see how it works.

Another class to look at would be MigrationTask.

0

Please sign in to leave a comment.