blob: 2b7b02fd3e5bd43cbf980d8ec339a7077890b1c5 [file] [log] [blame]
<project default="main">
<!-- ANT Taskdefs for ant-contrib -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<target name="loadModels">
<epsilon.emf.register file="tree.ecore"/>
<epsilon.emf.loadModel name="M" modelfile="tree.model"
metamodeluri="Tree" read="false" store="true"/>
</target>
<target name="Transformation1">
<epsilon.eol>
<model ref="M"/>
var t : new Tree;
t.label = 't1';
</epsilon.eol>
</target>
<target name="Transformation2">
<epsilon.eol>
<model ref="M"/>
var t : new Tree;
t.label = 't2';
</epsilon.eol>
</target>
<target name="Validation1">
<epsilon.evl>
<model ref="M"/>
context Tree {
constraint C1 {
check : true
}
}
</epsilon.evl>
</target>
<target name="Validation2">
<epsilon.evl>
<model ref="M"/>
context Tree {
constraint C2 {
check : true -- Switch to false to make validation fail
}
}
</epsilon.evl>
</target>
<target name="Evaluation">
<epsilon.eol>
<model ref="M"/>
Tree.all.size().println();
</epsilon.eol>
</target>
<target name="main" depends="loadModels">
<runtarget target="Transformation1"/>
<runtarget target="Validation1"/>
<trycatch>
<try>
<!--Start a transaction on M so that we can roll it back later on.-->
<epsilon.startTransaction name="Transaction1" models="M"/>
<runtarget target="Transformation2"/>
<runtarget target="Validation2"/>
<!-- No errors in the validation. Commit the transaction.-->
<epsilon.commitTransaction name="Transaction1"/>
</try>
<catch>
<!--If validation fails, roll back the transaction.-->
<epsilon.rollbackTransaction name="Transaction1"/>
</catch>
</trycatch>
<runtarget target="Evaluation"/>
</target>
</project>