Skip to content

Commit

Permalink
Merge #3355
Browse files Browse the repository at this point in the history
3355: Fetch the pirita download URL r=syrusakbary a=Michael-F-Bryan

Add some more queries to the `wasmer-registry` crate.

I've also had to remove `lib/wasi-types/wit-bindgen` because it's a broken link to use `wai-bindgen` from crates.io, otherwise you get the following error when trying to use `wasmerio/wasmer` as a git dependency (I had to temporarily patch my `wasmer-registry` from crates.io in wasmerio/pirita#62 to see if this PR would work).

```
    Updating git repository `https://github.com/wasmerio/wasmer`
error: failed to load source for dependency `wasmer-registy`

Caused by:
  Unable to update https://github.com/wasmerio/wasmer?branch=more-queries

Caused by:
  failed to update submodule `lib/wasi-types/wit-bindgen`

Caused by:
  no URL configured for submodule 'lib/wasi-types/wit-bindgen'; class=Submodule (17)
```

Co-authored-by: Michael-F-Bryan <michael@wasmer.io>
  • Loading branch information
bors[bot] and Michael-F-Bryan authored Nov 23, 2022
2 parents f247db8 + c1b2b08 commit a22b50a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion lib/registry/graphql/queries/get_package_by_command.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ query GetPackageByCommandQuery ($commandName: String!) {
manifest
distribution {
downloadUrl
piritaDownloadUrl
}
package {
displayName
}
}
}
}
}
3 changes: 2 additions & 1 deletion lib/registry/graphql/queries/get_package_version.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ query GetPackageVersionQuery ($name: String!, $version: String) {
isLastVersion
distribution {
downloadUrl
piritaDownloadUrl
}
manifest
}
}
}
4 changes: 4 additions & 0 deletions lib/registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub struct PackageDownloadInfo {
pub commands: String,
pub manifest: String,
pub url: String,
pub pirita_url: Option<String>,
}

pub fn get_package_local_dir(
Expand Down Expand Up @@ -317,6 +318,7 @@ pub fn query_command_from_registry(
let package = command.package_version.package.display_name;
let version = command.package_version.version;
let url = command.package_version.distribution.download_url;
let pirita_url = command.package_version.distribution.pirita_download_url;

Ok(PackageDownloadInfo {
registry: registry_url.to_string(),
Expand All @@ -326,6 +328,7 @@ pub fn query_command_from_registry(
manifest: command.package_version.manifest,
commands: command_name.to_string(),
url,
pirita_url,
})
}

Expand Down Expand Up @@ -612,6 +615,7 @@ pub fn query_package_from_registry(
.join(", "),

url: v.distribution.download_url.clone(),
pirita_url: v.distribution.pirita_download_url.clone(),
})
}

Expand Down
9 changes: 3 additions & 6 deletions lib/wasi-types/regenerate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ rm -f \

cat "$BASEDIR"/wit-clean/typenames.wit "$BASEDIR"/wit-clean/wasi_unstable.wit > "$BASEDIR"/wit-clean/output.wit

git clone https://github.com/wasmerio/wit-bindgen --branch force-generate-structs --single-branch
cargo install --force wai-bindgen
git pull origin force-generate-structs
cd wit-bindgen
cargo build
cd ..

./wit-bindgen/target/debug/wit-bindgen rust-wasm \
wai-bindgen rust-wasm \
--import "$BASEDIR"/wit-clean/output.wit \
--force-generate-structs \
--out-dir "$BASEDIR"/src/wasi \
Expand All @@ -30,4 +27,4 @@ pwd
`pwd`/target/debug/wasi-types-generator-extra
cd ..

cargo fmt --all
cargo fmt --all
1 change: 0 additions & 1 deletion lib/wasi-types/wit-bindgen
Submodule wit-bindgen deleted from 095d29

0 comments on commit a22b50a

Please sign in to comment.