summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-02-19 17:01:41 +0100
committerEike Ziller <eike.ziller@qt.io>2020-04-28 11:21:19 +0000
commit05f746cfd029c0232bb5880c50d0b0d7d17f0cc5 (patch)
tree755de0f0722fac93faf3474bf335b1c268c1f6c3 /scripts
parent794f3a5f55e09c0cb3ecd43833f58d11b9fbc263 (diff)
downloadqt-creator-05f746cfd029c0232bb5880c50d0b0d7d17f0cc5.tar.gz
Add script for building external plugins for packaging
Also turn off PCH for building Qt Creator and add some more options for local testing. Change-Id: Ic05099ef1dd8e8c78b174d7cd07a83b2f4a9cbb5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.py45
-rwxr-xr-xscripts/build_plugin.py130
2 files changed, 155 insertions, 20 deletions
diff --git a/scripts/build.py b/scripts/build.py
index 3c48136239..a58a688dca 100755
--- a/scripts/build.py
+++ b/scripts/build.py
@@ -83,6 +83,10 @@ def get_arguments():
action='store_true', default=(not common.is_windows_platform()))
parser.add_argument('--no-docs', help='Skip documentation generation',
action='store_true', default=False)
+ parser.add_argument('--no-dmg', help='Skip disk image creation (macOS)',
+ action='store_true', default=False)
+ parser.add_argument('--no-zip', help='Skip creation of 7zip files for install and developer package',
+ action='store_true', default=False)
return parser.parse_args()
def build_qtcreator(args, paths):
@@ -124,8 +128,7 @@ def build_qtcreator(args, paths):
'-DPYTHON_INCLUDE_DIR=' + os.path.join(args.python_path, 'include')]
# TODO this works around a CMake bug https://gitlab.kitware.com/cmake/cmake/issues/20119
- if common.is_linux_platform():
- cmake_args += ['-DBUILD_WITH_PCH=OFF']
+ cmake_args += ['-DBUILD_WITH_PCH=OFF']
ide_revision = common.get_commit_SHA(paths.src)
if ide_revision:
@@ -191,30 +194,32 @@ def deploy_qt(args, paths):
paths.build)
def package_qtcreator(args, paths):
- common.check_print_call(['7z', 'a', '-mmt2', os.path.join(paths.result, 'qtcreator.7z'), '*'],
- paths.install)
- common.check_print_call(['7z', 'a', '-mmt2',
- os.path.join(paths.result, 'qtcreator_dev.7z'), '*'],
- paths.dev_install)
- if common.is_windows_platform():
+ if not args.no_zip:
+ common.check_print_call(['7z', 'a', '-mmt2', os.path.join(paths.result, 'qtcreator.7z'), '*'],
+ paths.install)
common.check_print_call(['7z', 'a', '-mmt2',
- os.path.join(paths.result, 'wininterrupt.7z'), '*'],
- paths.wininterrupt_install)
- if not args.no_cdb:
+ os.path.join(paths.result, 'qtcreator_dev.7z'), '*'],
+ paths.dev_install)
+ if common.is_windows_platform():
common.check_print_call(['7z', 'a', '-mmt2',
- os.path.join(paths.result, 'qtcreatorcdbext.7z'), '*'],
- paths.qtcreatorcdbext_install)
+ os.path.join(paths.result, 'wininterrupt.7z'), '*'],
+ paths.wininterrupt_install)
+ if not args.no_cdb:
+ common.check_print_call(['7z', 'a', '-mmt2',
+ os.path.join(paths.result, 'qtcreatorcdbext.7z'), '*'],
+ paths.qtcreatorcdbext_install)
if common.is_mac_platform():
if args.keychain_unlock_script:
common.check_print_call([args.keychain_unlock_script], paths.install)
- common.check_print_call(['python', '-u',
- os.path.join(paths.src, 'scripts', 'makedmg.py'),
- 'qt-creator.dmg',
- 'Qt Creator',
- paths.src,
- paths.install],
- paths.result)
+ if not args.no_dmg:
+ common.check_print_call(['python', '-u',
+ os.path.join(paths.src, 'scripts', 'makedmg.py'),
+ 'qt-creator.dmg',
+ 'Qt Creator',
+ paths.src,
+ paths.install],
+ paths.result)
def get_paths(args):
Paths = collections.namedtuple('Paths',
diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py
new file mode 100755
index 0000000000..45c16765d3
--- /dev/null
+++ b/scripts/build_plugin.py
@@ -0,0 +1,130 @@
+#!/usr/bin/env python
+#############################################################################
+##
+## Copyright (C) 2020 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the release tools of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see https://www.qt.io/terms-conditions. For further
+## information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+# import the print function which is used in python 3.x
+from __future__ import print_function
+
+import argparse
+import collections
+import os
+
+import common
+
+def get_arguments():
+ parser = argparse.ArgumentParser(description='Build Qt Creator for packaging')
+ parser.add_argument('--name', help='Name to use for build results', required=True)
+ parser.add_argument('--src', help='Path to sources', required=True)
+ parser.add_argument('--build', help='Path that should be used for building', required=True)
+ parser.add_argument('--qt-path', help='Path to Qt', required=True)
+ parser.add_argument('--qtc-path',
+ help='Path to Qt Creator installation including development package',
+ required=True)
+ parser.add_argument('--output-path', help='Output path for resulting 7zip files')
+ parser.add_argument('--add-path', help='Adds a CMAKE_PREFIX_PATH to the build',
+ action='append', dest='prefix_paths', default=[])
+ parser.add_argument('--deploy', help='Installs the "Dependencies" component of the plugin.',
+ action='store_true', default=False)
+ parser.add_argument('--debug', help='Enable debug builds', action='store_true', default=False)
+ return parser.parse_args()
+
+def build(args, paths):
+ if not os.path.exists(paths.build):
+ os.makedirs(paths.build)
+ if not os.path.exists(paths.result):
+ os.makedirs(paths.result)
+ prefix_paths = [paths.qt, paths.qt_creator] + [os.path.abspath(fp) for fp in args.prefix_paths]
+ build_type = 'Debug' if args.debug else 'Release'
+ cmake_args = ['cmake',
+ '-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
+ '-DCMAKE_BUILD_TYPE=' + build_type,
+ '-DCMAKE_INSTALL_PREFIX=' + paths.install,
+ '-G', 'Ninja']
+
+ # force MSVC on Windows, because it looks for GCC in the PATH first,
+ # even if MSVC is first mentioned in the PATH...
+ # TODO would be nicer if we only did this if cl.exe is indeed first in the PATH
+ if common.is_windows_platform():
+ cmake_args += ['-DCMAKE_C_COMPILER=cl',
+ '-DCMAKE_CXX_COMPILER=cl']
+
+ # TODO this works around a CMake bug https://gitlab.kitware.com/cmake/cmake/issues/20119
+ cmake_args += ['-DBUILD_WITH_PCH=OFF']
+
+ ide_revision = common.get_commit_SHA(paths.src)
+ if ide_revision:
+ cmake_args += ['-DQTC_PLUGIN_REVISION=' + ide_revision]
+ with open(os.path.join(paths.result, args.name + '.7z.git_sha'), 'w') as f:
+ f.write(ide_revision)
+
+ common.check_print_call(cmake_args + [paths.src], paths.build)
+ common.check_print_call(['cmake', '--build', '.'], paths.build)
+ common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install, '--strip'],
+ paths.build)
+ if args.deploy:
+ common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install,
+ '--component', 'Dependencies'],
+ paths.build)
+ common.check_print_call(['cmake', '--install', '.', '--prefix', paths.dev_install,
+ '--component', 'Devel'],
+ paths.build)
+
+def package(args, paths):
+ if not os.path.exists(paths.result):
+ os.makedirs(paths.result)
+ 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
+ common.check_print_call(['7z', 'a', '-mmt2',
+ os.path.join(paths.result, args.name + '_dev.7z'), '*'],
+ paths.dev_install)
+
+def get_paths(args):
+ Paths = collections.namedtuple('Paths',
+ ['qt', 'src', 'build', 'qt_creator',
+ 'install', 'dev_install', 'result'])
+ build_path = os.path.abspath(args.build)
+ install_path = os.path.join(build_path, 'install')
+ result_path = os.path.abspath(args.output_path) if args.output_path else build_path
+ return Paths(qt=os.path.abspath(args.qt_path),
+ src=os.path.abspath(args.src),
+ build=os.path.join(build_path, 'build'),
+ qt_creator=os.path.abspath(args.qtc_path),
+ install=os.path.join(install_path, args.name),
+ dev_install=os.path.join(install_path, args.name + '-dev'),
+ result=result_path)
+
+def main():
+ args = get_arguments()
+ paths = get_paths(args)
+
+ build(args, paths)
+ package(args, paths)
+
+if __name__ == '__main__':
+ main()