def build_plugins(caller_arguments): (basename, _) = os.path.splitext(os.path.basename(caller_arguments.target_7zfile)) Paths = collections.namedtuple('Paths', [ 'qt5', 'temp', 'qtc_dev', 'qtc_build', 'source', 'build', 'target', 'dev_target' ]) paths = Paths(qt5=os.path.join(caller_arguments.build_path, basename + '-qt5'), temp=os.path.join(caller_arguments.build_path, basename + '-temp'), qtc_dev=caller_arguments.qtc_dev, qtc_build=caller_arguments.qtc_build, source=caller_arguments.plugin_path, build=os.path.join(caller_arguments.build_path, basename + '-build'), target=os.path.join(caller_arguments.build_path, basename + '-target'), dev_target=os.path.join(caller_arguments.build_path, basename + '-tempdev')) if caller_arguments.clean: bldinstallercommon.remove_tree(paths.qt5) bldinstallercommon.remove_tree(paths.temp) if caller_arguments.qtc_dev_url: bldinstallercommon.remove_tree(paths.qtc_dev) if caller_arguments.qtc_build_url: bldinstallercommon.remove_tree(paths.qtc_build) bldinstallercommon.remove_tree(paths.build) bldinstallercommon.remove_tree(paths.target) bldinstallercommon.remove_tree(paths.dev_target) download_packages_work = ThreadedWork( 'Get and extract all needed packages') need_to_install_qt = not os.path.exists(paths.qt5) if need_to_install_qt: download_packages_work.addTaskObject( bldinstallercommon.create_qt_download_task( caller_arguments.qt_modules, paths.qt5, paths.temp, caller_arguments)) if caller_arguments.qtc_build_url and not os.path.exists(paths.qtc_build): download_packages_work.addTaskObject( bldinstallercommon.create_download_extract_task( caller_arguments.qtc_build_url, paths.qtc_build, paths.temp, caller_arguments)) if caller_arguments.qtc_dev_url and not os.path.exists(paths.qtc_dev): download_packages_work.addTaskObject( bldinstallercommon.create_download_extract_task( caller_arguments.qtc_dev_url, paths.qtc_dev, paths.temp, caller_arguments)) if download_packages_work.taskNumber != 0: download_packages_work.run() if need_to_install_qt: patch_qt_pri_files(paths.qt5) bldinstallercommon.patch_qt(paths.qt5) # qmake arguments qmake_filepath = qmake_binary(paths.qt5) common_qmake_arguments = get_common_qmake_arguments( paths, caller_arguments) # environment environment = get_common_environment(paths.qt5, caller_arguments) # build plugins print('------------') print('Building plugin "{0}" in "{1}" ...'.format(paths.source, paths.build)) qmake_command = [qmake_filepath] qmake_command.append(paths.source) qmake_command.extend(common_qmake_arguments) runCommand(qmake_command, paths.build, callerArguments=caller_arguments, init_environment=environment) runBuildCommand(currentWorkingDirectory=paths.build, callerArguments=caller_arguments, init_environment=environment) runBuildCommand("docs", currentWorkingDirectory=paths.build, callerArguments=caller_arguments, init_environment=environment) # run custom deploy script if caller_arguments.deploy_command: custom_deploy_command = caller_arguments.deploy_command + [ paths.qt5, paths.target ] runCommand(custom_deploy_command, currentWorkingDirectory=paths.target) if caller_arguments.deploy: runInstallCommand(["deploy"], currentWorkingDirectory=paths.build, callerArguments=caller_arguments, init_environment=environment) sevenzip_filepath = '7z.exe' if bldinstallercommon.is_win_platform( ) else '7z' if hasattr(caller_arguments, 'sevenzippath') and caller_arguments.sevenzippath: sevenzip_filepath = os.path.join(caller_arguments.sevenzippath, sevenzip_filepath) # deploy and zip up deploy_command = [ 'python', '-u', os.path.join(paths.qtc_dev, 'scripts', 'packagePlugins.py'), '--qmake_binary', os.path.join(paths.qt5, 'bin', 'qmake'), '--7z', sevenzip_filepath ] deploy_command.extend([paths.target, caller_arguments.target_7zfile]) runCommand(deploy_command, paths.temp, callerArguments=caller_arguments, init_environment=environment) if caller_arguments.target_dev7zfile: dev_command = [ 'python', '-u', os.path.join(paths.qtc_dev, 'scripts', 'createDevPackage.py'), '--source', paths.source, '--build', paths.build, '--7z', sevenzip_filepath, '--7z_out', caller_arguments.target_dev7zfile, paths.dev_target ] runCommand(dev_command, paths.temp, callerArguments=caller_arguments, init_environment=environment)
def mingw_training(base_path, qtcreator_path, bitness): # Checkout qt-creator, download libclang for build, qt installer and DebugView bld_utils.runCommand(['git', 'checkout', training_qtcreator_version()], qtcreator_path) # Set up paths script_dir = os.path.dirname(os.path.realpath(__file__)) debugview_dir = os.path.join(base_path, 'debugview') creator_build_dir = os.path.join(base_path, 'qtcreator_build') creator_libclang_dir = os.path.join(base_path, 'qtcreator_libclang') creator_settings_dir = os.path.join(base_path, 'qtc-settings') creator_logs_dir = os.path.join(base_path, 'logs') training_dir = os.path.join(script_dir, 'libclang_training') qt_dir = os.path.join(base_path, 'qt') # Create some paths os.makedirs(debugview_dir) os.makedirs(creator_build_dir) os.makedirs(creator_settings_dir) os.makedirs(creator_logs_dir) pkg_server = os.environ['PACKAGE_STORAGE_SERVER'] # Install Qt qt_modules = ['qtbase', 'qtdeclarative', 'qtgraphicaleffects', 'qtimageformats', 'qtlocation', 'qtmacextras', 'qtquickcontrols', 'qtquickcontrols2', 'qtscript', 'qtsvg', 'qttools', 'qttranslations', 'qtx11extras', 'qtxmlpatterns'] qt_base_url = 'http://' + pkg_server + '/packages/jenkins/archive/qt/' \ + training_qt_version() + '/' + training_qt_long_version() + '/latest' arg = 'X86_64' if bitness == 64 else 'X86' msvc_year_ver = msvc_year_version() qt_postfix = '-Windows-Windows_10-' + msvc_year_ver + '-Windows-Windows_10-' + arg + '.7z' qt_module_urls = [qt_base_url + '/' + module + '/' + module + qt_postfix for module in qt_modules] qt_temp = os.path.join(base_path, 'qt_download') download_packages_work = threadedwork.ThreadedWork("get and extract Qt") download_packages_work.addTaskObject(bldinstallercommon.create_qt_download_task(qt_module_urls, qt_dir, qt_temp, None)) download_packages_work.addTaskObject(bldinstallercommon.create_download_extract_task( 'http://' + pkg_server \ + '/packages/jenkins/qtcreator_libclang/libclang-' + training_libclang_version() \ + '-windows-' + msvc_year_version_libclang() + '_' + str(bitness) + '-clazy.7z', creator_libclang_dir, base_path, None)) download_packages_work.addTaskObject(bldinstallercommon.create_download_extract_task( 'https://download.sysinternals.com/files/DebugView.zip', debugview_dir, base_path, None)) download_packages_work.run() bld_qtcreator.patch_qt_pri_files(qt_dir) bldinstallercommon.patch_qt(qt_dir) # Build QtCreator with installed libclang and qt # Debug version of QtCreator is required to support running .batch files msvc_env = msvc_environment(bitness) msvc_env['LLVM_INSTALL_DIR'] = os.path.join(creator_libclang_dir, 'libclang') bld_utils.runCommand([os.path.join(qt_dir, 'bin', 'qmake.exe'), os.path.join(qtcreator_path, 'qtcreator.pro'), '-spec', 'win32-msvc', 'CONFIG+=debug'], creator_build_dir, None, msvc_env) bld_utils.runCommand(['jom', 'qmake_all'], creator_build_dir, None, msvc_env) bld_utils.runCommand(['jom'], creator_build_dir, None, msvc_env) qtConfFile = open(os.path.join(creator_build_dir, 'bin', 'qt.conf'), "w") qtConfFile.write("[Paths]" + os.linesep) qtConfFile.write("Prefix=../../qt" + os.linesep) qtConfFile.close() # Train mingw libclang library with build QtCreator bld_utils.runCommand([os.path.join(training_dir, 'runBatchFiles.bat')], base_path, callerArguments = None, init_environment = None, onlyErrorCaseOutput=False, expectedExitCodes=[0,1])
def build_plugins(caller_arguments): (basename,_) = os.path.splitext(os.path.basename(caller_arguments.target_7zfile)) Paths = collections.namedtuple('Paths', ['qt5', 'temp', 'qtc_dev', 'qtc_build', 'source', 'build', 'target', 'dev_target']) paths = Paths(qt5 = os.path.join(caller_arguments.build_path, basename + '-qt5'), temp = os.path.join(caller_arguments.build_path, basename + '-temp'), qtc_dev = caller_arguments.qtc_dev, qtc_build = caller_arguments.qtc_build, source = caller_arguments.plugin_path, build = os.path.join(caller_arguments.build_path, basename + '-build'), target = os.path.join(caller_arguments.build_path, basename + '-target'), dev_target = os.path.join(caller_arguments.build_path, basename + '-tempdev')) if caller_arguments.clean: bldinstallercommon.remove_tree(paths.qt5) bldinstallercommon.remove_tree(paths.temp) if caller_arguments.qtc_dev_url: bldinstallercommon.remove_tree(paths.qtc_dev) if caller_arguments.qtc_build_url: bldinstallercommon.remove_tree(paths.qtc_build) bldinstallercommon.remove_tree(paths.build) bldinstallercommon.remove_tree(paths.target) bldinstallercommon.remove_tree(paths.dev_target) download_packages_work = ThreadedWork('Get and extract all needed packages') need_to_install_qt = not os.path.exists(paths.qt5) if need_to_install_qt: download_packages_work.addTaskObject(bldinstallercommon.create_qt_download_task( caller_arguments.qt_modules, paths.qt5, paths.temp, caller_arguments)) if caller_arguments.qtc_build_url and not os.path.exists(paths.qtc_build): download_packages_work.addTaskObject(bldinstallercommon.create_download_extract_task(caller_arguments.qtc_build_url, paths.qtc_build, paths.temp, caller_arguments)) if caller_arguments.qtc_dev_url and not os.path.exists(paths.qtc_dev): download_packages_work.addTaskObject(bldinstallercommon.create_download_extract_task(caller_arguments.qtc_dev_url, paths.qtc_dev, paths.temp, caller_arguments)) if download_packages_work.taskNumber != 0: download_packages_work.run() if need_to_install_qt: patch_qt_pri_files(paths.qt5) bldinstallercommon.patch_qt(paths.qt5) # qmake arguments qmake_filepath = qmake_binary(paths.qt5) common_qmake_arguments = get_common_qmake_arguments(paths, caller_arguments) # environment environment = get_common_environment(paths.qt5, caller_arguments) # build plugins print('------------') print('Building plugin "{0}" in "{1}" ...'.format(paths.source, paths.build)) qmake_command = [qmake_filepath] qmake_command.append(paths.source) qmake_command.extend(common_qmake_arguments) runCommand(qmake_command, paths.build, callerArguments = caller_arguments, init_environment = environment) runBuildCommand(currentWorkingDirectory = paths.build, callerArguments = caller_arguments, init_environment = environment) # run custom deploy script if caller_arguments.deploy_command: custom_deploy_command = caller_arguments.deploy_command + [paths.qt5, paths.target] runCommand(custom_deploy_command, currentWorkingDirectory = paths.target) sevenzip_filepath = '7z.exe' if bldinstallercommon.is_win_platform() else '7z' if hasattr(caller_arguments, 'sevenzippath') and caller_arguments.sevenzippath: sevenzip_filepath = os.path.join(caller_arguments.sevenzippath, sevenzip_filepath) # deploy and zip up deploy_command = ['python', '-u', os.path.join(paths.qtc_dev, 'scripts', 'packagePlugins.py'), '--qmake_binary', os.path.join(paths.qt5, 'bin', 'qmake'), '--7z', sevenzip_filepath] deploy_command.extend([paths.target, caller_arguments.target_7zfile]) runCommand(deploy_command, paths.temp, callerArguments = caller_arguments, init_environment = environment) if caller_arguments.target_dev7zfile: dev_command = ['python', '-u', os.path.join(paths.qtc_dev, 'scripts', 'createDevPackage.py'), '--source', paths.source, '--build', paths.build, '--7z', sevenzip_filepath, '--7z_out', caller_arguments.target_dev7zfile, paths.dev_target] runCommand(dev_command, paths.temp, callerArguments = caller_arguments, init_environment = environment)