Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 11-07-update-sns-aggregator
Browse files Browse the repository at this point in the history
bitdivine authored Nov 8, 2023
2 parents 347eff3 + 10f86e3 commit caa6d1c
Showing 6 changed files with 77 additions and 50 deletions.
12 changes: 12 additions & 0 deletions .github/actions/install_binstall/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Installs binstall'
description: |
Installs `cargo binstall` at the version specified in `bin/versions.bash`
runs:
using: "composite"
steps:
- name: Install binstall
shell: bash
run: |
. bin/versions.bash
curl -L --proto '=https' --tlsv1.2 -sSf "https://github.com/cargo-bins/cargo-binstall/releases/download/v${BINSTALL_VERSION}/cargo-binstall-x86_64-unknown-linux-musl.tgz" | tar -xvzf -
./cargo-binstall -y --force "cargo-binstall@$BINSTALL_VERSION"
12 changes: 10 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -60,8 +60,12 @@ jobs:
- uses: actions/checkout@v3
- name: Install apt-dependencies
run: sudo apt-get update && sudo apt-get install moreutils -yy && command -v more
- name: Install cargo binstall
uses: ./.github/actions/install_binstall
- name: Install tools
run: ./bin/dfx-software-wasm-nm-install
run: |
. bin/versions.bash
cargo binstall --force --no-confirm "ic-wasm@${IC_WASM_VERSION}"
- name: "Test the sns aggregator version command"
run: ./bin/dfx-software-sns-aggregator-version.test
env:
@@ -117,8 +121,12 @@ jobs:
run: ./bin/dfx-software-nns-dapp-version.test
env:
GH_TOKEN: ${{ github.token }}
- name: Install cargo binstall
uses: ./.github/actions/install_binstall
- name: Install tools
run: ./bin/dfx-software-wasm-nm-install
run: |
. bin/versions.bash
cargo binstall --force --no-confirm "ic-wasm@${IC_WASM_VERSION}"
- name: "Test the nns-dapp url command"
run: ./bin/dfx-software-nns-dapp-ci-wasm-url.test
env:
2 changes: 1 addition & 1 deletion bin/dfx-canister-nm
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ source "$SOURCE_DIR/clap.bash"
source "$(clap.build)"

# The only meaningful export from canister wasms is function names.
canister_nm=(wasm-nm -je)
canister_nm=(wasm-nm -j -e)

canister_wasm="$1"
case "$(file "$canister_wasm")" in
47 changes: 0 additions & 47 deletions bin/dfx-software-wasm-nm-install

This file was deleted.

2 changes: 2 additions & 0 deletions bin/versions.bash
Original file line number Diff line number Diff line change
@@ -8,3 +8,5 @@ NNS_DAPP_RELEASE=proposal-121690
DIDC_VERSION=2023-07-25
QUILL_VERSION=0.4.0
IDL2JSON_VERSION=0.8.5
BINSTALL_VERSION=1.3.0
IC_WASM_VERSION=0.6.0
52 changes: 52 additions & 0 deletions bin/wasm-nm
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -euo pipefail
SOURCE_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
PATH="$SOURCE_DIR:$PATH"

print_help() {
cat <<-EOF
Polyfill for the now outdated wasm-nm.
Supports only:
wasm-nm -e SOMEFILE.wasm
wasm-nm -e -j SOMEFILE.wasm
Note: ic-wasm now provides much the same information, but not in a very machine-readable format.
EOF
}

# Source the clap.bash file ---------------------------------------------------
source "$SOURCE_DIR/clap.bash"
# Define options
clap.define short=e long=export desc="Display only export symbols." variable=ONLY_EXPORT nargs=0
clap.define short=j long=export desc="Just display the symbol names (no type)." variable=NO_TYPE nargs=0
# Source the output file ----------------------------------------------------------
source "$(clap.build)"

(($# == 1)) || {
echo "ERROR: Please provide the Wasm filename as a positional argument, like this:"
echo " wasm-nm -e my-file.wasm"
exit 1
} >&2

WASM_FILENAME="${1:-}"

export_symbols() {
ic-wasm "${WASM_FILENAME:-}" info | sed -nE '/^Exported methods:/,/^]/p' | sed '1d;$d' | sed -E 's/.*"(.*)",/\1/;s/ *\(.*//g' | {
if [[ "${NO_TYPE:-}" == "true" ]]; then
cat
else
sed 's/^/e /g'
fi
}
}

if [[ "${ONLY_EXPORT}" == "true" ]]; then
export_symbols
else
{
echo "ERROR: Action not supported, sorry."
exit 1
} >&2
fi

0 comments on commit caa6d1c

Please sign in to comment.