65 lines
2.6 KiB
Ruby
65 lines
2.6 KiB
Ruby
class Sonarqube < Formula
|
|
desc "Manage code quality"
|
|
homepage "https://www.sonarqube.org/"
|
|
url "https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-9.2.4.50792.zip"
|
|
sha256 "98532c5ce9d478708f99dbfa331fac21f705b3e2ec5f08cec2c5c4168ef11aae"
|
|
license "LGPL-3.0-or-later"
|
|
|
|
livecheck do
|
|
url "https://binaries.sonarsource.com/Distribution/sonarqube/"
|
|
regex(/href=.*?sonarqube[._-]v?(\d+(?:\.\d+)+)\.zip/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "6588ce4ca1838536f1dad1bb6a27b9970f8e578b2e1963d5236407cffe5e8b09"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "fc725ead5e7a24d15205a2be00dc65b9da9994c7ab857057c7659d2dcb21e372"
|
|
sha256 cellar: :any_skip_relocation, catalina: "9ed9af17b64ca779a16f9d10ff3ebba1c1d7b57c07d154b521a6f3cd8ee955c2"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "f011f8829c6ac8b91e1a01fa65b46f2d10021f121decd152b37410ba60095ab6"
|
|
end
|
|
|
|
depends_on "java-service-wrapper"
|
|
depends_on "openjdk@11"
|
|
|
|
conflicts_with "sonarqube-lts", because: "both install the same binaries"
|
|
|
|
def install
|
|
# Use Java Service Wrapper 3.5.46 which is Apple Silicon compatible
|
|
# Java Service Wrapper doesn't support the wrapper binary to be symlinked, so it's copied
|
|
jsw_libexec = Formula["java-service-wrapper"].opt_libexec
|
|
ln_s jsw_libexec/"lib/wrapper.jar", "#{buildpath}/lib/jsw/wrapper-3.5.46.jar"
|
|
ln_s jsw_libexec/"lib/libwrapper.dylib", "#{buildpath}/bin/macosx-universal-64/lib/"
|
|
cp jsw_libexec/"bin/wrapper", "#{buildpath}/bin/macosx-universal-64/"
|
|
cp jsw_libexec/"scripts/App.sh.in", "#{buildpath}/bin/macosx-universal-64/sonar.sh"
|
|
sonar_sh_file = "bin/macosx-universal-64/sonar.sh"
|
|
inreplace sonar_sh_file, "@app.name@", "SonarQube"
|
|
inreplace sonar_sh_file, "@app.long.name@", "SonarQube"
|
|
inreplace sonar_sh_file, "../conf/wrapper.conf", "../../conf/wrapper.conf"
|
|
inreplace "conf/wrapper.conf", "wrapper-3.2.3.jar", "wrapper-3.5.46.jar"
|
|
rm "lib/jsw/wrapper-3.2.3.jar"
|
|
rm "bin/macosx-universal-64/lib/libwrapper.jnilib"
|
|
|
|
# Delete native bin directories for other systems
|
|
remove, keep = if OS.mac?
|
|
["linux", "macosx-universal"]
|
|
else
|
|
["macosx", "linux-x86"]
|
|
end
|
|
|
|
rm_rf Dir["bin/{#{remove},windows}-*"]
|
|
|
|
libexec.install Dir["*"]
|
|
|
|
(bin/"sonar").write_env_script libexec/"bin/#{keep}-64/sonar.sh",
|
|
Language::Java.overridable_java_home_env("11")
|
|
end
|
|
|
|
service do
|
|
run [opt_bin/"sonar", "console"]
|
|
keep_alive true
|
|
end
|
|
|
|
test do
|
|
assert_match "SonarQube", shell_output("#{bin}/sonar status", 1)
|
|
end
|
|
end
|