I'm trying to write a plugin for gradle for python language.
I would like to keep python sources the same way as for another languages, for example in <project root>/src/main/python
.
In other words, I don't want to add directory like main
in example above, but rather python
.
I cannot find any explanation how can I do this. I know how to add custom source set, but not how to extend them.
I've tried analysing gradle java and groovy plugins, but they both have quite a different approach, and many of those classes aren't well documented (it's internal API, so that's not so bad). I also tried googling "add source set subdir gradle", "custom source set subdirectory gradle", etc. All the results (for queries that I've asked, maybe I should have rephrased it in some way I didn't try) were about custom source sets (like integrationTest), not their subdirs for different languages or resources.
Yes, I know that python project structure doesn't work like JVM-based languages, but that's not the point of the question. Consider it language-agnostic and don't care that it's python.
==EDIT==
This apparently needs clarification.
I want to add subdirectories to each and every source set of the project. Normally I'd like to add <project root>/src/main/python
and <project root>/src/test/python
.
If user explicitly created new source set, for example integTest
, I'd like to add <project root>/src/integTest/python
.
I need it to be recognized as directory containing code, so that e.g. idea
plugin will mark them as proper source-related directories.