Skip to content

Commit 4340799

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. 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. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent bfdec4e commit 4340799

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export TEST_CONTRIB_TOO=yes
1010
case "$jobname" in
1111
fedora-breaking-changes-musl|linux-breaking-changes)
1212
export WITH_BREAKING_CHANGES=YesPlease
13-
export WITH_RUST=YesPlease
1413
MESONFLAGS="$MESONFLAGS -Dbreaking_changes=true"
1514
MESONFLAGS="$MESONFLAGS -Drust=enabled"
1615
;;
@@ -30,6 +29,7 @@ linux-TEST-vars)
3029
export GIT_TEST_PACK_USE_BITMAP_BOUNDARY_TRAVERSAL=1
3130
;;
3231
linux-clang)
32+
export NO_RUST=UnfortunatelyYes
3333
export GIT_TEST_DEFAULT_HASH=sha1
3434
;;
3535
linux-sha256)

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ version_def_h = custom_target(
17461746
libgit_sources += version_def_h
17471747

17481748
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())
1749+
rust_option = get_option('rust')
17501750
if rust_option.allowed()
17511751
subdir('src')
17521752
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.')

0 commit comments

Comments
 (0)