Skip to content

Commit

Permalink
finalise buildlib
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiragKV-Juspay committed Nov 19, 2024
1 parent 2aa549a commit eac5262
Showing 1 changed file with 2 additions and 140 deletions.
142 changes: 2 additions & 140 deletions build-lib.sh
Original file line number Diff line number Diff line change
@@ -1,112 +1,3 @@
# #!/bin/bash

# echo "Checking environment variables:"
# if [ -z "$SONATYPE_TOKEN" ]; then
# echo "ERROR: SONATYPE_TOKEN is not set!"
# fi

# echo "Library generation process initiated."

# echo "Generating artifacts for React Native Gradle Plugin."

# # Navigate to the react-native gradle plugin and build and publish
# cd node_modules/@react-native/gradle-plugin
# ./gradlew build
# ./gradlew publish

# echo "Applying LibraryCreation Patch."

# # Navigate to the Android folder and apply the patch
# cd ../../../android
# # git apply libraryCreation.patch

# cd hyperswitch-gradle-plugin
# ./gradlew build
# ./gradlew publish

# cd ..

# # Remove unnecessary files
# # rm app/src/main/java/io/hyperswitch/MainActivity.kt
# # rm app/src/main/res/layout/main_activity.xml
# # rm app/src/main/res/values/styles.xml

# echo "Generating artifacts for Hyperswitch Android SDK."

# # Build and publish the library
# ./gradlew clean
# ./gradlew assembleRelease
# ./gradlew publish

# cd maven/io/hyperswitch || exit 1

# # Function to sign files and create a bundle
# process_version_directory() {
# local base_dir="$1"
# local version_dir="$2"

# cd "$version_dir" || return

# # Sign all relevant files in the version directory
# for file in *.{aar,pom,jar,module}; do
# [ -e "$file" ] || continue

# echo "Signing $file..."
# gpg --armor --output "${file}.asc" --detach-sign "$file"
# done

# # # Create the ZIP bundle
# # local base_name
# # base_name=$(basename "$base_dir")
# # local zip_name="${base_name}-$(basename "$version_dir")-bundle.zip"

# # echo "Creating ZIP bundle for $zip_name..."
# # zip -r "$zip_name" *.{aar,pom,jar,module} *-sources.jar *-javadoc.jar *.asc

# cd ..
# }

# upload_to_sonatype() {
# local zip_file="$1"
# local sonatype_url="https://central.sonatype.com/api/v1/publisher/upload"
# local authorization_token="Bearer $SONTAYPE_TOKEN"

# echo "Uploading $zip_file to Sonatype Central... with key $SONATYPE_TOKEN"

# # Perform the CURL upload
# curl --request POST \
# --verbose \
# --header "Authorization: $authorization_token" \
# --form bundle=@"$zip_file" \
# $sonatype_url
# }

# # Process each library directory
# for library_dir in */; do
# [ -d "$library_dir" ] || continue
# cd "$library_dir" || continue

# # Process each version directory
# for version_dir in */; do
# [ -d "$version_dir" ] || continue
# process_version_directory "$library_dir" "$version_dir"
# done

# cd ..
# done

# # Create the ZIP bundle
# cd ../../
# local zip_name="hyperswitch-sdk-bundle.zip"
# echo "Creating ZIP bundle for $zip_name..."
# # zip -r "hyperswitch-sdk-bundle.zip" ./*
# zip -r "hyperswitch-sdk-bundle.zip" io/hyperswitch

# upload_to_sonatype "hyperswitch-sdk-bundle.zip"

# echo "Processing completed."


#!/bin/bash

echo "Checking environment variables:"
Expand All @@ -119,13 +10,11 @@ echo "Generating artifacts for React Native Gradle Plugin."

cd ..
cd node_modules/@react-native/gradle-plugin
echo "DIRECTORY ECHO"
pwd

./gradlew build
./gradlew publish

# echo "Applying LibraryCreation Patch."

# Navigate to the Android folder and apply the patch
cd ../../../android
# cd ../../../hyperswitch-sdk-android
Expand All @@ -136,7 +25,7 @@ cd hyperswitch-gradle-plugin
./gradlew publish

cd ..
# echo "Generating artifacts for Hyperswitch Android SDK."
echo "Generating artifacts for Hyperswitch Android SDK."
# ./gradlew clean
./gradlew assembleRelease
./gradlew publish
Expand Down Expand Up @@ -187,38 +76,11 @@ done

# Get user selection
selected_libraries=()
# echo
# echo "Enter the numbers of the libraries you want to include (space-separated)"
# echo "Example: 1 3 4"
# read -p "Your selection: " selections

# # Convert selections to array
# read -ra selection_array <<< "$selections"

# # Validate and process selections
# for selection in "${selection_array[@]}"; do
# if [[ "$selection" =~ ^[0-9]+$ ]] && ((selection > 0 && selection <= ${#available_libraries[@]})); then
# selected_libraries+=("${available_libraries[$selection-1]}")
# echo "Selected: ${available_libraries[$selection-1]}"
# else
# echo "Invalid selection: $selection"
# fi
# done

# # Check if any libraries were selected
# if [ ${#selected_libraries[@]} -eq 0 ]; then
# echo "No valid libraries selected. Exiting."
# exit 1
# fi

# Check if SELECTED_LIBRARIES environment variable is set (for CI)
if [ ! -z "$SELECTED_LIBRARIES" ]; then
echo "Using libraries from SELECTED_LIBRARIES environment variable"
IFS=',' read -ra selected_libraries <<< "$SELECTED_LIBRARIES"
# Check if command line arguments were provided
elif [ $# -gt 0 ]; then
echo "Using libraries from command line arguments"
selected_libraries=("$@")
else
# Interactive mode
echo "Available libraries:"
Expand Down

0 comments on commit eac5262

Please sign in to comment.