def build_static_libclang_msvc(toolchain,
                               src_path,
                               build_path,
                               install_path,
                               profile_data_path,
                               bitness=64,
                               environment=None,
                               build_type='Release'):
    build_path_static = os.path.join(build_path, 'static_build')
    if build_path_static and not os.path.lexists(build_path_static):
        os.makedirs(build_path_static)

    cmake_cmd = cmake_static_libclang(toolchain, src_path, install_path,
                                      profile_data_path, bitness, build_type)

    bldinstallercommon.do_execute_sub_process(cmake_cmd,
                                              build_path_static,
                                              extra_env=environment)
    build_and_install(toolchain, build_path_static, environment,
                      ['libclang_static', 'libclang'], [])
    pack_command = [
        'lib.exe',
        '/OUT:' + os.path.join(install_path, 'lib', 'libclang_static.lib')
    ]
    for file in os.listdir(os.path.join(build_path_static, 'lib')):
        if file.endswith('.lib') and file != 'libclang.lib':
            pack_command.append(file)
    bld_utils.runCommand(pack_command, os.path.join(build_path_static, 'lib'),
                         None, environment)
Example #2
0
def git_clone_and_checkout(base_path, remote_repository_url, directory, revision):
    bld_utils.runCommand(['git', 'clone',
                          '--config', 'core.eol=lf',
                          '--config', 'core.autocrlf=input',
                          '--branch', revision,
                          '--recursive',
                          remote_repository_url, directory], base_path)
Example #3
0
def create_extract_function(file_path, target_path, caller_arguments=None):
    create_dirs(target_path)
    working_dir = os.path.dirname(file_path)
    if file_path.endswith('.tar.gz'):
        return lambda: runCommand(['tar', 'zxf', file_path, '-C', target_path],
                                  working_dir, caller_arguments)
    return lambda: runCommand(['7z', 'x', '-y', file_path, '-o' + target_path],
                              working_dir, caller_arguments)
Example #4
0
def patch_qt(qt5_path):
    print("##### {0} #####".format("patch Qt"))
    qmake_binary = os.path.join(qt5_path, 'bin', 'qmake')
    # write qt.conf
    qtConfFile = open(os.path.join(qt5_path, 'bin', 'qt.conf'), "w")
    qtConfFile.write("[Paths]" + os.linesep)
    qtConfFile.write("Prefix=.." + os.linesep)
    qtConfFile.close()
    # fix rpaths
    if is_linux_platform():
        handle_component_rpath(qt5_path, 'lib')
    print("##### {0} ##### ... done".format("patch Qt"))
    runCommand(qmake_binary + " -query", qt5_path)
Example #5
0
def patch_qt(qt5_path):
    print("##### {0} #####".format("patch Qt"))
    qmake_binary = os.path.join(qt5_path, 'bin', 'qmake')
    # write qt.conf
    qtConfFile = open(os.path.join(qt5_path, 'bin', 'qt.conf'), "w")
    qtConfFile.write("[Paths]" + os.linesep)
    qtConfFile.write("Prefix=.." + os.linesep)
    qtConfFile.close()
    # fix rpaths
    if is_linux_platform():
        handle_component_rpath(qt5_path, 'lib')
    print("##### {0} ##### ... done".format("patch Qt"))
    runCommand(qmake_binary + " -query", qt5_path)
Example #6
0
def build_static_libclang_msvc(toolchain, src_path, build_path, install_path, profile_data_path, bitness=64, environment=None, build_type='Release'):
    build_path_static = os.path.join(build_path, 'static_build')
    if build_path_static and not os.path.lexists(build_path_static):
        os.makedirs(build_path_static)

    cmake_cmd = cmake_static_libclang(toolchain, src_path, install_path, profile_data_path, bitness, build_type)

    bldinstallercommon.do_execute_sub_process(cmake_cmd, build_path_static, extra_env=environment)
    build_and_install(toolchain, build_path_static, environment, ['libclang_static', 'libclang'], [])
    pack_command = ['lib.exe', '/OUT:' + os.path.join(install_path, 'lib', 'libclang_static.lib')]
    for file in os.listdir(os.path.join(build_path_static, 'lib')):
        if file.endswith('.lib') and file != 'libclang.lib':
            pack_command.append(file)
    bld_utils.runCommand(pack_command, os.path.join(build_path_static, 'lib'), None, environment)
Example #7
0
def remove_tree(path):
    if os.path.isdir(path) and os.path.exists(path):
        if IS_WIN_PLATFORM:
            path = win32api.GetShortPathName(path)
            #a funny thing is that rmdir does not set an exitcode it is just using the last set one
            try:
                runCommand("rmdir {0} /S /Q".format(path), SCRIPT_ROOT_DIR, onlyErrorCaseOutput=True)
            except:
                traceback.print_exc()
                pass
        else:
            #shutil.rmtree(path)
            runCommand("rm -rf {0}".format(path), SCRIPT_ROOT_DIR, onlyErrorCaseOutput=True)
    return not os.path.exists(path)
Example #8
0
def remove_tree(path):
    if os.path.isdir(path) and os.path.exists(path):
        if IS_WIN_PLATFORM:
            path = win32api.GetShortPathName(path.replace('/', '\\'))
            #a funny thing is that rmdir does not set an exitcode it is just using the last set one
            try:
                runCommand(['rmdir', path, '/S', '/Q'], SCRIPT_ROOT_DIR, onlyErrorCaseOutput=True)
            except:
                traceback.print_exc()
                pass
        else:
            #shutil.rmtree(path)
            runCommand(['rm', '-rf', path], SCRIPT_ROOT_DIR, onlyErrorCaseOutput=True)
    return not os.path.exists(path)
Example #9
0
def get_clang(base_path, llvm_revision, clang_revision):
    bld_utils.runCommand(['git', 'clone', 'http://llvm.org/git/llvm.git'],
                         base_path)
    bld_utils.runCommand(['git', 'checkout', llvm_revision],
                         os.path.join(base_path, 'llvm'))
    bld_utils.runCommand(['git', 'clone', 'http://llvm.org/git/clang.git'],
                         os.path.join(base_path, 'llvm', 'tools'))
    bld_utils.runCommand(['git', 'checkout', clang_revision],
                         os.path.join(base_path, 'llvm', 'tools', 'clang'))
Example #10
0
def git_clone_and_checkout(base_path, remote_repository_url, directory,
                           revision):
    bld_utils.runCommand(
        ['git', 'clone', '--no-checkout', remote_repository_url, directory],
        base_path)
    local_repo_path = os.path.join(base_path, directory)
    bld_utils.runCommand(['git', 'config', 'core.eol', 'lf'], local_repo_path)
    bld_utils.runCommand(['git', 'config', 'core.autocrlf', 'input'],
                         local_repo_path)
    bld_utils.runCommand(['git', 'checkout', revision], local_repo_path)
Example #11
0
def remove_tree(path):
    if os.path.isdir(path) and os.path.exists(path):
        if IS_WIN_PLATFORM:
            path = win32api.GetShortPathName(path)
            #a funny thing is that rmdir does not set an exitcode it is just using the last set one
            try:
                runCommand(['rmdir', path, '/S', '/Q'],
                           SCRIPT_ROOT_DIR,
                           onlyErrorCaseOutput=True)
            except:
                traceback.print_exc()
                pass
        else:
            #shutil.rmtree(path)
            runCommand(['rm', '-rf', path],
                       SCRIPT_ROOT_DIR,
                       onlyErrorCaseOutput=True)
    return not os.path.exists(path)
Example #12
0
def extract_file(path, to_directory='.'):
    cmd_args = []
    if path.endswith('.tar'):
        cmd_args = ['tar', '-xf', path]
    elif path.endswith('.tar.gz') or path.endswith('.tgz'):
        cmd_args = ['tar', '-xzf', path]
    elif path.endswith('.tar.bz2') or path.endswith('.tbz'):
        cmd_args = ['tar', '-xjf', path]
    elif path.endswith('.7z') or path.endswith('.zip'):
        cmd_args = ['7z', 'x', path]
    else:
        print 'Did not extract the file! Not archived or no appropriate extractor was found: ' + path
        return False

    ret = runCommand(cmd_args, currentWorkingDirectory=to_directory, onlyErrorCaseOutput=True)
    if ret:
        raise RuntimeError('Failure running the last command: %i' % ret)
    return True
Example #13
0
def extract_file(path, to_directory='.'):
    cmd_args = []
    if path.endswith('.tar'):
        cmd_args = ['tar', '-xf', path]
    elif path.endswith('.tar.gz') or path.endswith('.tgz'):
        cmd_args = ['tar', '-xzf', path]
    elif path.endswith('.tar.xz'):
        cmd_args = ['tar', '-xf', path]
    elif path.endswith('.tar.bz2') or path.endswith('.tbz'):
        cmd_args = ['tar', '-xjf', path]
    elif path.endswith('.7z') or path.endswith('.zip'):
        cmd_args = ['7z', 'x', path]
    else:
        print 'Did not extract the file! Not archived or no appropriate extractor was found: ' + path
        return False

    ret = runCommand(cmd_args,
                     currentWorkingDirectory=to_directory,
                     onlyErrorCaseOutput=True)
    if ret:
        raise RuntimeError('Failure running the last command: %i' % ret)
    return True
Example #14
0
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])
Example #15
0
def apply_patch(src_path, patch_filepath):
    print('Applying patch: "' + patch_filepath + '" in "' + src_path + '"')
    bld_utils.runCommand(['git', 'apply', '--whitespace=fix', patch_filepath], src_path)
Example #16
0
def create_extract_function(file_path, target_path, caller_arguments = None):
    create_dirs(target_path)
    working_dir = os.path.dirname(file_path)
    if file_path.endswith('.tar.gz'):
        return lambda: runCommand(['tar', 'zxf', file_path, '-C', target_path], working_dir, caller_arguments)
    return lambda: runCommand(['7z', 'x', '-y', file_path, '-o'+target_path], working_dir, caller_arguments)
Example #17
0
def build_qt(build, make_command):
    bld_utils.runCommand(make_command, build)
Example #18
0
def upload_clang(file_path, remote_path):
    (path, filename) = os.path.split(file_path)
    scp_bin = '%SCP%' if bldinstallercommon.is_win_platform() else 'scp'
    scp_command = [scp_bin, filename, remote_path]
    bld_utils.runCommand(scp_command, path)
Example #19
0
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)
Example #20
0
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])
Example #21
0
def mingw_training(base_path, qtcreator_path, environment, bitness):
    # Checkout qt-creator, download libclang for build, qt installer and DebugView

    git_clone_and_checkout(base_path,
                           'git://code.qt.io/qt-creator/qt-creator.git',
                           qtcreator_path, training_qtcreator_version())

    # Set up paths
    script_dir = os.path.dirname(os.path.realpath(__file__))
    debugview_dir = os.path.join(base_path, 'debugview')
    cmake_dir = os.path.join(base_path, 'cmake')
    creator_build_dir = os.path.join(base_path, 'qtcreator_build')
    creator_install_dir = os.path.join(base_path, 'qtcreator_install')
    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')
    qt_mingw_dir = os.path.join(base_path, 'qt_mingw')

    # Create some paths
    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', 'qtquickcontrols', 'qtquickcontrols2', 'qtscript',
        'qtsvg', 'qttools', 'qttranslations', 'qtxmlpatterns'
    ]

    qt_base_url = 'http://' + pkg_server + '/packages/jenkins/archive/qt/' \
        + training_qt_version() + '/' + training_qt_long_version() + '/latest'
    msvc_year_ver = msvc_year_version()
    if bitness == 64:
        qt_mingw_postfix = '-Windows-Windows_10-Mingw-Windows-Windows_10-X86_64.7z'
        qt_postfix = '-Windows-Windows_10-' + msvc_year_ver + '-Windows-Windows_10-X86_64.7z'
    else:
        qt_mingw_postfix = '-Windows-Windows_7-Mingw-Windows-Windows_7-X86.7z'
        qt_postfix = '-Windows-Windows_10-' + msvc_year_ver + '-Windows-Windows_10-X86.7z'

    qt_module_urls = [
        qt_base_url + '/' + module + '/' + module + qt_postfix
        for module in qt_modules
    ]
    qt_mingw_module_urls = [
        qt_base_url + '/' + module + '/' + module + qt_mingw_postfix
        for module in qt_modules
    ]
    qt_temp = os.path.join(base_path, 'qt_download')
    qt_mingw_temp = os.path.join(base_path, 'qt_download_mingw')
    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_qt_download_task(qt_mingw_module_urls,
                                                   qt_mingw_dir, qt_mingw_temp,
                                                   None))

    download_packages_work.addTaskObject(
        bldinstallercommon.create_download_extract_task(
            'https://download.sysinternals.com/files/DebugView.zip',
            debugview_dir, base_path, None))

    # Install CMake
    cmake_arch_suffix = 'win64-x64' if bitness == 64 else 'win32-x86'
    cmake_base_url = 'http://' + pkg_server + '/packages/jenkins/cmake/' \
        + cmake_version() + '/cmake-' + cmake_version() + '-' + cmake_arch_suffix + '.zip'
    download_packages_work.addTaskObject(
        bldinstallercommon.create_download_extract_task(
            cmake_base_url, cmake_dir, base_path, None))

    download_packages_work.run()

    # Build QtCreator with installed libclang and qt
    # WITH_TESTS is required for QtCreator to support running .batch files
    cmake_command = os.path.join(
        cmake_dir, 'cmake-' + cmake_version() + '-' + cmake_arch_suffix, 'bin',
        'cmake')
    qtc_cmake = [
        cmake_command, '-GNinja', '-DCMAKE_BUILD_TYPE=Release',
        '-DWITH_TESTS=ON', '-DBUILD_PLUGIN_ANDROID=OFF',
        '-DBUILD_PLUGIN_AUTOTEST=OFF',
        '-DBUILD_PLUGIN_AUTOTOOLSPROJECTMANAGER=OFF',
        '-DBUILD_PLUGIN_BAREMETAL=OFF', '-DBUILD_PLUGIN_BAZAAR=OFF',
        '-DBUILD_PLUGIN_BEAUTIFIER=OFF', '-DBUILD_PLUGIN_BINEDITOR=OFF',
        '-DBUILD_PLUGIN_BOOKMARKS=OFF', '-DBUILD_PLUGIN_BOOT2QT=OFF',
        '-DBUILD_PLUGIN_CLANGFORMAT=OFF', '-DBUILD_PLUGIN_CLANGPCHMANAGER=OFF',
        '-DBUILD_PLUGIN_CLANGREFACTORING=OFF', '-DBUILD_PLUGIN_CLASSVIEW=OFF',
        '-DBUILD_PLUGIN_CLEARCASE=OFF', '-DBUILD_PLUGIN_CODEPASTER=OFF',
        '-DBUILD_PLUGIN_COMPILATIONDATABASEPROJECTMANAGER=OFF',
        '-DBUILD_PLUGIN_COMPONENTSPLUGIN=OFF', '-DBUILD_PLUGIN_CPPCHECK=OFF',
        '-DBUILD_PLUGIN_CTFVISUALIZER=OFF', '-DBUILD_PLUGIN_CVS=OFF',
        '-DBUILD_PLUGIN_DIFFEDITOR=OFF', '-DBUILD_PLUGIN_EMACSKEYS=OFF',
        '-DBUILD_PLUGIN_FAKEVIM=OFF',
        '-DBUILD_PLUGIN_GENERICPROJECTMANAGER=OFF', '-DBUILD_PLUGIN_GIT=OFF',
        '-DBUILD_PLUGIN_GLSLEDITOR=OFF', '-DBUILD_PLUGIN_HELLOWORLD=OFF',
        '-DBUILD_PLUGIN_HELP=OFF', '-DBUILD_PLUGIN_IMAGEVIEWER=OFF',
        '-DBUILD_PLUGIN_IOS=OFF', '-DBUILD_PLUGIN_LANGUAGECLIENT=OFF',
        '-DBUILD_PLUGIN_MACROS=OFF', '-DBUILD_PLUGIN_MARKETPLACE=OFF',
        '-DBUILD_PLUGIN_MCUSUPPORT=OFF', '-DBUILD_PLUGIN_MERCURIAL=OFF',
        '-DBUILD_PLUGIN_MODELEDITOR=OFF', '-DBUILD_PLUGIN_NIM=OFF',
        '-DBUILD_PLUGIN_PERFORCE=OFF', '-DBUILD_PLUGIN_PERFPROFILER=OFF',
        '-DBUILD_PLUGIN_PYTHON=OFF', '-DBUILD_PLUGIN_QBSPROJECTMANAGER=OFF',
        '-DBUILD_PLUGIN_QMLDESIGNER=OFF', '-DBUILD_PLUGIN_QMLJSEDITOR=OFF',
        '-DBUILD_PLUGIN_QMLJSTOOLS=OFF', '-DBUILD_PLUGIN_QMLPREVIEW=OFF',
        '-DBUILD_PLUGIN_QMLPREVIEWPLUGIN=OFF',
        '-DBUILD_PLUGIN_QMLPROFILER=OFF',
        '-DBUILD_PLUGIN_QMLPROJECTMANAGER=OFF', '-DBUILD_PLUGIN_QNX=OFF',
        '-DBUILD_PLUGIN_QTQUICKPLUGIN=OFF', '-DBUILD_PLUGIN_REMOTELINUX=OFF',
        '-DBUILD_PLUGIN_SCXMLEDITOR=OFF', '-DBUILD_PLUGIN_SERIALTERMINAL=OFF',
        '-DBUILD_PLUGIN_SILVERSEARCHER=OFF',
        '-DBUILD_PLUGIN_STUDIOWELCOME=OFF', '-DBUILD_PLUGIN_SUBVERSION=OFF',
        '-DBUILD_PLUGIN_TASKLIST=OFF', '-DBUILD_PLUGIN_TODO=OFF',
        '-DBUILD_PLUGIN_UPDATEINFO=OFF', '-DBUILD_PLUGIN_VALGRIND=OFF',
        '-DBUILD_PLUGIN_VCSBASE=OFF', '-DBUILD_PLUGIN_WEBASSEMBLY=OFF',
        '-DBUILD_PLUGIN_WELCOME=OFF', '-DBUILD_PLUGIN_WINRT=OFF',
        '-DBUILD_EXECUTABLE_BUILDOUTPUTPARSER=OFF',
        '-DBUILD_EXECUTABLE_CPASTER=OFF',
        '-DBUILD_EXECUTABLE_CPLUSPLUS-KEYWORDGEN=OFF',
        '-DBUILD_EXECUTABLE_QML2PUPPET=OFF',
        '-DBUILD_EXECUTABLE_QTC-ASKPASS=OFF',
        '-DBUILD_EXECUTABLE_QTCDEBUGGER=OFF',
        '-DBUILD_EXECUTABLE_QTCREATOR_CTRLC_STUB=OFF',
        '-DBUILD_EXECUTABLE_QTCREATOR_PROCESS_STUB=OFF',
        '-DBUILD_EXECUTABLE_QTPROMAKER=OFF', '-DBUILD_EXECUTABLE_SDKTOOL=OFF',
        '-DBUILD_EXECUTABLE_VALGRIND-FAKE=OFF',
        '-DBUILD_EXECUTABLE_WIN32INTERRUPT=OFF',
        '-DBUILD_EXECUTABLE_WIN64INTERRUPT=OFF',
        '-DBUILD_EXECUTABLE_WINRTDEBUGHELPER=OFF', '-DCMAKE_PREFIX_PATH=' +
        qt_mingw_dir + ';' + os.path.join(base_path, 'libclang'),
        '-S' + qtcreator_path, '-B' + creator_build_dir
    ]

    # Two times until CMake 3.18
    bld_utils.runCommand(qtc_cmake, creator_build_dir, None, environment)
    bld_utils.runCommand(qtc_cmake, creator_build_dir, None, environment)
    bld_utils.runCommand([cmake_command, '--build', creator_build_dir],
                         creator_build_dir, None, environment)
    bld_utils.runCommand([
        cmake_command, '--install', creator_build_dir, '--prefix',
        creator_install_dir
    ], creator_build_dir, None, environment)
    bld_utils.runCommand([
        cmake_command, '--install', creator_build_dir, '--prefix',
        creator_install_dir, '--component', 'Dependencies'
    ], creator_build_dir, None, environment)

    # Remove the regular libclang.dll which got deployed via 'Dependencies' qtcreator install target
    os.remove(os.path.join(creator_install_dir, 'bin', 'libclang.dll'))

    # Train mingw libclang library with build QtCreator
    # First time open the project, then close it. This will generate initial settings and .user files. Second time do the actual training.
    for batchFile in ['qtc.openProject.batch', 'qtc.fileTextEditorCpp.batch']:
        bld_utils.runCommand([
            os.path.join(training_dir, 'runBatchFiles.bat'),
            msvc_version(), 'x64' if bitness == 64 else 'x86', batchFile
        ],
                             base_path,
                             callerArguments=None,
                             init_environment=None,
                             onlyErrorCaseOutput=False,
                             expectedExitCodes=[0, 1])
Example #22
0
    if bldinstallercommon.is_mac_platform():
        qmakeCommand.append('QMAKE_MAC_SDK=macosx') # work around QTBUG-41238

    if bldinstallercommon.is_win_platform():  # allow app to run on Windows XP
        qmakeCommand.append('QMAKE_LFLAGS_WINDOWS=/SUBSYSTEM:WINDOWS,5.01')
        # skip compilation of cdbextension and wininterrupt, they are built separately below
        qmakeCommand.append('QTC_SKIP_CDBEXT=1')
        qmakeCommand.append('QTC_SKIP_WININTERRUPT=1')

    qmakeCommand.append('QTC_SKIP_SDKTOOL=1')

    if callerArguments.additional_qmake_arguments:
        qmakeCommand.extend(callerArguments.additional_qmake_arguments)

    runCommand(qmakeCommand, qtCreatorBuildDirectory,
        callerArguments = callerArguments, init_environment = environment)

    runBuildCommand(currentWorkingDirectory = qtCreatorBuildDirectory, callerArguments = callerArguments,
        init_environment = environment)

    # on windows the install command is usual nmake so single threaded
    # because docs is creating same directory at the same time sometimes
    runInstallCommand("docs", currentWorkingDirectory = qtCreatorBuildDirectory, callerArguments = callerArguments,
        init_environment = environment)

    if not bldinstallercommon.is_mac_platform():
        runInstallCommand(['install', 'install_docs'], currentWorkingDirectory = qtCreatorBuildDirectory,
            callerArguments = callerArguments, init_environment = environment)

    runInstallCommand('deployqt', currentWorkingDirectory = qtCreatorBuildDirectory, callerArguments = callerArguments,
        init_environment = environment)
Example #23
0
    qmakeCommandArguments = "-r {0} QTC_PREFIX={1} DEFINES+=IDE_REVISION={2} CONFIG+={3}".format(
        qtCreatorProFile, qtCreatorInstallDirectory, buildGitSHA, buildType)

    # hack to ensure plugins depending on declarative are also compiled with 2.7.0/5.0.1
    qmakeCommandArguments += " QT_CONFIG+=declarative"

    if bldinstallercommon.is_mac_platform():
        qmakeCommandArguments += " QMAKE_MAC_SDK=macosx" # work around QTBUG-41238

    if sys.platform == "win32":  # allow app to run on Windows XP
        qmakeCommandArguments += " QMAKE_SUBSYSTEM_SUFFIX=,5.01"

    if callerArguments.versiondescription:
        qmakeCommandArguments += " DEFINES+=IDE_VERSION_DESCRIPTION={0}".format(callerArguments.versiondescription)

    runCommand("{0} {1}".format(qmakeBinary, qmakeCommandArguments), qtCreatorBuildDirectory,
        callerArguments = callerArguments, init_environment = environment)

    runBuildCommand(currentWorkingDirectory = qtCreatorBuildDirectory, callerArguments = callerArguments,
        init_environment = environment)

    # on windows the install command is usual nmake so single threaded
    # because docs is creating same directory at the same time sometimes
    runInstallCommand("docs", currentWorkingDirectory = qtCreatorBuildDirectory, callerArguments = callerArguments,
        init_environment = environment)

    if not bldinstallercommon.is_mac_platform():
        runInstallCommand('install install_docs', currentWorkingDirectory = qtCreatorBuildDirectory,
            callerArguments = callerArguments, init_environment = environment)

    runInstallCommand('deployqt', currentWorkingDirectory = qtCreatorBuildDirectory, callerArguments = callerArguments,
        init_environment = environment)
Example #24
0
def zip_sdktool(sdktool_target_path, out_7zip):
    glob = "*.exe" if bldinstallercommon.is_win_platform() else "*"
    bld_utils.runCommand(['7z', 'a', out_7zip, glob], sdktool_target_path)
Example #25
0
def build_qt(build, make_command):
    bld_utils.runCommand(make_command, build)
Example #26
0
def build_sdktool_impl(src, build, target, qmake_command, make_command):
    bldinstallercommon.create_dirs(build)
    bld_utils.runCommand([qmake_command, '-after', 'DESTDIR=' + target, src],
                         build)
    bld_utils.runCommand(make_command, build)
Example #27
0
def configure_qt(src, build):
    bldinstallercommon.create_dirs(build)
    configure = os.path.join(src, 'configure')
    bld_utils.runCommand([configure, '-prefix', build] + qt_static_configure_options(), build)
Example #28
0
def useRunCommand(testArguments, *arguments):
    return runCommand("{0} {1}".format(baseCommand(), testArguments), *arguments)
Example #29
0
def git_clone_and_checkout(base_path, remote_repository_url, directory, revision):
    bld_utils.runCommand(['git', 'clone', '--no-checkout', remote_repository_url, directory], base_path)
    local_repo_path = os.path.join(base_path, directory)
    bld_utils.runCommand(['git', 'config', 'core.eol', 'lf'], local_repo_path)
    bld_utils.runCommand(['git', 'config', 'core.autocrlf', 'input'], local_repo_path)
    bld_utils.runCommand(['git', 'checkout', revision], local_repo_path)
Example #30
0
def upload_clang(file_path, remote_path):
    (path, filename) = os.path.split(file_path)
    scp_bin = '%SCP%' if bldinstallercommon.is_win_platform() else 'scp'
    scp_command = [scp_bin, filename, remote_path]
    bld_utils.runCommand(scp_command, path)
Example #31
0
def package_clang(install_path, result_file_path):
    (basepath, dirname) = os.path.split(install_path)
    zip_command = ['7z', 'a', result_file_path, dirname]
    bld_utils.runCommand(zip_command, basepath)
Example #32
0
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)
Example #33
0
def get_clang(base_path, llvm_revision, clang_revision):
    bld_utils.runCommand(['git', 'clone', 'http://llvm.org/git/llvm.git'], base_path)
    bld_utils.runCommand(['git', 'checkout', llvm_revision], os.path.join(base_path, 'llvm'))
    bld_utils.runCommand(['git', 'clone', 'http://llvm.org/git/clang.git'], os.path.join(base_path, 'llvm', 'tools'))
    bld_utils.runCommand(['git', 'checkout', clang_revision], os.path.join(base_path, 'llvm', 'tools', 'clang'))
Example #34
0
def package_clang(install_path, result_file_path):
    (basepath, dirname) = os.path.split(install_path)
    zip_command = ['7z', 'a', result_file_path, dirname]
    bld_utils.runCommand(zip_command, basepath)
Example #35
0
    if bldinstallercommon.is_mac_platform():
        qmakeCommand.append('QMAKE_MAC_SDK=macosx')  # work around QTBUG-41238

    if bldinstallercommon.is_win_platform():  # allow app to run on Windows XP
        qmakeCommand.append('QMAKE_LFLAGS_WINDOWS=/SUBSYSTEM:WINDOWS,5.01')
        # skip compilation of cdbextension and wininterrupt, they are built separately below
        qmakeCommand.append('QTC_SKIP_CDBEXT=1')
        qmakeCommand.append('QTC_SKIP_WININTERRUPT=1')

    qmakeCommand.append('QTC_SKIP_SDKTOOL=1')

    if callerArguments.additional_qmake_arguments:
        qmakeCommand.extend(callerArguments.additional_qmake_arguments)

    runCommand(qmakeCommand,
               qtCreatorBuildDirectory,
               callerArguments=callerArguments,
               init_environment=environment)

    runBuildCommand(currentWorkingDirectory=qtCreatorBuildDirectory,
                    callerArguments=callerArguments,
                    init_environment=environment)

    # on windows the install command is usual nmake so single threaded
    # because docs is creating same directory at the same time sometimes
    runInstallCommand("docs",
                      currentWorkingDirectory=qtCreatorBuildDirectory,
                      callerArguments=callerArguments,
                      init_environment=environment)

    if not bldinstallercommon.is_mac_platform():
        runInstallCommand(['install', 'install_docs'],
Example #36
0
def zip_sdktool(sdktool_target_path, out_7zip):
    glob = "*.exe" if bldinstallercommon.is_win_platform() else "*"
    bld_utils.runCommand(['7z', 'a', out_7zip, glob], sdktool_target_path)
Example #37
0
            generateCommand.append(extra_arg)
    generateCommand.append('-DCMAKE_PREFIX_PATH=' + ';'.join(cmake_prefix_path))
    # for now assume that qtModuleSourceDirectory contains CMakeLists.txt directly
    generateCommand.append(qtModuleSourceDirectory)
else: # --> qmake
    qtModuleProFile = locate_pro(qtModuleSourceDirectory)
    if bldinstallercommon.is_win_platform():
        # do not shadow-build with qmake on Windows
        qtModuleBuildDirectory = os.path.dirname(qtModuleProFile)
    generateCommand = [qmakeBinary]
    generateCommand.extend(callerArguments.additional_config_args)
    if os.environ.get('EXTRA_QMAKE_ARGS'):
        generateCommand.append(os.environ["EXTRA_QMAKE_ARGS"])
    generateCommand.append(qtModuleProFile)

runCommand(generateCommand, currentWorkingDirectory = qtModuleBuildDirectory,
           callerArguments = callerArguments, init_environment = environment)

ret = runBuildCommand(currentWorkingDirectory = qtModuleBuildDirectory, callerArguments = callerArguments)
if ret:
    raise RuntimeError('Failure running the last command: %i' % ret)

ret = runInstallCommand(['install', 'INSTALL_ROOT=' + qtModuleInstallDirectory],
                 currentWorkingDirectory = qtModuleBuildDirectory,
                 callerArguments = callerArguments, init_environment = environment)
if ret:
    raise RuntimeError('Failure running the last command: %i' % ret)

# patch .so filenames on Windows/Android
if bldinstallercommon.is_win_platform() and os.environ.get('DO_PATCH_ANDROID_SONAME_FILES'):
    bldinstallercommon.rename_android_soname_files(qtModuleInstallDirectory)
Example #38
0
def configure_qt(src, build):
    bldinstallercommon.create_dirs(build)
    configure = os.path.join(src, 'configure')
    bld_utils.runCommand([configure, '-prefix', build] +
                         qt_static_configure_options(), build)
Example #39
0
                           ';'.join(cmake_prefix_path))
    # for now assume that qtModuleSourceDirectory contains CMakeLists.txt directly
    generateCommand.append(qtModuleSourceDirectory)
else:  # --> qmake
    qtModuleProFile = locate_pro(qtModuleSourceDirectory)
    if bldinstallercommon.is_win_platform():
        # do not shadow-build with qmake on Windows
        qtModuleBuildDirectory = os.path.dirname(qtModuleProFile)
    generateCommand = [qmakeBinary]
    generateCommand.extend(callerArguments.additional_config_args)
    if os.environ.get('EXTRA_QMAKE_ARGS'):
        generateCommand.append(os.environ["EXTRA_QMAKE_ARGS"])
    generateCommand.append(qtModuleProFile)

runCommand(generateCommand,
           currentWorkingDirectory=qtModuleBuildDirectory,
           callerArguments=callerArguments,
           init_environment=environment)

ret = runBuildCommand(currentWorkingDirectory=qtModuleBuildDirectory,
                      callerArguments=callerArguments)
if ret:
    raise RuntimeError('Failure running the last command: %i' % ret)

ret = runInstallCommand(
    ['install', 'INSTALL_ROOT=' + qtModuleInstallDirectory],
    currentWorkingDirectory=qtModuleBuildDirectory,
    callerArguments=callerArguments,
    init_environment=environment)
if ret:
    raise RuntimeError('Failure running the last command: %i' % ret)
Example #40
0
def mingw_training(base_path, qtcreator_path, environment, bitness):
    # Checkout qt-creator, download libclang for build, qt installer and DebugView

    git_clone_and_checkout(base_path,
                           'git://code.qt.io/qt-creator/qt-creator.git',
                           qtcreator_path, training_qtcreator_version())

    # Set up paths
    script_dir = os.path.dirname(os.path.realpath(__file__))
    debugview_dir = os.path.join(base_path, 'debugview')
    cmake_dir = os.path.join(base_path, 'cmake')
    creator_build_dir = os.path.join(base_path, 'qtcreator_build')
    creator_install_dir = os.path.join(base_path, 'qtcreator_install')
    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')
    qt_mingw_dir = os.path.join(base_path, 'qt_mingw')

    # Create some paths
    os.makedirs(creator_settings_dir)
    os.makedirs(creator_logs_dir)

    pkg_server = get_pkg_value("PACKAGE_STORAGE_SERVER")

    # Install Qt
    qt_modules = [
        'qtbase', 'qtdeclarative', 'qtgraphicaleffects', 'qtimageformats',
        'qtlocation', 'qtquickcontrols', 'qtquickcontrols2', 'qtscript',
        'qtsvg', 'qttools', 'qttranslations', 'qtxmlpatterns'
    ]

    qt_base_url = 'http://' + pkg_server + '/packages/jenkins/archive/qt/' \
        + training_qt_version() + '/' + training_qt_long_version() + '/latest'
    msvc_year_ver = msvc_year_version()
    if bitness == 64:
        qt_mingw_postfix = '-Windows-Windows_10-Mingw-Windows-Windows_10-X86_64.7z'
        qt_postfix = '-Windows-Windows_10-' + msvc_year_ver + '-Windows-Windows_10-X86_64.7z'
    else:
        qt_mingw_postfix = '-Windows-Windows_7-Mingw-Windows-Windows_7-X86.7z'
        qt_postfix = '-Windows-Windows_10-' + msvc_year_ver + '-Windows-Windows_10-X86.7z'

    qt_module_urls = [
        qt_base_url + '/' + module + '/' + module + qt_postfix
        for module in qt_modules
    ]
    qt_mingw_module_urls = [
        qt_base_url + '/' + module + '/' + module + qt_mingw_postfix
        for module in qt_modules
    ]
    qt_temp = os.path.join(base_path, 'qt_download')
    qt_mingw_temp = os.path.join(base_path, 'qt_download_mingw')
    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_qt_download_task(qt_mingw_module_urls,
                                                   qt_mingw_dir, qt_mingw_temp,
                                                   None))

    download_packages_work.addTaskObject(
        bldinstallercommon.create_download_extract_task(
            'https://download.sysinternals.com/files/DebugView.zip',
            debugview_dir, base_path, None))

    # Install CMake
    cmake_arch_suffix = 'win64-x64' if bitness == 64 else 'win32-x86'
    cmake_base_url = 'http://' + pkg_server + '/packages/jenkins/cmake/' \
        + cmake_version() + '/cmake-' + cmake_version() + '-' + cmake_arch_suffix + '.zip'
    download_packages_work.addTaskObject(
        bldinstallercommon.create_download_extract_task(
            cmake_base_url, cmake_dir, base_path, None))

    download_packages_work.run()

    # Build QtCreator with installed libclang and qt
    # WITH_TESTS is required for QtCreator to support running .batch files
    cmake_command = os.path.join(
        cmake_dir, 'cmake-' + cmake_version() + '-' + cmake_arch_suffix, 'bin',
        'cmake')
    qtc_cmake = [
        cmake_command, '-GNinja', '-DCMAKE_BUILD_TYPE=Release',
        '-DWITH_TESTS=ON', '-DBUILD_QBS=OFF', '-DBUILD_PLUGINS_BY_DEFAULT=OFF',
        '-DBUILD_EXECUTABLES_BY_DEFAULT=OFF', '-DBUILD_PLUGIN_CORE=ON',
        '-DBUILD_PLUGIN_TEXTEDITOR=ON', '-DBUILD_PLUGIN_PROJECTEXPLORER=ON',
        '-DBUILD_PLUGIN_CPPTOOLS=ON', '-DBUILD_PLUGIN_CPPEDITOR=ON',
        '-DBUILD_PLUGIN_QMAKEPROJECTMANAGER=ON',
        '-DBUILD_PLUGIN_CLANGCODEMODEL=ON', '-DBUILD_PLUGIN_CLANGTOOLS=ON',
        '-DBUILD_PLUGIN_DEBUGGER=ON', '-DBUILD_PLUGIN_DESIGNER=ON',
        '-DBUILD_PLUGIN_QTSUPPORT=ON', '-DBUILD_PLUGIN_RESOURCEEDITOR=ON',
        '-DBUILD_EXECUTABLE_QTCREATOR=ON', '-DBUILD_EXECUTABLE_ECHO=ON',
        '-DBUILD_EXECUTABLE_CLANGBACKEND=ON', '-DCMAKE_PREFIX_PATH=' +
        qt_mingw_dir + ';' + os.path.join(base_path, 'libclang'),
        '-S' + qtcreator_path, '-B' + creator_build_dir
    ]

    bld_utils.runCommand(qtc_cmake, creator_build_dir, None, environment)
    bld_utils.runCommand([cmake_command, '--build', creator_build_dir],
                         creator_build_dir, None, environment)
    bld_utils.runCommand([
        cmake_command, '--install', creator_build_dir, '--prefix',
        creator_install_dir
    ], creator_build_dir, None, environment)
    bld_utils.runCommand([
        cmake_command, '--install', creator_build_dir, '--prefix',
        creator_install_dir, '--component', 'Dependencies'
    ], creator_build_dir, None, environment)

    # Remove the regular libclang.dll which got deployed via 'Dependencies' qtcreator install target
    os.remove(os.path.join(creator_install_dir, 'bin', 'libclang.dll'))

    # Train mingw libclang library with build QtCreator
    # First time open the project, then close it. This will generate initial settings and .user files. Second time do the actual training.
    for batchFile in ['qtc.openProject.batch', 'qtc.fileTextEditorCpp.batch']:
        bld_utils.runCommand([
            os.path.join(training_dir, 'runBatchFiles.bat'),
            msvc_version(), 'x64' if bitness == 64 else 'x86', batchFile
        ],
                             base_path,
                             callerArguments=None,
                             init_environment=None,
                             onlyErrorCaseOutput=False,
                             expectedExitCodes=[0, 1])
Example #41
0
def apply_patch(src_path, patch_filepath):
    print('Applying patch: "' + patch_filepath + '" in "' + src_path + '"')
    bld_utils.runCommand(['git', 'apply', '--whitespace=fix', patch_filepath], src_path)
Example #42
0
def build_sdktool_impl(src, build, target, qmake_command, make_command):
    bldinstallercommon.create_dirs(build)
    bld_utils.runCommand([qmake_command, '-after', 'DESTDIR=' + target, src], build)
    bld_utils.runCommand(make_command, build)
Example #43
0
def package_clang(install_path, result_file_path):
    (basepath, dirname) = os.path.split(install_path)
    zip_command = ['cmake', '-E', 'tar', 'cvf', result_file_path, '--format=7zip', dirname]
    bld_utils.runCommand(zip_command, basepath)
Example #44
0
def get_clang(base_path, llvm_revision, clang_revision, tools_revision):
    bld_utils.runCommand(['git', 'clone', '--no-checkout', '[email protected]:llvm-mirror/llvm.git'], base_path)
    bld_utils.runCommand(['git', 'config', 'core.eol', 'lf'], os.path.join(base_path, 'llvm'))
    bld_utils.runCommand(['git', 'config', 'core.autocrlf', 'input'], os.path.join(base_path, 'llvm'))
    bld_utils.runCommand(['git', 'checkout', llvm_revision], os.path.join(base_path, 'llvm'))
    bld_utils.runCommand(['git', 'clone', '--no-checkout', '[email protected]:llvm-mirror/clang.git'], os.path.join(base_path, 'llvm', 'tools'))
    bld_utils.runCommand(['git', 'config', 'core.eol', 'lf'], os.path.join(base_path, 'llvm', 'tools', 'clang'))
    bld_utils.runCommand(['git', 'config', 'core.autocrlf', 'input'], os.path.join(base_path, 'llvm', 'tools', 'clang'))
    bld_utils.runCommand(['git', 'checkout', clang_revision], os.path.join(base_path, 'llvm', 'tools', 'clang'))
    bld_utils.runCommand(['git', 'clone', '--no-checkout', '[email protected]:llvm-mirror/clang-tools-extra.git', os.path.join(base_path, 'llvm', 'tools', 'clang', 'tools', 'extra')], '.')
    bld_utils.runCommand(['git', 'config', 'core.eol', 'lf'], os.path.join(base_path, 'llvm', 'tools', 'clang', 'tools', 'extra'))
    bld_utils.runCommand(['git', 'config', 'core.autocrlf', 'input'], os.path.join(base_path, 'llvm', 'tools', 'clang', 'tools', 'extra'))
    bld_utils.runCommand(['git', 'checkout', tools_revision], os.path.join(base_path, 'llvm', 'tools', 'clang', 'tools', 'extra'))
Example #45
0
def get_clazy(base_path, clazy_revision):
    bld_utils.runCommand(['git', 'clone', '--no-checkout', '[email protected]:KDE/clazy.git'], os.path.join(base_path, 'llvm', 'tools', 'clang', 'tools', 'extra'))
    bld_utils.runCommand(['git', 'checkout', clazy_revision], os.path.join(base_path, 'llvm', 'tools', 'clang', 'tools', 'extra', 'clazy'))
Example #46
0
def get_clang(base_path, llvm_revision, clang_revision):
    bld_utils.runCommand(['git', '-c', 'http.postBuffer=524288000', 'clone', 'https://github.com/llvm-mirror/llvm'], base_path)
    bld_utils.runCommand(['git', 'checkout', llvm_revision], os.path.join(base_path, 'llvm'))
    bld_utils.runCommand(['git', '-c', 'http.postBuffer=524288000', 'clone', 'https://github.com/llvm-mirror/clang'], os.path.join(base_path, 'llvm', 'tools'))
    bld_utils.runCommand(['git', 'checkout', clang_revision], os.path.join(base_path, 'llvm', 'tools', 'clang'))