From f1fde363a080384779ccf1126d1ba4da2d11bb71 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 17 Mar 2023 13:00:34 +0100 Subject: Build: Optionally sign on Windows Add an argument to the build script that takes a signing command (path to sign is added at the end, run in cwd) Task-number: QTCREATORBUG-25740 Task-number: QTCREATORBUG-28909 Change-Id: I6d3bdf7bd9fab0ea1fc129da08cf77c9a5448b31 Reviewed-by: Cristian Adam Reviewed-by: --- scripts/build.py | 11 +++++++++++ scripts/build_plugin.py | 7 +++++++ 2 files changed, 18 insertions(+) (limited to 'scripts') diff --git a/scripts/build.py b/scripts/build.py index d6a30a18ff3..2fced683b1b 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -8,6 +8,7 @@ from __future__ import print_function import argparse import collections import os +import shlex import shutil import common @@ -43,6 +44,8 @@ def get_arguments(): # signing parser.add_argument('--keychain-unlock-script', help='Path to script for unlocking the keychain used for signing (macOS)') + parser.add_argument('--sign-command', + help='Command to use for signing (Windows). The installation directory to sign is added at the end. Is run in the CWD.') # cdbextension parser.add_argument('--python-path', @@ -262,6 +265,14 @@ def zipPatternForApp(paths): def package_qtcreator(args, paths): + if common.is_windows_platform() and args.sign_command: + command = shlex.split(args.sign_command) + if not args.no_qtcreator: + common.check_print_call(command + [paths.install]) + common.check_print_call(command + [paths.wininterrupt_install]) + if not args.no_cdb: + common.check_print_call(command + [paths.qtcreatorcdbext_install]) + if not args.no_zip: if not args.no_qtcreator: common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads, diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py index 38d247d4d50..4f4ddfdcb02 100755 --- a/scripts/build_plugin.py +++ b/scripts/build_plugin.py @@ -9,6 +9,7 @@ import argparse import collections import glob import os +import shlex import common @@ -46,6 +47,9 @@ def get_arguments(): # signing parser.add_argument('--keychain-unlock-script', help='Path to script for unlocking the keychain used for signing (macOS)') + parser.add_argument('--sign-command', + help='Command to use for signing (Windows). The installation directory to sign is added at the end. Is run in the CWD.') + args = parser.parse_args() args.with_debug_info = args.build_type == 'RelWithDebInfo' return args @@ -140,6 +144,9 @@ def build(args, paths): def package(args, paths): if not os.path.exists(paths.result): os.makedirs(paths.result) + if common.is_windows_platform() and args.sign_command: + command = shlex.split(args.sign_command) + common.check_print_call(command + [paths.install]) common.check_print_call(['7z', 'a', '-mmt2', os.path.join(paths.result, args.name + '.7z'), '*'], paths.install) if os.path.exists(paths.dev_install): # some plugins might not provide anything in Devel -- cgit v1.2.3