Beispiel #1
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)
Beispiel #2
0
    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)

    if bldinstallercommon.is_mac_platform():
        if callerArguments.keychain_unlock_script:
Beispiel #3
0
        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)

#doc collection
if callerArguments.collectDocs:
    doc_list = bldinstallercommon.make_files_list(qtModuleSourceDirectory,
                                                  '\\.qch')
    doc_install_dir = os.path.join(qtModuleInstallDirectory, 'doc')
Beispiel #4
0
    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)

    if bldinstallercommon.is_mac_platform():
        if callerArguments.keychain_unlock_script:
            runCommand(callerArguments.keychain_unlock_script, qtCreatorBuildDirectory, callerArguments = callerArguments,
                init_environment = environment)
        # environment has to have SIGNING_IDENTITY, can have SIGNING_FLAGS
        runInstallCommand('codesign', currentWorkingDirectory = qtCreatorBuildDirectory,
            callerArguments = callerArguments, init_environment = environment)
Beispiel #5
0
        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)

    if bldinstallercommon.is_mac_platform():
        if callerArguments.keychain_unlock_script:
            runCommand(callerArguments.keychain_unlock_script, qtCreatorBuildDirectory, callerArguments = callerArguments,
                init_environment = environment)

    if bldinstallercommon.is_win_platform():
        runInstallCommand('deployartifacts', qtCreatorBuildDirectory,
Beispiel #6
0
        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)

#doc collection
if callerArguments.collectDocs:
    doc_list = bldinstallercommon.make_files_list(qtModuleSourceDirectory, '\\.qch')
    doc_install_dir = os.path.join(qtModuleInstallDirectory, 'doc')
    bldinstallercommon.create_dirs(doc_install_dir)
    for item in doc_list:
        shutil.copy(item, doc_install_dir)
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)
    buildGitSHA = gitSHA(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)