-
Notifications
You must be signed in to change notification settings - Fork 8
Migrate scala-client to SDK.v3 + libuast.v3 #83
Comments
New API exampleProtocol.v2 response is protobuf-like encoded binary blob, so libuast now provides a method to Examples below use explicit type excessively in order to highlight the API internals, real applications \w same code will be more concise. decode + load (Go->JVM)import org.bblfsh.client.v2.*
// parse
//// read the binary UASTv2
val resp = client.parse(fileName, fileContent)
//// decode it, UAST is backed by Go
val ctx: Context = resp.uast.decode()
val rootNode: Node = ctx.root()
//// load the UAST from Go to JVM
val rootJvm: Map[String, _] = rootNode.load() Iterate UAST (JVM)// iterate the tree from root
def processRecursive(node: Any): Unit = node match {
case m: Map[_, _] => {
for ((k, v) <- m) {
println(k)
processRecursive(v)
}
}
case s: Seq[_] => {
for (e <- s) {
processRecursive(e)
}
}
case a: Any => println(a)
}
processRecursive(rootJvm) Query (Go->JVM)Print every node val nodes: List[Node] = ctx.filter(rootNode, "//*")
nodes.foreach { n =>
println(s"Node: $n")
}
|
Maybe we can call Also, the |
Thank you for the suggestion! I assumed that it will be simpler to make the decode part work first, with a global context. |
#83 (comment) updated to include better type names and USAT iteration example. |
It also adds a temp job that will be kept updated and is expected to pass for bblfsh#83 and track it's progress. Signed-off-by: Alexander Bezzubov <[email protected]>
It also adds a temp job that will be kept updated and is expected to pass for bblfsh#83 and track it's progress. Signed-off-by: Alexander Bezzubov <[email protected]>
Update: RC1 has been published. |
Update: RC3 has been published. |
The only missing part before doing v2.0.0 release is a developer documentation! |
Everything seems to be ready for initial release 🎉 |
An umbrella issue for client migration to new SDK.
Takes similar approach to bblfsh/client-python. but aims to avoid having all the changes in a single PR, so will be broken down.
parse()
impl, that uses newprotocol.v2
decode()
impl, so the binary wire protocol can be read (on Go side)root()
impl, so the decoded (on Go side) UAST can be exposed to JVMload()
impl, so the Go-backed UAST can be transferred to host JVM memory Node.load() implementation #91encode()
impl. Reverse: JVM memory objects transferred to Goiterator()
impl, so UAST can be iterated with and without loading it to JVM Iterator implementation #106filter()
impl, so XPath filtering works Filter implementation #109take early feedback on API into account
Context
impl (JVM-side factory), so multiple concurrentfilter()
calls from the client are supportedSupport for languages/version request (as soon as Language aliases and languages protocol v2 sdk#400 is released)
investigate JNI warningsmoved to v2: investigate all warnings from -Xcheck:jni #112enable timeouts at v2 API againmoved to v2: expose custom gRPC connection timeouts #100CI: refactor to multiple modular jobs (tests, releases per-platform, etc)moved to Improve the CI #87The text was updated successfully, but these errors were encountered: