[GRADLE-1816] Tooling API: don't expose project source dir as a dependency Created: 29/Sep/11  Updated: 03/Sep/13  Resolved: 03/Sep/13

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Denis Zhdanov Assignee: Unassigned
Resolution: Not A Bug Votes: 0


 Description   

The problem is that 'ProjectConnection.getModel(BasicIdeaProject.class)' called for the 'Gradle' project returns model that references resource roots as a module libraries. For example, module 'announce' has content root 'subprojects/announce' and library dependency with the binary path 'subprojects/announce/src/main/resources'.

That path should be marked as a source root under the module content root instead.



 Comments   
Comment by Szczepan Faber [ 29/Sep/11 ]

Hey Denis!

Let's forget about the tooling-api for a sec - I'd like to describe why we configure our idea setup this way

If your resources contain groovy code (for example some fake classes for the purposes of testing) IDEA will try to compile them. However, they don't compile because they are only test resources. To avoid compilation errors and to allow normal work we disable sources from compilation (it's a setting in .ipr file, cannot be set via UI). However, this leads to a different problem: those resources are no longer on the classpath. So to add them to the classpath we put resources on the binary path. We still need them configured as content root -> 'resources' because we want to edit them easily.

Consider this 'hack' as something unusual. Most projects don't need that.

Now, can you tell me why such setup is a problem in the idea plugin ?

Cheers!

Comment by Denis Zhdanov [ 04/Oct/11 ]

The use-case looked unnatural for me as I haven't thought about it from such an angle.

There are no technical problems with such a configuration at IntelliJ IDEA. However, my concern here is about default tooling api behavior - how does it understand what is 'source dir' and what is 'resource dir'?

Normally we'd like to configure resources as a module source root in order to show them at the project view next to the real module sources.

Comment by Szczepan Faber [ 04/Oct/11 ]

Hey Denis!

The tooling-api should understand the source dir correctly and treat it as a source dir. It's just in our project we deliberately configure the idea plugin to specifically also treat source dirs as binary path folders. The tooling-api should honor our 'hacks' and provide the model accordingly

>Normally we'd like to configure resources as a module source root in order to show them at the project view next to the real module sources.

Yes, I completely agree.

Comment by Denis Zhdanov [ 20/Oct/11 ]

I think we can close this ticket then.

Generated at Wed Jun 30 12:05:07 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.