-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #308 from ruby/pr-83d6a25e8fc9b4178f125b1878fecc2f…
…b96d1117 Introduce rbs-based type check
- Loading branch information
Showing
9 changed files
with
303 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ group :development do | |
gem "rake" | ||
gem "syntax_tree", "~> 3.5" | ||
gem "webrick" | ||
gem "steep" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
D = Steep::Diagnostic | ||
|
||
target :lib do | ||
signature "sig" | ||
|
||
check "lib" | ||
# RBS's stdlib signatures don't have rake signatures yet. | ||
ignore "lib/ruby_wasm/rake_task.rb" | ||
|
||
library "digest" | ||
library "tmpdir" | ||
library "fileutils" | ||
library "open-uri" | ||
library "uri" | ||
|
||
configure_code_diagnostics(D::Ruby.default) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# TODO: Upstream OpenURI sigs to rbs/stdlib | ||
module OpenURI | ||
def self.open_uri: [T] (*untyped, **untyped) { (untyped) -> T } -> T | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,257 @@ | ||
module RubyWasm | ||
VERSION: String | ||
|
||
class BuildParams | ||
attr_accessor name: String | ||
attr_accessor target: String | ||
attr_accessor default_exts: String | ||
end | ||
|
||
class BuildProduct | ||
def name: -> String | ||
end | ||
|
||
class AutoconfProduct < BuildProduct | ||
@target: String | ||
@toolchain: Toolchain | ||
|
||
def initialize: (String target, Toolchain toolchain) -> void | ||
def system_triplet_args: -> Array[String] | ||
| -> Array[String] | ||
def tools_args: -> Array[String] | ||
| -> Array[String] | ||
def configure_args: -> Array[String] | ||
| -> Array[String] | ||
end | ||
|
||
class BuildSource < BuildProduct | ||
@params: Hash[untyped, untyped] | ||
@build_dir: String | ||
|
||
def initialize: (untyped params, String build_dir) -> void | ||
def name: -> String | ||
def cache_key: (Digest::SHA256 digest) -> void | ||
def src_dir: -> String | ||
def configure_file: -> String | ||
def fetch: (BuildExecutor executor) -> void | ||
def build: (BuildExecutor executor) -> void | ||
end | ||
|
||
class BaseRubyProduct < BuildProduct | ||
@build_dir: String | ||
@source: BuildSource | ||
@channel: String | ||
|
||
def initialize: (String build_dir, BuildSource source) -> void | ||
def product_build_dir: -> String | ||
def install_dir: -> String | ||
def name: -> String | ||
def build: (BuildExecutor executor) -> void | ||
end | ||
|
||
class ZlibProduct < AutoconfProduct | ||
ZLIB_VERSION: String | ||
@build_dir: String | ||
|
||
attr_reader target: String | ||
def initialize: (String build_dir, String target, Toolchain toolchain) -> void | ||
def product_build_dir: -> String | ||
def destdir: -> String | ||
def install_root: -> String | ||
def name: -> String | ||
def configure_args: -> Array[String] | ||
def build: (BuildExecutor executor) -> void | ||
end | ||
|
||
class LibYAMLProduct < AutoconfProduct | ||
LIBYAML_VERSION: String | ||
@build_dir: String | ||
|
||
attr_reader target: String | ||
def initialize: (String build_dir, String target, Toolchain toolchain) -> void | ||
def product_build_dir: -> String | ||
def destdir: -> String | ||
def install_root: -> String | ||
def name: -> String | ||
def build: (BuildExecutor executor) -> void | ||
end | ||
|
||
class OpenSSLProduct < AutoconfProduct | ||
OPENSSL_VERSION: String | ||
@build_dir: String | ||
|
||
attr_reader target: String | ||
def initialize: (String build_dir, String target, Toolchain toolchain) -> void | ||
def product_build_dir: -> String | ||
def destdir: -> String | ||
def install_root: -> String | ||
def name: -> String | ||
def configure_args: -> Array[String] | ||
def build: (BuildExecutor executor) -> void | ||
end | ||
|
||
class WasiVfsProduct < BuildProduct | ||
WASI_VFS_VERSION: String | ||
@build_dir: String | ||
@need_fetch_lib: bool | ||
@cli_path: String | ||
@need_fetch_cli: bool | ||
|
||
def initialize: (String build_dir) -> void | ||
def lib_product_build_dir: -> String | ||
def lib_wasi_vfs_a: -> String | ||
def cli_product_build_dir: -> String | ||
def cli_bin_path: -> String | ||
def name: -> String | ||
def build: (BuildExecutor executor) -> void | ||
def install_cli: -> bool? | ||
def cli_download_url: -> String | ||
end | ||
|
||
class CrossRubyExtProduct < BuildProduct | ||
@toolchain: Toolchain | ||
@srcdir: String | ||
|
||
attr_reader name: String | ||
def initialize: (String srcdir, Toolchain toolchain, ?name: nil) -> void | ||
def product_build_dir: (CrossRubyProduct crossruby) -> String | ||
def linklist: (CrossRubyProduct crossruby) -> String | ||
def make_args: (CrossRubyProduct crossruby) -> Array[String] | ||
def build: (BuildExecutor executor, CrossRubyProduct crossruby) -> void | ||
def do_extconf: (BuildExecutor executor, CrossRubyProduct crossruby) -> void | ||
def do_install_rb: (BuildExecutor executor, CrossRubyProduct crossruby) -> void | ||
def cache_key: (Digest::SHA256 digest) -> void | ||
end | ||
|
||
class CrossRubyProduct < AutoconfProduct | ||
@params: BuildParams | ||
@rubies_dir: String | ||
@build_dir: String | ||
@baseruby: BaseRubyProduct | ||
@libyaml: LibYAMLProduct | ||
@zlib: ZlibProduct | ||
@openssl: OpenSSLProduct | ||
@wasi_vfs: WasiVfsProduct | ||
|
||
attr_reader source: BuildSource | ||
attr_reader toolchain: Toolchain | ||
attr_accessor user_exts: Array[CrossRubyExtProduct] | ||
attr_accessor wasmoptflags: Array[String] | ||
attr_accessor cppflags: Array[String] | ||
attr_accessor cflags: Array[String] | ||
attr_accessor ldflags: Array[String] | ||
attr_accessor debugflags: Array[String] | ||
attr_accessor xcflags: Array[String] | ||
attr_accessor xldflags: Array[String] | ||
def initialize: (BuildParams params, String build_dir, String rubies_dir, BaseRubyProduct baseruby, BuildSource source, Toolchain toolchain, ?user_exts: Array[CrossRubyExtProduct]) -> void | ||
def configure: (BuildExecutor executor, ?reconfigure: bool) -> void | ||
def build_exts: (BuildExecutor executor) -> bool? | ||
def build: (BuildExecutor executor, ?remake: bool, ?reconfigure: bool) -> bool? | ||
def clean: (BuildExecutor executor) -> void | ||
def name: -> String | ||
def cache_key: (Digest::SHA256 digest) -> void | ||
def build_dir: -> String | ||
def ext_build_dir: -> String | ||
def with_libyaml: (LibYAMLProduct libyaml) -> LibYAMLProduct | ||
def with_zlib: (ZlibProduct zlib) -> ZlibProduct | ||
def with_wasi_vfs: (WasiVfsProduct wasi_vfs) -> WasiVfsProduct | ||
def with_openssl: (OpenSSLProduct openssl) -> OpenSSLProduct | ||
def dest_dir: -> String | ||
def artifact: -> String | ||
def extinit_obj: -> String | ||
def extinit_c_erb: -> String | ||
def baseruby_path: -> String | ||
def configure_args: (String build_triple, Toolchain toolchain) -> Array[String] | ||
end | ||
|
||
class WitBindgen | ||
@build_dir: String | ||
@tool_dir: String | ||
@revision: String | ||
|
||
attr_reader bin_path: String | ||
def initialize: (build_dir: String, ?revision: String) -> void | ||
def install: -> void | ||
end | ||
|
||
class Toolchain | ||
@tools: Hash[untyped, untyped] | ||
@tools_cache: Hash[untyped, untyped] | ||
|
||
attr_reader name: String | ||
def initialize: -> void | ||
def find_tool: (Symbol name) -> bot | ||
def check_envvar: (untyped name) -> nil | ||
def self.get: (String target, ?String? build_dir) -> (Toolchain) | ||
def self.find_path: (String command) -> String? | ||
def self.check_executable: (String command) -> String | ||
def cc: -> nil | ||
def ranlib: -> nil | ||
def ld: -> nil | ||
def ar: -> nil | ||
|
||
def install: -> void | ||
end | ||
|
||
class WASISDK < Toolchain | ||
@wasm_opt_path: String | ||
@need_fetch_wasi_sdk: bool | ||
@need_fetch_binaryen: bool | ||
@tools: Hash[Symbol, String] | ||
@wasi_sdk_path: String | ||
@binaryen_version: Integer | ||
@version_major: Integer | ||
@version_minor: Integer | ||
@binaryen_path: String | ||
|
||
def initialize: (?String? wasi_sdk_path, ?build_dir: String?, ?version_major: Integer, ?version_minor: Integer, ?binaryen_version: Integer) -> void | ||
def find_tool: (Symbol name) -> String | ||
def wasm_opt: -> String | ||
def wasi_sdk_path: -> String | ||
def download_url: (Integer? version_major, Integer? version_minor) -> String | ||
def binaryen_download_url: (Integer? version) -> String | ||
def install_wasi_sdk: -> void | ||
def install_binaryen: -> void | ||
end | ||
|
||
class Emscripten < Toolchain | ||
@tools: Hash[Symbol, String] | ||
|
||
def initialize: -> void | ||
def find_tool: (Symbol name) -> String | ||
end | ||
|
||
class BuildExecutor | ||
def system: (*untyped, **untyped) -> bool? | ||
def rm_rf: (FileUtils::pathlist list) -> void | ||
def rm_f: (FileUtils::pathlist list) -> void | ||
def cp_r: (FileUtils::pathlist src, path dest) -> void | ||
def mv: (FileUtils::pathlist src, path dest) -> void | ||
def mkdir_p: (FileUtils::pathlist list) -> void | ||
def write: (String path, _ToS data) -> void | ||
end | ||
|
||
class Downloader | ||
def format_size: (Integer size) -> String | ||
|
||
def download: (String url, String dest, String message) -> void | ||
end | ||
|
||
class BuildTask | ||
@build_dir: String | ||
@rubies_dir: String | ||
@openssl: OpenSSLProduct | ||
|
||
attr_accessor name: String | ||
attr_reader source: BuildSource | ||
attr_reader target: String | ||
attr_reader toolchain: Toolchain | ||
attr_reader libyaml: LibYAMLProduct | ||
attr_reader zlib: ZlibProduct | ||
attr_reader wasi_vfs: WasiVfsProduct | ||
attr_reader baseruby: BaseRubyProduct | ||
attr_reader crossruby: CrossRubyProduct | ||
def initialize: (String name, target: String, src: untyped, ?toolchain: Toolchain?, ?build_dir: String?, ?rubies_dir: String?, **untyped) -> void | ||
def hexdigest: -> String | ||
end | ||
end |