mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-03-28 14:56:19 +01:00
build: crash-reporting: add scripting option to enable crash reporting
Gitlab: #1454 Change-Id: I51fdc2af15c7cdd6469dd817b6a4ad89e45bab1c
This commit is contained in:
parent
70c64a5947
commit
7acf48d919
3 changed files with 52 additions and 13 deletions
21
build.py
21
build.py
|
@ -366,13 +366,27 @@ def cwd(path):
|
|||
def run_install(args):
|
||||
# Platforms with special compilation scripts
|
||||
if args.distribution == WIN32_DISTRIBUTION_NAME:
|
||||
# Build daemon if not using pywinmake
|
||||
if not args.pywinmake:
|
||||
with cwd('daemon/compat/msvc'):
|
||||
execute_script([f'python winmake.py -iv -s {args.sdk} -b daemon'])
|
||||
|
||||
# Prepare the build-windows.py script call
|
||||
build_windows = 'extras/scripts/build-windows.py'
|
||||
# Initialize build environment
|
||||
execute_script([f'python {build_windows} --init'])
|
||||
execute_script([f'python {build_windows} --qt={args.qt}'])
|
||||
|
||||
# Construct build command with options
|
||||
build_cmd = [
|
||||
'python',
|
||||
build_windows,
|
||||
f'--qt={args.qt}'
|
||||
]
|
||||
|
||||
if args.enable_crash_reports:
|
||||
build_cmd.append('--enable-crash-reports')
|
||||
|
||||
execute_script([' '.join(build_cmd)])
|
||||
return True
|
||||
|
||||
# Unix-like platforms
|
||||
|
@ -401,6 +415,8 @@ def run_install(args):
|
|||
install_args += ('-a', args.arch)
|
||||
if args.extra_cmake_flags:
|
||||
install_args += ('-D', args.extra_cmake_flags)
|
||||
if args.enable_crash_reports:
|
||||
install_args.append('-C')
|
||||
|
||||
if args.distribution == OSX_DISTRIBUTION_NAME:
|
||||
# The `universal_newlines` parameter has been renamed to `text` in
|
||||
|
@ -750,6 +766,9 @@ def parse_args():
|
|||
# Allow supplying extra congifure flags to the client cmake.
|
||||
ap.add_argument('--extra-cmake-flags', type=str,
|
||||
help='Extra flags to pass to the client cmake')
|
||||
ap.add_argument('--enable-crash-reports',
|
||||
action='store_true', default=False,
|
||||
help='Enable crash reporting')
|
||||
|
||||
dist = choose_distribution()
|
||||
|
||||
|
|
|
@ -9,14 +9,15 @@ and package the project for Windows.
|
|||
usage: build.py [-q] [-h] [-a ARCH] [-c CONFIG] [-t] [-i] [-v] {pack} ...
|
||||
|
||||
optional arguments:
|
||||
-q, --qt PATH Sets the Qt installation path
|
||||
-a ARCH, --arch ARCH Sets the build architecture
|
||||
-q, --qt PATH Sets the Qt installation path
|
||||
-a ARCH, --arch ARCH Sets the build architecture
|
||||
-c CONFIG, --config CONFIG
|
||||
Sets the build configuration type
|
||||
-t, --tests Build and run tests
|
||||
-i, --init Initialize submodules
|
||||
-v, --version Show the version number and exit
|
||||
-s, --skip-build Only do packaging or run tests, skip building
|
||||
Sets the build configuration type
|
||||
-t, --tests Build and run tests
|
||||
-i, --init Initialize submodules
|
||||
-v, --version Show the version number and exit
|
||||
-s, --skip-build Only do packaging or run tests, skip building
|
||||
--enable-crash-reports Enable crash reports
|
||||
|
||||
positional arguments:
|
||||
{pack}
|
||||
|
@ -260,7 +261,7 @@ def cmake_build(config_str, env_vars, cmake_build_dir):
|
|||
return True
|
||||
|
||||
|
||||
def build(config_str, qt_dir, tests):
|
||||
def build(config_str, qt_dir, tests, enable_crash_reports):
|
||||
"""Use cmake to build the project."""
|
||||
print("Building with Qt at " + qt_dir)
|
||||
|
||||
|
@ -284,6 +285,11 @@ def build(config_str, qt_dir, tests):
|
|||
"-DBETA=" + str((0, 1)[config_str == "Beta"]),
|
||||
]
|
||||
|
||||
if enable_crash_reports:
|
||||
cmake_options.append("-DENABLE_CRASHREPORTS=ON")
|
||||
else:
|
||||
cmake_options.append("-DENABLE_CRASHREPORTS=OFF")
|
||||
|
||||
# Make sure the build directory exists.
|
||||
if not os.path.exists(build_dir):
|
||||
os.makedirs(build_dir)
|
||||
|
@ -471,17 +477,20 @@ def parse_args():
|
|||
parser.add_argument(
|
||||
"-i", "--init", action="store_true", help="Initialize submodules")
|
||||
parser.add_argument(
|
||||
'-sd',
|
||||
'--skip-deploy',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Force skip deployment of runtime files needed for packaging')
|
||||
parser.add_argument(
|
||||
"-sb",
|
||||
"--skip-build",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Only do packaging or run tests, skip build step")
|
||||
parser.add_argument(
|
||||
'--enable-crash-reports',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Enable crash reporting')
|
||||
|
||||
pack_arg_parser = subparsers.add_parser("pack")
|
||||
pack_group = pack_arg_parser.add_mutually_exclusive_group(required=True)
|
||||
|
@ -534,7 +543,7 @@ def main():
|
|||
|
||||
def do_build(do_tests):
|
||||
if not parsed_args.skip_build:
|
||||
build(config_str, parsed_args.qt, do_tests)
|
||||
build(config_str, parsed_args.qt, do_tests, parsed_args.enable_crash_reports)
|
||||
if not parsed_args.skip_deploy:
|
||||
deploy_runtimes(config_str, parsed_args.qt)
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ export OSTYPE
|
|||
# -a: arch to build
|
||||
# -A: enable AddressSanitizer
|
||||
# -D: extra CMake flags for the client
|
||||
# -C: enable crash reporting
|
||||
|
||||
set -ex
|
||||
|
||||
|
@ -49,8 +50,9 @@ asan=
|
|||
extra_cmake_flags=''
|
||||
arch=''
|
||||
enable_testing=false
|
||||
enable_crashreports=false
|
||||
|
||||
while getopts gsc:dQ:P:p:uWwa:AtD: OPT; do
|
||||
while getopts gsc:dQ:P:p:uWwa:AtD:C OPT; do
|
||||
case "$OPT" in
|
||||
g)
|
||||
global='true'
|
||||
|
@ -91,6 +93,9 @@ while getopts gsc:dQ:P:p:uWwa:AtD: OPT; do
|
|||
D)
|
||||
extra_cmake_flags="${OPTARG}"
|
||||
;;
|
||||
C)
|
||||
enable_crashreports='true'
|
||||
;;
|
||||
\?)
|
||||
exit 1
|
||||
;;
|
||||
|
@ -212,6 +217,12 @@ else
|
|||
client_cmake_flags+=(-DBUILD_TESTING=Off)
|
||||
fi
|
||||
|
||||
if [ "${enable_crashreports}" = "true" ]; then
|
||||
client_cmake_flags+=(-DENABLE_CRASHREPORTS=ON)
|
||||
else
|
||||
client_cmake_flags+=(-DENABLE_CRASHREPORTS=OFF)
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
#detect arch for macos
|
||||
CMAKE_OSX_ARCHITECTURES="arm64"
|
||||
|
|
Loading…
Add table
Reference in a new issue