-
Notifications
You must be signed in to change notification settings - Fork 9
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
Support for defining hierarchical project paths in the Settings DSL #136
Comments
What I tried to convey when I answered this is the other issue is that in my opinion, in the context of a Java Project, it is good practice to give a unique name to each project. The Javadoc you cited is true as a general statement about Gradle's Project type, which can be used in all kinds of contexts. And then yes, in general multiple projects with the same name are possible. Since you have a project where you use the same name multiple times, I am happy to discuss which feature you would like to see to support your setup better. We would need more features in the Settings plugin approach. Probably an additional configuration option for the project path if it differs from the "artifact". As I myself have no use for it, I can't really test it out in a real large project, but I could imagine something like this:
Would that work for you? Maybe you want to give adding something like that a try? |
My naive idea: using the default gradle syntax -> |
My idea with the
If we are fine with saying: If you have a path then the path needs to match the directory hierarchy Maybe you can try different ideas in you projects to get a feeling for what has the best usability for your use cases. |
So a few thoughts so far:
As an alternative I see the following
Thoughts? |
Good point @TheGoesen. The idea behind the Settings DSL is certainly opinionated towards certain use cases. I understand that it is not what you want in some existing projects, which follow different patterns/conventions already that you would like to keep for whatever reason. Therefore, I think it makes sense to split the tow aspects if we can:
Then you could basically exchange (1) with you own mechanism and still profit from (2). A problem why it can't be completely detached right now is that the mechanism also needs to know the Assuming that we do not need the group anymore, we can offer something for this:
For example:
This can then be embedded in you own code that auto-includes by looking for build files etc. Maybe such a general mechanism is also a good solution for the original issue? That is, we don't extend the DSL for including directories with more specifics, but instead allow you to do your own thing if needed by using Gradle's default include plus |
Hmm can this new feature be used for something that doesnt have its own "sourceSet"? like the way its documented I would asume you need to create a sourceSet for your "feature"/jar file, which I avoided in some case of generated code. |
I am pretty sure it works with all |
ok but If i am not registering a sourceSet with a feature... then how can I use a feature at all? |
In combination with Java Modules it makes little sense to use it without its own Source Set, and it's own module-info, in my opinion. In traditional Java, this is a way to formalize what is called "Optional Dependency" in Maven. Which, in Maven, is just useless metadata the tools ignore. But here you can say "I have transitive dependency X which is only needed if you use a certain piece of my code". If you use that piece, please tell by "using" the feature. The feature points to the "main" source set but still has additional dependencies only in the scope of that feature. Here is an article on that topic: But I think this is pretty unrelated to this issue. :) |
That statement is incorrect. The name of the project is not an identity. as the javadoc of project.name states:
As mentioned by my work account in #108: I have a lot of projects that have the same name, but not the same path. I guess i have also no clue why I have not been affected by gradle/gradle#847 in the slightest, for me multiple projects with the same name work just fine.
So currently i would not use the settings syntax because it would cause the ApplyPluginsAction to run on unintended projects, because they have the same name as intended projects. (But different paths)
The text was updated successfully, but these errors were encountered: