Пример #1
0
def install_qt(args):
    download_packages_work = ThreadedWork('get and extract Qt 5 binaries')
    need_to_install_qt = not os.path.lexists(args.qt_path)
    if need_to_install_qt:
        download_packages_work.addTaskObject(
            bldinstallercommon.create_qt_download_task(args.qt_modules,
                                                       args.qt_path,
                                                       args.temp_path, args))

    # run task if needed
    if download_packages_work.taskNumber != 0:
        download_packages_work.run()
        bldinstallercommon.patch_qt(args.qt_path)
Пример #2
0
        bldinstallercommon.remove_tree(qtCreatorInstallDirectory)
        if bldinstallercommon.is_win_platform():
            bldinstallercommon.remove_tree(cdbextBuildDirectory)
            bldinstallercommon.remove_tree(cdbextInstallDirectory)
            bldinstallercommon.remove_tree(wininterruptBuildDirectory)
            bldinstallercommon.remove_tree(wininterruptInstallDirectory)
        bldinstallercommon.remove_tree(tempPath)

    qmakeBinary = qmake_binary(callerArguments.qt5path)

    download_packages_work = ThreadedWork("get and extract Qt 5 binaries")
    need_to_install_qt = not os.path.lexists(callerArguments.qt5path)
    if need_to_install_qt:
        download_packages_work.addTaskObject(
            bldinstallercommon.create_qt_download_task(
                callerArguments.qt_modules, callerArguments.qt5path, tempPath,
                callerArguments))

    # run get Qt 5 tasks
    if download_packages_work.taskNumber != 0:
        download_packages_work.run()

    if need_to_install_qt:
        patch_qt_pri_files(callerArguments.qt5path)
        bldinstallercommon.patch_qt(callerArguments.qt5path)

    ### lets start building

    environment = get_common_environment(callerArguments.qt5path,
                                         callerArguments)
    environment["INSTALL_BASENAME"] = "qt-creator"
Пример #3
0
            bldinstallercommon.remove_tree(wininterruptBuildDirectory)
            bldinstallercommon.remove_tree(wininterruptInstallDirectory)
        bldinstallercommon.remove_tree(tempPath)

    if not os.path.lexists(callerArguments.qt5path) and not callerArguments.qt_modules:
        parser.print_help()
        print(("error: You have to pass the --qt-module argument if the {0} does not exist"
            + os.linesep + os.linesep).format(callerArguments.qt5path))
        sys.exit(1)

    qmakeBinary = qmake_binary(callerArguments.qt5path)

    download_packages_work = ThreadedWork("get and extract Qt 5 binaries")
    need_to_install_qt = not os.path.lexists(callerArguments.qt5path)
    if need_to_install_qt:
        download_packages_work.addTaskObject(bldinstallercommon.create_qt_download_task(
            callerArguments.qt_modules, callerArguments.qt5path, tempPath, callerArguments))

    # run get Qt 5 tasks
    if download_packages_work.taskNumber != 0:
        download_packages_work.run()

    if need_to_install_qt:
        patch_qt_pri_files(callerArguments.qt5path)
        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"
    if callerArguments.debug:
Пример #4
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)
Пример #5
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])
Пример #6
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])
Пример #7
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])
Пример #8
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])
Пример #9
0
        bldinstallercommon.remove_tree(qtCreatorBuildDirectory)
        bldinstallercommon.remove_tree(qtCreatorInstallDirectory)
        bldinstallercommon.remove_tree(tempPath)

    if not os.path.lexists(callerArguments.qt5path) and not callerArguments.qt_modules:
        parser.print_help()
        print(("error: You have to pass the --qt-module argument if the {0} does not exist"
            + os.linesep + os.linesep).format(callerArguments.qt5path))
        sys.exit(1)

    qmakeBinary = qmake_binary(callerArguments.qt5path)

    download_packages_work = ThreadedWork("get and extract Qt 5 binaries")
    need_to_install_qt = not os.path.lexists(callerArguments.qt5path)
    if need_to_install_qt:
        download_packages_work.addTaskObject(bldinstallercommon.create_qt_download_task(
            callerArguments.qt_modules, callerArguments.qt5path, tempPath, callerArguments))

    # run get Qt 5 tasks
    if download_packages_work.taskNumber != 0:
        download_packages_work.run()

    if need_to_install_qt:
        patch_qt_pri_files(callerArguments.qt5path)
        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"
    if callerArguments.debug:
Пример #10
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)
Пример #11
0
    bldinstallercommon.remove_tree(callerArguments.qt5path)
    bldinstallercommon.remove_tree(qtModuleInstallDirectory)
    bldinstallercommon.remove_tree(tempPath)

if not os.path.lexists(callerArguments.qt5path) and not callerArguments.qt5_module_urls:
    parser.print_help()
    print(("error: Please add the missing qt5_module_url arguments if the {0} does not exist"
        + os.linesep + os.linesep).format(callerArguments.qt5path))
    raise RuntimeError()

qmakeBinary = os.path.abspath(os.path.join(callerArguments.qt5path, 'bin', 'qmake'))

if not os.path.lexists(callerArguments.qt5path):
    # get Qt
    myGetQtBinaryWork = ThreadedWork("get and extract Qt 5 binary")
    myGetQtBinaryWork.addTaskObject(bldinstallercommon.create_qt_download_task(callerArguments.qt5_module_urls,
                                       callerArguments.qt5path, tempPath, callerArguments))
    myGetQtBinaryWork.run()

    # Save QT_INSTALL_PREFIX
    qt_install_prefix = get_qt_install_prefix(callerArguments.qt5path)

    # "install" Qt
    bldinstallercommon.patch_qt(callerArguments.qt5path)

### lets start building

# prepare the environment for example setting LD_LIBRARY_PATH
# or adding qmake path into the Path environment variable (Qt deployment step)
pathKeyList = []
qtBinPath = os.path.abspath(os.path.join(callerArguments.qt5path, 'bin'))
pathKeyList.append(qtBinPath)