TeaSpeak-Client/jenkins/create_build.sh

128 lines
4.9 KiB
Bash
Raw Normal View History

2019-10-25 19:51:40 -04:00
#!/usr/bin/env bash
cd "$(dirname $0)/../"
2020-12-05 17:14:37 -05:00
echo "Creating build for channel ${teaclient_deploy_channel}"
2019-10-25 19:51:40 -04:00
project_name="__build_teaclient"
2020-02-08 14:45:04 -05:00
source ../build-helpers/build_helper.sh
2019-10-25 19:51:40 -04:00
function install_npm() {
begin_task "${project_name}_update" "Installing NPM"
npm install --save-dev
check_err_exit ${project_name} "Failed to install nodejs files!"
npm run install-platform
check_err_exit ${project_name} "Failed to install platform depend nodejs files!"
npm update
check_err_exit ${project_name} "Failed to update nodejs files!"
end_task "${project_name}_update" "NPM installed"
}
function compile_scripts() {
begin_task "${project_name}_tsc_sass" "Compiling TypeScript & SASS"
2020-04-04 08:17:07 -04:00
#./build_declarations.sh
#check_err_exit ${project_name} "Failed to build shared ui import declarations!"
2019-10-25 19:51:40 -04:00
npm run compile-tsc -- -p modules/tsconfig_main.json
check_err_exit ${project_name} "Failed to compile typescript main files!"
npm run compile-tsc -- -p modules/tsconfig_renderer.json
check_err_exit ${project_name} "Failed to compile typescript renderer files!"
if [[ ${build_os_type} == "win32" ]]; then
npm run compile-tsc -- -p installer/tsconfig_windows.json
check_err_exit ${project_name} "Failed to compile typescript installer files!"
else
npm run compile-tsc -- -p installer/tsconfig_linux.json
check_err_exit ${project_name} "Failed to compile typescript installer files!"
fi
npm run compile-sass
check_err_exit ${project_name} "Failed to compile sass files!"
end_task "${project_name}_tsc_sass" "TypeScript & SASS compiled"
echo ""
}
function compile_native() {
begin_task "${project_name}_native" "Compiling native extensions"
2020-02-08 14:45:04 -05:00
2019-10-25 19:51:40 -04:00
local build_path="native/out/${build_os_type}_${build_os_arch}/"
[[ -d ${build_path} ]] && rm -r ${build_path}
mkdir -p ${build_path}
check_err_exit ${project_name} "Failed to create build directory!"
cd ${build_path}
check_err_exit ${project_name} "Failed to enter build directory!"
local _arguments=""
2020-04-04 08:17:07 -04:00
[[ -n "$tearoot_cmake_module" ]] && _arguments="${_arguments} -DCMAKE_MODULE_PATH=\"$tearoot_cmake_module\""
[[ -n "$tearoot_cmake_config" ]] && _arguments="${_arguments} -DCMAKE_PLATFORM_INCLUDE=\"$tearoot_cmake_config\""
[[ -n "$traroot_library" ]] && _arguments="${_arguments} -DLIBRARY_PATH=\"$traroot_library\""
2019-10-25 19:51:40 -04:00
2020-02-08 14:45:04 -05:00
local _cmake_generator=""
[[ -n "${build_cmake_generator}" ]] && _cmake_generator="${build_cmake_generator}"
[[ -z "${_cmake_generator}" && "${build_os_type}" == "win32" ]] && _cmake_generator=" -G\"Visual Studio 15 2017 Win64\""
2019-10-25 19:51:40 -04:00
2020-02-08 14:45:04 -05:00
_command="cmake ../../ ${_cmake_generator} -DCMAKE_BUILD_TYPE=RelWithDebInfo ${_arguments}"
2019-10-25 19:51:40 -04:00
echo "Executing cmake command $_command"
eval ${_command}
check_err_exit ${project_name} "Failed create build targets!"
2020-12-02 12:08:49 -05:00
cmake --build "$(pwd)" --target update_installer -- ${CMAKE_MAKE_OPTIONS}
2019-10-25 19:51:40 -04:00
check_err_exit ${project_name} "Failed build teaclient update installer!"
2020-12-02 12:08:49 -05:00
cmake --build "$(pwd)" --target teaclient_connection -- ${CMAKE_MAKE_OPTIONS}
2019-10-25 19:51:40 -04:00
check_err_exit ${project_name} "Failed build teaclient connection!"
2020-12-02 12:08:49 -05:00
cmake --build "$(pwd)" --target teaclient_crash_handler -- ${CMAKE_MAKE_OPTIONS}
2019-10-25 19:51:40 -04:00
check_err_exit ${project_name} "Failed build teaclient crash handler!"
2020-12-02 12:08:49 -05:00
cmake --build "$(pwd)" --target teaclient_ppt -- ${CMAKE_MAKE_OPTIONS}
2019-10-25 19:51:40 -04:00
check_err_exit ${project_name} "Failed build teaclient ppt!"
2020-12-02 12:08:49 -05:00
cmake --build "$(pwd)" --target teaclient_dns -- ${CMAKE_MAKE_OPTIONS}
2019-10-25 19:51:40 -04:00
check_err_exit ${project_name} "Failed to build teaclient dns!"
end_task "${project_name}_native" "Native extensions compiled"
}
function package_client() {
begin_task "${project_name}_package" "Packaging client"
if [[ ${build_os_type} == "win32" ]]; then
2020-12-02 12:08:49 -05:00
npm run build-windows-64 "${teaclient_deploy_channel}"
2019-10-25 19:51:40 -04:00
check_err_exit ${project_name} "Failed to package client!"
else
2020-12-02 12:08:49 -05:00
npm run build-linux-64 "${teaclient_deploy_channel}"
2019-10-25 19:51:40 -04:00
check_err_exit ${project_name} "Failed to package client!"
fi
end_task "${project_name}_package" "Client package created"
}
function deploy_client() {
begin_task "${project_name}_package" "Deploying client"
[[ -z ${teaclient_deploy_secret} ]] && {
echo "Missing deploy secret. Dont deploy client!"
return 0
}
[[ -z ${teaclient_deploy_channel} ]] && {
echo "Missing deploy channel. Dont deploy client!"
return 0
}
if [[ ${build_os_type} == "win32" ]]; then
2020-12-02 12:08:49 -05:00
npm run package-windows-64 "${teaclient_deploy_channel}"
2019-10-25 19:51:40 -04:00
check_err_exit ${project_name} "Failed to deploying client!"
else
2020-12-02 12:08:49 -05:00
npm run package-linux-64 "${teaclient_deploy_channel}"
2019-10-25 19:51:40 -04:00
check_err_exit ${project_name} "Failed to deploying client!"
fi
end_task "${project_name}_package" "Client successfully deployed!"
}
2020-02-13 18:42:56 -05:00
#install_npm
#compile_scripts
compile_native
2020-12-05 10:40:34 -05:00
package_client
2020-12-02 12:32:58 -05:00
deploy_client