public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* contrib/bazel interest check
@ 2026-01-05 15:34 Son Luong Ngoc
  2026-01-05 22:43 ` brian m. carlson
  0 siblings, 1 reply; 3+ messages in thread
From: Son Luong Ngoc @ 2026-01-05 15:34 UTC (permalink / raw)
  To: git

  Hi folks,

  For my personal use case, I have bootstrapped building libgit and git
  using Bazel, an open-sourced build tool by Google (1).  Currently, the
  code is squashed into a giant commit (2) in my repo at
  github.com/sluongng/git in the branch sluongng/next-bazel.  The commit
  is based on the 'next' branch from upstream.

  Similar to Meson, Bazel requires fine-grained BUILD files to be
  sprinkled throughout the repo.  So it's fairly invasive to try to get
  this merged.

  I also won't have the capacity to maintain this setup for every new
  upstream topic that comes up.  Though I am willing to spend the effort
  to maintain it for major releases.

  I want to send this as an interest check to see if there are folks who
  are willing to co-maintain this with me in-tree style inside git.git.
  Otherwise, I plan to send this to the Bazel Central Registry (3), the
  public package registry for the Bazel ecosystem, in overlay mode.  The
  overlay shall be applied on top of the checkout copy before Bazel
  starts the build.

  Although the patch is currently unpolished and only supports Linux, it
  can already run most of the unit and integration tests under t/ dir to
  verify libgit and git.  MacOS and Windows support can be added as we
  mature the setup over time.

  (1): https://github.com/bazelbuild/bazel
  (2): https://github.com/sluongng/git/commit/04c5a9ec4c3634469b2b7eafd8ba21e09ec3b326
  (3): https://github.com/bazelbuild/bazel-central-registry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: contrib/bazel interest check
  2026-01-05 15:34 contrib/bazel interest check Son Luong Ngoc
@ 2026-01-05 22:43 ` brian m. carlson
  2026-01-06 14:39   ` Son Luong Ngoc
  0 siblings, 1 reply; 3+ messages in thread
From: brian m. carlson @ 2026-01-05 22:43 UTC (permalink / raw)
  To: Son Luong Ngoc; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 2479 bytes --]

On 2026-01-05 at 15:34:45, Son Luong Ngoc wrote:
>   Hi folks,
> 
>   For my personal use case, I have bootstrapped building libgit and git
>   using Bazel, an open-sourced build tool by Google (1).  Currently, the
>   code is squashed into a giant commit (2) in my repo at
>   github.com/sluongng/git in the branch sluongng/next-bazel.  The commit
>   is based on the 'next' branch from upstream.
> 
>   Similar to Meson, Bazel requires fine-grained BUILD files to be
>   sprinkled throughout the repo.  So it's fairly invasive to try to get
>   this merged.
> 
>   I also won't have the capacity to maintain this setup for every new
>   upstream topic that comes up.  Though I am willing to spend the effort
>   to maintain it for major releases.
> 
>   I want to send this as an interest check to see if there are folks who
>   are willing to co-maintain this with me in-tree style inside git.git.
>   Otherwise, I plan to send this to the Bazel Central Registry (3), the
>   public package registry for the Bazel ecosystem, in overlay mode.  The
>   overlay shall be applied on top of the checkout copy before Bazel
>   starts the build.

We already have two officially supported build systems (Make and Meson),
plus CMake in contrib.  I don't think adding a fourth build system would
be a good idea, especially since it's already burdensome enough to deal
with the main two.

I'd also like to encourage you not to send this as-is to the Bazel
Central Registry, since it hard-codes various values that are intended
to be configurable, such as `SHELL_PATH`[0], `PERL_PATH`, and
`PYTHON_PATH`.  It also hard-codes a variety of define values which are
not necessarily correct for all systems (for instance, my Debian
unstable system _does_ have `strlcpy`).  Shipping a build system like
this would be a regression in functionality and result in broken
packages on a variety of systems[1].  If you're suggesting to the public
that this is an appropriate way to build Git in general, it would be
nice if it were no less functional and flexible than our existing build
system.

[0] For instance, I set `SHELL_PATH` to test building and running Git
against zsh from time to time.
[1] As an example, this would not work correctly on the version of Git
a previous employer ships because they ship their own version of Perl
and Python that should be used instead of the system one.
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: contrib/bazel interest check
  2026-01-05 22:43 ` brian m. carlson
@ 2026-01-06 14:39   ` Son Luong Ngoc
  0 siblings, 0 replies; 3+ messages in thread
From: Son Luong Ngoc @ 2026-01-06 14:39 UTC (permalink / raw)
  To: brian m. carlson, Son Luong Ngoc, git

Hi Brian,

Thanks for giving it a read.

On Mon, Jan 5, 2026 at 11:43 PM brian m. carlson
<sandals@crustytoothpaste•net> wrote:
>
> We already have two officially supported build systems (Make and Meson),
> plus CMake in contrib.  I don't think adding a fourth build system would
> be a good idea, especially since it's already burdensome enough to deal
> with the main two.

Fair take.

There are a few folks who mentioned that they might be interested in this
on the community Discord. Unless those folks are willing to share the
maintenance load, I will go with the out-of-tree approach instead.

> I'd also like to encourage you not to send this as-is to the Bazel
> Central Registry, since it hard-codes various values that are intended
> to be configurable, such as `SHELL_PATH`[0], `PERL_PATH`, and
> `PYTHON_PATH`.  It also hard-codes a variety of define values which are
> not necessarily correct for all systems (for instance, my Debian
> unstable system _does_ have `strlcpy`).  Shipping a build system like
> this would be a regression in functionality and result in broken
> packages on a variety of systems[1].  If you're suggesting to the public
> that this is an appropriate way to build Git in general, it would be
> nice if it were no less functional and flexible than our existing build
> system.
>
> [0] For instance, I set `SHELL_PATH` to test building and running Git
> against zsh from time to time.
> [1] As an example, this would not work correctly on the version of Git
> a previous employer ships because they ship their own version of Perl
> and Python that should be used instead of the system one.

Yeah, the commit is definitely more tailored toward my use case right now
(building libgit and linking it to some Go binaries).

In the Bazel ecosystem, these tool paths are determined by "toolchains"
and the "platforms" selecting which toolchains to use (1).
Luckily, shell, python and perl all already have their dedicated Bazel
rules set (2)(3)(4) with toolchain definitions included.
So one should be able to make these configurable in the future through
respective rules toolchains instead of using the hard-coded value in my
build config. Good call out though.

I guess I will make a note that this is an unofficial,
"community-maintained" build setup when sending this to Bazel's
Central Registry. That should help set the expectation of downstream
users and remind folks that contributions are always welcome.

(1): https://bazel.build/extending/platforms
(2): https://github.com/bazelbuild/rules_shell/blob/main/shell/toolchains/sh_toolchain.bzl
(3): https://github.com/bazel-contrib/rules_python/blob/main/python/private/toolchains_repo.bzl
(4): https://github.com/bazel-contrib/rules_perl/blob/main/perl/toolchain.bzl

> --
> brian m. carlson (they/them)
> Toronto, Ontario, CA

Cheers,
Son Luong.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-06 14:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-05 15:34 contrib/bazel interest check Son Luong Ngoc
2026-01-05 22:43 ` brian m. carlson
2026-01-06 14:39   ` Son Luong Ngoc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox