Support Kotlin,Groovy in Gradle projects#3682
Support Kotlin,Groovy in Gradle projects#3682snjeza wants to merge 1 commit intoeclipse-jdtls:mainfrom
Conversation
|
So it seems that if, after a kotlin project has been imported, if I create a new kt file, e.g. App2.kt, a copy of App.kt, and then reference it in the java file ( |
fbricon
left a comment
There was a problem hiding this comment.
adding new Kotlin or Groovy files, or adding new methods to existing ones are not visible to the java compiler, until a full reimport occurs
| @@ -0,0 +1,10 @@ | |||
| package org.sample; | |||
There was a problem hiding this comment.
should prolly go into src/main/java
There was a problem hiding this comment.
I have tried it, but the compileGroovy task depends on the compileJava task, which compiles the Java source before the Groovy source, and can't find the App class. It fails from the Gradle command line.
| @@ -0,0 +1,22 @@ | |||
| apply plugin: "io.freefair.aspectj" | |||
| @@ -0,0 +1,22 @@ | |||
| apply plugin: "io.freefair.aspectj" | |||
If you change a Groovy or Kotlin class, you will need to reload the root project for the changes to be visible when running the tests. We could add *.kt and *.groovy files to VS Code watchers if the Groovy and Kotlin preferences are enabled. |
Sounds like it's gonna be pretty slow no? if you rebuild on each kt change |
Gradle supports incremental build - https://docs.gradle.org/current/userguide/incremental_build.html |
let's see how it goes |
I have added this feature. |
| if (preferenceManager.getPreferences().isAutobuildEnabled() && ProjectUtils.isGradleProject(project)) { | ||
| if ((preferenceManager.getPreferences().isAspectjSupportEnabled() && resource.getName().endsWith(".aj")) || (preferenceManager.getPreferences().isKotlinSupportEnabled() && resource.getName().endsWith(".kt")) | ||
| || (preferenceManager.getPreferences().isGroovySupportEnabled() && resource.getName().endsWith(".groovy"))) { |
There was a problem hiding this comment.
ProjectUtils.isGradleProject(project)) {
if ((preferenceManager.getPreferences().isAspectjSupportEnabled() && resource.getName().endsWith(".aj")) || (preferenceManager.getPreferences().isKotlinSupportEnabled() && resource.getName().endsWith(".kt"))
all that Gradle specific stuff should be moved down some IBuildSupport.shouldCompile(...) method. I'd rather prefer we avoided more build specific coupling in the managers
|
@fbricon I have updated the PR. |
|
@fbricon I have updated the PR. |
a5a2295 to
650941d
Compare
|
I have added the following improvements:
|
|
test this please |
|
test this please |
Addresses redhat-developer/vscode-java#4312
linked to redhat-developer/vscode-java#4313
cc @fbricon @rgrunber @tsmaeder