TeaSpeak-Client/jenkins/create_build.sh

122 lines
4.5 KiB
Bash
Raw Normal View History

2019-07-03 13:16:38 +02:00
#!/usr/bin/env bash
2019-07-03 13:32:39 +02:00
cd "$(dirname $0)/../"
2019-07-03 13:16:38 +02:00
project_name="__build_teaclient"
source ../scripts/build_helper.sh
function install_npm() {
begin_task "${project_name}_update" "Installing NPM"
2019-07-06 19:30:15 +02:00
npm install --save-dev
2019-07-03 13:16:38 +02:00
check_err_exit ${project_name} "Failed to install nodejs files!"
2019-07-06 19:30:15 +02:00
npm run install-platform
check_err_exit ${project_name} "Failed to install platform depend nodejs files!"
2019-07-03 13:16:38 +02:00
npm update
check_err_exit ${project_name} "Failed to update nodejs files!"
2019-07-03 13:23:50 +02:00
end_task "${project_name}_update" "NPM installed"
2019-07-03 13:16:38 +02:00
}
function compile_scripts() {
begin_task "${project_name}_tsc_sass" "Compiling TypeScript & SASS"
2019-07-03 14:15:57 +02:00
./build_declarations.sh
check_err_exit ${project_name} "Failed to build shared ui import declarations!"
2019-07-03 13:16:38 +02:00
npm run compile-tsc -- -p modules/tsconfig_main.json
check_err_exit ${project_name} "Failed to compile typescript main files!"
2019-07-03 13:16:38 +02:00
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
2019-07-03 13:16:38 +02:00
npm run compile-sass
check_err_exit ${project_name} "Failed to compile sass files!"
2019-07-03 13:23:50 +02:00
end_task "${project_name}_tsc_sass" "TypeScript & SASS compiled"
2019-07-03 13:16:38 +02:00
echo ""
}
function compile_native() {
begin_task "${project_name}_native" "Compiling native extensions"
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!"
2019-07-03 13:23:50 +02:00
local _arguments=""
2019-07-03 13:25:03 +02:00
[[ ! -z "$tearoot_cmake_module" ]] && _arguments="${_arguments} -DCMAKE_MODULE_PATH=\"$tearoot_cmake_module\""
[[ ! -z "$tearoot_cmake_config" ]] && _arguments="${_arguments} -DCMAKE_PLATFORM_INCLUDE=\"$tearoot_cmake_config\""
[[ ! -z "$traroot_library" ]] && _arguments="${_arguments} -DLIBRARY_PATH=\"$traroot_library\""
2019-07-05 21:02:09 +02:00
2019-07-06 20:49:31 +02:00
local _generator=""
2019-07-06 21:47:28 +02:00
[[ ${build_os_type} == "win32" ]] && _generator='-G"Visual Studio 15 2017 Win64"'
2019-07-06 20:49:31 +02:00
_command="cmake ../../ ${_generator} -DCMAKE_BUILD_TYPE=RelWithDebInfo ${_arguments}"
2019-07-05 21:26:44 +02:00
echo "Executing cmake command $_command"
eval ${_command}
2019-07-03 13:16:38 +02:00
check_err_exit ${project_name} "Failed create build targets!"
2019-07-06 21:51:51 +02:00
cmake --build `pwd` --target update_installer -- ${CMAKE_MAKE_OPTIONS}
2019-07-05 23:09:10 +02:00
check_err_exit ${project_name} "Failed build teaclient update installer!"
2019-07-06 21:51:51 +02:00
cmake --build `pwd` --target teaclient_connection -- ${CMAKE_MAKE_OPTIONS}
2019-07-03 13:16:38 +02:00
check_err_exit ${project_name} "Failed build teaclient connection!"
2019-07-06 21:51:51 +02:00
cmake --build `pwd` --target teaclient_crash_handler -- ${CMAKE_MAKE_OPTIONS}
2019-07-03 13:16:38 +02:00
check_err_exit ${project_name} "Failed build teaclient crash handler!"
2019-07-06 21:51:51 +02:00
cmake --build `pwd` --target teaclient_ppt -- ${CMAKE_MAKE_OPTIONS}
2019-07-03 13:16:38 +02:00
check_err_exit ${project_name} "Failed build teaclient ppt!"
2019-07-03 13:23:50 +02:00
end_task "${project_name}_native" "Native extensions compiled"
2019-07-03 13:16:38 +02:00
}
2019-07-05 21:58:48 +02:00
function package_client() {
begin_task "${project_name}_package" "Packaging client"
2019-07-07 00:14:38 +02:00
if [[ ${build_os_type} == "win32" ]]; then
npm run build-windows-64
check_err_exit ${project_name} "Failed to package client!"
else
npm run build-linux-64
check_err_exit ${project_name} "Failed to package client!"
fi
2019-07-05 21:58:48 +02:00
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
}
2019-07-07 00:14:38 +02:00
if [[ ${build_os_type} == "win32" ]]; then
npm run package-windows-64 ${teaclient_deploy_channel}
check_err_exit ${project_name} "Failed to deploying client!"
else
npm run package-linux-64 ${teaclient_deploy_channel}
check_err_exit ${project_name} "Failed to deploying client!"
fi
2019-07-05 21:58:48 +02:00
end_task "${project_name}_package" "Client successfully deployed!"
}
2019-10-24 19:12:59 +01:00
#install_npm
#compile_scripts
#compile_native
#package_client
2019-07-06 20:49:31 +02:00
deploy_client