|
1 | 1 | package org.jetbrains.bsp.testkit.client.bazel |
2 | 2 |
|
3 | | -import ch.epfl.scala.bsp4j.BuildClient |
4 | | -import ch.epfl.scala.bsp4j.BuildServer |
5 | | -import ch.epfl.scala.bsp4j.InitializeBuildParams |
6 | | -import org.jetbrains.bsp.testkit.client.BasicTestClient |
7 | 3 | import java.nio.file.Path |
8 | 4 | import java.util.Locale |
9 | 5 |
|
10 | | -class BazelTestClient<Server : BuildServer, Client : BuildClient>( |
11 | | - workspacePath: Path, |
12 | | - initializeParams: InitializeBuildParams, |
| 6 | +class BazelJsonTransformer( |
| 7 | + private val workspacePath: Path, |
13 | 8 | private val bazelCache: Path, |
14 | 9 | private val bazelOutputBase: Path, |
15 | | - client: Client, |
16 | | - serverClass: Class<Server> |
17 | | -) : BasicTestClient<Server, Client>( |
18 | | - workspacePath, |
19 | | - initializeParams, |
20 | | - { s: String -> |
21 | | - s.replace("\$WORKSPACE", workspacePath.toString()) |
| 10 | +) { |
| 11 | + fun transformJson(s: String): String { |
| 12 | + return s |
| 13 | + .replace("\$WORKSPACE", workspacePath.toString()) |
22 | 14 | .replace("\$BAZEL_CACHE", bazelCache.toString()) |
23 | 15 | .replace("\$BAZEL_OUTPUT_BASE_PATH", bazelOutputBase.toString()) |
24 | 16 | .replace("\$OS", osFamily) |
25 | | - }, |
26 | | - client = client, |
27 | | - serverClass = serverClass |
28 | | -) { |
| 17 | + } |
| 18 | + |
29 | 19 | companion object { |
30 | 20 | private val osFamily: String = System.getProperty("os.name").lowercase(Locale.getDefault()).let { osName -> |
31 | 21 | when { |
|
0 commit comments