Skip to content

Instantly share code, notes, and snippets.

View jasonhofer's full-sized avatar

Jason Hofer jasonhofer

  • Sarnia, Ontario
View GitHub Profile
@jasonhofer
jasonhofer / ant-color-output.xml
Created March 2, 2012 14:45
Apache Ant color output
ant -logger org.apache.tools.ant.listener.AnsiColorLogger
@jasonhofer
jasonhofer / ant-props-setup.xml
Created March 2, 2012 14:42
Apache "Props" Ant Library setup
<!--
Requires Ant 1.8+
Home page: http://ant.apache.org/antlibs/props
SVN URL: https://svn.apache.org/repos/asf/ant/antlibs/props/trunk
ViewVC: http://svn.apache.org/viewvc/ant/antlibs/props/trunk
-->
<taskdef resource="org/apache/ant/props/antlib.xml"
classpath="${lib.dir}/ant-props-1.0Alpha.jar" />
@jasonhofer
jasonhofer / ant-php-macrodef.xml
Created March 1, 2012 18:07
Apache Ant "php" macrodef for executing PHP code
<!--
@todo new attributes "include" and/or "require" which take csv file lists. useful for presetdefs
@todo new attribute "namespace" (useful?)
@todo use "return" instead of "echo", or allow both. maybe use attributes "returnProperty" and "outputProperty" instead of just "property"
@todo could (optionally) predefine some variables, such as $basedir
@todo could (optionally) use "echoProperties" to dump properties to a temp file and load them into a predefined $ant, $properties, or $p array
-->
<macrodef name="php" description="Executes PHP code">
<attribute name="code" default="" />
@jasonhofer
jasonhofer / ant-property-shortcuts.xml
Last active October 1, 2015 08:08
Apache Ant property shortcuts
<property name="\n" value="${line.separator}" />
<property name="/" value="${file.separator}" />
<property name=":" value="${path.separator}" />
<!-- tab char -->
<script language="javascript">project.setUserProperty("\\t", "\t");</script>
<!-- for surrounding command line options -->
<condition property="'" value="&quot;" else="'">
<os family="windows" />
@jasonhofer
jasonhofer / ant-which.xml
Last active October 1, 2015 08:07
Apache Ant "which" scriptdef
<property environment="env" />
<property name="env.PATH" value="${env.Path}" /><!-- because windows -->
<scriptdef name="which" language="javascript">
<attribute name="command" />
<attribute name="property" />
<![CDATA[
var cmd = attributes.get("command") || "";
var prop = attributes.get("property") || "";