Feature request: add "getFileSystemPath" to org.gradle.tooling.model.GradleProject

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Feature request: add "getFileSystemPath" to org.gradle.tooling.model.GradleProject

alex.ruiz.05
Greetings,

We have discovered a serious bug in Android Studio (and IDEA.) When importing a Gradle project, IDEA tries to find the root directory of the Gradle project this way:

1. gets the GradleScript from the GradleProject
2. if GradleScript.getSourceFile() is not null, it assumes the parent java.io.File of the build.gradle file is the root directory of the GradleProject
3. otherwise, it "deduces" the physical path from the logical path (GradleProject#getPath())

This is completely broken for Gradle projects that do not have a build.gradle file and GradleProject#getPath is not the same as the path in the file system. For example:

include ':app'
project(':app').projectDir = new File(rootDir, 'test/app')

Can you please expose the project's physical path in GradleProject? That would make it really easy to solve the issue in IDEA. It would be great to have this in 1.12 :-)

Many thanks,
-Alex
 
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: add "getFileSystemPath" to org.gradle.tooling.model.GradleProject

Radim Kubacki
Hi Alex,

can't you just get BasicGradleProject instance (from GradleBuild) and call its http://www.gradle.org/docs/current/javadoc/org/gradle/tooling/model/gradle/BasicGradleProject.html#getProjectDirectory() ?

-Radim


On Thu, Mar 13, 2014 at 10:57 PM, Alex Ruiz <[hidden email]> wrote:
Greetings,

We have discovered a serious bug in Android Studio (and IDEA.) When importing a Gradle project, IDEA tries to find the root directory of the Gradle project this way:

1. gets the GradleScript from the GradleProject
2. if GradleScript.getSourceFile() is not null, it assumes the parent java.io.File of the build.gradle file is the root directory of the GradleProject
3. otherwise, it "deduces" the physical path from the logical path (GradleProject#getPath())

This is completely broken for Gradle projects that do not have a build.gradle file and GradleProject#getPath is not the same as the path in the file system. For example:

include ':app'
project(':app').projectDir = new File(rootDir, 'test/app')

Can you please expose the project's physical path in GradleProject? That would make it really easy to solve the issue in IDEA. It would be great to have this in 1.12 :-)

Many thanks,
-Alex
 

Reply | Threaded
Open this post in threaded view
|

Re: Feature request: add "getFileSystemPath" to org.gradle.tooling.model.GradleProject

alex.ruiz.05
Thanks a lot, Radim. I just tried it and it fixes the issue! :-)


On Thu, Mar 13, 2014 at 3:04 PM, Radim Kubacki <[hidden email]> wrote:
Hi Alex,

can't you just get BasicGradleProject instance (from GradleBuild) and call its http://www.gradle.org/docs/current/javadoc/org/gradle/tooling/model/gradle/BasicGradleProject.html#getProjectDirectory() ?

-Radim


On Thu, Mar 13, 2014 at 10:57 PM, Alex Ruiz <[hidden email]> wrote:
Greetings,

We have discovered a serious bug in Android Studio (and IDEA.) When importing a Gradle project, IDEA tries to find the root directory of the Gradle project this way:

1. gets the GradleScript from the GradleProject
2. if GradleScript.getSourceFile() is not null, it assumes the parent java.io.File of the build.gradle file is the root directory of the GradleProject
3. otherwise, it "deduces" the physical path from the logical path (GradleProject#getPath())

This is completely broken for Gradle projects that do not have a build.gradle file and GradleProject#getPath is not the same as the path in the file system. For example:

include ':app'
project(':app').projectDir = new File(rootDir, 'test/app')

Can you please expose the project's physical path in GradleProject? That would make it really easy to solve the issue in IDEA. It would be great to have this in 1.12 :-)

Many thanks,
-Alex