#!/bin/bash
# *************************************************************************
# Copyright: (c) Huawei Technologies Co., Ltd. 2022. All rights reserved
#
#  description: the script that build DMS in component
#  date: 2022-11-01
#  version: 3.0.0
#  history:
#
# *************************************************************************

# Clone DMS code to local dir
DMS_REPO=https://gitcode.com/opengauss/DMS.git
DMS_BRANCH=master

echo "clone dms code"
if [ -d DMS ]; then
    rm -rf DMS
fi
git clone ${DMS_REPO} -b ${DMS_BRANCH} DMS
cd DMS

LOCAL_PATH="$(pwd)"
LOCAL_DIR=$(dirname "${LOCAL_PATH}")
ROOT_DIR="${PWD}/../../.."
export PLAT_FORM_STR=$(sh ${LOCAL_DIR}/../../build/get_PlatForm_str.sh)

cd build/linux/opengauss
sh -x build.sh -3rd "${ROOT_DIR}/output/"