Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Passing ant properties to Eugenia polishing transformation (Creating model instance programmatically)
Passing ant properties to Eugenia polishing transformation [message #1844185] Sun, 05 September 2021 23:04 Go to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

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 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

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 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

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

Re: Passing ant properties to Eugenia polishing transformation [message #1844192 is a reply to message #1844190] Mon, 06 September 2021 06:04 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Many thanks for sharing your solution!

Best,
Dimitris

Previous Topic:Generating Hostable Picto Views/Server Use
Next Topic:Generating plugins with dependent models using Eugenia
Goto Forum:
  


Current Time: Sat Apr 27 12:52:20 GMT 2024

Powered by FUDForum. Page generated in 0.02736 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top