TeaSpeak-Client/jenkins/create_build.sh

112 lines
4.1 KiB
Bash
Raw Normal View History

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