Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cucumber crate to cargo raze #394

Merged
merged 4 commits into from
Nov 23, 2022

Conversation

dmitrii-ubskii
Copy link
Member

@dmitrii-ubskii dmitrii-ubskii commented Nov 23, 2022

What is the goal of this PR?

We add the cucumber testing framework crate to our pinned rust dependencies.

What are the changes implemented in this PR?

While making this change, we encountered an issue in bazel (bazelbuild/bazel#13785) that made it throw an error because, in essence, libc was included in two out of three conditions, which was regarded as a dependency duplication.

Cargo-raze is aware of this issue (google/cargo-raze#451) and has their own workaround in the works (google/cargo-raze#512) which is not being reviewed or merged due to reviewer bandwidth issues.

As our own workaround, we separate the inclusion of libc into its own condition, overriding raze and pacifying bazel. This change is stored separately from the razed crates and reapplied when library/crates/update.sh is run.

@typedb-bot
Copy link
Member

typedb-bot commented Nov 23, 2022

PR Review Checklist

Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.


Code

  • Packages, classes, and methods have a single domain of responsibility.
  • Packages, classes, and methods are grouped into cohesive and consistent domain model.
  • The code is canonical and the minimum required to achieve the goal.
  • Modules, libraries, and APIs are easy to use, robust (foolproof and not errorprone), and tested.
  • Logic and naming has clear narrative that communicates the accurate intent and responsibility of each module (e.g. method, class, etc.).
  • The code is algorithmically efficient and scalable for the whole application.

Architecture

  • Any required refactoring is completed, and the architecture does not introduce technical debt incidentally.
  • Any required build and release automations are updated and/or implemented.
  • Any new components follows a consistent style with respect to the pre-existing codebase.
  • The architecture intuitively reflects the application domain, and is easy to understand.
  • The architecture has a well-defined hierarchy of encapsulated components.
  • The architecture is extensible and scalable.

Comment on lines -50 to 89
[package.metadata.raze.crates.tonic.'0.8.0']
[package.metadata.raze.crates.axum.'0.5.15']
compile_data_attr = "glob([\"**/*.md\"])"

[package.metadata.raze.crates.clap.'4.0.26']
compile_data_attr = "glob([\"**/*.md\"])"

[package.metadata.raze.crates.clap_derive.'4.0.21']
compile_data_attr = "glob([\"**/*.md\"])"

[package.metadata.raze.crates.cucumber-codegen.'0.15.3']
compile_data_attr = "glob([\"**/*.md\"])"

[package.metadata.raze.crates.cucumber-expressions.'0.2.1']
compile_data_attr = "glob([\"**/*.md\"])"

[package.metadata.raze.crates.cucumber.'0.15.2']
compile_data_attr = "glob([\"**/*.md\"])"

[package.metadata.raze.crates.prost.'0.11.0']
compile_data_attr = "glob([\"**/*.md\"])"

[package.metadata.raze.crates.axum.'0.5.15']
[package.metadata.raze.crates.synthez-codegen.'0.2.0']
compile_data_attr = "glob([\"**/*.md\"])"

[package.metadata.raze.crates.synthez-core.'0.2.0']
compile_data_attr = "glob([\"**/*.md\"])"

[package.metadata.raze.crates.synthez.'0.2.0']
compile_data_attr = "glob([\"**/*.md\"])"

[package.metadata.raze.crates.tonic.'0.8.0']
compile_data_attr = "glob([\"**/*.md\"])"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These crates require their README.md to be present during compilation, which aren't pulled in by raze by default.

Comment on lines +1 to +6
"""
@generated
cargo-raze crate build file.

DO NOT EDIT! Replaced on runs of cargo-raze
"""
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagrantly disregarding this docstring. This is a manually edited version of the generated file that works around a bug in bazel.

Comment on lines +12 to +28
clap = "=4.0.26"
clap_derive = "=4.0.21"
crossbeam = "=0.8.2"
cucumber = "=0.15.2"
cucumber-codegen = "=0.15.3"
cucumber-expressions = "=0.2.1"
cxx = "=1.0.59"
derivative = "=2.2.0"
enum_dispatch = "=0.3.8"
futures = { version = "=0.3.21", features = ["executor", "thread-pool"] }
log = "=0.4.8"
prost = "=0.11.0"
rocksdb = "=0.17.0"
rustix = "=0.35.9"
synthez = "=0.2.0"
synthez-codegen = "=0.2.0"
synthez-core = "=0.2.0"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added cucumber and pinned its dependencies that require additional configuration to work with raze ('md' files referenced in code)

Comment on lines +124 to +150
] + selects.with_or({
(
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu",
"@rules_rust//rust/platform:x86_64-apple-darwin",
"@rules_rust//rust/platform:x86_64-pc-windows-msvc",
"@rules_rust//rust/platform:aarch64-apple-darwin",
): [
"@raze__libc__0_2_132//:libc",
],
"//conditions:default": [],
}) + selects.with_or({
(
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu",
): [
"@raze__linux_raw_sys__0_0_46//:linux_raw_sys",
],
"//conditions:default": [],
}) + selects.with_or({
(
"@rules_rust//rust/platform:x86_64-apple-darwin",
"@rules_rust//rust/platform:x86_64-pc-windows-msvc",
"@rules_rust//rust/platform:aarch64-apple-darwin",
): [
"@raze__errno__0_2_8//:errno",
],
"//conditions:default": [],
}) + selects.with_or({
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are here, from (pseudocode) if (x) [libc, linux_raw_sys] else [] + if (y) [libc, errno] else [], which bazel rules is an error (bazelbuild/bazel#13785), to if (x || y) [libc] else [] + if (x) [linux_raw_sys] else [] + if (y) [errno] else []

Comment on lines +30 to +31
cp overrides/* remote/.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restore all manual changes after running cargo raze.

@dmitrii-ubskii dmitrii-ubskii changed the title Cucumber Add cucumber crate to cargo raze Nov 23, 2022
@dmitrii-ubskii dmitrii-ubskii marked this pull request as ready for review November 23, 2022 11:30
@dmitrii-ubskii dmitrii-ubskii added type: feature priority: high dependencies Pull requests that update a dependency file labels Nov 23, 2022
@dmitrii-ubskii dmitrii-ubskii modified the milestones: TypeQL: Rust Rew, TypeQL: Rust Rewrite Nov 23, 2022
@dmitrii-ubskii dmitrii-ubskii merged commit 57d73f9 into typedb:master Nov 23, 2022
@dmitrii-ubskii dmitrii-ubskii deleted the cucumber branch November 23, 2022 12:01
jamesreprise pushed a commit to jamesreprise/vaticle-dependencies that referenced this pull request Dec 5, 2022
## What is the goal of this PR?

We add the cucumber testing framework crate to our pinned rust
dependencies.

## What are the changes implemented in this PR?

While making this change, we encountered an issue in bazel
(bazelbuild/bazel#13785) that made it throw an
error because, in essence, libc was included in two out of three
conditions, which was regarded as a dependency duplication.

Cargo-raze is aware of this issue
(google/cargo-raze#451) and has their own
workaround in the works (google/cargo-raze#512)
which is not being reviewed or merged due to reviewer bandwidth issues.

As our own workaround, we separate the inclusion of libc into its own
condition, overriding raze and pacifying bazel. This change is stored
separately from the razed crates and reapplied when
`library/crates/update.sh` is run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file priority: high type: feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants