Skip to content

Commit

Permalink
kendall/main into main (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
KendallWeihe authored Apr 24, 2024
1 parent bf6241a commit b7ac054
Show file tree
Hide file tree
Showing 169 changed files with 20,870 additions and 757 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ Cargo.lock
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
*.pdb

# -- developer added

.hermit/
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# The format is described: https://github.blog/2017-07-06-introducing-code-owners/

# These owners will be the default owners for everything in the repo.
* @amika-sq
* @KendallWeihe @nitro-neal @kirahsapong @shamilovtim @diehuxx @decentralgabe


# -----------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[workspace]
members = [
"bindings/*",
members = [
"crates/*",
"bindings/uniffi",
"bindings/wasm",
]
default-members = [
"crates/*",
Expand All @@ -14,10 +15,9 @@ repository = "https://github.com/TBD54566975/web5-rs.git"
license-file = "LICENSE"

[workspace.dependencies]
base64 = "0.22.0"
chrono = { version = "0.4.37", features = ["std"] }
thiserror = "1.0.50"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
serde_with = "3.4.0"

# Update to released version once foreign traits are included (likely 0.26.0).
uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "7cd3aac735e905e1725d350a7a82d57aa50caaa1" }
67 changes: 67 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
set shell := ["bash", "-uc"]

build:
cargo build --release

test:
cargo test

lint:
cargo clippy --workspace
cargo fmt

bind:
just bind-ts
just bind-kotlin
just bind-swift

bind-ts:
cargo build --release --package web5-wasm
if ! command -v wasm-pack &> /dev/null; then cargo install wasm-pack; fi
wasm-pack build --target nodejs --out-dir ../../binded/ts/pkg bindings/wasm
rm binded/LICENSE
rm binded/ts/pkg/.gitignore

bind-kotlin:
cargo build --release --package web5-uniffi
cargo run --package web5-uniffi \
--bin uniffi-bindgen \
generate --library target/release/libweb5.dylib \
--language kotlin \
--out-dir target/bindgen-kotlin
cp target/release/libweb5.dylib binded/kt/src/main/resources/natives
cp target/bindgen-kotlin/web5/sdk/web5.kt binded/kt/src/main/kotlin/web5/sdk
cd binded/kt && ./fix-load.sh

bind-swift:
cargo build --release --package web5-uniffi
cargo run --package web5-uniffi \
--bin uniffi-bindgen \
generate --library target/release/libweb5.dylib \
--language swift \
--out-dir target/bindgen-swift
mkdir -p target/xcframework-staging
mv target/bindgen-swift/web5.swift binded/swift/Sources/UniFFI
mv target/bindgen-swift/web5FFI.modulemap target/xcframework-staging/module.modulemap
mv target/bindgen-swift/web5FFI.h target/xcframework-staging/
rm -rf binded/swift/libweb5-rs.xcframework
xcodebuild -create-xcframework \
-library target/release/libweb5.dylib \
-headers target/xcframework-staging \
-output binded/swift/libweb5-rs.xcframework

test-binded:
just test-ts
just test-kotlin
just test-swift

test-ts:
cd binded/ts && npm i && npm test

test-kotlin:
cd binded/kt && mvn clean test

test-swift:
cd binded/swift && \
swift package clean && \
swift test
1 change: 1 addition & 0 deletions bin/.just-1.23.0.pkg
1 change: 1 addition & 0 deletions bin/.maven-3.9.6.pkg
1 change: 1 addition & 0 deletions bin/.node-20.9.0.pkg
1 change: 1 addition & 0 deletions bin/.openjdk-17.0.8_7.pkg
1 change: 1 addition & 0 deletions bin/.python3-3.10.11.pkg
1 change: 1 addition & 0 deletions bin/.rustup-1.25.2.pkg
7 changes: 7 additions & 0 deletions bin/README.hermit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Hermit environment

This is a [Hermit](https://github.com/cashapp/hermit) bin directory.

The symlinks in this directory are managed by Hermit and will automatically
download and install Hermit itself as well as packages. These packages are
local to this environment.
21 changes: 21 additions & 0 deletions bin/activate-hermit
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# This file must be used with "source bin/activate-hermit" from bash or zsh.
# You cannot run it directly
#
# THIS FILE IS GENERATED; DO NOT MODIFY

if [ "${BASH_SOURCE-}" = "$0" ]; then
echo "You must source this script: \$ source $0" >&2
exit 33
fi

BIN_DIR="$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")"
if "${BIN_DIR}/hermit" noop > /dev/null; then
eval "$("${BIN_DIR}/hermit" activate "${BIN_DIR}/..")"

if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ]; then
hash -r 2>/dev/null
fi

echo "Hermit environment $("${HERMIT_ENV}"/bin/hermit env HERMIT_ENV) activated"
fi
1 change: 1 addition & 0 deletions bin/cargo
1 change: 1 addition & 0 deletions bin/cargo-clippy
1 change: 1 addition & 0 deletions bin/cargo-fmt
1 change: 1 addition & 0 deletions bin/cargo-miri
1 change: 1 addition & 0 deletions bin/clippy-driver
1 change: 1 addition & 0 deletions bin/corepack
43 changes: 43 additions & 0 deletions bin/hermit
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
#
# THIS FILE IS GENERATED; DO NOT MODIFY

set -eo pipefail

export HERMIT_USER_HOME=~

if [ -z "${HERMIT_STATE_DIR}" ]; then
case "$(uname -s)" in
Darwin)
export HERMIT_STATE_DIR="${HERMIT_USER_HOME}/Library/Caches/hermit"
;;
Linux)
export HERMIT_STATE_DIR="${XDG_CACHE_HOME:-${HERMIT_USER_HOME}/.cache}/hermit"
;;
esac
fi

export HERMIT_DIST_URL="${HERMIT_DIST_URL:-https://github.com/cashapp/hermit/releases/download/stable}"
HERMIT_CHANNEL="$(basename "${HERMIT_DIST_URL}")"
export HERMIT_CHANNEL
export HERMIT_EXE=${HERMIT_EXE:-${HERMIT_STATE_DIR}/pkg/hermit@${HERMIT_CHANNEL}/hermit}

if [ ! -x "${HERMIT_EXE}" ]; then
echo "Bootstrapping ${HERMIT_EXE} from ${HERMIT_DIST_URL}" 1>&2
INSTALL_SCRIPT="$(mktemp)"
# This value must match that of the install script
INSTALL_SCRIPT_SHA256="180e997dd837f839a3072a5e2f558619b6d12555cd5452d3ab19d87720704e38"
if [ "${INSTALL_SCRIPT_SHA256}" = "BYPASS" ]; then
curl -fsSL "${HERMIT_DIST_URL}/install.sh" -o "${INSTALL_SCRIPT}"
else
# Install script is versioned by its sha256sum value
curl -fsSL "${HERMIT_DIST_URL}/install-${INSTALL_SCRIPT_SHA256}.sh" -o "${INSTALL_SCRIPT}"
# Verify install script's sha256sum
openssl dgst -sha256 "${INSTALL_SCRIPT}" | \
awk -v EXPECTED="$INSTALL_SCRIPT_SHA256" \
'$2!=EXPECTED {print "Install script sha256 " $2 " does not match " EXPECTED; exit 1}'
fi
/bin/bash "${INSTALL_SCRIPT}" 1>&2
fi

exec "${HERMIT_EXE}" --level=fatal exec "$0" -- "$@"
Empty file added bin/hermit.hcl
Empty file.
1 change: 1 addition & 0 deletions bin/jar
1 change: 1 addition & 0 deletions bin/jarsigner
1 change: 1 addition & 0 deletions bin/java
1 change: 1 addition & 0 deletions bin/javac
1 change: 1 addition & 0 deletions bin/javadoc
1 change: 1 addition & 0 deletions bin/javap
1 change: 1 addition & 0 deletions bin/jcmd
1 change: 1 addition & 0 deletions bin/jconsole
1 change: 1 addition & 0 deletions bin/jdb
1 change: 1 addition & 0 deletions bin/jdeprscan
1 change: 1 addition & 0 deletions bin/jdeps
1 change: 1 addition & 0 deletions bin/jfr
1 change: 1 addition & 0 deletions bin/jhsdb
1 change: 1 addition & 0 deletions bin/jimage
1 change: 1 addition & 0 deletions bin/jinfo
1 change: 1 addition & 0 deletions bin/jlink
1 change: 1 addition & 0 deletions bin/jmap
1 change: 1 addition & 0 deletions bin/jmod
1 change: 1 addition & 0 deletions bin/jpackage
1 change: 1 addition & 0 deletions bin/jps
1 change: 1 addition & 0 deletions bin/jrunscript
1 change: 1 addition & 0 deletions bin/jshell
1 change: 1 addition & 0 deletions bin/jstack
1 change: 1 addition & 0 deletions bin/jstat
1 change: 1 addition & 0 deletions bin/jstatd
1 change: 1 addition & 0 deletions bin/just
1 change: 1 addition & 0 deletions bin/keytool
1 change: 1 addition & 0 deletions bin/mvn
1 change: 1 addition & 0 deletions bin/mvnDebug
1 change: 1 addition & 0 deletions bin/node
1 change: 1 addition & 0 deletions bin/npm
1 change: 1 addition & 0 deletions bin/npx
1 change: 1 addition & 0 deletions bin/pip
1 change: 1 addition & 0 deletions bin/pip3
1 change: 1 addition & 0 deletions bin/pip3.10
1 change: 1 addition & 0 deletions bin/pydoc3
1 change: 1 addition & 0 deletions bin/pydoc3.10
1 change: 1 addition & 0 deletions bin/python
1 change: 1 addition & 0 deletions bin/python3
1 change: 1 addition & 0 deletions bin/python3-config
1 change: 1 addition & 0 deletions bin/python3.10
1 change: 1 addition & 0 deletions bin/python3.10-config
1 change: 1 addition & 0 deletions bin/rls
1 change: 1 addition & 0 deletions bin/rmiregistry
1 change: 1 addition & 0 deletions bin/rust-analyzer
1 change: 1 addition & 0 deletions bin/rust-gdb
1 change: 1 addition & 0 deletions bin/rust-gdbgui
1 change: 1 addition & 0 deletions bin/rust-lldb
1 change: 1 addition & 0 deletions bin/rustc
1 change: 1 addition & 0 deletions bin/rustdoc
1 change: 1 addition & 0 deletions bin/rustfmt
1 change: 1 addition & 0 deletions bin/rustup
1 change: 1 addition & 0 deletions bin/serialver
Loading

0 comments on commit b7ac054

Please sign in to comment.