No worry. I think I see where you are going.

Gradle doesn't know and doesn't care what is the default output directory
for project or for module. It only adds this information to its Idea model
if it is told that the output location should be customized. That's all
what is needed to generate IDEA project and module files offline or to
build a model that will be used through toolingApi to synchronize Gradle
project with IntelliJ's project.


On Thu, Mar 6, 2014 at 11:27 PM, Alex Ruiz <alr...@google.com> wrote:

> Thanks Radim and Szczepan. I apologize I didn't explain the problem well.
> What I'm saying is that I was expecting IdeaCompilerOutput to return, for
> example "build/classes/main" and "build/classes/tests" if I haven't
> configured the output directories of a project.
>
>
> On Thu, Mar 6, 2014 at 12:39 PM, Szczepan Faber <
> szczepan.fa...@gradleware.com> wrote:
>
>> Hey Alex,
>>
>> This could be a bug. Configuring the output dirs should be possible -
>> check out this integ test:
>> https://github.com/gradle/gradle/blob/master/subprojects/tooling-api/src/integTest/groovy/org/gradle/integtests/tooling/m5/ToolingApiIdeaModelCrossVersionSpec.groovy#L111
>>
>> Cheers!
>>
>>
>> On Thu, Mar 6, 2014 at 8:55 PM, Radim Kubacki <
>> radim.kuba...@gradleware.com> wrote:
>>
>>> Hello Alex,
>>>
>>> I am not sure what you want to achieve / why you want to access these
>>> values. What I think is the expected behavior here is:
>>>
>>> - no inheritOutputDirs or true creates .iml saying that output dirs are
>>> inherited from project settings
>>> - inheritOutputDirs set to false and no output dirs will tell IDEA to
>>> use project specific output dirs and IDEA or user will set exact location
>>> - inheritOutputDirs set to false and output dirs tells IDEA that this
>>> module should use specific dirs for its outputs.
>>>
>>> IMO if you are looking for classes from some library inside your AS
>>> plugin you should be able to query IJ API. And if they should be separated
>>> from classes built by android project/library then set inheritOutputDirs to
>>> false and optionally specify folders.
>>>
>>> -Radim
>>>
>>>
>>> On Thu, Mar 6, 2014 at 7:44 PM, Alex Ruiz <alr...@google.com> wrote:
>>>
>>>> Greetings,
>>>>
>>>> In Android Studio we set up a Gradle-based Android project by first
>>>> getting the structure of the project from Gradle (IDEA's infrastructure
>>>> gets a org.gradle.tooling.model.idea.IdeaProject using the Gradle tooling
>>>> API.)
>>>>
>>>> We currently have a problem when setting up Java-only library modules
>>>> (non-Android.) The problem is that when we get an IdeaCompilerOutput from
>>>> an IdeaModule, the output paths are null. The only way I can get it return
>>>> a value is by adding this to a build.gradle file:
>>>>
>>>> apply plugin: 'idea'
>>>>
>>>> idea {
>>>>     module {
>>>>         inheritOutputDirs = false
>>>>         outputDir = file('muchBetterOutputDir')
>>>>         testOutputDir = file('muchBetterTestOutputDir')
>>>>     }
>>>> }
>>>>
>>>> Even setting up the output path in the Gradle Java plug-in as follows:
>>>>
>>>> sourceSets.main.output.classesDir = file('muchBetterClassesDir')
>>>>
>>>> has no effect on IdeaCompilerOutput.
>>>>
>>>> Is this the expected behavior? I originally thought this was a bug, but
>>>> if this the expected behavior, and given that there is no Java model (like
>>>> the Android model the Android plug-in provides,) what would make more 
>>>> sense:
>>>> 1. Us writing our own Java model (IntelliJ already has something like
>>>> this and we could extend it,)
>>>> or
>>>> 2. Have this functionality provided by Gradle
>>>> ?
>>>>
>>>> Many thanks in advance,
>>>> -Alex
>>>>
>>>>
>>>
>>
>>
>> --
>> Szczepan Faber
>> Principal engineer@gradle; Founder@mockito
>>
>
>

Reply via email to