1

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.

Filip Malczak
  • 3,124
  • 24
  • 44
  • You'd like to keep python sources under `/src/main/python` but without `main`? – Opal Aug 17 '15 at 11:18
  • 2
    A [python plugin](https://engineering.linkedin.com/blog/2016/08/introducing--py-gradle--an-open-source-python-plugin-for-gradle) for Gradle was made public in 2016. The source and documentation are on [github](https://github.com/linkedin/pygradle). – user1241663 Sep 02 '16 at 13:45
  • Wow. @user1241663 - thanks a lot, I'm sooooo glad to see that. – Filip Malczak Sep 17 '16 at 08:20

0 Answers0