This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] server handles properly remote artefacts after sync | #BAZEL-82…
…3, #BAZEL-793 Done review workssss todo uri -> path koooootlin Rename .java to .kt Merge-request: BAZEL-MR-823 Merged-by: Marcin Abramowicz <marcin.abramowicz@jetbrains.com>
- Loading branch information
1 parent
31df73d
commit 0cc0014
Showing
10 changed files
with
106 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 0 additions & 47 deletions
47
server/src/main/kotlin/org/jetbrains/bsp/bazel/server/bep/BepOutputBuilder.java
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
server/src/main/kotlin/org/jetbrains/bsp/bazel/server/bep/BepOutputBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.jetbrains.bsp.bazel.server.bep | ||
|
||
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos | ||
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.NamedSetOfFiles | ||
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.OutputGroup | ||
import org.jetbrains.bsp.bazel.server.paths.BazelPathsResolver | ||
import java.io.File | ||
import java.nio.file.Path | ||
import kotlin.io.path.Path | ||
|
||
data class TextProtoDepSet(val files: Collection<Path>, val children: Collection<String>) | ||
|
||
internal class BepOutputBuilder(private val bazelPathsResolver: BazelPathsResolver) { | ||
private val outputGroups: MutableMap<String, MutableSet<String>> = HashMap() | ||
private val textProtoFileSets: MutableMap<String, TextProtoDepSet> = HashMap() | ||
private val rootTargets: MutableSet<String> = HashSet() | ||
|
||
fun storeNamedSet(id: String, namedSetOfFiles: NamedSetOfFiles) { | ||
val textProtoDepSet = TextProtoDepSet( | ||
files = namedSetOfFiles | ||
.filesList | ||
.filter { it.name.endsWith("bsp-info.textproto") } | ||
.map { it.toLocalPath() }, | ||
children = namedSetOfFiles.fileSetsList.map { it.id } | ||
) | ||
|
||
textProtoFileSets[id] = textProtoDepSet | ||
} | ||
|
||
private fun BuildEventStreamProtos.File.toLocalPath(): Path { | ||
val mergedPathPrefix = Path(pathPrefixList.joinToString(File.separator)) | ||
val bazelOutputRelativePath = mergedPathPrefix.resolve(name) | ||
|
||
return bazelPathsResolver.resolveOutput(bazelOutputRelativePath) | ||
} | ||
|
||
fun storeTargetOutputGroups(target: String, outputGroups: List<OutputGroup>) { | ||
rootTargets.add(target) | ||
|
||
for (group in outputGroups) { | ||
val fileSets = group.fileSetsList.map { it.id } | ||
this.outputGroups.computeIfAbsent(group.name) { HashSet() }.addAll(fileSets) | ||
} | ||
} | ||
|
||
fun clear() { | ||
outputGroups.clear() | ||
textProtoFileSets.clear() | ||
rootTargets.clear() | ||
} | ||
|
||
fun build(): BepOutput = BepOutput(outputGroups, textProtoFileSets, rootTargets) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
server/src/main/kotlin/org/jetbrains/bsp/bazel/server/bep/TextProtoDepSet.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.