Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions cli/src/main/kotlin/com/bazel_diff/bazel/BazelModService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class BazelModService(
* Computes a stable fingerprint of the currently resolved external dependency state.
*
* The hash includes:
* - bzlmod mode marker + `bazel mod graph --output=json`
* - repository-definition bytes from `bazel mod show_repo` (streamed proto when available)
* - bzlmod mode marker + `bazel mod graph --output=json`
* - repository-definition bytes from `bazel mod show_repo` (streamed proto when available)
*/
suspend fun getDependencyFingerprint(): String? {
if (!isBzlmodEnabled) {
Expand Down Expand Up @@ -152,8 +152,8 @@ class BazelModService(
}

/**
* Returns canonical bzlmod repo names in @@<canonical> form, discovered from
* `bazel mod dump_repo_mapping ""`.
* Returns canonical bzlmod repo names in @@<canonical> form, discovered from `bazel mod
* dump_repo_mapping ""`.
*/
private fun discoverCanonicalBzlmodRepos(): List<String> {
val output = runBazelRaw(listOf("mod", "dump_repo_mapping", "")) ?: return emptyList()
Expand Down Expand Up @@ -222,7 +222,8 @@ class BazelModService(
addAll(args)
}
return try {
val nullDevice = if (System.getProperty("os.name").startsWith("Windows")) "NUL" else "/dev/null"
val nullDevice =
if (System.getProperty("os.name").startsWith("Windows")) "NUL" else "/dev/null"
val process =
ProcessBuilder(command)
.directory(workingDirectory.toFile())
Expand Down
7 changes: 4 additions & 3 deletions cli/src/main/kotlin/com/bazel_diff/server/HashService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ class HashService(
val writeStartNanos = System.nanoTime()
val depEdges = depEdgesOf(hashes)
val dependencyFingerprint =
guard.currentDependencyFingerprint ?: runBlocking { bazelModService.getDependencyFingerprint() }
guard.currentDependencyFingerprint
?: runBlocking { bazelModService.getDependencyFingerprint() }
storage.put(
key,
serialize(hashes, moduleGraphJson, depEdges, dependencyFingerprint)
Expand Down Expand Up @@ -249,7 +250,6 @@ class HashService(
guard.computed = true
}


private fun elapsedMillis(startNanos: Long): Long = (System.nanoTime() - startNanos) / 1_000_000

/**
Expand Down Expand Up @@ -279,7 +279,8 @@ class HashService(
val metadata = mutableMapOf<String, Any>()
if (moduleGraphJson != null) metadata["moduleGraphJson"] = moduleGraphJson
if (depEdges.isNotEmpty()) metadata["depEdges"] = depEdges
if (dependencyFingerprint != null) metadata["dependencyFingerprint"] = dependencyFingerprint
if (dependencyFingerprint != null)
metadata["dependencyFingerprint"] = dependencyFingerprint
mapOf("hashes" to serializedHashes, "metadata" to metadata)
} else {
serializedHashes
Expand Down
Loading