64 lines
1.9 KiB
Ruby
64 lines
1.9 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.10.6-bin.tar.xz"
|
|
sha256 "9fc0aef3247485cc406f7bb24d922706e627fca53aed00f2c76810536045d5ec"
|
|
head "https://git-wip-us.apache.org/repos/asf/ant.git"
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on :java => "1.8+"
|
|
|
|
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 "https://www.apache.org/dyn/closer.cgi?path=commons/bcel/binaries/bcel-6.3.1-bin.tar.gz"
|
|
sha256 "ed1d281cb66dedb89611019168071fe22a50ff325253e2c453dc00423905cf9d"
|
|
end
|
|
|
|
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
|
|
|
|
resource("ivy").stage do
|
|
(libexec/"lib").install Dir["ivy-*.jar"]
|
|
end
|
|
|
|
resource("bcel").stage do
|
|
(libexec/"lib").install "bcel-#{resource("bcel").version}.jar"
|
|
end
|
|
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
|