Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: add project name and version #32567

Open
FroMage opened this issue Apr 12, 2023 · 9 comments
Open

CLI: add project name and version #32567

FroMage opened this issue Apr 12, 2023 · 9 comments
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) kind/enhancement New feature or request

Comments

@FroMage
Copy link
Member

FroMage commented Apr 12, 2023

Description

In order to do my CLI plugin which creates packages for Debian or RPM, I need to be able to access the project's name and version.

The current QuarkusProject API doesn't contain this info. Could we add it?

Implementation ideas

No response

@FroMage FroMage added the kind/enhancement New feature or request label Apr 12, 2023
@quarkus-bot quarkus-bot bot added the area/cli Related to quarkus cli (not maven/gradle/etc.) label Apr 12, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 12, 2023

/cc @ebullient (cli), @maxandersen (cli)

@FroMage
Copy link
Member Author

FroMage commented Apr 12, 2023

@aloubyansky said it could be done.

@ebullient
Copy link
Contributor

#29379 -- like this?

@aloubyansky
Copy link
Member

No, this is about a project in which the CLI is executing a command. The challenge is to do that efficiently for Gradle projects. If we add it to QuarkusProject and it's "expensive" to provide this info it will affect all the commands including those that don't consume this info.

@maxandersen
Copy link
Contributor

How about we generate a json that gets updated by quarkus dev to store things that are semi static like this so you only pay the cost lazily ?

@iocanel
Copy link
Contributor

iocanel commented Apr 13, 2023

No, this is about a project in which the CLI is executing a command. The challenge is to do that efficiently for Gradle projects. If we add it to QuarkusProject and it's "expensive" to provide this info it will affect all the commands including those that don't consume this info.

I am not 100% sure on why is it expensive for gralde projects to get the name and version. So, I am talking out loud in hope that someone will correct me.

Let's start with name:

  • name is optional in build.gradle and fallback to directory name.
  • name can use placeholders with values provided in settings.gralde or global settings.gralde.

And for version:

  • version is optional and fallback to the value unspecified.
  • version can be specified via allprojects.
  • version can use placeholders with values provided in settings.gralde or global settings.gralde.

It doesn't seem like a huge amount of work to get the QuarkusProjectHelper fetch these.

@aloubyansky
Copy link
Member

As long as there is no expectation for us to provide accurate info but the best effort then yes, there are options.
AFAIK, the official Gradle way to obtain this info would be to use the Gradle tooling API, which interprets the scripts and relevant configs.

@iocanel
Copy link
Contributor

iocanel commented Apr 13, 2023

@aloubyansky: Initially bringing the gradle api to devtools common didn't seem like a good idea to me, but we do bring the maven api, already. wdyt? Shall we bring in the gradle api or go with best effort?

@aloubyansky
Copy link
Member

One difference is that the Maven resolver API is used to communicate with the registry in both Maven and Gradle projects. The other one is that with Maven API we can analyze projects "from outside", i.e. w/o requiring to launch a Maven process. The Gradle tooling API is different in that regard, which is why normally we don't bother using it preferring to invoke a Gradle task.
Otherwise, basically, the Gradle API is added where it matters. So the answer would be if there is a place that needs it, we should add it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants