File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
lib/ruby_wasm/build_system/product Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ BUILDS = [
45
45
46
46
LIB_ROOT = File . dirname ( __FILE__ )
47
47
48
+ TOOLCHAINS = { }
49
+
48
50
namespace :build do
49
51
BUILDS . each do |params |
50
52
name = "#{ params [ :src ] } -#{ params [ :target ] } -#{ params [ :profile ] } "
@@ -60,6 +62,9 @@ namespace :build do
60
62
srcdir = File . join ( LIB_ROOT , "ext" , ext )
61
63
RubyWasm ::CrossRubyExtProduct . new ( srcdir , toolchain )
62
64
end
65
+ unless TOOLCHAINS . key? toolchain . name
66
+ TOOLCHAINS [ toolchain . name ] = toolchain
67
+ end
63
68
end
64
69
end
65
70
end
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ class WasiVfsProduct < BuildProduct
9
9
10
10
def initialize ( build_dir )
11
11
@build_dir = build_dir
12
+ @cli_path = ENV [ "WASI_VFS_CLI" ] || Toolchain . find_path ( "wasi-vfs" )
13
+ @need_fetch_cli = @cli_path . nil?
14
+ @cli_path ||= File . join ( cli_product_build_dir , "wasi-vfs" )
12
15
end
13
16
14
17
def lib_product_build_dir
@@ -32,7 +35,7 @@ def cli_product_build_dir
32
35
end
33
36
34
37
def cli_bin_path
35
- ENV [ "WASI_VFS_CLI" ] || File . join ( cli_product_build_dir , "wasi-vfs" )
38
+ @cli_path
36
39
end
37
40
38
41
def name
@@ -60,7 +63,7 @@ def define_task
60
63
sh "curl -L -o #{ zipfiel } #{ self . cli_download_url } "
61
64
sh "unzip #{ zipfiel } -d #{ cli_product_build_dir } "
62
65
end
63
- cli_install_deps = ENV [ "WASI_VFS_CLI" ] ? [ ] : [ cli_bin_path ]
66
+ cli_install_deps = @need_fetch_cli ? [ cli_bin_path ] : [ ]
64
67
@cli_install_task = task "wasi-vfs-cli:install" => cli_install_deps
65
68
end
66
69
Original file line number Diff line number Diff line change @@ -9,12 +9,18 @@ WAPM_PACKAGES = [
9
9
]
10
10
11
11
namespace :npm do
12
+ wasi_vfs = RubyWasm ::WasiVfsProduct . new ( "build" )
13
+ wasi_vfs . define_task
14
+ tools = {
15
+ "WASI_VFS_CLI" => wasi_vfs . cli_bin_path ,
16
+ "WASMOPT" => TOOLCHAINS [ "wasi-sdk" ] . wasm_opt ,
17
+ }
12
18
NPM_PACKAGES . each do |pkg |
13
19
base_dir = Dir . pwd
14
20
pkg_dir = "#{ Dir . pwd } /packages/npm-packages/#{ pkg [ :name ] } "
15
21
16
22
desc "Build npm package #{ pkg [ :name ] } "
17
- task pkg [ :name ] => [ "build:#{ pkg [ :build ] } " ] do
23
+ task pkg [ :name ] => [ "build:#{ pkg [ :build ] } " , wasi_vfs . cli_install_task ] do
18
24
sh "npm ci" , chdir : pkg_dir
19
25
sh "#{ pkg_dir } /build-package.sh #{ base_dir } /rubies/#{ pkg [ :build ] } "
20
26
sh "npm pack" , chdir : pkg_dir
You can’t perform that action at this time.
0 commit comments