Beispiel #1
0
        bldinstallercommon.patch_qt(callerArguments.qt5path)

    ### lets start building

    environment = get_common_environment(callerArguments.qt5path,
                                         callerArguments)
    environment["INSTALL_BASENAME"] = "qt-creator"
    environment["INSTALLER_ARCHIVE"] = "qtcreator.7z"

    environment["QTC_NO_CLANG_LIBTOOLING"] = "1"

    if callerArguments.debug:
        buildType = 'debug'
    else:
        buildType = 'release'
    buildGitSHA = get_commit_SHA(qtCreatorSourceDirectory, callerArguments)
    qtCreatorProFile = os.path.join(qtCreatorSourceDirectory, 'qtcreator.pro')

    qmakeCommand = [
        qmakeBinary, qtCreatorProFile,
        'QTC_PREFIX=' + qtCreatorInstallDirectory,
        'DEFINES+=IDE_REVISION=' + buildGitSHA,
        'IDE_REVISION_URL=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id='
        + buildGitSHA, 'CONFIG+=' + buildType, 'CONFIG+=force_debug_info',
        'CONFIG+=separate_debug_info'
    ]

    # perfparser for Qt Creator >= 4.9
    if callerArguments.elfutils_path:
        qmakeCommand.append('ELFUTILS_INSTALL_DIR=' +
                            callerArguments.elfutils_path)
Beispiel #2
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)
    # get SHA either via git, or if that fails look for a .tag file
    buildGitSHA = get_commit_SHA(paths.source, 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)
    if buildGitSHA:
        qmake_command.append('QTC_PLUGIN_REVISION=' + buildGitSHA)
    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)

    # write information about git sha
    with open(caller_arguments.target_7zfile + '.git_sha', 'w') as f:
        f.write(buildGitSHA)

    # clean up
    if caller_arguments.cleanup:
        bldinstallercommon.remove_tree(paths.qt5)
        bldinstallercommon.remove_tree(paths.temp)
        bldinstallercommon.remove_tree(paths.build)
        bldinstallercommon.remove_tree(paths.dev_target)
        if caller_arguments.qtc_dev_url:
            bldinstallercommon.remove_tree(paths.qtc_dev)
        if caller_arguments.qtc_build_url:
            bldinstallercommon.remove_tree(paths.qtc_build)