Replies: 1 comment 2 replies
-
Excellent question of which the answer has many nuances. The answer is that anything is doable; bu to quote a favorite fictional scientist: In short - the jury is still out if we should do it; let me elaborate: Today JBang has a "integration" mechanism that lets dependencies participate in the post build process. That is how Quarkus integrates with JBang - here Quarkus registers itself to be given the output of jbang's own build of classes before it is turned into a jar. Letting Quarkus (or anything else for that matter) perform build time optimizations. This is too late in the process for what you are asking about open-api or antlr needs running before the source gets compiled. Lets now imagine we decided to have a prebuild integration API that could participate before sources are made available. And yes, if one made that it would not be unthinkable we could just call out to a Maven Mojo or Gradle Plugin - the issue is that most of those plugins assumes a lot of things; like project structure, build phases, certain sequence, complex configuration and a lot more. It would generally mean that JBang would become a full grown build system which at that point we would have to ask ourselves - well; why don't we just use some of the existing perfectly great build systems like Maven and Gradle in that case? And that is actually my current stance on this - that if you need "complex" build steps use a build tool - maven and gradle are great at this. I do though play with the notion of supporting "simple" build steps - i.e. things that are fairly well isolated and has a enough of a well-defined lifecycle so it does not increase complexity. For JBang users and as well as for JBang's architecture and goals of being just enough magic glue on top of the existing Java tool chain to unleash the full power of java to use in exploration and automation. As it turns out - there actually is a mechanism today you can use for this which fits pretty well with JBang: Annotation Processors. They execute as part of the javac build and are limited in what they can do - thus fulfills this "simple" build step idea. For example some years ago https://github.com/Cosium/openapi-annotation-processor was made which expose openapi code generation - that should actually be doable and work. It has limitations and it might need some tweaking to work smoothly in the IDE's that support JBang styled coding - but I believe that has potential and something I would like to see explored before we go and jump the shark fully and add a prebuild API to JBang. ...I'm realizing this is getting a rather long answer and there is even more to it and I really need to run for some weekend/vacation chores: in short - yes, its doable, but no we are not doing it but curious in exploring limited variants of this and happy to help you explore enable them if you are interested in contributing. Peace. |
Beta Was this translation helpful? Give feedback.
-
There are several projects, such as open-api or antlr, that provide maven and gradle plugins. These plugins generate code during the build process, allowing the generated code to be utilized in the project.
Is it feasible to have a similar functionality in jbang? For instance, could we incorporate maven plugin coordinates along with plugin configuration, and have them executed before the actual execution?
Beta Was this translation helpful? Give feedback.
All reactions