| <?xml version="1.0" encoding="ISO-8859-1"?> |
| <project name="CreateTestTargetDefinitionFile" basedir="." default="create-target-file" > |
| |
| <property name="local.target.name" value="rap-examples-test.target"/> |
| <property name="local.target" location="${ant.file}/../${local.target.name}"/> |
| <property name="orig.target" location="../../examples/org.eclipse.emf.parsley.examples.rap.targetplatform/emf-parsely-rap.target"/> |
| <property name="local.mirror.path.input" location="../../target/repository/"/> |
| <property name="local.mirror.url.input" value="file:${local.mirror.path}"/> |
| |
| <macrodef name="replace_win_slashes"> |
| <attribute name="property.to.process" /> |
| <attribute name="output.property" /> |
| <sequential> |
| <loadresource property="@{output.property}"> |
| <string value="@{property.to.process}"/> |
| <filterchain> |
| <replaceregex pattern="\\" replace="/" flags="gi"/> |
| </filterchain> |
| </loadresource> |
| <echo message="property.to.process: @{property.to.process}" /> |
| <echo message="output.property : ${@{output.property}}" /> |
| </sequential> |
| </macrodef> |
| |
| <replace_win_slashes property.to.process="${local.mirror.path.input}" output.property="local.mirror.path" /> |
| <replace_win_slashes property.to.process="${local.mirror.url.input}" output.property="local.mirror.url" /> |
| |
| <target name="copy-target-file" description="Copy the .target definition file into the local.target"> |
| <echo message="local.target: ${local.target}" /> |
| <echo message="orig.target : ${orig.target}" /> |
| |
| <copy file="${orig.target}" tofile="${local.target}" overwrite="true" verbose="true"/> |
| </target> |
| |
| |
| <target name="create-target-file" depends="copy-target-file" description="Creates a .target file from the original one, pointing to a local mirror"> |
| <echo message="local.mirror.path: ${local.mirror.path}" /> |
| <echo message="local.mirror.url : ${local.mirror.url}" /> |
| |
| <replaceregexp> |
| <regexp pattern="target name="(\S+)"(\.*)" /> |
| <substitution expression="target name="local"\2" /> |
| <fileset id="path.target" dir="${ant.file}/../"> |
| <include name="${local.target.name}" /> |
| </fileset> |
| </replaceregexp> |
| |
| <replaceregexp byline="true"> |
| <regexp pattern="<repository location="(http://download.eclipse.org/emf-parsley/rt)"(\.*)/>" /> |
| <substitution expression="<repository location="${local.mirror.url}"\2/>" /> |
| <fileset id="path.target" dir="${ant.file}/../"> |
| <include name="${local.target.name}" /> |
| </fileset> |
| </replaceregexp> |
| </target> |
| |
| </project> |