Setting sourceDirs without java plugin

已回答

Given the following build.gradle:

plugins {
id "ru.vyarus.use-python" version "2.2.0"
id "idea"
}

python {
minPythonVersion = '3.7'

pip 'aiohttp[speedups]:3.6.2'
pip 'curl:0.0.1'
pip 'validators:0.14.3'
pip 'simple_rest_client:1.0.5'
pip 'prompt_toolkit:3.0.2'
}

task run(type: PythonTask) {
command = "clipy.py"
workDir = "src"
}

idea {
module {
sourceDirs += file('src')
resourceDirs += file('mock-rest-api')
excludeDirs += file('mock-rest-api/node_modules')
}
}

I expect that, when I open Module Settings, that this module would have the "src" directory marked as a source directory.
I see the excluded directory "mock-rest-api/node_modules", but not the source directory.

https://www.dropbox.com/s/mcnt8c242wl4h75/Screenshot%202020-05-11%2017.01.09.png?dl=0

I can get it to appear by applying the "java" plugin, as seen below, but should that be necessary, given that this is a Python project?

plugins {
id "ru.vyarus.use-python" version "2.2.0"
id "java"
id "idea"
}

python {
minPythonVersion = '3.7'

pip 'aiohttp[speedups]:3.6.2'
pip 'curl:0.0.1'
pip 'validators:0.14.3'
pip 'simple_rest_client:1.0.5'
pip 'prompt_toolkit:3.0.2'
}

task run(type: PythonTask) {
command = "clipy.py"
workDir = "src"
}

idea {
module {
sourceDirs += file('src')
resourceDirs += file('mock-rest-api')
excludeDirs += file('mock-rest-api/node_modules')
}
}
0

IDE configures source directories according to a Gradle conventions. There are no such convention for Gradle python plugin. 

Source directory is needed for the sources which are then compiled by the compiler into the compiled output (bytecode). Why do you need to have it for python? The navigation and resolution should work without marking directory as a source root.

0

请先登录再写评论。