Commit | Line | Data |
---|---|---|
ca135637 JRT |
1 | <?xml version="1.0" encoding="ASCII"?> |
2 | ||
3 | <!-- | |
4 | ||
5 | ############################################################################## | |
6 | # $URL$ | |
7 | # $Date$ | |
8 | # $Author$ | |
9 | # $Revision$ | |
10 | ############################################################################## | |
11 | ||
12 | The following is an Ant build script for building Perl distributions | |
13 | based on Module::Build. It has been written so that tools like | |
14 | Eclipse that are well-suited for running Ant scripts (for Java | |
15 | projects) can be easily configured to build Perl projects. Most of | |
16 | the standard Module::Build actions are availalbe as Ant targets here. | |
17 | But if you want to run a non-standard Module::Build action, use the | |
18 | "user.defined" Ant target and you will be prompted to enter the name | |
19 | of the Module::Build action that you want to run. | |
20 | ||
21 | Enjoy!! | |
22 | ||
23 | --> | |
24 | ||
25 | <project name="Perl-Critic" default="build" basedir="."> | |
26 | ||
27 | <description> | |
28 | Build the Perl-Critic distribution. | |
29 | </description> | |
30 | ||
31 | <property environment="env" /> | |
32 | <property name="perl.exe" value="perl" /> | |
33 | <property name="sudo.exe" value="sudo" /> | |
34 | <property name="bash.exe" value="bash" /> | |
35 | <property name="builder" value="Build" /> | |
36 | ||
37 | ||
38 | <macrodef name="module.build"> | |
39 | <attribute name="action" default="build" /> | |
ca135637 JRT |
40 | <sequential> |
41 | <exec executable="${perl.exe}" failonerror="true"> | |
42 | <arg value="${builder}" /> | |
43 | <arg value="@{action}" /> | |
60fcacd6 | 44 | <env key='PATH' path="${path.prepend}:${env.PATH}" /> |
ca135637 JRT |
45 | </exec> |
46 | </sequential> | |
47 | </macrodef> | |
48 | ||
49 | ||
50 | <available file="${builder}" property="Build.initialized" /> | |
51 | <target name="init" unless="Build.initialized" description="perl Build.PL"> | |
52 | <exec executable="${perl.exe}" failonerror="true"> | |
53 | <arg value="Build.PL" /> | |
54 | </exec> | |
55 | </target> | |
56 | ||
57 | ||
58 | <target name="user.defined" depends="init" description="Build (whatever)"> | |
59 | <input message="Enter build action:" addproperty="build.action" defaultvalue="build" /> | |
60 | <module.build action="${build.action}" /> | |
61 | </target> | |
62 | ||
63 | ||
64 | <target name="help" depends="init" description="Build help"> | |
65 | <module.build action="help" /> | |
66 | </target> | |
67 | ||
68 | ||
69 | <target name="build" depends="init" description="Build build"> | |
70 | <module.build action="build" /> | |
71 | </target> | |
72 | ||
73 | ||
74 | <target name="test" depends="init" description="Build test"> | |
75 | <module.build action="test" /> | |
76 | </target> | |
77 | ||
78 | ||
79 | <target name="testunit" depends="init" description="Build testunit"> | |
80 | <module.build action="testunit" /> | |
81 | </target> | |
82 | ||
83 | ||
84 | <target name="testfunctional" depends="init" description="Build testfunctional"> | |
85 | <module.build action="testfunctional" /> | |
86 | </target> | |
87 | ||
88 | ||
89 | <target name="testauthor" depends="init" description="Build testauthor"> | |
90 | <module.build action="testauthor" /> | |
91 | </target> | |
92 | ||
93 | ||
94 | <target name="testpod" depends="init" description="Build testpod"> | |
95 | <module.build action="testpod" /> | |
96 | </target> | |
97 | ||
98 | ||
99 | <target name="testpodcoverage" depends="init" description="Build testpod"> | |
100 | <module.build action="testpodcoverage" /> | |
101 | </target> | |
102 | ||
103 | ||
104 | <target name="testcover" depends="init" description="Build testcover"> | |
60fcacd6 | 105 | <module.build action="testcover"/> |
ca135637 JRT |
106 | </target> |
107 | ||
108 | ||
109 | <target name="manifest" depends="init" description="Build manifest"> | |
110 | <module.build action="manifest" /> | |
111 | </target> | |
112 | ||
113 | ||
114 | <target name="docs" depends="init" description="Build docs"> | |
115 | <module.build action="docs" /> | |
116 | </target> | |
117 | ||
118 | ||
119 | <target name="distcheck" depends="init" description="Build distcheck"> | |
120 | <module.build action="distcheck" /> | |
121 | </target> | |
122 | ||
123 | ||
124 | <target name="distmeta" depends="init" description="Build distmeta"> | |
125 | <module.build action="distmeta" /> | |
126 | </target> | |
127 | ||
128 | ||
129 | <target name="disttest" depends="init" description="Build disttest"> | |
130 | <module.build action="disttest" /> | |
131 | </target> | |
132 | ||
133 | ||
134 | <target name="distdir" depends="init" description="Build distdir"> | |
135 | <module.build action="distdir" /> | |
136 | </target> | |
137 | ||
138 | ||
139 | <target name="dist" depends="init" description="Build dist"> | |
140 | <module.build action="dist" /> | |
141 | </target> | |
142 | ||
143 | ||
144 | <target name="distsign" depends="init" description="Build distsign"> | |
145 | <module.build action="distsign" /> | |
146 | </target> | |
147 | ||
148 | <!-- | |
149 | ||
150 | The "install" target has been especially crafted to work on Unix-like | |
151 | systems that require super-user privileges to install stuff. Note that | |
152 | Eclipse does not hide the password when you type it in. Sorry. | |
153 | ||
154 | --> | |
155 | ||
156 | <target name="install" depends="init" description="Build install"> | |
157 | <input message="Enter your sudo password: " addproperty="sudo.password" /> | |
158 | <exec executable="${sudo.exe}" inputstring="${sudo.password}" failonerror="true"> | |
159 | <arg value="${bash.exe}" /> | |
160 | <arg value="-c" /> | |
161 | <arg value="./${builder} install && ./${builder} clean" /> | |
162 | </exec> | |
163 | </target> | |
164 | ||
165 | ||
166 | <target name="fakeinstall" depends="init" description="Build fakeinstall"> | |
167 | <module.build action="fakeinstall" /> | |
168 | </target> | |
169 | ||
170 | ||
171 | <target name="realclean" depends="init" description="Build realclean"> | |
172 | <module.build action="realclean" /> | |
173 | </target> | |
174 | ||
175 | ||
176 | <target name="distclean" depends="init" description="Build distclean"> | |
177 | <module.build action="distclean" /> | |
178 | </target> | |
179 | ||
180 | ||
181 | <target name="clean" depends="init" description="Build clean"> | |
182 | <module.build action="clean" /> | |
183 | </target> | |
184 | ||
185 | </project> |