-- @atlcompiler emftvm -- @path CFG=/uml2cs-transformations-config/model/Transformations.ecore -- @path XML=/uml2cs-instantmessenger-config-editor/metamodels/XML.ecore -- $Id: ConfigToBuildFile.atl 7429 2008-04-16 13:31:17Z dwagelaa $ -- Generates a build.xml file from a Transformations.ecore config file module "Transformations::ConfigToBuildFile"; create OUT : XML from IN : CFG; -- ====================================================================== -- transformation rules begin -- ====================================================================== rule ConfigRoot { from s : CFG!"transformations::TransformationConfig" to root : XML!"XML::Root" ( name <- thisModule.ConfigHeader(s)) } lazy rule ConfigHeader { from s : CFG!"transformations::TransformationConfig" -- to name : XML!"XML::Attribute" ( parent <- s, name <- 'name', value <- s.targetProject + '/build'), -- import : XML!"XML::Element" ( parent <- s, name <- 'import'), importfile : XML!"XML::Attribute" ( parent <- import, name <- 'file', value <- 'common.xml'), -- currentpath : XML!"XML::Element" ( parent <- s, name <- 'property', children <- thisModule.Property('current.uri', 'platform:/resource/${ant.project.name}')), -- save : XML!"XML::Element" ( parent <- s, name <- 'property', children <- thisModule.Property( if s.saveModels = #none then 'saveNoModels' else if s.saveModels = #all then 'saveModels' else 'saveLastModel' endif endif, 'true')) do { 'project'; } } rule Java1DataTypes { from s : CFG!"transformations::Java1DataTypes" -- to java1 : XML!"XML::Element" ( parent <- s.mapping.config, name <- 'property', children <- thisModule.Property('java1', 'true')) } rule Java2DataTypes { from s : CFG!"transformations::Java2DataTypes" -- to java2 : XML!"XML::Element" ( parent <- s.mapping.config, name <- 'property', children <- thisModule.Property('java2', 'true')) } rule UML2Observer { from s : CFG!"transformations::UML2Observer" ( s.oclIsTypeOf(CFG!"transformations::UML2Observer")) -- to observer : XML!"XML::Element" ( parent <- s.config, name <- 'property', children <- thisModule.Property('observer', 'true')) } rule UML2JavaObserver { from s : CFG!"transformations::UML2JavaObserver" -- to javaobserver : XML!"XML::Element" ( parent <- s.config, name <- 'property', children <- thisModule.Property('javaobserver', 'true')) } rule UML2Applet { from s : CFG!"transformations::UML2Applet" ( s.oclIsTypeOf(CFG!"transformations::UML2Applet")) -- to applet : XML!"XML::Element" ( parent <- s.config, name <- 'property', children <- thisModule.Property('applet', 'true')) } rule UML2MIDlet { from s : CFG!"transformations::UML2MIDlet" -- to midlet : XML!"XML::Element" ( parent <- s.config, name <- 'property', children <- thisModule.Property('midlet', 'true')) } rule UML2SWTApplication { from s : CFG!"transformations::UML2SWTApplication" -- to midlet : XML!"XML::Element" ( parent <- s.config, name <- 'property', children <- thisModule.Property('swt-application', 'true')) } rule Property(name : String, value : String) { -- Sequence{name="name", value="value"} to propertyname : XML!"XML::Attribute" ( name <- 'name', value <- name), propertyvalue : XML!"XML::Attribute" ( name <- 'value', value <- value) do { Sequence{propertyname, propertyvalue}; } } -- ====================================================================== -- transformation rules end -- ======================================================================