Skip to content

Instantly share code, notes, and snippets.

@gamma
Last active May 4, 2022 13:27
Show Gist options
  • Save gamma/e7962495017070b7f3914a390f5e09c3 to your computer and use it in GitHub Desktop.
Save gamma/e7962495017070b7f3914a390f5e09c3 to your computer and use it in GitHub Desktop.
Gradle 4 for homebrew
# cat > /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gradle4.rb
# brew install --build-from-source gradle4
class Gradle4 < 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-4.10.3-all.zip"
sha256 "336b6898b491f6334502d8074a6b8c2d73ed83b92123106bd4bf837f04111043"
# not needed in newer gradle releases
# bottle :unneeded
def install
rm_f Dir["bin/*.bat"]
libexec.install %w[bin docs lib media samples src]
(bin/"gradle").write_env_script libexec/"bin/gradle", Language::Java.overridable_java_home_env
end
def caveats
<<~EOS
This formula requires Java 8 to be installed, such as:
brew install --cask adoptopenjdk8
EOS
end
test do
assert_match version.to_s, shell_output("#{bin}/gradle --version")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment