homebrew-core/Formula/gradle.rb

29 lines
876 B
Ruby

class Gradle < Formula
desc "Open-source build automation tool based on the Groovy and Kotlin DSL"
homepage "https://www.gradle.org/"
url "https://services.gradle.org/distributions/gradle-6.5.1-all.zip"
sha256 "143a28f54f1ae93ef4f72d862dbc3c438050d81bb45b4601eb7076e998362920"
bottle :unneeded
depends_on "openjdk"
def install
rm_f Dir["bin/*.bat"]
libexec.install %w[bin docs lib src]
(bin/"gradle").write_env_script libexec/"bin/gradle",
JAVA_HOME: "${JAVA_HOME:-#{Formula["openjdk"].opt_prefix}}"
end
test do
assert_match version.to_s, shell_output("#{bin}/gradle --version")
(testpath/"settings.gradle").write ""
(testpath/"build.gradle").write <<~EOS
println "gradle works!"
EOS
gradle_output = shell_output("#{bin}/gradle build --no-daemon")
assert_includes gradle_output, "gradle works!"
end
end