Updated KDoc

This commit is contained in:
Akash Yadav
2022-05-15 22:44:20 +05:30
parent f54cb2f90b
commit fd13dce5e0
3 changed files with 25 additions and 6 deletions
@@ -60,7 +60,8 @@ import org.gradle.tooling.exceptions.UnsupportedOperationConfigurationException
*
* @author Akash Yadav
*/
internal class ToolingApiServerImpl (val forwardingProject: InternalForwardingProject) : IToolingApiServer {
internal class ToolingApiServerImpl(private val forwardingProject: InternalForwardingProject) :
IToolingApiServer {
private var initialized = false
private var client: IToolingApiClient? = null
@@ -17,6 +17,7 @@
package com.itsaky.androidide.tooling.impl.model
import com.itsaky.androidide.tooling.api.IToolingApiClient
import com.itsaky.androidide.tooling.api.model.IProject
import com.itsaky.androidide.tooling.api.model.IdeAndroidModule
import com.itsaky.androidide.tooling.api.model.IdeGradleProject
@@ -25,42 +26,59 @@ import com.itsaky.androidide.utils.ILogger
import java.io.File
import java.util.concurrent.*
/** @author Akash Yadav */
/**
* An [IProject] implementation which forwards all calls to another [IProject].
*
* We provide [IProject] as a service to the [IToolingApiClient]. As there is no real project
* instance available when the server starts, we use this implementation. When the project is
* initialized, the Tooling API server updates the project instance here. Once the project instance
* is available, the client can fetch real information about the project.
*
* @author Akash Yadav
*/
class InternalForwardingProject(var project: IProject?) : IProject {
private val log = ILogger.newInstance(javaClass.simpleName)
override fun getName(): CompletableFuture<String> {
log.debug("getName", "this.project", this.project)
return if (this.project != null) this.project!!.name else CompletableFuture.completedFuture("")
}
override fun getName(): CompletableFuture<String> =
if (this.project != null) this.project!!.name else CompletableFuture.completedFuture("")
override fun getDescription(): CompletableFuture<String> =
if (this.project != null) this.project!!.description
else CompletableFuture.completedFuture("")
override fun getProjectPath(): CompletableFuture<String> =
if (this.project != null) this.project!!.projectPath
else CompletableFuture.completedFuture("")
override fun getProjectDir(): CompletableFuture<File> =
if (this.project != null) this.project!!.projectDir
else CompletableFuture.completedFuture(File("."))
override fun getBuildDir(): CompletableFuture<File> =
if (this.project != null) this.project!!.buildDir
else CompletableFuture.completedFuture(File("."))
override fun getBuildScript(): CompletableFuture<File> =
if (this.project != null) this.project!!.buildScript
else CompletableFuture.completedFuture(File("."))
override fun getTasks(): CompletableFuture<MutableList<IdeGradleTask>> =
if (this.project != null) this.project!!.tasks
else CompletableFuture.completedFuture(mutableListOf())
override fun getModules(): CompletableFuture<MutableList<IdeGradleProject>> =
if (this.project != null) this.project!!.modules
else CompletableFuture.completedFuture(mutableListOf())
override fun findByPath(path: String): CompletableFuture<IdeGradleProject?> =
if (this.project != null) this.project!!.findByPath(path)
else CompletableFuture.completedFuture(null)
override fun findAndroidModules(): CompletableFuture<MutableList<IdeAndroidModule>> =
if (this.project != null) this.project!!.findAndroidModules()
else CompletableFuture.completedFuture(mutableListOf())
override fun findFirstAndroidModule(): CompletableFuture<IdeAndroidModule?> =
if (this.project != null) this.project!!.findFirstAndroidModule()
else CompletableFuture.completedFuture(null)