Skip to content

Instantly share code, notes, and snippets.

@ankit-jha
Created November 12, 2021 21:34
Show Gist options
  • Save ankit-jha/b8b7d342212a8085b97df4495100532f to your computer and use it in GitHub Desktop.
Save ankit-jha/b8b7d342212a8085b97df4495100532f to your computer and use it in GitHub Desktop.
gradle 6.8.1
# brew install --build-from-source ./gradle.rb
# All Gradle version - https://gist.github.com/l1x/d8ba66343fceb927d691
# Install Gradle from local Formule - https://github.com/Homebrew/brew/issues/1468
# Or you can download distribution from official site https://services.gradle.org/distributions/
# When you run the above local Formule build and if the build fails with sha mismath, Replace sha256 below with the Actual sha256 returned by your run also don't forget to replace gradle version in url
# Below is sample Gradle class
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.8.1-all.zip"
sha256 "3db89524a3981819ff28c3f979236c1274a726e146ced0c8a2020417f9bc0782"
license "Apache-2.0"
# Comment out live check otherwise it will install gradle 7
# livecheck do
# url "https://services.gradle.org/distributions/"
# regex(/href=.*?gradle[._-]v?(\d+(?:\.\d+)+)-all\.(?:[tz])/i)
# end
# 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", Language::Java.overridable_java_home_env
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
@sithwarrior
Copy link

Nice.. helped me a bunch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment