init-repository is now implemented using CMake + .sh / .bat scripts. The intent behind the change is not to require Perl to checkout and build Qt, because it can be troublesome to acquire on Windows and it can also lead to issues during builds due to CMake picking up a Perl distribution-shipped compiler. All previous options were ported over like - module-subset - alternates - etc. A few new options were added: - --resolve-deps / --no-resolve-deps - --optional-deps / --no-optional-deps - --verbose and some other internal ones for testing reasons. The new script does automatic resolving of dependencies based on the depends / recommends keys in .gitmodules unless --no-resolve-deps is passed. So if you configure with --module-subset=qtsvg, the script will also initialize qtbase. If --no-optional-deps is passed, only required dependencies ('depends' ky) will be included and optional dependencies ('recommends' key) will be excluded. The new script now has a new default behavior when calling init-repository a second time with --force, without specifying a --module-subset option. Instead of initializing all submodules, it will just update the existing / previously initialized submodules. It also understands a new module-subset keyword "existing", which expands to the previously initialized submodules, so someone can initialize an additional submodule by calling init-repository -f --module-subset=existing,qtsvg Implementation notes: The overall code flow is init-repository -> cmake/QtIRScript.cmake -> qt_ir_run_main_script -> qt_ir_run_after_args_parsed -> qt_ir_handle_init_submodules (recursive) -> qt_ir_clone_one_submodule with some bells and whistles on the side. The command line parsing is an adapted copy of the functions in qtbase/cmake/QtProcessConfigureArgs.cmake. We can't use those exact functions because qtbase is not available when init-repository is initially called, and force cloning qtbase was deemed undesirable. We also have a new mechanism to detect whether init-repository was previously called. The perl script used the existence of the qtbase submodule as the check. In the cmake script, we instead set a custom marker into the local repo config file. Otherwise the code logic should be a faithful reimplementation of init-repository.pl aside from some small things like logging and progress reporting. The pre-existing git cloning logic in QtTopLevelHelpers was not used because it would not be compatible with the alternates option and I didn't want to accidentally break the pre-existing code. Plus init-repository is a bit opinionated about how it clones and checks out repos. The dependency collection and sorting logic uses the pre-existing code though. See follow up commit about implicitly calling init-repository when qt5/configure is called and the repo was not initialized before. [ChangeLog][General] init-repository was rewritten using CMake. Perl is no longer required to initialize the qt5.git super repo. Task-number: QTBUG-120030 Task-number: QTBUG-122622 Change-Id: Ibc38ab79d3fdedd62111ebbec496eabd64c20d2b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
24 lines
1.0 KiB
Batchfile
24 lines
1.0 KiB
Batchfile
:: Copyright (C) 2024 The Qt Company Ltd.
|
|
:: SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
@echo off
|
|
setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
|
|
set script_dir_path=%~dp0
|
|
set script_dir_path=%script_dir_path:~0,-1%
|
|
|
|
set cmake_scripts_dir=%script_dir_path%\cmake
|
|
:: The '.' in 'echo.%*' ensures we don't print "echo is off" when no arguments are passed
|
|
:: https://devblogs.microsoft.com/oldnewthing/20170802-00/?p=96735
|
|
:: The space before the '>' makes sure that when we have a digit at the end of the args, we
|
|
:: don't accidentally concatenate it with the '>' resulting in '0>' or '2>' which redirects into the
|
|
:: file from a stream different than stdout, leading to broken or empty content.
|
|
echo.%* >init-repository.opt.in
|
|
|
|
call cmake -DIN_FILE=init-repository.opt.in -DOUT_FILE=init-repository.opt ^
|
|
-P "%cmake_scripts_dir%\QtWriteArgsFile.cmake"
|
|
call cmake -DOPTFILE=init-repository.opt ^
|
|
-P "%cmake_scripts_dir%\QtIRScript.cmake"
|
|
|
|
del init-repository.opt.in
|
|
del init-repository.opt
|