Skip to content
This repository has been archived by the owner on Feb 17, 2018. It is now read-only.
jonathanle edited this page Feb 13, 2012 · 3 revisions

How to use Poppy

Add a taskdef to your Ant project that defines Poppy and create a target that calls the poppy task.

<property name="debug" value="true"/>
<target name="generate">
    <taskdef name="poppy" classname="com.poppy.Poppy" classpath="${out.jar}"/>
    <poppy classname="com.poppy.P" destdir="gen">
        <propertyset>
            <propertyref name="debug"/>
        </propertyset>
    </poppy>
</target>

When executed, the target defined above will generate a Java source file located at gen/com/poppy/P.java.

package com.poppy;

public class P {
    public static final boolean DEBUG = true;
}

Types

By default, a property will be written as a String. To ensure your constant will be defined in the type you want, you must explicitly set its type by prefixing your property name. The list prefixes understood by poppy are listed below.

  • int
  • short
  • long
  • float
  • double
  • bool
  • char

Example

int.property=100
mybool=true
bool.property=true
Clone this wiki locally