Skip to content

Commit 32d5b90

Browse files
bk2204gitster
authored andcommitted
Enable Rust by default
Our breaking changes document says that we'll enable Rust by default in Git 2.54. Adjust the Makefile to switch the option from WITH_RUST to NO_RUST to enable it by default and update the help text accordingly. Similarly, for Meson, enable the option by default and do not automatically disable it if Cargo is missing, since the goal is to help users find where they are likely to have problems in the future. Update our CI tests to swap out the single Linux job with Rust to a single job without, both for Makefile and Meson. Similarly, update the Windows Makefile job to not use Rust, while the Meson job (which does not build with ci/lib.sh) will default to having it enabled. Move the check for Cargo in the Meson build because it is no longer needed in the main script. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 30e6f7a commit 32d5b90

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,9 @@ include shared.mak
498498
#
499499
# == Optional Rust support ==
500500
#
501-
# Define WITH_RUST if you want to include features and subsystems written in
502-
# Rust into Git. For now, Rust is still an optional feature of the build
503-
# process. With Git 3.0 though, Rust will always be enabled.
501+
# Define NO_RUST if you want to disable features and subsystems written in Rust
502+
# from being compiled into Git. For now, Rust is still an optional feature of
503+
# the build process. With Git 3.0 though, Rust will always be enabled.
504504
#
505505
# Building Rust code requires Cargo.
506506
#
@@ -1351,7 +1351,7 @@ LIB_OBJS += urlmatch.o
13511351
LIB_OBJS += usage.o
13521352
LIB_OBJS += userdiff.o
13531353
LIB_OBJS += utf8.o
1354-
ifndef WITH_RUST
1354+
ifdef NO_RUST
13551355
LIB_OBJS += varint.o
13561356
endif
13571357
LIB_OBJS += version.o
@@ -1590,7 +1590,7 @@ endif
15901590
ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_APPEND)
15911591
ALL_LDFLAGS = $(LDFLAGS) $(LDFLAGS_APPEND)
15921592

1593-
ifdef WITH_RUST
1593+
ifndef NO_RUST
15941594
BASIC_CFLAGS += -DWITH_RUST
15951595
GITLIBS += $(RUST_LIB)
15961596
ifeq ($(uname_S),Windows)

ci/lib.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ linux-asan-ubsan)
372372
osx-meson)
373373
MESONFLAGS="$MESONFLAGS -Dcredential_helpers=osxkeychain"
374374
;;
375+
windows-*)
376+
export NO_RUST=UnfortunatelyYes
377+
;;
375378
esac
376379

377380
MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"

ci/run-build-and-tests.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
export TEST_CONTRIB_TOO=yes
99

1010
case "$jobname" in
11+
linux-musl-meson)
12+
MESONFLAGS="$MESONFLAGS -Drust=disabled"
13+
;;
1114
fedora-breaking-changes-musl|linux-breaking-changes)
1215
export WITH_BREAKING_CHANGES=YesPlease
13-
export WITH_RUST=YesPlease
1416
MESONFLAGS="$MESONFLAGS -Dbreaking_changes=true"
15-
MESONFLAGS="$MESONFLAGS -Drust=enabled"
1617
;;
1718
linux-TEST-vars)
1819
export OPENSSL_SHA1_UNSAFE=YesPlease
@@ -30,6 +31,7 @@ linux-TEST-vars)
3031
export GIT_TEST_PACK_USE_BITMAP_BOUNDARY_TRAVERSAL=1
3132
;;
3233
linux-clang)
34+
export NO_RUST=UnfortunatelyYes
3335
export GIT_TEST_DEFAULT_HASH=sha1
3436
;;
3537
linux-sha256)

meson.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,8 +1745,7 @@ version_def_h = custom_target(
17451745
)
17461746
libgit_sources += version_def_h
17471747

1748-
cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))
1749-
rust_option = get_option('rust').disable_auto_if(not cargo.found())
1748+
rust_option = get_option('rust')
17501749
if rust_option.allowed()
17511750
subdir('src')
17521751
libgit_c_args += '-DWITH_RUST'

meson_options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ option('zlib_backend', type: 'combo', choices: ['auto', 'zlib', 'zlib-ng'], valu
7777
# Build tweaks.
7878
option('breaking_changes', type: 'boolean', value: false,
7979
description: 'Enable upcoming breaking changes.')
80-
option('rust', type: 'feature', value: 'auto',
80+
option('rust', type: 'feature', value: 'enabled',
8181
description: 'Enable building with Rust.')
8282
option('macos_use_homebrew_gettext', type: 'boolean', value: true,
8383
description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')

src/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ libgit_rs = custom_target('git_rs',
2929
)
3030
libgit_dependencies += declare_dependency(link_with: libgit_rs)
3131

32+
cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))
3233
if get_option('tests')
3334
test('rust', cargo,
3435
args: [

0 commit comments

Comments
 (0)