Skip to content

Commit

Permalink
Remove wasi-vfs CLI downloading code
Browse files Browse the repository at this point in the history
  • Loading branch information
kateinoigakukun committed Jan 4, 2024
1 parent 8d1a4c7 commit 4864614
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 40 deletions.
38 changes: 0 additions & 38 deletions lib/ruby_wasm/build/product/wasi_vfs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ class WasiVfsProduct < BuildProduct
def initialize(build_dir)
@build_dir = build_dir
@need_fetch_lib = ENV["LIB_WASI_VFS_A"].nil?
installed_cli_path =
ENV["WASI_VFS_CLI"] || Toolchain.find_path("wasi-vfs")
@need_fetch_cli = installed_cli_path.nil?
@cli_path =
installed_cli_path || File.join(cli_product_build_dir, "wasi-vfs")
end

def lib_product_build_dir
Expand All @@ -26,18 +21,6 @@ def lib_wasi_vfs_a
ENV["LIB_WASI_VFS_A"] || File.join(lib_product_build_dir, "libwasi_vfs.a")
end

def cli_product_build_dir
File.join(
@build_dir,
RbConfig::CONFIG["host"],
"wasi-vfs-#{WASI_VFS_VERSION}"
)
end

def cli_bin_path
@cli_path
end

def name
"wasi-vfs-#{WASI_VFS_VERSION}-#{RbConfig::CONFIG["host"]}"
end
Expand All @@ -58,26 +41,5 @@ def build(executor)
executor.mv File.join(tmpdir, "libwasi_vfs.a"), lib_wasi_vfs_a
end
end

def install_cli
return if !@need_fetch_cli || File.exist?(cli_bin_path)
FileUtils.mkdir_p cli_product_build_dir
zipfile = File.join(cli_product_build_dir, "wasi-vfs-cli.zip")
system "curl", "-L", "-o", zipfile, self.cli_download_url
system "unzip", zipfile, "-d", cli_product_build_dir
end

def cli_download_url
assets = [
[/x86_64-linux/, "wasi-vfs-cli-x86_64-unknown-linux-gnu.zip"],
[/x86_64-darwin/, "wasi-vfs-cli-x86_64-apple-darwin.zip"],
[/arm64e?-darwin/, "wasi-vfs-cli-aarch64-apple-darwin.zip"]
]
asset = assets.find { |os, _| os =~ RUBY_PLATFORM }&.at(1)
if asset.nil?
raise "unsupported platform for fetching wasi-vfs CLI: #{RUBY_PLATFORM}"
end
"https://github.com/kateinoigakukun/wasi-vfs/releases/download/v#{WASI_VFS_VERSION}/#{asset}"
end
end
end
2 changes: 0 additions & 2 deletions rakelib/packaging.rake
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ namespace :npm do

desc "Make tarball for npm package #{pkg[:name]}"
task pkg[:name] do
wasi_vfs.install_cli
wasi_sdk.install_binaryen
Rake::Task["npm:#{pkg[:name]}:build"].invoke
sh "npm pack", chdir: pkg_dir
Expand Down Expand Up @@ -137,7 +136,6 @@ namespace :standalone do

desc "Build standalone package #{pkg[:name]}"
task "#{pkg[:name]}" => ["build:#{pkg[:build]}"] do
wasi_vfs.install_cli
wasi_sdk.install_binaryen
base_dir = Dir.pwd
sh tools,
Expand Down

0 comments on commit 4864614

Please sign in to comment.