beni 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6a016874c88f351f3e16608a037dcf43764b1a6103a2343095a8309993ef3e6
4
- data.tar.gz: 7dee2ba6bf749ca47d21c03c7ae8e13b088967ed066cdc1af7f65d3faa51c6c0
3
+ metadata.gz: 38f0019d83181c71f73bd28ac1e0dac4496f90da8c9ea4138674ebb7563607ab
4
+ data.tar.gz: 9908ec932576527cce5b4accc728b5e22e118e3dd2c9447cd3ec1b1b60bfee6a
5
5
  SHA512:
6
- metadata.gz: 003cb5fd98c9c85c2e3e50e8e491c1e013239910e0d7fd77acfa5758666814dcf28217e0bd46323e44cee26024025359ccc0675cb998c466c8d59975467f5f30
7
- data.tar.gz: 6eed22fd23baf576f241c1d05d3120fbcb368387b4fe9df59ac3932b4a5f596a5ca775c141f47cbcfcb2d87dbe04744277b5416d8c273f38b2dbdba7b1c25620
6
+ metadata.gz: cc8e2f46c0d880f6906fbcf0158854c62300e76287b1c2fc36be14fce337a6c0b4755c39178eccc00872545ffb99618a874cf249954cd77d5943e368209e7540
7
+ data.tar.gz: a6656f2edb19c7f52ee1478598e037cf485322926f0fe37ef21d82dcfb4f37a37298b7b12817a1fc97b7fe7da87dab8105784801e8864d4efa6870838acd86e1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.26.0](https://github.com/elct9620/beni/compare/v0.25.0...v0.26.0) (2026-11-06)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **beni:** `RString::as_bytes` is renamed `as_slice`; `ReprValue::freeze` returns `()` instead of the receiver; `RArray::join` takes an `IntoRString` separator, so `Some(sep)` becomes `sep` and `None` becomes `""`.
9
+
10
+ ### Features
11
+
12
+ * **beni:** read frames in every build, as magnus's DebugInspector does ([7a3b01d](https://github.com/elct9620/beni/commit/7a3b01d6b44ee3cf861d3282f5c2aad1097b9c77))
13
+ * **beni:** take a join separator through IntoRString and read string bytes as as_slice ([0c2f6bd](https://github.com/elct9620/beni/commit/0c2f6bd540d1782af15e0e8a906401acb450b685))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **beni:** accept only an initialized Range into the Range handle ([85a3005](https://github.com/elct9620/beni/commit/85a3005107f8a0fd9a53401afdd36ddde5dc2445))
19
+ * **beni:** copy a file name out before the next name read rewrites it ([aadf0b0](https://github.com/elct9620/beni/commit/aadf0b01a3d7ae8a9d54051885fe6fd4363b854e))
20
+ * **beni:** find no frames when the inspector opens with no Ruby call running ([11b6f87](https://github.com/elct9620/beni/commit/11b6f8708b0007cc64c7faf5a3a6a26ca0113f65))
21
+ * **beni:** read a String allocated without content as no bytes ([822a9f1](https://github.com/elct9620/beni/commit/822a9f17423e1cb340cd8ed090c6e12394f037b5))
22
+ * **gemspec:** leave the cloud bootstrap and the steep patch out of the package ([c6b5a12](https://github.com/elct9620/beni/commit/c6b5a12d2d40a050831d3cdd0a5d6edc10a4836d))
23
+ * **tasks:** clean every build tree and staged toolchain, not only the declared ones ([ca0b8d6](https://github.com/elct9620/beni/commit/ca0b8d62ec86caf19d4ed9234a9eb2cc56956894))
24
+ * **tasks:** stage and read the archive from one vendor tree ([5346e9c](https://github.com/elct9620/beni/commit/5346e9cfec90405f1391a9ac2ca44a03f2c91b49))
25
+ * **vendor:** leave no partial download behind when a fetch fails ([4bf2af3](https://github.com/elct9620/beni/commit/4bf2af3cdcb85b798d23dfa1e5e50613d8e9dc39))
26
+ * **vendor:** refuse a missing platform checksum at setup and drop a tarball that fails verification ([e3ca724](https://github.com/elct9620/beni/commit/e3ca724128f172ab607e0f9b3d5ffb95f45c6c22))
27
+
3
28
  ## [0.25.0](https://github.com/elct9620/beni/compare/v0.24.0...v0.25.0) (2026-10-22)
4
29
 
5
30
 
@@ -30,16 +30,11 @@ module Beni
30
30
  # wrong release.
31
31
  def staged_default_config(mruby_dir, version)
32
32
  source = File.join(mruby_dir, "build_config", "default.rb")
33
- return source if staged_version(mruby_dir) == version && File.exist?(source)
33
+ return source if Vendor::Tarball.staged_version(mruby_dir) == version && File.exist?(source)
34
34
 
35
35
  raise Error,
36
36
  "[beni] mruby #{version}'s source is not staged at #{mruby_dir} — " \
37
37
  "run `rake beni:vendor:setup` first"
38
38
  end
39
-
40
- def staged_version(mruby_dir)
41
- marker = File.join(mruby_dir, Vendor::Tarball::VERSION_MARKER)
42
- File.read(marker).strip if File.exist?(marker)
43
- end
44
39
  end
45
40
  end
data/lib/beni/builder.rb CHANGED
@@ -25,6 +25,10 @@ module Beni
25
25
  # The sidecar mruby writes beside every archive it builds.
26
26
  FLAGS_MAK = "libmruby.flags.mak"
27
27
 
28
+ # Where mruby clones the gem sources a build config fetches, under
29
+ # its build directory.
30
+ CLONED_GEMS_DIR = "repos"
31
+
28
32
  attr_reader :vendor_dir, :build_config, :targets
29
33
 
30
34
  def initialize(vendor_dir:, build_config: nil, targets: DEFAULT_TARGETS)
@@ -88,10 +92,15 @@ module Beni
88
92
  verify_artifacts!
89
93
  end
90
94
 
91
- # Remove each target's build tree (keeps the vendored mruby source).
95
+ # Remove every build tree, declared or not, keeping the vendored
96
+ # mruby source and the gem sources mruby clones into +build/repos+,
97
+ # which mruby's own +clean+ keeps too.
92
98
  def clean
93
- targets.each do |target|
94
- dir = File.join(mruby_dir, "build", target)
99
+ build_dir = File.join(mruby_dir, "build")
100
+ return unless Dir.exist?(build_dir)
101
+
102
+ (Dir.children(build_dir) - [CLONED_GEMS_DIR]).each do |entry|
103
+ dir = File.join(build_dir, entry)
95
104
  FileUtils.rm_rf(dir)
96
105
  puts "[beni] removed #{dir}"
97
106
  end
@@ -5,7 +5,9 @@ module Beni
5
5
  # +sha256+ is concrete at resolution time — a definition's declared
6
6
  # value or the built-in checksum +Beni::Vendor+ resolves. +nil+ has
7
7
  # exactly one reachable meaning: mruby at a non-default version, where
8
- # verification falls to the TOFU sidecar path.
8
+ # verification falls to the TOFU sidecar path. A
9
+ # +Vendor::UnvendoredChecksum+ stands for a built-in pair lacking the
10
+ # build platform's checksum, which setup refuses.
9
11
  class SelectedToolchain < Data.define(:name, :version, :sha256)
10
12
  end
11
13
  end
data/lib/beni/tasks.rb CHANGED
@@ -103,7 +103,9 @@ module Beni
103
103
  def define_vendor_clean_tasks
104
104
  desc "Remove unpacked vendor toolchains (keeps cached tarballs)"
105
105
  task :clean do
106
- vendor_toolchains.each { |toolchain| FileUtils.rm_rf(toolchain.final_dir) }
106
+ Vendor::TOOLCHAIN_FACTORIES.each_key do |name|
107
+ FileUtils.rm_rf(File.join(configuration.vendor_dir, Vendor.staged_dir(name)))
108
+ end
107
109
  end
108
110
 
109
111
  desc "Remove #{configuration.vendor_dir} entirely (unpacked trees and cached tarballs)"
@@ -32,14 +32,18 @@ module Beni
32
32
  end
33
33
 
34
34
  # Fetch +url+ into +dest+ atomically via a +.part+ sidecar, retrying
35
- # transient failures with exponential backoff. Permanent failures
36
- # (4xx, DNS resolution failure on non-network condition) surface
35
+ # transient failures with exponential backoff. A 4xx surfaces
37
36
  # immediately. Raises whatever the underlying +URI#open+ raises after
38
- # the retry budget is exhausted.
37
+ # the retry budget is exhausted, leaving no +.part+ behind.
39
38
  def download
40
39
  FileUtils.mkdir_p(File.dirname(@dest))
41
40
  tmp = "#{@dest}.part"
42
- with_retry { fetch(tmp) }
41
+ begin
42
+ with_retry { fetch(tmp) }
43
+ rescue StandardError
44
+ FileUtils.rm_f(tmp)
45
+ raise
46
+ end
43
47
  File.rename(tmp, @dest)
44
48
  end
45
49
 
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Beni
4
+ # The build platform half of the vendor façade: how the host's
5
+ # +RUBY_PLATFORM+ names the platform toolchains key their tarballs by.
6
+ module Vendor
7
+ # +RUBY_PLATFORM+ spells the same architecture and operating system
8
+ # differently across hosts; toolchains key their per-platform tarballs
9
+ # by one spelling each.
10
+ ARCH_ALIASES = { "x64" => "x86_64", "amd64" => "x86_64", "aarch64" => "arm64" }.freeze
11
+ OS_ALIASES = { /darwin/ => "macos", /linux/ => "linux", /mingw|mswin/ => "windows" }.freeze
12
+
13
+ # The build platform: the architecture and operating system the Rake
14
+ # tasks run on, spelled the way toolchains key their tarballs. Derived
15
+ # from the host rather than matched against a covered set, so a host no
16
+ # toolchain vendors a tarball for still has a name to be named in.
17
+ def self.build_platform(platform = RUBY_PLATFORM)
18
+ "#{platform_arch(platform)}-#{platform_os(platform)}"
19
+ end
20
+
21
+ def self.platform_arch(platform)
22
+ arch = platform.split("-").first.to_s
23
+ ARCH_ALIASES.fetch(arch, arch)
24
+ end
25
+
26
+ def self.platform_os(platform)
27
+ OS_ALIASES.find { |pattern, _| pattern.match?(platform) }&.last ||
28
+ platform.split("-")[1].to_s
29
+ end
30
+
31
+ private_class_method :platform_arch, :platform_os
32
+
33
+ # The build platform, resolved once at load.
34
+ BUILD_PLATFORM = build_platform
35
+ end
36
+ end
@@ -18,6 +18,13 @@ module Beni
18
18
  # value short-circuits +#prepare+, a mismatch forces re-extract.
19
19
  VERSION_MARKER = ".beni-version"
20
20
 
21
+ # Version the last successful unpack into +dir+ recorded, or +nil+
22
+ # when the tree is absent or predates version stamping.
23
+ def self.staged_version(dir)
24
+ marker = File.join(dir, VERSION_MARKER)
25
+ File.read(marker).strip if File.exist?(marker)
26
+ end
27
+
21
28
  def initialize(tarball:, top_level_dir:, final_dir:, version:)
22
29
  @tarball = tarball
23
30
  @top_level_dir = top_level_dir
@@ -44,11 +51,10 @@ module Beni
44
51
 
45
52
  private
46
53
 
47
- # Version recorded by the last successful unpack, or +nil+ when the tree
48
- # is absent or predates version stamping (forcing a re-extract).
54
+ # Version recorded by the last successful unpack; +nil+ forces a
55
+ # re-extract.
49
56
  def installed_version
50
- marker = File.join(@final_dir, VERSION_MARKER)
51
- File.read(marker).strip if File.exist?(marker)
57
+ self.class.staged_version(@final_dir)
52
58
  end
53
59
 
54
60
  def extract_to_staging(staging)
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "fileutils"
4
+
3
5
  module Beni
4
6
  module Vendor
5
7
  # Declarative value object describing a tarball-style vendored
@@ -21,8 +23,8 @@ module Beni
21
23
  # stamped into +final_dir+ as the idempotency key
22
24
  # that detects a bump and forces a re-extract.
23
25
  # * +base_url+ — remote URL prefix; resolved through
24
- # +Beni::Vendor.base_url_for+ so test fixtures
25
- # can override via +BENI_VENDOR_BASE_URL+.
26
+ # +Beni::Vendor.base_url_for+, which a
27
+ # +BENI_VENDOR_BASE_URL+ mirror replaces.
26
28
  # * +tarball_name+ — filename joined to both +base_url+ (download)
27
29
  # and the +.cache+ directory (cache location).
28
30
  # * +top_level_dir+ — the single top-level directory produced when
@@ -37,7 +39,8 @@ module Beni
37
39
  # * +expected_sha256+ — the toolchain's selected checksum (resolved
38
40
  # by +Beni::Vendor+ from the built-in pair or a
39
41
  # consumer override); +nil+ falls to TOFU
40
- # sidecar pinning in +Checksum#verify_or_pin+.
42
+ # sidecar pinning in +Checksum#verify_or_pin+,
43
+ # and an +UnvendoredChecksum+ refuses setup.
41
44
  class Toolchain <
42
45
  Data.define(:name, :version_label, :base_url, :tarball_name, :top_level_dir, :vendor_dir, :staged_dir,
43
46
  :expected_sha256)
@@ -52,9 +55,8 @@ module Beni
52
55
  name.tr("-", "_").to_sym
53
56
  end
54
57
 
55
- # Resolved download URL. Honours the +BENI_VENDOR_BASE_URL+ test
56
- # fixture override at call time (not at construction time), so a
57
- # test can flip the env var after the Toolchain is built.
58
+ # Resolved download URL. Reads the +BENI_VENDOR_BASE_URL+ mirror at
59
+ # call time, not at construction time.
58
60
  def url
59
61
  "#{Vendor.base_url_for(base_url)}/#{tarball_name}"
60
62
  end
@@ -73,10 +75,10 @@ module Beni
73
75
  # Download the tarball into +tarball_path+ and verify its SHA256.
74
76
  # Intended as the body of the +file tarball_path+ rake task; the
75
77
  # task's mtime-based caching avoids re-downloading on a cache hit.
76
- # A tarball failing verification deliberately stays cached: a
77
- # checksum mismatch is an abort condition, never a re-download
78
- # trigger, and the cache-hit path re-fails it the same way.
78
+ # A toolchain with no checksum for the build platform is refused
79
+ # before anything downloads.
79
80
  def fetch
81
+ expected_checksum
80
82
  puts "[beni] downloading #{name} #{version_label} from #{url}"
81
83
  downloader.download
82
84
  verify
@@ -85,9 +87,13 @@ module Beni
85
87
  # Recompute the cached tarball's SHA256 and check it against
86
88
  # +expected_sha256+ (or pin via TOFU sidecar). Idempotent — safe
87
89
  # to call from both +file+ and +setup+ task bodies when the latter
88
- # depends on the former.
90
+ # depends on the former. A tarball failing verification leaves the
91
+ # cache, so the next setup downloads it again.
89
92
  def verify
90
- Checksum.new(tarball_path, expected_sha256).verify_or_pin
93
+ Checksum.new(tarball_path, expected_checksum).verify_or_pin
94
+ rescue Error
95
+ FileUtils.rm_f(tarball_path)
96
+ raise
91
97
  end
92
98
 
93
99
  # Verify the cached tarball, then unpack it into +final_dir+ via
@@ -106,6 +112,15 @@ module Beni
106
112
 
107
113
  private
108
114
 
115
+ # The checksum verification compares against, +nil+ for a TOFU pin;
116
+ # raises for a built-in pair lacking the build platform's checksum.
117
+ def expected_checksum
118
+ checksum = expected_sha256
119
+ raise Error, checksum.message if checksum.is_a?(UnvendoredChecksum)
120
+
121
+ checksum
122
+ end
123
+
109
124
  # The network boundary — tests override this to script the
110
125
  # download without opening a connection.
111
126
  def downloader
@@ -10,8 +10,9 @@ MRuby::Toolchain.new(:wasi) do |conf, _params|
10
10
  wasi_sdk = ENV["WASI_SDK_PATH"] || File.join(File.expand_path("..", MRUBY_ROOT), "wasi-sdk")
11
11
  bin = File.join(wasi_sdk, "bin")
12
12
  target_flags = ["--target=wasm32-wasip1", "--sysroot=#{File.join(wasi_sdk, "share", "wasi-sysroot")}"]
13
- # setjmp/longjmp via the wasm exception-handling mechanism: all
14
- # three flags must be present at both compile and link stages.
13
+ # setjmp/longjmp via the wasm exception-handling mechanism: these
14
+ # flags go to every compile and the link, and the link adds the
15
+ # setjmp library.
15
16
  sjlj_flags = ["-mllvm", "-wasm-enable-sjlj", "-mllvm", "-wasm-use-legacy-eh=false"]
16
17
 
17
18
  conf.toolchain :clang
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Beni
4
+ module Vendor
5
+ # The checksum a platform-keyed built-in pair lacks for the build
6
+ # platform. It stands in for the checksum until setup, which refuses
7
+ # it before anything downloads, so the tasks still load there.
8
+ class UnvendoredChecksum < Data.define(:name, :version, :platform)
9
+ def message
10
+ "[beni] #{name} #{version} vendors no tarball for build platform #{platform}; " \
11
+ "declare the toolchain with a version and sha256 for this platform"
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/beni/vendor.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "vendor/platform"
3
4
  require_relative "vendor/downloader"
4
5
  require_relative "vendor/checksum"
6
+ require_relative "vendor/unvendored_checksum"
5
7
  require_relative "vendor/tarball"
6
8
  require_relative "vendor/toolchain"
7
9
 
@@ -15,8 +17,7 @@ module Beni
15
17
  # tarball extraction in +Vendor::Tarball+, and the per-toolchain
16
18
  # pipeline composition in +Vendor::Toolchain+.
17
19
  #
18
- # Honors +BENI_VENDOR_BASE_URL+ to point downloads at a local fixture
19
- # during tests.
20
+ # Honors +BENI_VENDOR_BASE_URL+ to move every download to a mirror.
20
21
  module Vendor
21
22
  # ---- Built-in pairs ----------------------------------------------------
22
23
  # The version and checksum pair this release vendors per toolchain.
@@ -54,35 +55,6 @@ module Beni
54
55
  # mruby source rather than serving a target, and has no built-in pair.
55
56
  SELECTED_BY_DEFINITION = %w[prism].freeze
56
57
 
57
- # +RUBY_PLATFORM+ spells the same architecture and operating system
58
- # differently across hosts; toolchains key their per-platform tarballs
59
- # by one spelling each.
60
- ARCH_ALIASES = { "x64" => "x86_64", "amd64" => "x86_64", "aarch64" => "arm64" }.freeze
61
- OS_ALIASES = { /darwin/ => "macos", /linux/ => "linux", /mingw|mswin/ => "windows" }.freeze
62
-
63
- # The build platform: the architecture and operating system the Rake
64
- # tasks run on, spelled the way toolchains key their tarballs. Derived
65
- # from the host rather than matched against a covered set, so a host no
66
- # toolchain vendors a tarball for still has a name to be named in.
67
- def self.build_platform(platform = RUBY_PLATFORM)
68
- "#{platform_arch(platform)}-#{platform_os(platform)}"
69
- end
70
-
71
- def self.platform_arch(platform)
72
- arch = platform.split("-").first.to_s
73
- ARCH_ALIASES.fetch(arch, arch)
74
- end
75
-
76
- def self.platform_os(platform)
77
- OS_ALIASES.find { |pattern, _| pattern.match?(platform) }&.last ||
78
- platform.split("-")[1].to_s
79
- end
80
-
81
- private_class_method :platform_arch, :platform_os
82
-
83
- # The build platform, resolved once at load.
84
- BUILD_PLATFORM = build_platform
85
-
86
58
  # Known toolchain names mapped to their factory methods — the name
87
59
  # domain the DSL validates against and +Beni::Tasks+ dispatches on.
88
60
  TOOLCHAIN_FACTORIES = {
@@ -91,10 +63,16 @@ module Beni
91
63
  "prism" => :prism
92
64
  }.freeze
93
65
 
66
+ # Where a toolchain staging somewhere other than its own name under
67
+ # the vendor tree unpacks; every other one unpacks at its name.
68
+ STAGED_DIRS = {
69
+ "prism" => File.join("mruby", "mrbgems", "mruby-compiler", "lib", "prism")
70
+ }.freeze
71
+
94
72
  module_function
95
73
 
96
74
  def wasi_sdk(vendor_dir:, version: nil, sha256: nil)
97
- version ||= BUILT_IN_PAIRS.fetch("wasi-sdk").fetch(:version)
75
+ version ||= built_in_version("wasi-sdk")
98
76
  # The release tag carries the major version only; tarballs carry the
99
77
  # full version plus the platform.
100
78
  Toolchain.new(
@@ -109,7 +87,7 @@ module Beni
109
87
  end
110
88
 
111
89
  def mruby(vendor_dir:, version: nil, sha256: nil)
112
- version ||= BUILT_IN_PAIRS.fetch("mruby").fetch(:version)
90
+ version ||= built_in_version("mruby")
113
91
  Toolchain.new(
114
92
  name: "mruby",
115
93
  version_label: version,
@@ -133,14 +111,14 @@ module Beni
133
111
  tarball_name: "#{version}.tar.gz",
134
112
  top_level_dir: "prism-#{version}",
135
113
  vendor_dir: vendor_dir,
136
- staged_dir: File.join("mruby", "mrbgems", "mruby-compiler", "lib", "prism"),
114
+ staged_dir: staged_dir("prism"),
137
115
  expected_sha256: sha256
138
116
  )
139
117
  end
140
118
 
141
119
  # When BENI_VENDOR_BASE_URL is set, all tarballs are fetched from that
142
- # base URL (test fixture). The base URL must serve files named exactly
143
- # +tarball_name+ for each toolchain.
120
+ # mirror, which serves each toolchain's tarball under its exact
121
+ # +tarball_name+.
144
122
  def base_url_for(default)
145
123
  override = ENV.fetch("BENI_VENDOR_BASE_URL", nil)
146
124
  return default if override.nil? || override.empty?
@@ -148,24 +126,32 @@ module Beni
148
126
  override.chomp("/")
149
127
  end
150
128
 
129
+ # The version +name+'s built-in pair vendors.
130
+ def built_in_version(name)
131
+ BUILT_IN_PAIRS.fetch(name).fetch(:version)
132
+ end
133
+ private_class_method :built_in_version
134
+
135
+ # Where +name+ unpacks, relative to the vendor tree.
136
+ def staged_dir(name)
137
+ STAGED_DIRS.fetch(name, name)
138
+ end
139
+
151
140
  # The built-in checksum for +name+ at +version+: the build platform's
152
141
  # entry when the toolchain's checksums are platform-keyed, +nil+ for
153
142
  # any version other than the vendored one — mruby's TOFU pinning path.
154
143
  # A platform-keyed pair carrying no entry for +platform+ vendors no
155
- # tarball there, and says so rather than letting another platform's
156
- # checksum stand in.
144
+ # tarball there: the lookup answers an +UnvendoredChecksum+, which
145
+ # setup refuses, rather than letting another platform's checksum
146
+ # stand in.
157
147
  def built_in_sha256(name, version, platform = BUILD_PLATFORM)
158
148
  pair = BUILT_IN_PAIRS.fetch(name)
159
- return nil unless version == pair.fetch(:version)
149
+ return nil unless version == built_in_version(name)
160
150
 
161
151
  checksum = pair.fetch(:sha256)
162
152
  return checksum unless checksum.is_a?(Hash)
163
153
 
164
- checksum.fetch(platform) do
165
- raise Error, "[beni] #{name} #{version} vendors no tarball for build platform " \
166
- "#{platform}; declare the toolchain with a version and sha256 " \
167
- "for this platform"
168
- end
154
+ checksum.fetch(platform) { UnvendoredChecksum.new(name:, version:, platform:) }
169
155
  end
170
156
 
171
157
  # Write the gem-shipped wasi toolchain file into the staged mruby
data/lib/beni/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Beni
4
- VERSION = "0.25.0"
4
+ VERSION = "0.26.0"
5
5
  end
@@ -3,7 +3,5 @@ module Beni
3
3
  def self?.generate: (String dest, mruby_dir: String, version: String) -> String
4
4
 
5
5
  def self?.staged_default_config: (String mruby_dir, String version) -> String
6
-
7
- def self?.staged_version: (String mruby_dir) -> String?
8
6
  end
9
7
  end
data/sig/beni/builder.rbs CHANGED
@@ -3,6 +3,7 @@ module Beni
3
3
  DEFAULT_TARGETS: Array[String]
4
4
  ARCHIVE_PATH_KEY: String
5
5
  FLAGS_MAK: String
6
+ CLONED_GEMS_DIR: String
6
7
 
7
8
  attr_reader vendor_dir: String
8
9
  attr_reader build_config: String?
@@ -2,8 +2,8 @@ module Beni
2
2
  class SelectedToolchain
3
3
  attr_reader name: String
4
4
  attr_reader version: String
5
- attr_reader sha256: String?
5
+ attr_reader sha256: (String | Vendor::UnvendoredChecksum)?
6
6
 
7
- def initialize: (name: String, version: String, sha256: String?) -> void
7
+ def initialize: (name: String, version: String, sha256: (String | Vendor::UnvendoredChecksum)?) -> void
8
8
  end
9
9
  end
@@ -0,0 +1,13 @@
1
+ module Beni
2
+ module Vendor
3
+ ARCH_ALIASES: Hash[String, String]
4
+ OS_ALIASES: Hash[Regexp, String]
5
+ BUILD_PLATFORM: String
6
+
7
+ def self.build_platform: (?String platform) -> String
8
+
9
+ def self.platform_arch: (String platform) -> String
10
+
11
+ def self.platform_os: (String platform) -> String
12
+ end
13
+ end
@@ -3,6 +3,8 @@ module Beni
3
3
  class Tarball
4
4
  VERSION_MARKER: String
5
5
 
6
+ def self.staged_version: (String dir) -> String?
7
+
6
8
  @tarball: String
7
9
  @top_level_dir: String
8
10
  @final_dir: String
@@ -8,9 +8,9 @@ module Beni
8
8
  attr_reader top_level_dir: String
9
9
  attr_reader vendor_dir: String
10
10
  attr_reader staged_dir: String
11
- attr_reader expected_sha256: String?
11
+ attr_reader expected_sha256: (String | UnvendoredChecksum)?
12
12
 
13
- def initialize: (name: String, version_label: String, base_url: String, tarball_name: String, top_level_dir: String, vendor_dir: String, ?staged_dir: String, expected_sha256: String?) -> void
13
+ def initialize: (name: String, version_label: String, base_url: String, tarball_name: String, top_level_dir: String, vendor_dir: String, ?staged_dir: String, expected_sha256: (String | UnvendoredChecksum)?) -> void
14
14
 
15
15
  def task_name: () -> Symbol
16
16
 
@@ -28,6 +28,8 @@ module Beni
28
28
 
29
29
  private
30
30
 
31
+ def expected_checksum: () -> String?
32
+
31
33
  def downloader: () -> Downloader
32
34
  end
33
35
  end
@@ -0,0 +1,13 @@
1
+ module Beni
2
+ module Vendor
3
+ class UnvendoredChecksum
4
+ attr_reader name: String
5
+ attr_reader version: String
6
+ attr_reader platform: String
7
+
8
+ def initialize: (name: String, version: String, platform: String) -> void
9
+
10
+ def message: () -> String
11
+ end
12
+ end
13
+ end
data/sig/beni/vendor.rbs CHANGED
@@ -4,27 +4,23 @@ module Beni
4
4
 
5
5
  BUILT_IN_PAIRS: Hash[String, built_in_pair]
6
6
  DEPENDENCIES: Hash[String, Array[String]]
7
- ARCH_ALIASES: Hash[String, String]
8
- OS_ALIASES: Hash[Regexp, String]
9
- BUILD_PLATFORM: String
10
7
  TOOLCHAIN_FACTORIES: Hash[String, Symbol]
8
+ STAGED_DIRS: Hash[String, String]
11
9
  SELECTED_BY_DEFINITION: Array[String]
12
10
 
13
- def self.build_platform: (?String platform) -> String
11
+ def self?.wasi_sdk: (vendor_dir: String, ?version: String?, ?sha256: (String | UnvendoredChecksum)?) -> Toolchain
14
12
 
15
- def self.platform_arch: (String platform) -> String
16
-
17
- def self.platform_os: (String platform) -> String
18
-
19
- def self?.wasi_sdk: (vendor_dir: String, ?version: String?, ?sha256: String?) -> Toolchain
20
-
21
- def self?.mruby: (vendor_dir: String, ?version: String?, ?sha256: String?) -> Toolchain
13
+ def self?.mruby: (vendor_dir: String, ?version: String?, ?sha256: (String | UnvendoredChecksum)?) -> Toolchain
22
14
 
23
15
  def self?.prism: (vendor_dir: String, version: String, sha256: String) -> Toolchain
24
16
 
25
17
  def self?.base_url_for: (String default) -> String
26
18
 
27
- def self?.built_in_sha256: (String name, String version, ?String platform) -> String?
19
+ def self?.built_in_version: (String name) -> String
20
+
21
+ def self?.staged_dir: (String name) -> String
22
+
23
+ def self?.built_in_sha256: (String name, String version, ?String platform) -> (String | UnvendoredChecksum)?
28
24
 
29
25
  def self?.stage_wasi_toolchain_file: (vendor_dir: String) -> String
30
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beni
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aotokitsuruya
@@ -23,8 +23,8 @@ dependencies:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '13.0'
26
- description: Vendors mruby and builds libmruby.a through a Rake task library, with
27
- generated build configs for customization. Aims to grow into a full mruby dependency
26
+ description: Vendors mruby and builds its static archive through a Rake task library,
27
+ with generated build configs for customization. Aims to grow into a full mruby dependency
28
28
  manager.
29
29
  email:
30
30
  - contact@aotoki.me
@@ -50,11 +50,12 @@ files:
50
50
  - lib/beni/vendor.rb
51
51
  - lib/beni/vendor/checksum.rb
52
52
  - lib/beni/vendor/downloader.rb
53
+ - lib/beni/vendor/platform.rb
53
54
  - lib/beni/vendor/tarball.rb
54
55
  - lib/beni/vendor/toolchain.rb
55
56
  - lib/beni/vendor/toolchains/wasi.rake
57
+ - lib/beni/vendor/unvendored_checksum.rb
56
58
  - lib/beni/version.rb
57
- - scripts/cloud_setup.sh
58
59
  - sig/beni.rbs
59
60
  - sig/beni/build_config.rbs
60
61
  - sig/beni/builder.rbs
@@ -70,9 +71,10 @@ files:
70
71
  - sig/beni/vendor.rbs
71
72
  - sig/beni/vendor/checksum.rbs
72
73
  - sig/beni/vendor/downloader.rbs
74
+ - sig/beni/vendor/platform.rbs
73
75
  - sig/beni/vendor/tarball.rbs
74
76
  - sig/beni/vendor/toolchain.rbs
75
- - sig/patches/open-uri.rbs
77
+ - sig/beni/vendor/unvendored_checksum.rbs
76
78
  homepage: https://github.com/elct9620/beni
77
79
  licenses:
78
80
  - Apache-2.0
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Cloud session bootstrap
3
- # =======================
4
- #
5
- # A cloud session starts from a fresh VM holding nothing but a clone, so
6
- # everything the task surface expects from a working checkout is rebuilt
7
- # here. A local checkout keeps its own, so the script stops unless it is
8
- # running in the cloud.
9
- set -euo pipefail
10
-
11
- [ "${CLAUDE_CODE_REMOTE:-}" = "true" ] || exit 0
12
-
13
- cd "$CLAUDE_PROJECT_DIR"
14
-
15
- # The default rake task and every hook run through bundler.
16
- bundle check >/dev/null 2>&1 || bundle install
17
-
18
- # The coverage measure reads its inventory from the vendored mruby headers,
19
- # and the session's egress serves the git protocol but not source archives —
20
- # so the source arrives by clone here, at the gem's default version.
21
- if [ ! -d vendor/mruby ]; then
22
- version="$(ruby -Ilib -rbeni/vendor -e 'print Beni::Vendor::BUILT_IN_PAIRS.fetch("mruby").fetch(:version)')"
23
- GIT_LFS_SKIP_SMUDGE=1 git -c advice.detachedHead=false clone --quiet --depth 1 \
24
- --branch "$version" https://github.com/mruby/mruby.git vendor/mruby
25
- fi
@@ -1,10 +0,0 @@
1
- # Patch: rbs' open-uri stdlib signatures only cover the module function
2
- # +URI.open+; the instance form +URI::Generic#open+ (mixed in via
3
- # +OpenURI::OpenRead+ for http/https/ftp URIs at runtime) is missing.
4
- # Declared here so +Beni::Vendor::Downloader#download+ type-checks.
5
- module URI
6
- class Generic
7
- def open: (?String mode) -> (StringIO & OpenURI::Meta)
8
- | [T] (?String mode) { (StringIO | Tempfile) -> T } -> T
9
- end
10
- end