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

Make source set JVM specific elements an extension of the java plugin instead of hard coded and the container easier to create #18805

Open
lamba92 opened this issue Oct 27, 2021 · 3 comments
Labels
a:feature A new functionality in:configuration-model lazy api, domain object container

Comments

@lamba92
Copy link

lamba92 commented Oct 27, 2021

At the moment creating a source set for a custom plugin is such a nightmare that you always go for an other container, usually called sourceSets as well, inside your extension an you totally ignore the default one (if is there at all since it need to be initialized by the Java base plugin).

I would recommend to make all The sourceSet interface the most JVM agnostic as possible, always register the source sets in the project or create a base plugin that does so and make a JVM plugin that adds all those extensions.

@lamba92 lamba92 added a:feature A new functionality to-triage labels Oct 27, 2021
@octylFractal octylFractal added in:configuration-model lazy api, domain object container and removed to-triage labels Oct 27, 2021
@ljacomet
Copy link
Member

Can you be more specific about what the problems are?
Pointers to attempts and what was problematic would help. Then a description of use case(s) for where you would use a JVM agnostic SourceSet

@lamba92
Copy link
Author

lamba92 commented Oct 27, 2021

I am building a plugin to streamline Terraform projects from Gradle and I need the concept of a source set, of course. I a first attempt I wanted to add a terraform extension to every SourceSet created, but I quickly realized that there was no easy way to create the source set container without applying the Java plugin.

Furthermore, each source set has hardcoded properties and functions tied to the JVM environment, implying that the sources you are going to add to your project are somewhat going to be compiled for the JVM.

I was able to track down which plugin and where the source set container was created, but I decided it was not worth the effort and created a custom container with a custom class called TerraformSourceSet and mirrored some functions names and properties such as dependsOn() or srcDir().

If you allow to register the SourceSets container in a simple plugin, while having the SourceSet interface stripped away of the JVM stuff, it would be possible have a unified sourceSet api that I believe is much less chaotic compared to each plugin having the source sets in their own extensions.

Myself included was very confused at the begging by the Kotlin plugin having their kotlin.sourceSets accessors separated from the root sourceSets where you had to do something like kotlin.sourceSets.main.kotlin.

@lamba92 lamba92 changed the title Make source set JVM specific elements an extension of the java plugin instead of hard coded and also easier to create. Make source set JVM specific elements an extension of the java plugin instead of hard coded and the container easier to create Nov 1, 2021
@mitasov-ra
Copy link

Duplicates #831

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:configuration-model lazy api, domain object container
Projects
None yet
Development

No branches or pull requests

4 participants