homebrew-core/Formula/ant.rb
2015-06-16 08:19:04 +01:00

69 lines
2.3 KiB
Ruby

class Ant < 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.5-bin.tar.bz2"
sha256 "3019f1b8c18151982bf217d7947a8cf9a526019718251d88cf3eb60b7922f614"
head "https://git-wip-us.apache.org/repos/asf/ant.git"
bottle do
cellar :any
sha256 "4a3e8a137bd2d16160eb9115cb8fab16ba64285d5148d95e9fde569fe485f54c" => :yosemite
sha256 "6ae739e720f70613eb74bf020b211c0ed3a535712388ca92559f4060dccc7670" => :mavericks
sha256 "f672631ed1927c80759fec557c4d477056453b4ed267458b38916406d6146ee5" => :mountain_lion
end
keg_only :provided_by_osx if MacOS.version < :mavericks
option "with-ivy", "Install ivy dependency manager"
option "with-bcel", "Install Byte Code Engineering Library"
resource "ivy" do
url "https://www.apache.org/dyn/closer.cgi?path=ant/ivy/2.4.0/apache-ivy-2.4.0-bin.tar.gz"
sha256 "7a3d13a80b69d71608191463dfc2a74fff8ef638ce0208e70d54d28ba9785ee9"
end
resource "bcel" do
url "http://central.maven.org/maven2/org/apache/bcel/bcel/5.2/bcel-5.2.jar"
sha256 "7b87e2fd9ac3205a6e5ba9ef5e58a8f0ab8d1a0e0d00cb2a761951fa298cc733"
end
def install
rm Dir["bin/*.{bat,cmd,dll,exe}"]
libexec.install Dir["*"]
bin.install_symlink Dir["#{libexec}/bin/*"]
if build.with? "ivy"
resource("ivy").stage do
(libexec/"lib").install Dir["ivy-*.jar"]
end
end
if build.with? "bcel"
resource("bcel").stage do
(libexec/"lib").install Dir["bcel-*.jar"]
end
end
end
test do
(testpath/"build.xml").write <<-EOS.undent
<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.undent
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