mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Return all the tasks in the getDependencies() command.
This commit is contained in:
parent
27edec8f7a
commit
d198d5e6a1
2 changed files with 16 additions and 9 deletions
|
@ -36,6 +36,8 @@ class DependencyData @Inject constructor(val executors: KobaltExecutors, val dep
|
||||||
val pluginDependencies = projectResult.pluginUrls.map { File(it.toURI()) }.map {
|
val pluginDependencies = projectResult.pluginUrls.map { File(it.toURI()) }.map {
|
||||||
FileDependency(it.absolutePath)
|
FileDependency(it.absolutePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val allTasks = hashSetOf<TaskData>()
|
||||||
projectResult.projects.forEach { project ->
|
projectResult.projects.forEach { project ->
|
||||||
val compileDependencies = pluginDependencies.map { toDependencyData(it, "compile") } +
|
val compileDependencies = pluginDependencies.map { toDependencyData(it, "compile") } +
|
||||||
allDeps(project.compileDependencies).map { toDependencyData(it, "compile") } +
|
allDeps(project.compileDependencies).map { toDependencyData(it, "compile") } +
|
||||||
|
@ -55,15 +57,16 @@ class DependencyData @Inject constructor(val executors: KobaltExecutors, val dep
|
||||||
// Separate resource from source directories
|
// Separate resource from source directories
|
||||||
val sources = project.sourceDirectories.partition { KFiles.isResource(it) }
|
val sources = project.sourceDirectories.partition { KFiles.isResource(it) }
|
||||||
val tests = project.sourceDirectoriesTest.partition { KFiles.isResource(it) }
|
val tests = project.sourceDirectoriesTest.partition { KFiles.isResource(it) }
|
||||||
val allTasks = taskManager.tasksByNames(project).values().map {
|
val projectTasks = taskManager.tasksByNames(project).values().map {
|
||||||
TaskData(it.name, it.doc, it.group)
|
TaskData(it.name, it.doc, it.group)
|
||||||
}
|
}
|
||||||
|
allTasks.addAll(projectTasks)
|
||||||
projectDatas.add(ProjectData(project.name, project.directory, dependentProjects,
|
projectDatas.add(ProjectData(project.name, project.directory, dependentProjects,
|
||||||
compileDependencies, testDependencies,
|
compileDependencies, testDependencies,
|
||||||
sources.second.toSet(), tests.second.toSet(), sources.first.toSet(), tests.first.toSet(),
|
sources.second.toSet(), tests.second.toSet(), sources.first.toSet(), tests.first.toSet(),
|
||||||
allTasks))
|
projectTasks))
|
||||||
}
|
}
|
||||||
return GetDependenciesData(projectDatas, projectResult.taskResult.errorMessage)
|
return GetDependenciesData(projectDatas, allTasks, projectResult.taskResult.errorMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
/////
|
/////
|
||||||
|
@ -72,7 +75,9 @@ class DependencyData @Inject constructor(val executors: KobaltExecutors, val dep
|
||||||
//
|
//
|
||||||
|
|
||||||
class DependencyData(val id: String, val scope: String, val path: String)
|
class DependencyData(val id: String, val scope: String, val path: String)
|
||||||
class TaskData(val name: String, val description: String, val group: String)
|
data class TaskData(val name: String, val description: String, val group: String) {
|
||||||
|
override fun toString() = name
|
||||||
|
}
|
||||||
|
|
||||||
class ProjectData(val name: String, val directory: String,
|
class ProjectData(val name: String, val directory: String,
|
||||||
val dependentProjects: List<String>,
|
val dependentProjects: List<String>,
|
||||||
|
@ -81,5 +86,7 @@ class DependencyData @Inject constructor(val executors: KobaltExecutors, val dep
|
||||||
val sourceResourceDirs: Set<String>, val testResourceDirs: Set<String>,
|
val sourceResourceDirs: Set<String>, val testResourceDirs: Set<String>,
|
||||||
val tasks: Collection<TaskData>)
|
val tasks: Collection<TaskData>)
|
||||||
|
|
||||||
class GetDependenciesData(val projects: List<ProjectData>, val errorMessage: String?)
|
class GetDependenciesData(val projects: List<ProjectData> = emptyList(),
|
||||||
|
val allTasks: Collection<TaskData> = emptySet(),
|
||||||
|
val errorMessage: String?)
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class SparkServer(val initCallback: (String) -> List<Project>, val cleanUpCallba
|
||||||
|
|
||||||
override fun run(port: Int) {
|
override fun run(port: Int) {
|
||||||
Spark.port(port)
|
Spark.port(port)
|
||||||
Spark.get("/ping", { req, res -> KobaltServer.OK })
|
Spark.get("/ping", { req, res -> """ { "result" : "ok" } """ })
|
||||||
Spark.get("/quit", { req, res ->
|
Spark.get("/quit", { req, res ->
|
||||||
Executors.newFixedThreadPool(1).let { executor ->
|
Executors.newFixedThreadPool(1).let { executor ->
|
||||||
executor.submit {
|
executor.submit {
|
||||||
|
@ -58,13 +58,13 @@ class SparkServer(val initCallback: (String) -> List<Project>, val cleanUpCallba
|
||||||
|
|
||||||
dependencyData.dependenciesDataFor(buildFile, args)
|
dependencyData.dependenciesDataFor(buildFile, args)
|
||||||
} catch(ex: Exception) {
|
} catch(ex: Exception) {
|
||||||
DependencyData.GetDependenciesData(emptyList<DependencyData.ProjectData>(), ex.message)
|
DependencyData.GetDependenciesData(errorMessage = ex.message)
|
||||||
} finally {
|
} finally {
|
||||||
cleanUpCallback()
|
cleanUpCallback()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DependencyData.GetDependenciesData(emptyList<DependencyData.ProjectData>(),
|
DependencyData.GetDependenciesData(
|
||||||
"buildFile wasn't passed in the query parameter")
|
errorMessage = "buildFile wasn't passed in the query parameter")
|
||||||
}
|
}
|
||||||
cleanUpCallback()
|
cleanUpCallback()
|
||||||
result
|
result
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue