I have a Java multiproject which also contains some python build scripts:
my_project/
├── build.gradle.kts
├── settings.gradle.kts
├── module_a/
│ ├── build.gradle.kts
│ └── src/main/java/
├── module_b/
│ ├── build.gradle.kts
│ └── src/main/java/
└── buildscript/
├── build.py
├── common_func.py
└── tests/
├── test_build.py
└── test_common_func.py
IntelliJ recognizes the buildscript
directory as Python if I manually mark it as a Source directory. I then get code completion and can navigate code. I can also run the tests normally.
But whenever I reimport the Gradle project, IDEA forgets about the buildscript
directory, and I have to manually mark it as source again. What can I do to fix this? Some Gradle config, I assume?
Some additional info regarding the tests: I have sys.path.append(os.path.dirname(__file__) + '/..')
at the top of the test files, and have an Exec task for them:
tasks.register<Exec>("testBuildScripts") {
workingDir(rootDir)
commandLine("python3", "-m", "unittest", "discover", "buildscript/tests/")
}