class GradleAT6 < 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.9.3-all.zip" sha256 "91bbf438ec3f18c9273392972e5627bb9965ef88b262729d1b243d7db5cdd1b8" license "Apache-2.0" livecheck do url "https://gradle.org/releases/" regex(/href=.*?gradle[._-]v?(6(?:\.\d+)+)-all\.(?:zip|t)/i) end bottle do sha256 cellar: :any_skip_relocation, all: "9909831bb1e055c76ce61e2aafeefcc543f4c7a3cd4e90d945515c7c95beb19a" end keg_only :versioned_formula # gradle@6 does not support Java 16 depends_on "openjdk@11" 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("11") 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