Generator plugin: collect dependencies from the yaml file
The main yaml file that the user passes to qt_add_openapi_client()
might reference other yaml files. In order to properly set all the
dependencies for reconfiguration, we need to get the full list of
these referenced yaml files.
The upstream generator and the parser that is used there do not
provide any APIs to do that, so we need to parse the files
manually.
This patch implements a new class - YamlDependencyBuilder, that
uses the fasterxml.jackson and snakeyaml libraries to recursively
parse the main yaml file and all its dependencies. Note that both
libraries are already used by the upstream generator, so they're
implicitly available in our project - we do not introduce any
new dependencies.
The list of files is then written to a special file in the output
directory, so that it could be later used by CMake to generate
dependencies. This is done only when useCmakeMacro=true, so that
it does not affect the generator invokations from the command
line.
Note that at the CMake level we need to read the depfile twice.
First - before calling the generator to figure out if any of the
files was updated. That allows us to decide if we need to call
the generator or not.
Second - after the generation is done, because the list of
dependencies may be updated, and we need to add all of them as
dependencies at the CMake level.
Fixes: QTBUG-143502
Pick-to: 6.11
Change-Id: If5d7d1714211bfc2e76f2cbb5fe667d261096861
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>