From 6b142cd374de11379c83be1509ea2c26e059b9fd Mon Sep 17 00:00:00 2001
From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
Date: Fri, 31 Jan 2025 11:49:52 -0500
Subject: [PATCH] build: Windows: add a parameter to supply the crash report
 URL

This commit adds a parameter to the Windows-specific build script to
supply the crash report URL.

Gitlab: #1454
Change-Id: I9f131354c3e9041d068e399fd432c3f6c8325f51
---
 extras/scripts/build-windows.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/extras/scripts/build-windows.py b/extras/scripts/build-windows.py
index 963777ff..c1cb10cc 100644
--- a/extras/scripts/build-windows.py
+++ b/extras/scripts/build-windows.py
@@ -261,7 +261,7 @@ def cmake_build(config_str, env_vars, cmake_build_dir):
     return True
 
 
-def build(config_str, qt_dir, tests, enable_crash_reports):
+def build(config_str, qt_dir, tests, enable_crash_reports, crash_report_url=None):
     """Use cmake to build the project."""
     print("Building with Qt at " + qt_dir)
 
@@ -287,6 +287,8 @@ def build(config_str, qt_dir, tests, enable_crash_reports):
 
     if enable_crash_reports:
         cmake_options.append("-DENABLE_CRASHREPORTS=ON")
+        if crash_report_url:
+            cmake_options.append(f"-DCRASH_REPORT_URL={crash_report_url}")
     else:
         cmake_options.append("-DENABLE_CRASHREPORTS=OFF")
 
@@ -347,8 +349,8 @@ def deploy_runtimes(config_str, qt_dir):
     install_file("resources/images/jami.ico", repo_root_dir)
 
     # windeployqt
-    print("Running windeployqt (this may take a while)...")
     win_deploy_qt = os.path.join(qt_dir, "bin", "windeployqt.exe")
+    print(f"Running windeployqt ({win_deploy_qt}) (this may take a while)...")
     qml_src_dir = os.path.join(repo_root_dir, "src", "app")
     installation_dir = get_vs_prop("installationPath")
     if not installation_dir:
@@ -491,6 +493,10 @@ def parse_args():
         action='store_true',
         default=False,
         help='Enable crash reporting')
+    parser.add_argument(
+        '--crash-report-url',
+        help='Override the crash report submission URL',
+        default=None)
 
     pack_arg_parser = subparsers.add_parser("pack")
     pack_group = pack_arg_parser.add_mutually_exclusive_group(required=True)
@@ -543,7 +549,9 @@ def main():
 
     def do_build(do_tests):
         if not parsed_args.skip_build:
-            build(config_str, parsed_args.qt, do_tests, parsed_args.enable_crash_reports)
+            build(config_str, parsed_args.qt, do_tests,
+                  parsed_args.enable_crash_reports,
+                  parsed_args.crash_report_url)
         if not parsed_args.skip_deploy:
             deploy_runtimes(config_str, parsed_args.qt)
 
-- 
GitLab