5 Commits

Author SHA1 Message Date
Alexey Edelev
780c780763 Fix the support of the '-verbose' argument in configure script
Init repository logic eats the '-verbose' argument as the one that
is handled by internal init repository logic. The argument is also
a valid argument for configure script.

Introduce the 'COMMON' argument for of the qt_ir_commandline_option
macro. The argument indicates that the option is applicable for both
configure and init-repository scripts.  This is implemented only for
boolean arguments. The '-verbose' argument adopted the new feature.

Pick-to: 6.7 6.8
Change-Id: I5cb76502c8ecccccf3546fd7f7f111fe25700d0a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-06-07 06:25:58 +00:00
Alexey Edelev
f83837ec29 Fix the UNSUPPORTED argument handling in qt_ir_commandline_option
Set the argument name but not it's value in SHORT_NAME condition.
It works currently since the argument is visible from upper scope.

Pick-to: 6.7 6.8
Change-Id: Ie470a256f4735aeac5f50f0e6e5d17e2bb274ba2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-06-07 06:25:43 +00:00
Alexey Edelev
a3a8e3421e Fix the broken semicolon separated list arguments for configure
When evaluating the arguments from the config.tl.opt file we need
to consider that arguments may contain the escaped semicolons for
the list arguments. The escaped semicolons '\;' needs to be converted
to a CMake brace escaped sequence to make sure that semicolon persist
when running the command.

Fixes: QTBUG-124265
Change-Id: I051f856b43f75b0bac17ae13bd8c7de540f8c794
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-05-10 17:08:30 +02:00
Alexandru Croitor
2c9664ca33 CMake: Integrate init-repository with the configure script
Calling configure will now implicitly run init-repository when
appropriate. See further down below for what "appropriate" means.

All supported init-repository options can be passed to configure as
except for -mirror, -oslo, -berlin.

This includes useful options like -submodules, -no-resolve-deps and
-no-optional-deps.

When running configure on a qt5.git clone without any submodules
cloned, configure will exit with a helpful error message suggesting to
pass -init-submodules, so it automatically clones missing repositories.
This means cloning is opt-in, so that internet access is not done
implicitly.

The error message also suggests passing the -submodules option.
This will affect which submodules will be cloned by init-repository
and which submodules will be configured by configure.
In this case -submodules is effectively an alias of
init-repository's -module-subset for cloning purposes.

When calling configure a second time, without -init-submodules, on an
already configured repo, init-repository behavior is entirely skipped.

-submodules now accepts init-repository-style special values like
"essential", "addon", "all", "existing", "-deprecated" for the purpose
of cloning submodules. The values are then translated into actual repos
that should also be configured or skipped by configure.

The default subset of cloned submodules is currently the same one as
init-repository, "default", which clones 44 actively maintained
repositories as well as deprecated submodules.

If configure is called a second time WITH -init-submodules, it's the
same as calling init-repository --force to re-initialize submodules.
In this case passing something like
 --submodules existing,<additional-submodules>
might make sense to add or remove submodules.

As a drive-by this also fixes the bug where you couldn't pass a
  configure -- -DFOO=0
parameter to configure, because it got treated as '0>', redirecting
from a different stream than stdout, leading to empty content in the
file.

[ChangeLog][General][Build System] The configure script now implicitly
calls init-repository when appropriate and accepts init-repository
command line options.

Fixes: QTBUG-120030
Task-number: QTBUG-122622
Change-Id: Iedbfcbf0a87c8ee89e40d00b6377b68296a65a62
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-02-28 06:24:02 +01:00
Alexandru Croitor
29019c9cae CMake: Rewrite init-repository using CMake and .sh / .bat scripts
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>
2024-02-28 06:23:36 +01:00