67 lines
2.2 KiB
Ruby
67 lines
2.2 KiB
Ruby
class Dafny < Formula
|
|
desc "Verification-aware programming language"
|
|
homepage "https://github.com/dafny-lang/dafny/blob/master/README.md"
|
|
url "https://github.com/dafny-lang/dafny/archive/v3.0.0.tar.gz"
|
|
sha256 "5e9af6ca59c3329cd93d792bf9890c55c68c4f656afb19c85d1c44b0c7989fc2"
|
|
license "MIT"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, big_sur: "3509c42eaa5d7a44d8de60b9f0ec3f0f8e5b6f2f69724988b89ac71266fa1236"
|
|
sha256 cellar: :any_skip_relocation, catalina: "35229c27248fe2da8362e4dc6610aca3dd38ccfcaaaefab7971fce1957a9f3b1"
|
|
sha256 cellar: :any_skip_relocation, mojave: "75e758fa9f89593859f02258a917a86fbe938f341eb51d7e05a5c10717a640f1"
|
|
end
|
|
|
|
depends_on "gradle" => :build
|
|
depends_on "nuget" => :build
|
|
depends_on "dotnet"
|
|
depends_on "openjdk"
|
|
|
|
# Use the following along with the z3 build below, as long as dafny
|
|
# cannot build with latest z3 (https://github.com/dafny-lang/dafny/issues/810)
|
|
resource "z3" do
|
|
url "https://github.com/Z3Prover/z3/archive/Z3-4.8.5.tar.gz"
|
|
sha256 "4e8e232887ddfa643adb6a30dcd3743cb2fa6591735fbd302b49f7028cdc0363"
|
|
end
|
|
|
|
def install
|
|
system "make", "exe", "runtime"
|
|
|
|
libexec.install Dir["Binaries/*", "Scripts/quicktest.sh"]
|
|
|
|
dst_z3_bin = libexec/"z3/bin"
|
|
dst_z3_bin.mkpath
|
|
|
|
resource("z3").stage do
|
|
system "./configure"
|
|
system "make", "-C", "build"
|
|
mv("build/z3", dst_z3_bin/"z3")
|
|
end
|
|
|
|
(bin/"dafny").write <<~EOS
|
|
#!/bin/bash
|
|
dotnet #{libexec}/Dafny.dll "$@"
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.dfy").write <<~EOS
|
|
method Main() {
|
|
var i: nat;
|
|
assert i as int >= -1;
|
|
print "hello, Dafny\\n";
|
|
}
|
|
EOS
|
|
assert_equal "\nDafny program verifier finished with 1 verified, 0 errors\n",
|
|
shell_output("#{bin}/dafny /compile:0 #{testpath}/test.dfy")
|
|
assert_equal "\nDafny program verifier finished with 1 verified, 0 errors\nRunning...\n\nhello, Dafny\n",
|
|
shell_output("#{bin}/dafny /compile:3 #{testpath}/test.dfy")
|
|
assert_equal "Z3 version 4.8.5 - 64 bit\n",
|
|
shell_output("#{libexec}/z3/bin/z3 -version")
|
|
end
|
|
end
|