From 785b0eb86b34af6a696868bb9671f0675a68e844 Mon Sep 17 00:00:00 2001 From: Xinchen Liu Date: Sat, 26 Apr 2025 12:24:37 -0400 Subject: [PATCH 1/2] add homebrew taps --- .github/workflows/update-formula.yml | 43 ++++++++++++++++++++++++++++ Formula/README.md | 28 ++++++++++++++++++ Formula/resolc.rb | 19 ++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 .github/workflows/update-formula.yml create mode 100644 Formula/README.md create mode 100644 Formula/resolc.rb diff --git a/.github/workflows/update-formula.yml b/.github/workflows/update-formula.yml new file mode 100644 index 00000000..6e2c0310 --- /dev/null +++ b/.github/workflows/update-formula.yml @@ -0,0 +1,43 @@ +name: Update Homebrew Formula + +on: + release: + types: [published] + +jobs: + update-formula: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + + - name: Install dependencies + run: | + gem install bundler + bundle install + + - name: Update Formula + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Get the release version and SHA256 + VERSION=$(echo ${{ github.ref }} | sed 's/refs\/tags\/v//') + SHA256=$(curl -sL https://github.com/paritytech/revive/archive/refs/tags/v${VERSION}.tar.gz | shasum -a 256 | cut -d' ' -f1) + + # Update the Formula file + sed -i "s/url .*/url \"https:\/\/github.com\/paritytech\/revive\/archive\/refs\/tags\/v${VERSION}.tar.gz\"/" Formula/resolc.rb + sed -i "s/sha256 .*/sha256 \"${SHA256}\"/" Formula/resolc.rb + + # Commit and push changes + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add Formula/resolc.rb + git commit -m "Update resolc to v${VERSION}" + git push \ No newline at end of file diff --git a/Formula/README.md b/Formula/README.md new file mode 100644 index 00000000..53e675f7 --- /dev/null +++ b/Formula/README.md @@ -0,0 +1,28 @@ +# Revive Homebrew Tap + +This repository contains the Homebrew formula for the Revive Solidity Compiler (resolc). + +## Installation + +To install resolc using Homebrew: + +```bash +brew tap paritytech/revive +brew install resolc +``` + +## Updating + +To update the formula: + +1. Create a new release on GitHub +2. Update the `url` and `sha256` in `Formula/resolc.rb` +3. Commit and push the changes + +## Development + +To install the development version: + +```bash +brew install --HEAD resolc +``` diff --git a/Formula/resolc.rb b/Formula/resolc.rb new file mode 100644 index 00000000..83ba92c7 --- /dev/null +++ b/Formula/resolc.rb @@ -0,0 +1,19 @@ +class Resolc < Formula + desc "Revive Solidity Compiler" + homepage "https://github.com/paritytech/revive" + url "https://github.com/paritytech/revive/releases/download/v0.1.0-dev.14/resolc-universal-apple-darwin" + sha256 "7d5b3cd4233e60e8bfaade398062f1b609166dcb251424cd9d402e51126d8b4f" + license "MIT/Apache-2.0" + + depends_on "rust" => :build + depends_on "llvm@18" => :build + + def install + system "xattr", "-c", "resolc-universal-apple-darwin" + bin.install "resolc-universal-apple-darwin" => "resolc" + end + + test do + system "#{bin}/resolc", "--version" + end +end \ No newline at end of file From 46053c75f3a27908cd34d423d13c25f669b25ed6 Mon Sep 17 00:00:00 2001 From: Xinchen Liu Date: Sat, 26 Apr 2025 12:55:51 -0400 Subject: [PATCH 2/2] Add options to build from head and dep --- Formula/resolc.rb | 50 ++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/Formula/resolc.rb b/Formula/resolc.rb index 83ba92c7..1e66a9fa 100644 --- a/Formula/resolc.rb +++ b/Formula/resolc.rb @@ -1,19 +1,33 @@ class Resolc < Formula - desc "Revive Solidity Compiler" - homepage "https://github.com/paritytech/revive" - url "https://github.com/paritytech/revive/releases/download/v0.1.0-dev.14/resolc-universal-apple-darwin" - sha256 "7d5b3cd4233e60e8bfaade398062f1b609166dcb251424cd9d402e51126d8b4f" - license "MIT/Apache-2.0" - - depends_on "rust" => :build - depends_on "llvm@18" => :build - - def install - system "xattr", "-c", "resolc-universal-apple-darwin" - bin.install "resolc-universal-apple-darwin" => "resolc" - end - - test do - system "#{bin}/resolc", "--version" - end -end \ No newline at end of file +desc "Revive Solidity Compiler" +homepage "https://github.com/paritytech/revive" +url "https://github.com/paritytech/revive/releases/download/v0.1.0-dev.14/resolc-universal-apple-darwin" +sha256 "7d5b3cd4233e60e8bfaade398062f1b609166dcb251424cd9d402e51126d8b4f" +license "MIT/Apache-2.0" + +# If someone wants to build from latest source: +head "https://github.com/paritytech/revive.git", branch: "master" +depends_on "llvm@18" => :build if build.head? # only needed when building from source + + def install + if build.head? + # ensure they have a working rust toolchain via rustup + odie "rustup is required to build Resolc from source; please install it from https://rustup.rs/" \ + unless Utils.which("rustup") + + # use rustup's stable toolchain to build in release mode + system "rustup", "run", "stable", "cargo", "install", + "--locked", # lock Cargo.lock for reproducible builds + "--root", prefix, # install into Homebrew prefix + "--path", "." # current repo + else + # just strip any quarantine attribute and install the universal binary + system "xattr", "-c", "resolc-universal-apple-darwin" + bin.install "resolc-universal-apple-darwin" => "resolc" + end + end + + test do + assert_match version.to_s, shell_output("#{bin}/resolc --version") + end + end \ No newline at end of file