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 <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Eike Ziller
2023-03-17 13:00:34 +01:00
parent 584874f15f
commit f1fde363a0
2 changed files with 18 additions and 0 deletions

View File

@@ -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,

View File

@@ -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