Skip to content

Commit 5af0e96

Browse files
Fix type checks
1 parent 9557d17 commit 5af0e96

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

Steepfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ target :lib do
1919
library "logger"
2020
library "pathname"
2121
library "forwardable"
22-
library "net/http"
2322

2423
configure_code_diagnostics(D::Ruby.default)
2524
end

lib/ruby_wasm/build/executor.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,11 @@ def _print_command(args, env)
149149

150150
class SilentExecutor
151151
def system(*args, chdir: nil, env: nil)
152+
# @type var kwargs: Hash[Symbol, untyped]
152153
kwargs = {}
153154
kwargs[:chdir] = chdir if chdir
154155
kwargs[:exception] = true
155-
env ? Kernel.system(env, *args, **kwargs) : Kernel.system(*args, **kwargs)
156+
__skip__ = env ? Kernel.system(env, *args, **kwargs) : Kernel.system(*args, **kwargs)
156157
end
157158
end
158159

lib/ruby_wasm/build/toolchain.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def download_url
149149
# @type var url: URI::HTTPS
150150
url = URI.parse(url_str)
151151
ok =
152-
Net::HTTP.start(
152+
__skip__ = Net::HTTP.start(
153153
url.host,
154154
url.port,
155155
use_ssl: url.scheme == "https"

lib/ruby_wasm/cli.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,15 @@ def compute_build_alias(options)
214214
end
215215
# FIXME: We should have a way to specify extensions to be included by users.
216216
# For now, assume all default extensions available in the head revision are available.
217+
# @type var patches: Array[String]
218+
patches = []
217219
return(
218220
{
219221
name: "local",
220222
src: {
221223
type: "local",
222224
path: src_name,
223-
patches: []
225+
patches: patches
224226
},
225227
all_default_exts: RubyWasm::Packager::ALL_DEFAULT_EXTS
226228
}

sig/ruby_wasm/build.rbs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ module RubyWasm
249249
def ld: -> String
250250
def ar: -> String
251251

252-
def install: -> void
252+
def install: (_CommandExecutor executor) -> void
253253
end
254254

255255
class WASISDK < Toolchain
@@ -265,9 +265,8 @@ module RubyWasm
265265
def wasm_opt: -> String
266266
def wasi_sdk_path: -> String
267267
def download_url: () -> String
268-
def binaryen_download_url: (Integer? version) -> String
269-
def install_wasi_sdk: -> void
270-
def install_binaryen: -> void
268+
def install_wasi_sdk: (_CommandExecutor executor) -> void
269+
def install: (_CommandExecutor executor) -> void
271270
end
272271

273272
class Binaryen
@@ -280,8 +279,8 @@ module RubyWasm
280279
def wasm_opt: -> String
281280
def binaryen_path: -> String
282281
def binaryen_version: -> Integer
283-
def download_url: (Integer? version) -> String
284-
def install: -> void
282+
def download_url: (Integer version) -> String
283+
def install: (_CommandExecutor executor) -> void
285284
end
286285

287286
class Emscripten < Toolchain
@@ -291,7 +290,12 @@ module RubyWasm
291290
def find_tool: (Symbol name) -> String
292291
end
293292

293+
interface _CommandExecutor
294+
def system: (*_ToS args, ?chdir: String?, ?env: Hash[String, String]?) -> void
295+
end
296+
294297
class BuildExecutor
298+
include _CommandExecutor
295299
@verbose: bool
296300
@github_actions_markup: bool
297301
@process_count: Integer
@@ -300,7 +304,6 @@ module RubyWasm
300304
attr_reader process_count: Integer
301305

302306
def initialize: (?verbose: bool) -> void
303-
def system: (*_ToS args, ?chdir: String?, ?env: Hash[String, String]?) -> void
304307
def rm_rf: (FileUtils::pathlist list) -> void
305308
def rm_f: (FileUtils::pathlist list) -> void
306309
def cp_r: (FileUtils::pathlist src, path dest) -> void
@@ -315,6 +318,10 @@ module RubyWasm
315318
private def _print_command: (Array[_ToS] command, Hash[String, String]? env) -> void
316319
end
317320

321+
class SilentExecutor
322+
include _CommandExecutor
323+
end
324+
318325
class StatusPrinter
319326
@mutex: Mutex
320327
@counter: Integer

sig/ruby_wasm/cli.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ module RubyWasm
3838
private
3939

4040
def build_config: (cli_options options) -> Packager::build_config
41-
def compute_build_source: (cli_options options) -> [Packager::build_source, String?]
42-
def self.build_source_aliases: (string root) -> Hash[string, Packager::build_source]
41+
def compute_build_alias: (cli_options options) -> Packager::build_config
42+
def self.build_config_aliases: (string root) -> Hash[string, Packager::build_config]
4343
def self.bundled_patches_path: () -> string
4444
def root: () -> string
4545

sig/ruby_wasm/packager.rbs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,9 @@ class RubyWasm::Packager
1313
type: "local",
1414
path: String,
1515
}
16-
type build_source = (build_source_github | build_source_tarball | build_source_local) & {
17-
name: string,
18-
patches: Array[String],
19-
}
16+
type build_source = untyped
2017

21-
type build_config = {
22-
target: String,
23-
src: RubyWasm::Packager::build_source,
24-
default_exts: String,
25-
suffix: String,
26-
gem_home: String?,
27-
}
18+
type build_config = untyped
2819

2920
type bytes = String
3021

0 commit comments

Comments
 (0)