-- @atlcompiler emftvm -- Generates a build.xml file from a Transformations.ecore config file -- $Id: ConfigToBuildFile.atl 7431 2008-04-16 14:36:06Z dwagelaa $ module "PKDA::ConfigToBuildFile"; create OUT : XML from IN : CFG; uses "Transformations::ConfigToBuildFile"; -- ====================================================================== -- helper attributes begin -- ====================================================================== helper def : ModelPath : String = 'platform:/resource/platformkit-discovery-applet/models'; helper def : ModelName : String = 'PlatformkitDiscoveryApplet'; helper def : ModelPrefix : String = 'pkda'; -- ====================================================================== -- helper attributes end -- ====================================================================== -- ====================================================================== -- transformation rules begin -- ====================================================================== rule ConfigRoot { from s : CFG!"transformations::TransformationConfig" -- to root : XML!"XML::Root" ( name <- thisModule.ConfigHeader(s)), default : XML!"XML::Attribute" ( parent <- root, name <- 'default', value <- 'all'), -- allTarget : XML!"XML::Element" ( name <- 'target', children <- thisModule.AllTarget(s), parent <- root), -- allFeedbackTarget : XML!"XML::Element" ( name <- 'target', children <- thisModule.AllFeedbackTarget(s), parent <- root), -- imTarget : XML!"XML::Element" ( name <- 'target', children <- thisModule.ModelTarget( thisModule.ModelName, 'inModel', thisModule.ModelPrefix, thisModule.ModelPath + '/' + thisModule.ModelName + '.uml'), parent <- root), -- imTargetFeedback : XML!"XML::Element" ( name <- 'target', children <- thisModule.ModelFeedbackTarget( thisModule.ModelName + '-feedback', 'inModel', s.targetProject, thisModule.ModelPath + '/' + thisModule.ModelName + '.uml'), parent <- root) } lazy rule AllTarget { from c : CFG!"transformations::TransformationConfig" -- Sequence{name="all" depends="..."} to targetName : XML!"XML::Attribute"( name <- 'name', value <- 'all'), targetDepends : XML!"XML::Attribute"( name <- 'depends', value <- Sequence{thisModule.ModelName} ->append('prettyPrint') ->iterate(e; acc : String = '' | acc + if acc = '' then e else ', ' + e endif)->debug('All')) do { Sequence{targetName, targetDepends}; } } lazy rule AllFeedbackTarget { from c : CFG!"transformations::TransformationConfig" -- Sequence{name="all-feedback" depends="..."} to targetName : XML!"XML::Attribute"( name <- 'name', value <- 'all-feedback'), targetDepends : XML!"XML::Attribute"( name <- 'depends', value <- Sequence{thisModule.ModelName + '-feedback'} ->iterate(e; acc : String = '' | acc + if acc = '' then e else ', ' + e endif).debug('AllFeedback')), -- refresh : XML!"XML::Element" ( name <- 'eclipse.refreshLocal'), refreshResource : XML!"XML::Attribute" ( name <- 'resource', value <- thisModule.ModelPath, parent <- refresh) do { Sequence{targetName, targetDepends, refresh}; } } rule ModelTarget(name : String, inModel : String, prefix : String, uri : String) { -- Sequence{name = 'name' depends = 'allBase'} to targetName : XML!"XML::Attribute"( name <- 'name', value <- name), targetDepends : XML!"XML::Attribute"( name <- 'depends', value <- 'allBase'), -- loadModel : XML!"XML::Element" ( name <- 'emftvm.loadModel'), modelName : XML!"XML::Attribute" ( name <- 'name', value <- inModel, parent <- loadModel), modelPath : XML!"XML::Attribute" ( name <- 'uri', value <- uri, parent <- loadModel), -- antcall : XML!"XML::Element" ( name <- 'antcall'), antcalltarget : XML!"XML::Attribute" ( name <- 'target', value <- 'generateWithHBM', parent <- antcall), inheritRefs : XML!"XML::Attribute" ( name <- 'inheritRefs', value <- 'true', parent <- antcall), -- paramin : XML!"XML::Element" ( name <- 'param', children <- thisModule.Property('in', inModel), parent <- antcall), -- paramprefix : XML!"XML::Element" ( name <- 'param', children <- thisModule.Property('prefix', prefix), parent <- antcall) do { Sequence{targetName, targetDepends, loadModel, antcall}; } } rule ModelFeedbackTarget(name : String, inModel : String, targetProject : String, uri : String) { -- Sequence{name = 'name' depends = 'defineProperties, loadBaseModels, loadJAVA'} to targetName : XML!"XML::Attribute"( name <- 'name', value <- name), targetDepends : XML!"XML::Attribute"( name <- 'depends', value <- 'defineProperties, loadBaseModels, loadJAVA'), -- loadModel : XML!"XML::Element" ( name <- 'emftvm.loadModel'), modelName : XML!"XML::Attribute" ( name <- 'name', value <- inModel, parent <- loadModel), modelPath : XML!"XML::Attribute" ( name <- 'uri', value <- uri, parent <- loadModel), -- loadCode : XML!"XML::Element" ( name <- 'emftvm.loadModel'), cmodelName : XML!"XML::Attribute" ( name <- 'name', value <- inModel + 'Code', parent <- loadCode), cmodelPath : XML!"XML::Attribute" ( name <- 'path', value <- '../' + targetProject + '.javaxmi', parent <- loadCode), -- antcall : XML!"XML::Element" ( name <- 'antcall'), antcalltarget : XML!"XML::Attribute" ( name <- 'target', value <- 'java2uml', parent <- antcall), inheritRefs : XML!"XML::Attribute" ( name <- 'inheritRefs', value <- 'true', parent <- antcall), -- paramin : XML!"XML::Element" ( name <- 'param', children <- thisModule.Property('in', inModel), parent <- antcall), -- paramcode : XML!"XML::Element" ( name <- 'param', children <- thisModule.Property('code', inModel + 'Code'), parent <- antcall), -- parampath : XML!"XML::Element" ( name <- 'param', children <- thisModule.Property('uri', uri), parent <- antcall) do { Sequence{targetName, targetDepends, loadModel, loadCode, antcall}; } } -- ====================================================================== -- transformation rules end -- ======================================================================