-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_test_target.ant
57 lines (47 loc) · 2.56 KB
/
create_test_target.ant
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?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="(https://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>