#!/bin/sh -e

#  download_dependencies.sh
#
#  Downloads all compiled framework flavors in from Artifactory.
#

# Create new aggregate builds

if [ -z $ARTIFACTORY_URL ]; then
    ARTIFACTORY_URL="https://oneartifactoryprod.verizon.com/artifactory"
fi

BUILD_DIR=$(xcodebuild -showBuildSettings -project ./MVMCoreUI.xcodeproj | grep -w -o 'BUILD_DIR = .*' | cut -d\  -f3-)
FRAMEWORKS_DIR=$BUILD_DIR/../../../Frameworks/MVMCoreUI

if [ ! -d $FRAMEWORKS_DIR ]; then
    mkdir -p $FRAMEWORKS_DIR
fi

./Scripts/download_framework.sh $ARTIFACTORY_URL "$FRAMEWORKS_DIR/MVMCore.xcframework" BPHV_MobileFirst_IOS/com/vzw/hss/myverizon/MVMCore/3.1/MVMCore-3.1-Debug-SNAPSHOT.zip

./Scripts/download_framework.sh $ARTIFACTORY_URL "$FRAMEWORKS_DIR/VDS.xcframework" BPHV_MobileFirst_IOS/com/vzw/hss/myverizon/VDS/1.0/VDS-1.0-Debug-SNAPSHOT.zip

./Scripts/download_framework.sh $ARTIFACTORY_URL "$FRAMEWORKS_DIR/VDSColorTokens.xcframework" GVJV_VDS_Maven/@vds-tokens/ios/VDSColorTokens.1.0.6.xcframework.zip

./Scripts/download_framework.sh $ARTIFACTORY_URL "$FRAMEWORKS_DIR/VDSFormControlsTokens.xcframework" GVJV_VDS_Maven/@vds-tokens/ios/VDSFormControlsTokens.1.0.7.xcframework.zip
