Skip to content

Commit

Permalink
refactor(bazel): Simplify partitioning the dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau committed Jul 1, 2024
1 parent b6b7686 commit dccd7f7
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions plugins/package-managers/bazel/src/main/kotlin/Bazel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,9 @@ class Bazel(
}.getOrNull()

private fun getDependencyGraph(projectDir: File, depDirectives: Map<String, BazelDepDirective>): Set<Scope> {
val modGraphProcess = run(
"mod", "graph", "--output", "json", "--disk_cache=", workingDir = projectDir
)

val mainModule = modGraphProcess.stdout.parseBazelModule()
val devDeps = mainModule.dependencies.filter { depDirectives[it.key]?.devDependency == true }.toSet()
val mainDeps = mainModule.dependencies.toSet() - devDeps
val process = run("mod", "graph", "--output", "json", "--disk_cache=", workingDir = projectDir)
val mainModule = process.stdout.parseBazelModule()
val (mainDeps, devDeps) = mainModule.dependencies.partition { depDirectives[it.key]?.devDependency != true }

return setOf(
Scope(
Expand Down

0 comments on commit dccd7f7

Please sign in to comment.