1 | <?xml version="1.0"?>
|
---|
2 |
|
---|
3 | <project name="xxx-test" basedir="." default="test1">
|
---|
4 |
|
---|
5 | <property name="tmp.dir" location="replace/tmp"/>
|
---|
6 |
|
---|
7 | <target name="test1">
|
---|
8 | <replace/>
|
---|
9 | </target>
|
---|
10 |
|
---|
11 | <target name="test2">
|
---|
12 | <replace file=""/>
|
---|
13 | </target>
|
---|
14 |
|
---|
15 | <target name="test3">
|
---|
16 | <replace file="template.xml"/>
|
---|
17 | </target>
|
---|
18 |
|
---|
19 | <target name="test4">
|
---|
20 | <replace file="template.xml" token=""/>
|
---|
21 | </target>
|
---|
22 |
|
---|
23 | <target name="test5">
|
---|
24 | <replace file="template.xml"
|
---|
25 | token="dont_want_to_really_replace_something"/>
|
---|
26 | </target>
|
---|
27 |
|
---|
28 | <target name="test6">
|
---|
29 | <replace file="template.xml">
|
---|
30 | <replacefilter />
|
---|
31 | </replace>
|
---|
32 | </target>
|
---|
33 |
|
---|
34 | <target name="test7">
|
---|
35 | <replace file="template.xml">
|
---|
36 | <replacefilter token="" />
|
---|
37 | </replace>
|
---|
38 | </target>
|
---|
39 |
|
---|
40 | <target name="test8">
|
---|
41 | <replace file="template.xml">
|
---|
42 | <replacefilter token="dont_want_to_really_replace_something" />
|
---|
43 | </replace>
|
---|
44 | </target>
|
---|
45 |
|
---|
46 | <target name="test9-setup">
|
---|
47 | <!-- this fixing of line endings is necessary because the replace task is transforming the line endings -->
|
---|
48 | <!-- of the replacement tokens and values to the platform default -->
|
---|
49 | <!-- in certain cases (checkout done with cvs of cygwin, the line endings of the various files do not match-->
|
---|
50 | <!-- the system property line.separator -->
|
---|
51 | <copy file="replace/source.txt" tofile="${tmp.dir}/output.txt"/>
|
---|
52 | <copy file="replace/value.txt" tofile="${tmp.dir}/value.txt" />
|
---|
53 | <copy file="replace/result.txt" tofile="${tmp.dir}/result.txt" />
|
---|
54 | <fixcrlf srcdir="${tmp.dir}" includes="*.txt"/>
|
---|
55 | </target>
|
---|
56 | <target name="test9" depends="test9-setup">
|
---|
57 | <loadfile srcFile="${tmp.dir}/value.txt" property="content"/>
|
---|
58 | <replace file="${tmp.dir}/output.txt" token="@@@Replace this@@@" value="${content}"/>
|
---|
59 | </target>
|
---|
60 |
|
---|
61 | <target name="cleanup">
|
---|
62 | <delete dir="${tmp.dir}" quiet="true"/>
|
---|
63 | </target>
|
---|
64 | </project>
|
---|