Xtext has the possibility to generate xtext languages using gradle. part of this option is to run mwe2 workflows.
there is a mwe workflow component to run the ecore 2 java generator (EcoreGenerator)
thus you should be able to write a workflow that uses this component and do the generation via gradle.
unfortunately if will be manual work to stick all together
Workflow {
bean = org.eclipse.emf.mwe.utils.StandaloneSetup {
platformUri=".."
}
component = org.eclipse.emf.mwe.utils.DirectoryCleaner {
directory ="src/main/java/sample"
}
component = org.eclipse.emf.mwe2.ecore.EcoreGenerator {
generateCustomClasses = false
genModel = "platform:/resource/org.xtext.example.mydsl3/model/sample.genmodel"
srcPath = "platform:/resource/org.xtext.example.mydsl3/src/main/java"
}
}
e.g. you may have to adapt the genmodel regarding the places where the generated sources should go to etc.