Files
chain33-dtalk/script/build/quick_build.sh
2022-03-17 15:59:24 +08:00

68 lines
1.9 KiB
Bash

#!/bin/bash
file_path=$(
cd "$(dirname "$0")" || exit
pwd
)/../..
# shellcheck source=./util.sh
source "${file_path}"/script/build/util.sh
quickBuildService() {
file_path="$1"
pkg_path="$2"
service_name="$3"
sub_file_path="$4"
flags=$(getFlags)
cd "${file_path}/service/${sub_file_path}${service_name}/cmd" || exit
echo "┌ start building ${service_name} service"
go build -ldflags "${flags}" -o "${file_path}/${pkg_path}/${service_name}" || exit
echo "└ building ${service_name} service success"
}
quickBuildGateway() {
file_path="$1"
pkg_name="$2"
service_name="$3"
sub_file_path="$4"
flags=$(getFlags)
cd "${file_path}/gateway/api/${sub_file_path}" || exit
echo "┌ start building ${service_name} service"
go build -ldflags "${flags}" -o "${file_path}/${pkg_name}/${service_name}" || exit
echo "└ building ${service_name} service success"
}
mkDir() {
file_path="$1"
pkg_path="$2"
rm -rf ${file_path}/${pkg_path}
mkdir -pv "${file_path}/${pkg_path}"
}
env_type="$1"
initOS ${env_type}
os=$(initOS ${env_type})
api_version=""
project_name="dtalk"
now_time=$(date "+%Y_%m_%d")
pkg_path="${project_name}_bin_${now_time}_${os}"
mkDir "${file_path}" "${pkg_path}"
quickBuildGateway "${file_path}" "${pkg_path}" "gateway" "v1"
quickBuildService "${file_path}" "${pkg_path}" "backend"
quickBuildService "${file_path}" "${pkg_path}" "backup"
quickBuildService "${file_path}" "${pkg_path}" "call"
quickBuildService "${file_path}" "${pkg_path}" "discovery"
quickBuildService "${file_path}" "${pkg_path}" "generator"
quickBuildService "${file_path}" "${pkg_path}" "group"
quickBuildService "${file_path}" "${pkg_path}" "offline-push"
quickBuildService "${file_path}" "${pkg_path}" "oss"
quickBuildService "${file_path}" "${pkg_path}" "answer" "record/"
quickBuildService "${file_path}" "${pkg_path}" "pusher" "record/"
quickBuildService "${file_path}" "${pkg_path}" "store" "record/"