Login
Added a build.xml script to all distributions. Tools like Eclipse and Intelli-J
authorJeffrey Ryan Thalhammer <jeff@imaginative-software.com>
Sat, 23 Aug 2008 23:17:59 +0000 (23:17 +0000)
committerJeffrey Ryan Thalhammer <jeff@imaginative-software.com>
Sat, 23 Aug 2008 23:17:59 +0000 (23:17 +0000)
have good interfaces for creating and running Ant scripts.  These files
just serve as wrappers around Build.PL, so you can take advantage of those
interfaces when working with Perl dists.

build.xml [new file with mode: 0644]

diff --git a/build.xml b/build.xml
new file mode 100644 (file)
index 0000000..0bbd72c
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<!--
+
+##############################################################################
+#      $URL$
+#     $Date$
+#   $Author$
+# $Revision$
+##############################################################################
+
+The following is an Ant build script for building Perl distributions
+based on Module::Build.  It has been written so that tools like
+Eclipse that are well-suited for running Ant scripts (for Java
+projects) can be easily configured to build Perl projects.  Most of
+the standard Module::Build actions are availalbe as Ant targets here.
+But if you want to run a non-standard Module::Build action, use the
+"user.defined" Ant target and you will be prompted to enter the name
+of the Module::Build action that you want to run.
+
+Enjoy!!
+
+-->
+
+<project name="Perl-Critic" default="build" basedir=".">
+
+    <description>
+        Build the Perl-Critic distribution.
+    </description>
+
+    <property environment="env" />
+    <property name="perl.exe" value="perl" />
+    <property name="sudo.exe" value="sudo" />
+    <property name="bash.exe" value="bash" />
+    <property name="builder" value="Build" />
+
+
+    <macrodef name="module.build">
+        <attribute name="action" default="build" />
+        <element name="exec.extras" optional="yes" />
+        <sequential>
+            <exec executable="${perl.exe}" failonerror="true">
+                <arg value="${builder}" />
+                <arg value="@{action}" />
+                <exec.extras />
+            </exec>
+        </sequential>
+    </macrodef>
+
+
+    <available file="${builder}" property="Build.initialized" />
+    <target name="init" unless="Build.initialized" description="perl Build.PL">
+        <exec executable="${perl.exe}" failonerror="true">
+            <arg value="Build.PL" />
+        </exec>
+    </target>
+
+
+    <target name="user.defined" depends="init" description="Build (whatever)">
+        <input message="Enter build action:" addproperty="build.action" defaultvalue="build" />
+        <module.build action="${build.action}" />
+    </target>
+
+
+    <target name="help" depends="init" description="Build help">
+        <module.build action="help" />
+    </target>
+
+
+    <target name="build" depends="init" description="Build build">
+        <module.build action="build" />
+    </target>
+
+
+    <target name="test" depends="init" description="Build test">
+        <module.build action="test" />
+    </target>
+
+
+    <target name="testunit" depends="init" description="Build testunit">
+        <module.build action="testunit" />
+    </target>
+
+
+    <target name="testfunctional" depends="init" description="Build testfunctional">
+        <module.build action="testfunctional" />
+    </target>
+
+
+    <target name="testauthor" depends="init" description="Build testauthor">
+        <module.build action="testauthor" />
+    </target>
+
+
+    <target name="testpod" depends="init" description="Build testpod">
+        <module.build action="testpod" />
+    </target>
+
+
+    <target name="testpodcoverage" depends="init" description="Build testpod">
+        <module.build action="testpodcoverage" />
+    </target>
+
+
+    <target name="testcover" depends="init" description="Build testcover">
+        <module.build action="testcover">
+            <exec.extras>
+                <!-- set the $path.prepend property if "cover" is
+                 not installed in the standard place -->
+
+                <env key="PATH" path="${path.prepend}:${env.PATH}" />
+            </exec.extras>
+        </module.build>
+    </target>
+
+
+    <target name="manifest" depends="init" description="Build manifest">
+        <module.build action="manifest" />
+    </target>
+
+
+    <target name="docs" depends="init" description="Build docs">
+        <module.build action="docs" />
+    </target>
+
+
+    <target name="distcheck" depends="init" description="Build distcheck">
+        <module.build action="distcheck" />
+    </target>
+
+
+    <target name="distmeta" depends="init" description="Build distmeta">
+        <module.build action="distmeta" />
+    </target>
+
+
+    <target name="disttest" depends="init" description="Build disttest">
+        <module.build action="disttest" />
+    </target>
+
+
+    <target name="distdir" depends="init" description="Build distdir">
+        <module.build action="distdir" />
+    </target>
+
+
+    <target name="dist" depends="init" description="Build dist">
+        <module.build action="dist" />
+    </target>
+
+
+    <target name="distsign" depends="init" description="Build distsign">
+        <module.build action="distsign" />
+    </target>
+
+    <!--
+    
+    The "install" target has been especially crafted to work on Unix-like
+    systems that require super-user privileges to install stuff.  Note that
+    Eclipse does not hide the password when you type it in.  Sorry.
+    
+    -->
+
+    <target name="install" depends="init" description="Build install">
+        <input message="Enter your sudo password: " addproperty="sudo.password" />
+        <exec executable="${sudo.exe}" inputstring="${sudo.password}" failonerror="true">
+            <arg value="${bash.exe}" />
+            <arg value="-c" />
+            <arg value="./${builder} install &amp;&amp; ./${builder} clean" />
+        </exec>
+    </target>
+
+
+    <target name="fakeinstall" depends="init" description="Build fakeinstall">
+        <module.build action="fakeinstall" />
+    </target>
+
+
+    <target name="realclean" depends="init" description="Build realclean">
+        <module.build action="realclean" />
+    </target>
+
+
+    <target name="distclean" depends="init" description="Build distclean">
+        <module.build action="distclean" />
+    </target>
+
+
+    <target name="clean" depends="init" description="Build clean">
+        <module.build action="clean" />
+    </target>
+
+</project>