From: "Ezekiel Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Ezekiel Newren <ezekielnewren@gmail.com>
Subject: [PATCH 00/13] RFC: Convert to Cargo workspace
Date: Thu, 27 Nov 2025 01:10:22 +0000 [thread overview]
Message-ID: <pull.2110.git.git.1764205835.gitgitgadget@gmail.com> (raw)
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.
Ezekiel Newren (13):
make: undo Patrick's changes concerning Rust
meson: undo Patrick's changes concerning Rust
cargo: convert from a crate to a workspace
build: build Rust with Makefile and Meson
.gitignore: ignore /generated/
cargo: create crate generate-headers
cargo: create crate link-with-c
rust/gitcore: link with c
varint.h: unsigned char -> uint8_t
make: delete files in generated/
github-workflows: unify with rust parameters in make and meson
github workflows: install Rust
rust/build-rust.sh: update dir_git_root variable instantiation
.github/workflows/main.yml | 62 ++++++++++++++-
.gitignore | 1 +
Cargo.toml | 17 ++--
Makefile | 118 ++++++++++++++++------------
ci/install-dependencies.sh | 14 ++--
ci/install-rust-toolchain.sh | 30 +++++++
ci/install-rustup.sh | 25 ++++++
ci/make-test-artifacts.sh | 9 +++
ci/run-build-and-tests.sh | 17 +++-
meson.build | 83 ++++++++++++++-----
meson_options.txt | 4 +-
rust/build-crate.sh | 63 +++++++++++++++
rust/cbindgen-template.toml | 13 +++
rust/generate-headers/Cargo.toml | 12 +++
rust/generate-headers/src/main.rs | 44 +++++++++++
rust/gitcore/Cargo.toml | 12 +++
rust/gitcore/build.rs | 7 ++
{src => rust/gitcore/src}/lib.rs | 0
{src => rust/gitcore/src}/varint.rs | 0
rust/link-with-c/Cargo.toml | 9 +++
rust/link-with-c/src/lib.rs | 77 ++++++++++++++++++
shared.mak | 1 -
src/cargo-meson.sh | 39 ---------
src/meson.build | 41 ----------
varint.h | 4 +-
25 files changed, 528 insertions(+), 174 deletions(-)
create mode 100755 ci/install-rust-toolchain.sh
create mode 100755 ci/install-rustup.sh
create mode 100755 rust/build-crate.sh
create mode 100644 rust/cbindgen-template.toml
create mode 100644 rust/generate-headers/Cargo.toml
create mode 100644 rust/generate-headers/src/main.rs
create mode 100644 rust/gitcore/Cargo.toml
create mode 100644 rust/gitcore/build.rs
rename {src => rust/gitcore/src}/lib.rs (100%)
rename {src => rust/gitcore/src}/varint.rs (100%)
create mode 100644 rust/link-with-c/Cargo.toml
create mode 100644 rust/link-with-c/src/lib.rs
delete mode 100755 src/cargo-meson.sh
delete mode 100644 src/meson.build
base-commit: a99f379adf116d53eb11957af5bab5214915f91d
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2110%2Fezekielnewren%2Fcargo-workspace-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2110/ezekielnewren/cargo-workspace-v1
Pull-Request: https://github.com/git/git/pull/2110
--
gitgitgadget
next reply other threads:[~2025-11-27 1:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 1:10 Ezekiel Newren via GitGitGadget [this message]
2025-11-27 1:10 ` [PATCH 01/13] make: undo Patrick's changes concerning Rust Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 02/13] meson: " Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 03/13] cargo: convert from a crate to a workspace Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 04/13] build: build Rust with Makefile and Meson Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 05/13] .gitignore: ignore /generated/ Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 06/13] cargo: create crate generate-headers Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 07/13] cargo: create crate link-with-c Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 08/13] rust/gitcore: link with c Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 09/13] varint.h: unsigned char -> uint8_t Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 10/13] make: delete files in generated/ Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 11/13] github-workflows: unify with rust parameters in make and meson Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 12/13] github workflows: install Rust Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 13/13] rust/build-rust.sh: update dir_git_root variable instantiation Ezekiel Newren via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.2110.git.git.1764205835.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=ezekielnewren@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).