Skip to content

Commit fac40c1

Browse files
Fix ruby cache key calculation used for npm packaging
The `RUBY_WASM_ROOT` environment variable is not set when calculating ruby cache keys for npm packages and rbwasm assumes that the build_manifest.json file is placed in the cwd (npm package directory). But the build_manifest.json file is placed in the repository root so the cache key calculation didn't respect the pinned ruby revision.
1 parent 3040942 commit fac40c1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Rakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ class BuildTask < Struct.new(:name, :target, :build_command)
6868
def ruby_cache_key
6969
return @key if @key
7070
require "open3"
71+
env = { "RUBY_WASM_ROOT" => LIB_ROOT }
7172
cmd = build_command + ["--print-ruby-cache-key"]
72-
stdout, status = Open3.capture2(*cmd)
73+
stdout, status = Open3.capture2(env, *cmd)
7374
unless status.success?
7475
raise "Command failed with status (#{status.exitstatus}): #{cmd.join " "}"
7576
end

rakelib/packaging.rake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def npm_pkg_rubies_cache_key(pkg)
3030
require "open3"
3131
cmd = build_command + ["--print-ruby-cache-key"]
3232
chdir = pkg[:gemfile] ? File.dirname(pkg[:gemfile]) : Dir.pwd
33-
stdout, status = Open3.capture2(*cmd, chdir: chdir)
33+
env = { "RUBY_WASM_ROOT" => LIB_ROOT }
34+
stdout, status = Open3.capture2(env, *cmd, chdir: chdir)
3435
unless status.success?
3536
raise "Command failed with status (#{status.exitstatus}): #{cmd.join " "}"
3637
end

0 commit comments

Comments
 (0)