From 26d961f5137781a5bc5024f25f7d7f878d78fec0 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Mon, 22 Jun 2026 17:20:50 +0900 Subject: [PATCH 1/4] Fix gemspec to exclude `.vscode` files --- rbs.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rbs.gemspec b/rbs.gemspec index 870d99f03..ee78e0426 100644 --- a/rbs.gemspec +++ b/rbs.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |spec| spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do `git ls-files -z`.split("\x0").reject do |f| [ - %r{^(test|spec|features|bin|steep|benchmark|templates|rust)/}, + %r{^(test|spec|features|bin|steep|benchmark|templates|rust|\.vscode)/}, /Gemfile/, ].any? {|r| f.match(r) } end From 274105ddc529ff7bd6ddff20739de9c05706d813 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Mon, 22 Jun 2026 17:20:57 +0900 Subject: [PATCH 2/4] Version 4.1.0.pre.2 --- Gemfile.lock | 2 +- lib/rbs/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0d48270be..962a4600c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -22,7 +22,7 @@ GIT PATH remote: . specs: - rbs (4.1.0.pre.1) + rbs (4.1.0.pre.2) logger prism (>= 1.6.0) tsort diff --git a/lib/rbs/version.rb b/lib/rbs/version.rb index e860ea045..2ff70cac7 100644 --- a/lib/rbs/version.rb +++ b/lib/rbs/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module RBS - VERSION = "4.1.0.pre.1" + VERSION = "4.1.0.pre.2" end From 4d6a4ee8047222cbc181b6d373dcb74fc5c85573 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Mon, 22 Jun 2026 17:45:33 +0900 Subject: [PATCH 3/4] Add `docs/release.md` --- docs/release.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 docs/release.md diff --git a/docs/release.md b/docs/release.md new file mode 100644 index 000000000..459195828 --- /dev/null +++ b/docs/release.md @@ -0,0 +1,67 @@ +# Releasing RBS + +Each release ships **two gems**: + +| Gem | Platform | Parser | How it is built | +| --- | --- | --- | --- | +| `rbs-X.Y.Z.gem` | `ruby` (MRI) | C extension | `rake release` (re-builds it) | +| `rbs-X.Y.Z-java.gem` | `java` (JRuby) | WebAssembly (`lib/rbs/wasm`) | Docker image, pushed manually | + +The `-java` gem contains no native code — just `rbs_parser.wasm` plus the +Chicory/ASM jars — so it can be built once in any environment and runs on every +JRuby. + +## Prerequisites + +- Push rights to the `rbs` gem on RubyGems (`gem signin`). If your account has + MFA enabled, `gem push` / `rake release` will prompt for an OTP. +- Docker, for the `-java` gem. The WASI SDK is baked into the image, so there is + nothing to install on the host. + +## Steps + +### 1. Release the `ruby` gem + +Once the version is bumped and committed, run on CRuby: + +```console +$ bundle exec rake release +``` + +This re-builds the `ruby`-platform gem and then: + +- creates the tag `vX.Y.Z`, +- pushes the current branch and the tag to `origin`, +- pushes the gem to RubyGems, +- runs `release:note`, which opens a GitHub **draft** release (with + `--prerelease` for `*.pre.*` versions) and prints the remaining manual steps. + +### 2. Build and push the `java` gem + +The `java` gem is not built by `rake release`, so build and push it manually: + +```console +# Build from the committed state (the gemspec's file list comes from `git ls-files`). +$ docker build -f Dockerfile.jruby -t rbs-jruby . + +# Assemble rbs_parser.wasm + jars and build the -java gem into ./pkg on the host. +$ docker run --rm -e RBS_PLATFORM=java -v "$PWD/pkg:/out" rbs-jruby \ + gem build rbs.gemspec -o /out/rbs-X.Y.Z-java.gem + +$ gem push pkg/rbs-X.Y.Z-java.gem +``` + +Optionally confirm it installs and runs on JRuby before pushing: + +```console +$ docker run --rm -v "$PWD/pkg:/pkg" -w /tmp rbs-jruby bash -c \ + 'gem install /pkg/rbs-X.Y.Z-java.gem && ruby -e "require %q{rbs}; puts [RUBY_ENGINE, RBS::VERSION].join(%q{ })"' +``` + +## Notes + +- Prereleases (`X.Y.Z.pre.N`) are only installed with `gem install rbs --pre`; + a plain `gem install rbs` is unaffected. On JRuby, `gem install rbs [--pre]` + resolves to the `-java` gem automatically. +- The Dockerfile pins the WASI SDK / Chicory / ASM versions to match the + `wasm` and `jruby` CI workflows. Keep them in sync when bumping. From 21884ba682693a152b1d0bd657e913501b60adb6 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Mon, 22 Jun 2026 17:48:08 +0900 Subject: [PATCH 4/4] Add Dockerfile to build and test the JRuby gem `Dockerfile.jruby` is a single-stage JRuby image that installs the WASI SDK, assembles the WebAssembly parser and Chicory/ASM jars via `rake wasm:jruby_setup`, and runs the test suite. It also builds the `-java` platform gem with `RBS_PLATFORM=java gem build`, so the JRuby gem can be built without a WASI SDK on the host. `.dockerignore` keeps the build context small while preserving `.git` (the gemspec lists files via `git ls-files`). Co-Authored-By: Claude Opus 4.8 --- .dockerignore | 38 ++++++++++++++++++++++++++++++++++ Dockerfile.jruby | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile.jruby diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..a7ff961b4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,38 @@ +# Keep the build context small. .git is intentionally NOT ignored: rbs.gemspec +# builds its file list with `git ls-files`. +# +# Safe to ignore here: untracked/generated paths, and tracked paths the gemspec +# already rejects (so `gem build` does not expect them on disk). Do NOT ignore a +# tracked path the gemspec ships — `gem build` would fail with "... are not +# files". .vscode/ and benchmark/ are tracked but rejected by the gemspec. +.vscode/ +benchmark/ + +# Editor / tooling / worktree copies (untracked; each is a full repo clone) +.claude/ +trees/ +.devcontainer/ +.idea/ +.ruby-lsp/ +.yardoc/ +doc/ +datasets/ +tmp/ + +# Build artifacts — rebuilt inside the image by `rake wasm:jruby_setup` +lib/rbs/wasm/*.wasm +lib/rbs/wasm/jars/ +*.gem +ext/**/*.o +ext/**/*.so +ext/**/*.bundle +*.log + +# Local scratch / experiment files +flamegraph.html +gc.html +foo.rbs +sorted.json +string.json +Gemfile-* +gemfiles/ diff --git a/Dockerfile.jruby b/Dockerfile.jruby new file mode 100644 index 000000000..95715cffb --- /dev/null +++ b/Dockerfile.jruby @@ -0,0 +1,54 @@ +# JRuby verification image for RBS. +# +# RBS can't load its MRI C extension on JRuby, so it parses through a +# WebAssembly build of the parser (see lib/rbs/wasm and docs/wasm_serialization.md). +# This single-stage image installs the WASI SDK, compiles rbs_parser.wasm and +# vendors the Chicory/ASM jars into lib/rbs/wasm/, then runs the test suite on +# JRuby. It mirrors .github/workflows/jruby.yml but is fully self-contained. +# +# docker build -f Dockerfile.jruby -t rbs-jruby . +# docker run --rm rbs-jruby # run the test suite +# docker run --rm -e RBS_PLATFORM=java rbs-jruby \ +# gem build rbs.gemspec # build the -java gem +# +# Bundler is intentionally not used: the development Gemfile pulls in CRuby-only +# C extensions (bigdecimal, stackprof, ...) that cannot build on JRuby. The few +# gems the suite needs are installed directly, exactly as the CI does. + +FROM jruby:10.0.6-jdk21 + +# Keep in sync with .github/workflows/wasm.yml and .github/workflows/jruby.yml. +ARG WASI_SDK_VERSION=33 +ARG WASI_SDK_RELEASE=33.0 + +# build-essential supplies cc/make: on JRuby the prism gem builds libprism.so +# (loaded via FFI) instead of an MRI C extension, so it needs a C toolchain. +RUN apt-get update \ + && apt-get install -y --no-install-recommends git curl ca-certificates build-essential \ + && rm -rf /var/lib/apt/lists/* + +# The WASI SDK provides clang, the wasi-libc sysroot and the wasm32 compiler-rt +# builtins that `rake wasm:build` needs to compile src/**/*.c to WebAssembly. +RUN set -eux; \ + case "$(uname -m)" in \ + x86_64 | amd64) wasi_arch=x86_64 ;; \ + aarch64 | arm64) wasi_arch=arm64 ;; \ + *) echo "unsupported arch: $(uname -m)" >&2; exit 1 ;; \ + esac; \ + mkdir -p /opt/wasi-sdk; \ + curl -fsSL "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_RELEASE}-${wasi_arch}-linux.tar.gz" \ + | tar xz --strip-components=1 -C /opt/wasi-sdk +ENV WASI_SDK_PATH=/opt/wasi-sdk + +# Runtime/test gems the suite needs on JRuby (same set as the jruby.yml CI). +RUN gem install prism rake rake-compiler test-unit rdoc rspec minitest json-schema pry --no-document + +WORKDIR /rbs +COPY . . + +# Assemble the JRuby runtime: compile rbs_parser.wasm and download the +# Chicory + ASM jars into lib/rbs/wasm/. Runs on JRuby (clang is a subprocess, +# so the build is engine independent). +RUN rake wasm:jruby_setup + +CMD ["rake", "test"]