Generate using openapi-generator-cli executable if jar file is not found


We used to only search for "openapi-generator-cli.jar" file. If not
found, we would immediately skip building qtopenapi.

Users may install openapi-generator-cli via package managers (npm, pip,
Homebrew, Scoop). Generation should work like other OpenAPI generators.

In case of npm: Generating using the executable will install the latest
stable jar version, if the jar file was not found.

Since we are always creating a custom generator, only the npm-installed
executable supports direct generation via the --custom-generator option,
with other package manager installations, the jar file must be used
manually. The challenge here is to find its path as the name can change
from a version to another and a system to another.

New behavior:

- Search for openapi-generator-cli or openapi-generator files as
fallback when jar file is not found.

- Check if the installed file supports --custom-generator:
 * npm: Use --custom-generator option directly
- If it doesn't have it, detect installation method and find the jar
file accordingly:
  * pip: Exract jar path from the python package openapi-generator-cli
  * TODO: Homebrew (macOS) and Scoop (WIN)

- Set an additional INTERFACE_OPENAPI_GENERATOR_CLI_EXECUTABLE property
on the WrapOpenAPIGenerator target that holds the executable path.
Only set it if the executable supports --custom-generator.

- Modify the custom command to use the detected executable when
 1) OPENAPI_GENERATOR_CLI_JAR is not found
    +
 2) OPENAPI_GENERATOR_CLI_EXECUTABLE is set.

- Add a DEBUG message when:
 * Jar file is not found.
 * Executable is also not found.
 * Executable is found but it does not support custom generators and the
   expected jar file path does not exist.

Task-number: QTBUG-142545
Pick-to: 6.11
Change-Id: I609de2c8ca3f1f65211a8fcc54d823a6df93b875
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
commita9831bcbacf8c570afef8717b12d1daf2001249e
parentf123c01e3330a44844216ab35ce337ad78780e8f
authorRym Bouabid <rym.bouabid@qt.io>
committerRym Bouabid <rym.bouabid@qt.io>
commit timeWed, 28 Jan 2026 13:15:27 +0100