Skip to content

Conversation

@ezekielnewren
Copy link
Contributor

The goal of this patch series is to get feedback on converting from a single cargo crate to a cargo workspace. This series is incomplete, and as such, is marked as RFC.

Why using a cargo workspace is better than a single crate:

  • Better modularity.
  • Since a crate is the smallest unit of compilation in Rust (not individual files), multiple crates avoid recompiling everything
  • A C header is created for each crate by cbindgen (if requested), avoiding a single monolithic C header from all Rust sources.
  • This separates the dependencies of each crate, which is important if we’re forced to take an old or new dependency for a non-library crate, for example, and don’t want those altered dependencies affecting other crates.

I am particularly interested in feedback on the known issues below:

  • github workflow rust-analysis: broken because I removed the rust-version statement in Cargo.toml. The minimum Rust version supported by Git should be documented, but we shouldn’t require building with that minimum version.
  • win+Meson build: failing because it can't find the static library
  • Rust unit testing: not implemented yet, Make and Meson need to call cargo test
  • Conflicts with Brian's "SHA-1/SHA-256 interoperability" patch series

Much of Patrick's earlier work needed to be removed because it assumed a single-crate layout.

The Rust crates are located under rust/, but cargo build must be invoked from the top-level Git directory. cbindgen is included as part of this series, but nothing uses it yet. The generated/ directory is where cbindgen places the generated C header files.

@gitgitgadget-git
Copy link

There are issues in commit f6af342:
make: undo Patrick's changes concerning Rust
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit 2966944:
meson: undo Patrick's changes concerning Rust
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit 8ffcaf6:
cargo: convert from a crate to a workspace
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit 9d7071c:
build: build Rust with Makefile and Meson
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit 15e1bff:
.gitignore: ignore /generated/
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit 33fdad3:
cargo: create crate generate-headers
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit 37d068b:
cargo: create crate link-with-c
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit 7c8e835:
rust/gitcore: link with c
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit ddf6b94:
varint.h: unsigned char -> uint8_t
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit 849be70:
make: delete files in generated/
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit 9fbd884:
github-workflows: unify with rust parameters in make and meson
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit c9b8370:
github workflows: install Rust
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit 67a754d:
rust/build-rust.sh: update dir_git_root variable instantiation
Commit checks stopped - the message is too short
Commit not signed off

Signed-off-by: Ezekiel Newren <[email protected]>
Signed-off-by: Ezekiel Newren <[email protected]>
Signed-off-by: Ezekiel Newren <[email protected]>
-Drust=enabled -> -Dwith_rust=enabled
WITH_RUST=YesPlease -> WITH_RUST=true

Signed-off-by: Ezekiel Newren <[email protected]>
Signed-off-by: Ezekiel Newren <[email protected]>
@ezekielnewren
Copy link
Contributor Author

/submit

@gitgitgadget-git
Copy link

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-2110/ezekielnewren/cargo-workspace-v1

To fetch this version to local tag pr-git-2110/ezekielnewren/cargo-workspace-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2110/ezekielnewren/cargo-workspace-v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant