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

Ability to customise catalog file name and working with two or more catalog files #20

Closed
Strawely opened this issue Feb 3, 2022 · 7 comments

Comments

@Strawely
Copy link

Strawely commented Feb 3, 2022

In my case I need to change catalog file name, because in project we have 3 file with different names.
I can by myself reopen PR with file name customisation, but @hvisser, can you help me, can i update your plugin with ability to run it with several catalog files in a loop?

@Strawely
Copy link
Author

Strawely commented Feb 3, 2022

Or may be you can give me your contacts and we can collaborate?

@Strawely Strawely closed this as completed Feb 3, 2022
@hvisser
Copy link
Contributor

hvisser commented Feb 3, 2022

Let's keep the discussion here, because I still don't understand your use case, besides that your project apparently has multiple catalog files.

Per Gradle docs the catalog used by convention will be the libs.versions.toml file. If you have multiple, I'd like to understand why that is and how you reference them in your project.

Having multiple files might be useful, but I'm also trying to be careful not to add things that could be solved in other ways.

@hvisser hvisser reopened this Feb 3, 2022
@Strawely
Copy link
Author

Strawely commented Feb 3, 2022

Ok, look at article you mentioned more carefuly: Sharing catalogs, in the "Example 13" shown that we can define multiple catalogs. We can just define multiple 'create' sections in settings.gradle.

I can't say that my solution about this point is the best, and I'll be glad to hear your comments on it

@hvisser
Copy link
Contributor

hvisser commented Feb 3, 2022

OK so you are saying you have split up your catalogs that you use in the project? I'm still wondering if that's a reasonable thing to do 🤔

What if a command line option would be added for this specific use case? Then you could specify what catalog to update, something like ./gradlew versionCatalogUpdate --catalog-file <my file>
If you're updating all of them all of the time, why not just use one (larger) catalog?

Multiple catalogs introduce potentially some new edge cases as the dependencies are collected for the whole project, and it may affect other features, like keeping and pinning entries in the catalog (do you want to pin them in all catalogs for example?)

@Strawely
Copy link
Author

Strawely commented Feb 3, 2022

Yes, for example there is separate catalogs for android and kotlin dependencies and for our internal libs.
Your suggestion seems to be not bad and will help me partially. About one larger catalog - it will cause discomfort in daily usage of catalog (you know adding new dependencies, looking for exact line for example to add to new module).

And also I don't understand your concerns about existing features. In my mind - it will work as now, as if we define same artifact multiple times. And also I think that it user's responsibility to watch out such cases? And if user won't use overriding default catalog name - it will work as now (saw my new PR?).

@hvisser
Copy link
Contributor

hvisser commented Feb 3, 2022

Yes, for example there is separate catalogs for android and kotlin dependencies and for our internal libs. Your suggestion seems to be not bad and will help me partially. About one larger catalog - it will cause discomfort in daily usage of catalog (you know adding new dependencies, looking for exact line for example to add to new module).

How is that discomfort different from needing to now what file to edit? Re: finding the right line, the plugin can sort those lines for you 😄

Can you give me a small example of your project layout, because I don't think I fully understand how you are using those split catalogs. It sounds like you don't use them for sharing the list of dependencies with other projects, but for creating smaller toml files within a single project right?

And also I don't understand your concerns about existing features. In my mind - it will work as now, as if we define same artifact multiple times. And also I think that it user's responsibility to watch out such cases? And if user won't use overriding default catalog name - it will work as now (saw my new PR?).

What I meant is that an argument could be made that if the plugin updates multiple catalogs, you should also be able to set configuration per catalog, or it should be clear that that config applies to all catalogs. Not a huge deal maybe, but a bit of a concern to me from a usability perspective. Yes, there's user responsibility, but the plugin shouldn't allow you to shoot yourself in the foot either.

I saw your PR and I'll comment on it once it's clear that this is a feature to add and how to do it :)

@Strawely
Copy link
Author

Strawely commented Feb 3, 2022

So, I've checked out, and investigate that, Gradle allows me to customize properties of task, and I can run multiple task of your plugin with different parameters. I think we can close issue, thanks for your attention 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants