Skip to content

Commit

Permalink
code cleanup and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekinstnt committed Sep 20, 2024
1 parent e7fef6f commit 341213e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 114 deletions.
7 changes: 1 addition & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,4 @@ let package = Package(
checksum: "c8964e8a20c2e74199cf40848b7b14afc95a4f3dcae80a4dba974acf54d253ac"
)
]
)

//let AriesVCXTarget = package.targets.first(where: { $0.name == "InstntAriesVCXPackage" })

//AriesVCXTarget?.dependencies.append("VCX_uniffiFFI_Lib")

)
110 changes: 2 additions & 108 deletions aries/wrappers/uniffi-aries-vcx/scripts/ios.build.cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@
export IOS_APP_DIR="${ARIES_VCX_ROOT}/aries/agents/ios/ariesvcx/ariesvcx"
export ABI_PATH=${IOS_APP_DIR}/Frameworks

#mv ${UNIFFI_ROOT}/core/src/vcxFFI.modulemap ${UNIFFI_ROOT}/core/src/module.modulemap
mv ${IOS_APP_DIR}/Source/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"

#zip -r ${ABI_PATH}/vcx.xcframework.zip ${ABI_PATH}/vcx.xcframework

cd ${ABI_PATH}
zip -r vcx.xcframework.zip vcx.xcframework

Expand All @@ -86,55 +84,6 @@

}

release_xcframework_backup() {

export UNIFFI_ROOT="${ARIES_VCX_ROOT}/aries/wrappers/uniffi-aries-vcx"
export IOS_APP_DIR="${ARIES_VCX_ROOT}/aries/agents/ios/ariesvcx/ariesvcx"
export ABI_PATH=${IOS_APP_DIR}/Frameworks

XCFRAMEWORK_PATH="${ABI_PATH}/vcx.xcframework.zip"

# Print for debugging
echo "XCFRAMEWORK_PATH=${XCFRAMEWORK_PATH}"

# Ensure the file has the correct permissions (readable)
chmod u+rw "$XCFRAMEWORK_PATH"

# Get the name of the file to be uploaded
ASSET_NAME=$(basename "$XCFRAMEWORK_PATH")

# Fetch the list of assets for the release
ASSET_URL="https://api.github.com/repos/$REPO/releases/$TAG/assets"
ASSETS_JSON=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$ASSET_URL")

# Extract asset ID(s) of the existing asset with the same name
ASSET_IDS=$(echo "$ASSETS_JSON" | jq -r ".[] | select(.name == \"$ASSET_NAME\") | .id")

# Delete the existing asset(s)
for ASSET_ID in $ASSET_IDS; do
echo "Deleting existing asset with ID: $ASSET_ID"
curl -s -X DELETE -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/$REPO/releases/assets/$ASSET_ID"
done

# Upload the file to the release
# curl -s -X POST \
# -H "Authorization: token $GITHUB_TOKEN" \
# -H "Content-Type: application/zip" \
# --data-binary @"$XCFRAMEWORK_PATH" \
# "https://uploads.github.com/repos/$REPO/releases/$RELEASE_ID/assets?name=$(basename "$XCFRAMEWORK_PATH")"

RESPONSE=$(curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"Release $TAG\",\"draft\":false,\"prerelease\":false}" \
https://api.github.com/repos/$REPO/releases)

rm -R ${ABI_PATH}/vcx.xcframework.zip

echo "File uploaded"

}

delete_existing_xcframework() {

export UNIFFI_ROOT="${ARIES_VCX_ROOT}/aries/wrappers/uniffi-aries-vcx"
Expand Down Expand Up @@ -214,63 +163,8 @@

}

checksum() {


set -e

# Variables
URL="https://github.com/instnt-inc/instnt-aries-vcx/releases/download/abhishek_GithubAction2/vcx.xcframework.zip" # Replace with your URL
FILE_NAME="vcx.xcframework.zip" # Name of the downloaded file

# Function to display usage information
usage() {
echo "Usage: $0 -u <url> -f <file_name>"
exit 1
}

# Parse command-line arguments
while getopts "u:f:" opt; do
case ${opt} in
u )
URL=$OPTARG
;;
f )
FILE_NAME=$OPTARG
;;
* )
usage
;;
esac
done
shift $((OPTIND -1))

# Check if URL and FILE_NAME are provided
if [ -z "$URL" ] || [ -z "$FILE_NAME" ]; then
usage
fi

# Download the file
echo "Downloading file from $URL..."
curl -O "$URL"

# Verify if the file was downloaded successfully
if [ ! -f "$FILE_NAME" ]; then
echo "Error: File $FILE_NAME not found after download."
exit 1
fi

# Compute the SHA-256 checksum
CHECKSUM=$(shasum -a 256 "$FILE_NAME" | awk '{ print $1 }')

# Output the checksum
echo "Checksum for $FILE_NAME: $CHECKSUM"
}

generate_bindings
build_uniffi_for_demo
build_ios_xcframework
delete_existing_xcframework
upload_framework

#checksum
upload_framework

0 comments on commit 341213e

Please sign in to comment.