Regenerating project files #41352
Replies: 4 comments
-
For the docker files, I believe multiple extensions should be able to participate in providing packages to install or unpack the native library in the right directory (thus, targetted architecture will be required). |
Beta Was this translation helpful? Give feedback.
-
Hello, @iocanel and I had a quick chat about it. First, we would focus on docker file generation. By reducing the scope, we have more chances to make progress quickly while building the mechanism that would be used for the other generation. In this context, the goal is to drop the Dockerfile generated by
(Commands and parameters still under consideration) The command will NOT update an existing docker file. During the generation, extensions can contribute to the generated output by asking for a specific package to be installed and adding dockerfile clauses (mostly |
Beta Was this translation helpful? Give feedback.
-
Initial working group created: https://github.com/orgs/quarkusio/projects/27/views/1?pane=info |
Beta Was this translation helpful? Give feedback.
-
Had a meeting earlier today with @cescoffier and @ia3andy. Here's a brief summary:
|
Beta Was this translation helpful? Give feedback.
-
For a while now there have been discussions about the need for regenerating project files like:
The main need expressed in those discussions is that when users upgrade their version of Quarkus
these files often need upgrading. This is mostly due to
Sources of generated files
Potential ways of regenerating files
CLI
The CLI could introduce a new subcommand
generate
which will act as an entry point to additonal commands and pluginsFor example
Use in non-java environments
As some of this commands may be invoked from environments that do not provide a java developer setup it would be good to
ensure that the commands above are standalone (don't require maven / gradle) and work as native binaries.
Build Tool Plugins
The CLI is not something all quarkus developers use, it would be good if this functionality is available in our build tools too.
Maven
For maven the usage could be:
As the actual target is dynamic it should be passed as an agrgument
Gralde
In the same spirit for gradle:
Dev UI (Optional)
This is more of a nice to have. The added benefit of supporting this feature from the DevUI is the potential of showing a diff
that makes the changes/diff visible. Of course this can be achieved from the CLI, using a combination of commands and this is why
I am marking this as optional.
Generating files by source
As mentioned above there are two major sources the produce generated files that often require updating: codestarts and extensions.
Each case needs to be handled slightly differently.
Codestart
Detailed explanation of how codestarts work: https://quarkus.io/guides/extension-codestart
Each codestart provides a manifest and optionally qute templates. The generated files occur from rendering these templates with information
provided by the project model (e.g. project metadata etc) and the information available in the codestart etc. After each file is rendered there
are mutliple different strategies on how its added to the project (e.g. append, replace, ignore, forbidden).
Implementation proposal
Each tool that needs to re-generate files backed by codestarts can perform the following steps:
Related pull requests:
A pull request that uses an approach like this for regenerating dockerfiles is at: #36178
Quarkus extensions
Current situation
Currently most of our extensions that do generate project files via extension happen at build time. This means that files do get regenerated on each
build, which practically eliminates the possiblity of ending up with stale files. However, this approach suffers from a couple of limitations:
Potential improvements
Implementation ideas
As in most cases the generated code / resources make use of GeneratedFileSystemResourceBuildItem
We could possibly make use of that to control the file generation.
The existing build item has two fields:
So, any augmentation action that requires those build items will get them created, without actually generating them.
With them our tooling can produce the files anywhere we need.
Unfortunately, the only way to filter out the build items we need is by name (only applicable in case where files are generated in a sub-directory that can be used for filtering).
So maybe we should introduce a new field for optional grouping.
Beta Was this translation helpful? Give feedback.
All reactions