Skip to content

Commit

Permalink
Add extra logging when Gradle is running the model fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
hegyibalint committed Oct 1, 2024
1 parent 0e8e351 commit 9772f16
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,33 @@ package org.gradle.declarative.lsp
import org.gradle.declarative.lsp.build.action.GetDeclarativeResourcesModel
import org.gradle.declarative.lsp.build.model.DeclarativeResourcesModel
import org.gradle.tooling.GradleConnector
import org.gradle.tooling.ProgressEvent
import org.gradle.tooling.ProgressListener
import org.gradle.tooling.ProjectConnection
import org.slf4j.LoggerFactory
import java.io.File

class TapiConnectionHandler(val projectRoot: File) {
private val LOGGER = LoggerFactory.getLogger(TapiConnectionHandler::class.java)

class TapiConnectionHandler(val projectRoot: File): ProgressListener {

fun getDomPrequisites(): DeclarativeResourcesModel {
var connection: ProjectConnection? = null
try {
connection = GradleConnector
.newConnector()
.forProjectDirectory(projectRoot)
.connect()
return connection.action(GetDeclarativeResourcesModel()).run()
return connection
.action(GetDeclarativeResourcesModel())
.addProgressListener(this)
.run()
} finally {
connection?.close()
}
}

override fun statusChanged(event: ProgressEvent?) {
LOGGER.info("${event?.description}")
}
}

0 comments on commit 9772f16

Please sign in to comment.