Author Topic: Gradle project problems (continued from Java import disorganized).  (Read 4093 times)

Marcel

  • Senior Community Member
  • Posts: 242
  • Hero Points: 26
Still working on collecting data for the subproject issue. I also haven't gotten a PM as of yet.

  • Gradle setup wrapper checkbox.  Yes, I have indeed a (obsolete) gradlew file in my project root
  • The incomplete gradle.bat path: This looks like an environmental problem.  When I open SE with the root project and try to build (Ctrl-M), the path is incomplete, for the root or any of the subprojects. If I explicitly open one of the subproject .vpj, the path is complete and the build works.  If I then reopen the root project and build it, it now also works.
  • An implementation question: If I open a subproject .vpj explicitly (quite common), SE should be able to access symbols from other subprojects, this is pretty much the same thing as opening the root project. Example: Open subproject A which is has references to subproject B.  This is currently not working, subproject B definitions are not visible.  Are you supporting that?
« Last Edit: August 09, 2019, 08:44:26 pm by Dennis »

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3035
  • Hero Points: 446
Gradle project problems (continued from Java import disorganized).
« Reply #1 on: August 09, 2019, 06:13:41 pm »
Would you mind if we changed the subject of this thread to something about Gradle, now that it doesn't involve organize imports ?
« Last Edit: August 09, 2019, 08:44:36 pm by Dennis »

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1371
  • Hero Points: 127
Gradle project problems (continued from Java import disorganized).
« Reply #2 on: August 09, 2019, 06:34:36 pm »
Sorry about that, you should have a PM now. 

1. That makes sense.  I looked, and I do need to fix it to remember your choice for the next beta.

2.  That does sound like it could be with our environment handling.  Looking at it, I see that there are some places where I could miss that a project needed the tasks to be upgraded from a previous version, so this may be a combination of the two problems.

3. In general, if you open a project, you should see any other tags in any other projects.  The tags from the sub-projects go either to the workspace tag file, or a project specific tag file - but in both cases those tag files are searched from no matter with sub-project you have active.   So if you're not seeing tags from a particular project, my primary concern is that the files for that project aren't being registered in the tag file.   Back to gradle specific details, that might happen if the sub-project wasn't generated correctly, and is accidentally excluding the project's source files.

In the project view, if you expand a sub-project, and it doesn't show any source, that's a definite problem.  If it does show source, something else is going on, the other debug information you're gathering will narrow down what's going on there.

Marcel

  • Senior Community Member
  • Posts: 242
  • Hero Points: 26
Gradle project problems (continued from Java import disorganized).
« Reply #3 on: August 09, 2019, 07:12:12 pm »
@Dennis
Be my guest.  I have no idea how to link the original thread to this one, I leave this up to you.
« Last Edit: August 09, 2019, 08:44:17 pm by Dennis »

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3035
  • Hero Points: 446

Marcel

  • Senior Community Member
  • Posts: 242
  • Hero Points: 26
Re: Gradle project problems (continued from Java import disorganized).
« Reply #5 on: August 10, 2019, 03:52:28 am »
Requested files uploaded.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1371
  • Hero Points: 127
Re: Gradle project problems (continued from Java import disorganized).
« Reply #6 on: August 12, 2019, 12:53:36 pm »
Thanks, I've got the files. 

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1371
  • Hero Points: 127
Re: Gradle project problems (continued from Java import disorganized).
« Reply #7 on: August 12, 2019, 03:55:18 pm »
The files you collected are a great help.   Thanks.

  • I can see why you needed to run Gradle Options for the sub-projects to get the build task working, that's a problem.  That should have been in the list of things that needed to be updated when opening a project generated by a previous version, but I missed it. I'll get it in for the next beta drop.
  • I think I see why you're not seeing some of the dependencies for some of or your sub-projects.  It's a bug I missed because my test projects had sub-projects that tended to have the same sets of dependencies, so if something was missed, it wasn't as obvious.  I'll work on this for the next beta as well. 
  • Once I get through those, I'll circle back and look at the Java compiler tag problem you mentioned in the previous thread

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1371
  • Hero Points: 127
Re: Gradle project problems (continued from Java import disorganized).
« Reply #8 on: August 22, 2019, 05:15:40 pm »
Ok, found the bugs causing the Java compiler problem.

  • There was a bug in the code that picks the latest Java compiler, and your project is probably set to use the latest Java compiler.  It was picking 1.8.0 over 1.11, etc...
  • There was a bug in some cache invalidation logic where the latest JDK version wasn't updated after some changes to the compiler configuration.

These are fixed for the next beta. 

It sounded like you wanted it to use the default compiler you set rather than the latest compiler, so you can change that setting for your project. Go to Project -> Project Properties, go to the Compile/Link tab, and change the compiler to "Default Compiler (current default compiler name)".

« Last Edit: August 22, 2019, 05:18:00 pm by patrick »

Marcel

  • Senior Community Member
  • Posts: 242
  • Hero Points: 26
Re: Gradle project problems (continued from Java import disorganized).
« Reply #9 on: September 06, 2019, 12:19:02 am »
@patrick: Has any work been done on this feature in b3? There was nothing listed in the readme.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1371
  • Hero Points: 127
Re: Gradle project problems (continued from Java import disorganized).
« Reply #10 on: September 06, 2019, 12:52:20 am »
Yes, the Java compiler problem was fixed.  See my last post, since in addition to the bugs I found, it sounded like maybe your compiler setting for your project was to use the latest, rather than using whatever the default compiler is set to.

And there were a few problems I fixed with the Gradle dependency tagging that could have prevented you from seeing the tagged dependencies from some projects.  Run through Gradle Options for one of your sub-projects to force the tagging to update.  You may see some dependencies in the list you didn't see before - part of the bug was it was looking at dependencies for a single project when it was supposed to be looking at dependencies for the workspace.

Marcel

  • Senior Community Member
  • Posts: 242
  • Hero Points: 26
Re: Gradle project problems (continued from Java import disorganized).
« Reply #11 on: September 06, 2019, 02:05:28 pm »
I did a reset on my Gradle project (nuked *.v* throughout the tree, except for the external dependency project), then recreated from the root build.gradle.
  • The use gradle wrapper option is still being pre-checked. It is initially checked because of the gradlew file in my root. After clearing the check, then closing and reopening SE, the check is back. SE should have remembered my choice.
  • References to parallel subprojects still do not resolve. The dependencies are declared in the root gradle.properties. See details below.

Dependencies for some of the subprojects are declared in the root script like so:

Code: [Select]
project(':sub1') {
    dependencies {
        compile (project (':sub2'))
        compile (project (':sub3')) {transitive = false}
        compile (project (':sub4')) {transitive = false}
        compile (project (':sub5'))
    }
}

After opening the sub1 project and rerunning its Gradle setup (should not be necessary?), anything defined in sub2...5 does not resolve (e.g. import sub2.xxx).




patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1371
  • Hero Points: 127
Re: Gradle project problems (continued from Java import disorganized).
« Reply #12 on: September 06, 2019, 02:23:13 pm »
Ok,  I can see it not picking up the sub-projects declared in that way.  It's a little irritating, because we can see all of the sub-projects from the data we collect, but one part of the code is limiting its scope to what's in the settings.gradle.  I'll take a look at that. 

I didn't fix the saved state for the gradle wrapper check mark yet.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1371
  • Hero Points: 127
Re: Gradle project problems (continued from Java import disorganized).
« Reply #13 on: September 10, 2019, 08:36:18 pm »
I checked in some fixes for the next build for the problem with the dependencies not being found after updating some sub-projects.  It could do a bit of damage when the bug triggered, since it could remove previously resolved dependencies from the list. 

With this fixed, you shouldn't see different results when you update different sub-projects.  And when dependencies change, updating a single project should update the tagging dependencies for all of the projects in the workspace, you shouldn't have to go to run update on each one.   I'm leaving the update as having to be triggered manually for this release.


patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1371
  • Hero Points: 127
Re: Gradle project problems (continued from Java import disorganized).
« Reply #14 on: September 11, 2019, 06:22:40 pm »
Fixed the problem with the gradle wrapper checkmark not remember what you chose previously for the next build.

The first time you bring up Gradle Options for a project in your workspace, it will still have it checked, because it will see the gradle wrapper in your workspace directory, and it won't have a previous choice to go by.  But after that, it should remember your choice for that workspace.