Skip to content

Commit

Permalink
Switch to our patched version of rules_rust (based off v0.30.0) (type…
Browse files Browse the repository at this point in the history
…db#514)

## What is the goal of this PR?

We update rules_rust to v0.30.0 with a patch that resolves gherkin build errors.
  • Loading branch information
dmitrii-ubskii committed Jan 8, 2024
1 parent 8ca8651 commit fb1cd7e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dependencies/vaticle/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def vaticle_dependencies():
git_repository(
name = "vaticle_dependencies",
remote = "https://github.com/vaticle/dependencies",
commit = "6843746768973d441be943b0f7c5c9b3ac7a88a9", # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_dependencies
commit = "67a0602be830227247d31bb881029d752f05f9bb", # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_dependencies
)

def vaticle_typedb_common():
Expand Down
2 changes: 1 addition & 1 deletion rust/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

package(default_visibility = ["//visibility:public"])

load("@rules_rust//rust:defs.bzl", "rust_library", "rust_static_library", "rustfmt_test", "rust_doc")
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_static_library", "rustfmt_test")
load("@vaticle_bazel_distribution//crates:rules.bzl", "assemble_crate", "deploy_crate")
load("@vaticle_dependencies//builder/rust:rules.bzl", "rust_cbindgen")
load("@vaticle_dependencies//builder/swig:java.bzl", "swig_java")
Expand Down
4 changes: 2 additions & 2 deletions rust/docs/connection/Database.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ database.primary_replica_info()
[source,rust]
----
pub fn replicas_info(&self) -> Vec<ReplicaInfo> <a href="#" class="notable-traits" data-ty="Vec">ⓘ
pub fn replicas_info(&self) -> Vec<ReplicaInfo>
----
Returns the ``Replica`` instances for this database. _Only works in TypeDB Enterprise_
Expand All @@ -145,7 +145,7 @@ Returns the ``Replica`` instances for this database. _Only works in TypeDB Enter
.Returns
[source,rust]
----
Vec<ReplicaInfo> <a href="#" class="notable-traits" data-ty="Vec">ⓘ
Vec<ReplicaInfo>
----

[caption=""]
Expand Down
6 changes: 4 additions & 2 deletions tool/docs/rust/RustDocsParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import com.vaticle.typedb.driver.tool.docs.dataclasses.Variable
import com.vaticle.typedb.driver.tool.docs.util.*
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import org.jsoup.nodes.Node
import org.jsoup.nodes.TextNode
import picocli.CommandLine
import picocli.CommandLine.Parameters
import java.io.File
Expand Down Expand Up @@ -205,7 +207,7 @@ class RustDocParser : Callable<Unit> {
}

private fun parseMethod(element: Element, classAnchor: String, mode: String): Method {
val methodSignature = enhanceSignature(element.selectFirst("summary section h4")!!.html())
val methodSignature = enhanceSignature(element.selectFirst("summary section h4")!!.wholeText())
val methodName = element.selectFirst("summary section h4 a.fn")!!.text()
val methodAnchor = replaceSymbolsForAnchor(
element.selectFirst("summary section h4 a.fn")!!.attr("href").substringAfter("#")
Expand Down Expand Up @@ -279,7 +281,7 @@ class RustDocParser : Callable<Unit> {
}

private fun enhanceSignature(signature: String): String {
return replaceHtmlSymbols(removeAllTags(replaceSpaces(dispatchNewlines(signature))))
return signature;
}

private fun dispatchNewlines(html: String): String {
Expand Down
13 changes: 2 additions & 11 deletions tool/docs/rust/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,10 @@ load("@rules_rust//rust:defs.bzl", "rust_doc")


def rust_docs(name, feature):
# rust_doc from rules_rust < 0.20 produces a zip-archive
rust_doc(
name = "docs_html_zip_" + feature,
crate = ":typedb_driver",
# TODO: Replace with rustdoc_flags after upgrading rules_rust to >=0.20
rustc_flags = ["--cfg", "feature=\"" + feature + "\""],
)

native.genrule(
name = "docs_html_" + feature,
srcs = [":docs_html_zip_" + feature],
outs = ["docs_html_rustdoc_" + feature],
cmd = "mkdir $@ && unzip $< -d $@",
crate = ":typedb_driver",
rustdoc_flags = ["--cfg", "feature=\"" + feature + "\""],
)


Expand Down

0 comments on commit fb1cd7e

Please sign in to comment.