Skip to content

Commit

Permalink
tesing ios script
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekinstnt committed Sep 30, 2024
1 parent 74acb22 commit 33e77bd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 13 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/afc_updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,26 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Run Tests
- name: Install Dependencies
run: |
# Add your test commands here
echo "CI for aries-vcx-framework run test"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew install pkg-config libsodium openssl zeromq just jq
- name: Set up Rust
run: |
rustc --version
rustup default 1.78.0
rustc --version
- name: Run the script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
run: |
echo "executing ios build"
chmod +x ./aries_framework_vcx/src/scripts/ios.build.cargo.sh
./aries_framework_vcx/src/scripts/ios.build.cargo.sh
14 changes: 13 additions & 1 deletion aries_framework_vcx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ edition = "2021"

[dependencies]
uniffi = { version = "0.28.0", features = ["cli"] }
openssl = { version = "0.10", features = ["vendored"] }
aries_vcx = { path = "../aries/aries_vcx", features = [
"anoncreds",
"askar_wallet",
] }
async-trait = "0.1.81"
Expand All @@ -25,3 +25,15 @@ uuid = { version = "1.10.0", features = [
"v4", # Lets you generate random UUIDs
"fast-rng", # Use a faster (but still sufficiently random) RNG
] }

[lib]
crate-type = ["cdylib", "staticlib"]
name = "uniffi_vcx"

[[bin]]
name = "uniffi-bindgen"
path = "uniffi-bindgen.rs"

[build-dependencies]
uniffi = { version = "0.23.0", features = ["build", "cli"] }

19 changes: 10 additions & 9 deletions aries_framework_vcx/src/scripts/ios.build.cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

# Required env vars
ARIES_VCX_ROOT=$(dirname $(dirname $(dirname $SCRIPT_DIR)))
IOS_BUILD_DEPS_DIR=${ARIES_VCX_ROOT}/aries_framework_vcx/target/ios_build_deps
LANGUAGE="swift"
TARGET="aarch64-apple-ios"
TARGET_NICKNAME="arm64"
ABI="iphoneos"

generate_bindings() {

export UNIFFI_ROOT="${ARIES_VCX_ROOT}/aries_framework_vcx/"
export UNIFFI_ROOT="${ARIES_VCX_ROOT}/aries_framework_vcx"
export IOS_APP_DIR="${ARIES_VCX_ROOT}/aries_framework_vcx/ios/"

rustup target add ${TARGET}
Expand All @@ -22,24 +21,26 @@

pushd "${UNIFFI_ROOT}"
cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/aries_framework_vcx.udl --language ${LANGUAGE}
#cargo run --features=uniffi/cli --bin uniffi-bindgen generate src/aries_framework_vcx.udl --language ${LANGUAGE}
popd

#mkdir ${IOS_APP_DIR}/Source

cp -R ${UNIFFI_ROOT}/src/vcx.swift ${UNIFFI_ROOT}/src/vcxFFI.* ${IOS_APP_DIR}
cp -R ${UNIFFI_ROOT}/src/vcx.swift ${UNIFFI_ROOT}/src/vcxFFI.* ${IOS_APP_DIR}/Source
rm -R ${UNIFFI_ROOT}/src/vcx.swift ${UNIFFI_ROOT}/src/vcxFFI.*
cp -R ${UNIFFI_ROOT}/src/aries_framework_vcx.swift ${UNIFFI_ROOT}/src/aries_framework_vcxFFI.* ${IOS_APP_DIR}
cp -R ${UNIFFI_ROOT}/src/aries_framework_vcx.swift ${UNIFFI_ROOT}/src/aries_framework_vcxFFI.* ${IOS_APP_DIR}/Source
rm -R ${UNIFFI_ROOT}/src/aries_framework_vcx.swift ${UNIFFI_ROOT}/src/aries_framework_vcxFFI.*
}

build_uniffi_for_demo() {
echo "Running build_uniffi_for_demo..."
export UNIFFI_ROOT="${ARIES_VCX_ROOT}/aries_framework_vcx/"
export UNIFFI_ROOT="${ARIES_VCX_ROOT}/aries_framework_vcx"
export IOS_APP_DIR="${ARIES_VCX_ROOT}/aries_framework_vcx/ios"
export ABI_PATH=${IOS_APP_DIR}/Frameworks
mkdir -p ${ABI_PATH}

pushd ${UNIFFI_ROOT}/core
cargo build --target ${TARGET} --features "aries_vcx_anoncreds/zmq_vendored"
pushd ${UNIFFI_ROOT}
cargo build --target ${TARGET}
#--features "aries_vcx_anoncreds/zmq_vendored"
cp ${ARIES_VCX_ROOT}/aries_framework_vcx/target/${TARGET}/debug/libuniffi_vcx.a ${ABI_PATH}/libuniffi_vcx.a

popd
Expand All @@ -51,7 +52,7 @@
export IOS_APP_DIR="${ARIES_VCX_ROOT}/aries_framework_vcx/ios"
export ABI_PATH=${IOS_APP_DIR}/Frameworks

mv ${IOS_APP_DIR}/Source/vcxFFI.modulemap ${IOS_APP_DIR}/Source/module.modulemap
mv ${IOS_APP_DIR}/Source/aries_framework_vcxFFI.modulemap ${IOS_APP_DIR}/Source/module.modulemap

xcodebuild -create-xcframework -library ${ABI_PATH}/libuniffi_vcx.a -headers ${IOS_APP_DIR}/Source -output "${ABI_PATH}/vcx.xcframework"

Expand Down

0 comments on commit 33e77bd

Please sign in to comment.