homebrew-core/Formula/ant@1.9.rb
2018-07-13 14:05:36 +01:00

45 lines
1.3 KiB
Ruby

class AntAT19 < Formula
desc "Java build tool"
homepage "https://ant.apache.org/"
url "https://www.apache.org/dyn/closer.cgi?path=ant/binaries/apache-ant-1.9.13-bin.tar.bz2"
sha256 "e770c2ba77fd695734fa1945f887891a04524998f17e929d821f993ba3c5c73c"
bottle :unneeded
keg_only :versioned_formula
def install
rm Dir["bin/*.{bat,cmd,dll,exe}"]
libexec.install Dir["*"]
bin.install_symlink Dir["#{libexec}/bin/*"]
rm bin/"ant"
(bin/"ant").write <<~EOS
#!/bin/sh
#{libexec}/bin/ant -lib #{HOMEBREW_PREFIX}/share/ant "$@"
EOS
end
test do
(testpath/"build.xml").write <<~EOS
<project name="HomebrewTest" basedir=".">
<property name="src" location="src"/>
<property name="build" location="build"/>
<target name="init">
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}"/>
</target>
</project>
EOS
(testpath/"src/main/java/org/homebrew/AntTest.java").write <<~EOS
package org.homebrew;
public class AntTest {
public static void main(String[] args) {
System.out.println("Testing Ant with Homebrew!");
}
}
EOS
system "#{bin}/ant", "compile"
end
end