@@ -0,0 +1,1440 @@
+import org.apache.tools.ant.Task;%0Aimport org.apache.tools.ant.BuildException;%0Aimport org.apache.tools.ant.Project;%0Aimport org.apache.tools.ant.types.EnumeratedAttribute;%0A%0Aimport java.net.InetAddress;%0A%0Apublic class HostName extends Task %7B%0A%0A    private String hostname;%09%09// What is this used for?%0A    private String domainname;%09%09// What is this used for?%0A%0A%0A    public void execute() throws BuildException %7B%0A%09String hostName;%0A%09String domainName;%0A%0A%09try %7B%0A%09    InetAddress addr     = InetAddress.getLocalHost();%0A%09    InetAddress nameAddr = InetAddress.getByName(addr.getHostAddress());%0A%09    hostName             = nameAddr.getHostName();%0A%0A%09%7D catch (Exception e) %7B%0A%09    throw new BuildException(%22Could not find my host name%22 + e);%0A%09%7D%0A%0A%09int dot = hostName.indexOf('.');%0A%09if (dot == -1) %7B%0A%09    domainName = %22%22;%0A%09%7D else %7B%0A%09    domainName = hostName.substring(dot + 1);%0A%09%7D%0A%0A%09System.err.println(%22hostname %22 + hostName);%0A%09System.err.println(%22domainname %22 + domainName);%0A%0A%09addProperty(%22hostname%22, hostName);%0A%09addProperty(%22domainname%22, domainName);%0A    %7D%0A%0A    private void addProperty(String name, String value) %7B%0A%09if (getProject().getUserProperty(name) == null) %7B%0A%09    getProject().setInheritedProperty(name, value);%0A%09%7D else %7B%0A%09    log(%22Override ignored for %22 + name, Project.MSG_VERBOSE);%0A%09%7D%0A    %7D%0A%0A%0A    public void setHostname(String name) %7B%0A%09this.hostname = name;%0A    %7D%0A%0A    public void setDomainname(String name) %7B%0A%09this.domainname = name;%0A    %7D%0A%0A%7D%0A

Add a hostname/domainname task