Passing ant properties to Eugenia polishing transformation [message #1844185] |
Sun, 05 September 2021 23:04 |
|
I have a Eugenia workflow as shown below. The genmodels are being polished to use a separate target location (source code two). I would like to parameterize this target location, and I understand that the way to do that is to pass in a polishing model. My aim is to pass the parameter from the ant environment. How is this best accomplished? Ideally, I would like to construct the model on the fly.
Or should the polishing transform now be placed outside the eugenia call and open and store the generated genmodel before continuing?
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="default">
<!-- https://www.eclipse.org/epsilon/doc/articles/eugenia-ant/ -->
<!-- https://www.eclipse.org/forums/index.php/t/1108724/ -->
<!-- https://www.eclipse.org/forums/index.php/m/1844185/ -->
<macrodef name="emfatic2Plugins">
<attribute name="modelPath" />
<element name="settings" />
<sequential>
<epsilon.eugenia src="@{modelPath}.emf" firstStep="clean" lastStep="genmodel" />
<epsilon.eugenia src="@{modelPath}.emf" firstStep="emfcode" lastStep="emfcode" />
</sequential>
</macrodef>
<target name="default">
<emfatic2Plugins modelPath="common/entity" />
<emfatic2Plugins modelPath="common/security" />
<emfatic2Plugins modelPath="common/ui" />
</target>
</project>
var genModel = GenModel!GenModel.all().first();
genModel.modelDirectory = "/com.codebots.model.emf.commonEntity/src";
genModel.modelPluginID = "com.codebots.model.emf.commonEntity";
var genPackages = genModel.genPackages;
var genPackage = genPackages.first();
genPackage.basePackage = "com.codebots.model.emf";
[Updated on: Sun, 05 September 2021 23:07] Report message to a moderator
|
|
|
Re: Passing ant properties to Eugenia polishing transformation [message #1844186 is a reply to message #1844185] |
Sun, 05 September 2021 23:38 |
|
Update: For this specific use case the data can be derived, so the following can be done:
var genModel = GenModel!GenModel.all().first();
var ecorePackageName : String = genModel.genPackages.first().ecorePackage.name;
var prefix : String = "com.codebots.model.emf";
var pluginID : String = prefix + "." + ecorePackageName;
genModel.modelPluginID = pluginID;
genModel.modelDirectory = "/" + pluginID + "/src";
var genPackages = genModel.genPackages;
var genPackage = genPackages.first();
genPackage.basePackage="com.codebots.model.emf";
|
|
|
Re: Passing ant properties to Eugenia polishing transformation [message #1844190 is a reply to message #1844185] |
Mon, 06 September 2021 05:23 |
|
self-answer: Yes. Use the code below to load the genmodel into memory, then pass the values you need using the EOL pass mechanisms as shown below. Does not look as elegant as a model, but works just fine. Use an ant macro if you do this a lot.
<epsilon.emf.loadModel name="GenModel" modelFile="@{modelPath}.genmodel" metamodeluri="http://www.eclipse.org/emf/2002/GenModel" />
<epsilon.eol src="GetModelSourceCodeDirectory.eol">
<model ref="GenModel" />
<exports ref="modelSourceCodeDirectory" ant="true" />
</epsilon.eol>
[Updated on: Mon, 06 September 2021 05:59] by Moderator Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02736 seconds