-
Notifications
You must be signed in to change notification settings - Fork 2
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 #16 from wacker-dev/build
Use bash script instead of build script to manage wit dependencies
- Loading branch information
Showing
6 changed files
with
51 additions
and
40 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
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,47 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Script to re-vendor the WIT files. | ||
# | ||
# This script is also executed on CI to ensure that everything is up-to-date. | ||
set -ex | ||
|
||
# The make_vendor function takes a base path (e.g., "wasi") and a list | ||
# of packages in the format "name@tag". It constructs the full destination | ||
# path, downloads the tarballs from GitHub, extracts the relevant files, and | ||
# removes any unwanted directories. | ||
make_vendor() { | ||
local packages=$1 | ||
local path="waki/wit/deps" | ||
|
||
rm -rf $path | ||
mkdir -p $path | ||
|
||
for package in $packages; do | ||
IFS='@' read -r repo tag <<< "$package" | ||
mkdir -p $path/$repo | ||
cached_extracted_dir="$cache_dir/$repo-$tag" | ||
|
||
if [[ ! -d $cached_extracted_dir ]]; then | ||
mkdir -p $cached_extracted_dir | ||
curl -sL https://github.com/WebAssembly/wasi-$repo/archive/$tag.tar.gz | \ | ||
tar xzf - --strip-components=1 -C $cached_extracted_dir | ||
rm -rf $cached_extracted_dir/wit/deps* | ||
fi | ||
|
||
cp -r $cached_extracted_dir/wit/* $path/$repo | ||
done | ||
} | ||
|
||
cache_dir=$(mktemp -d) | ||
|
||
make_vendor " | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
" | ||
|
||
rm -rf $cache_dir |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.