Repository navigation
Expand file tree
/
Copy pathbuild.xml
More file actions
150 lines (126 loc) · 6.34 KB
/
Copy pathbuild.xml
File metadata and controls
150 lines (126 loc) · 6.34 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
cmakeant - copyright Iain Hull.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="cmakeant" basedir="." default="jar">
<property name="src.dir" value="src/main/java" />
<property name="build.src.dir" value="build/bin" />
<property name="test.dir" value="src/test/java" />
<property name="build.test.dir" value="build/bin.test" />
<property name="cmakeant.jar" value="build/${ant.project.name}.jar"/>
<property name="ant.test.lib" value="./lib/ant-testutil.jar"/>
<property name="junit.jar" value="./lib/junit.jar"/>
<property name="hamcrest.jar" value="./lib/hamcrest-all-1.3.jar"/>
<property name="build.cmake.dir" value="build/cmake" />
<property name="build.report.dir" value="build/report"/>
<property name="build.junit.out.dir.xml" value="${build.report.dir}/junit/xml"/>
<property name="build.junit.out.dir.html" value="${build.report.dir}/junit/html"/>
<target name="clean" description="Delete all generated files">
<delete failonerror="false" includeEmptyDirs="true">
<fileset dir="." includes="${ant.project.name}.jar" />
<fileset dir="${build.src.dir}/*" />
<fileset dir="${build.test.dir}/*" />
<fileset dir="${build.report.dir}" />
<fileset dir="${build.cmake.dir}" />
<fileset file="${ant.project.name}.jar" />
</delete>
</target>
<target name="compile" description="Compiles the Task">
<mkdir dir="${build.src.dir}" />
<javac srcdir="${src.dir}" destdir="${build.src.dir}" classpath="./lib/ant.jar" />
</target>
<target name="embedsource" description="Embed the source in the jar">
<mkdir dir="${build.src.dir}" />
<copy todir="${build.src.dir}">
<fileset dir="${src.dir}" />
</copy>
</target>
<target name="jar" description="JARs the Task" depends="compile,embedsource">
<jar destfile="${cmakeant.jar}" basedir="${build.src.dir}">
<manifest>
<section name="org.iainhull.ant">
<attribute name="Specification-Title" value="Cmake Ant" />
<attribute name="Specification-Version" value="${version}" />
<attribute name="Specification-Vendor" value="Iain Hull" />
<attribute name="Implementation-Title" value="Cmake Ant" />
<attribute name="Implementation-Version" value="${version} ${TODAY}" />
<attribute name="Implementation-Vendor" value="Iain Hull" />
</section>
</manifest>
</jar>
</target>
<path id="classpath.run">
<path path="${java.class.path}"/>
<path location="${cmakeant.jar}"/>
</path>
<path id="classpath.test">
<path refid="classpath.run"/>
<path location="${ant.test.lib}"/>
<path location="${junit.jar}"/>
<path location="${hamcrest.jar}"/>
<path location="${build.test.dir}" />
</path>
<target name="compileTest" description="Compiles the Task" depends="jar">
<mkdir dir="${build.test.dir}" />
<javac srcdir="${test.dir}" destdir="${build.test.dir}" classpathref="classpath.test"/>
</target>
<target name="junit" description="Runs the unit tests" depends="jar, compileTest">
<delete dir="${build.junit.out.dir.xml}"/>
<mkdir dir="${build.junit.out.dir.xml}"/>
<junit printsummary="yes" haltonfailure="no">
<classpath refid="classpath.test"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${build.junit.out.dir.xml}">
<fileset dir="${test.dir}" includes="**/*Test.java"/>
</batchtest>
</junit>
</target>
<target name="func-test" description="Runs basic functional test" depends="jar, compileTest">
<delete dir="${build.junit.out.dir.xml}"/>
<mkdir dir="${build.junit.out.dir.xml}"/>
<junit printsummary="yes" haltonfailure="no">
<classpath refid="classpath.test"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${build.junit.out.dir.xml}">
<fileset dir="${test.dir}" includes="**/FuncTestCmakeBuilder.java"/>
</batchtest>
</junit>
</target>
<target name="junitreport" description="Create a report for the rest result">
<mkdir dir="${build.junit.out.dir.html}"/>
<junitreport todir="${build.junit.out.dir.html}">
<fileset dir="${build.junit.out.dir.xml}">
<include name="*.xml"/>
</fileset>
<report format="frames" todir="${build.junit.out.dir.html}"/>
</junitreport>
</target>
<target name="test"
depends="junit,junitreport"
description="Runs unit tests and creates a report"
/>
<!-- used by FuncTestCmakeBuilder -->
<target name="test.basic">
<delete dir="${build.cmake.dir}" />
<taskdef name="cmake" classname="org.iainhull.ant.CmakeBuilder" classpath="${cmakeant.jar}"/>
<cmake srcdir="src/test/cmake/src" bindir="${build.cmake.dir}">
<!--generator name="Visual Studio 6" platform="win" /-->
<generator name="Visual Studio 8 2005" platform="win" />
<generator name="Unix Makefiles" platform="linux" />
<readvar name="CMAKE_RC_COMPILER" property="cmake.rc.compiler" />
</cmake>
<echo>${cmake.rc.compiler}</echo>
</target>
</project>