Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d843b67
Initial Rust commit
ridiculousfish Jan 14, 2023
096b254
Port fish_wcstoi to Rust
ridiculousfish Jan 15, 2023
681a165
Add an FFI test facility
ridiculousfish Jan 15, 2023
55f655f
Add a gettext wrapper in Rust
ridiculousfish Jan 15, 2023
e674678
Add a printf implementation
ridiculousfish Jan 16, 2023
f38543c
Rename ast::job_t to ast::job_pipeline_t
ridiculousfish Jan 16, 2023
76adfed
Implement builtin_wait in Rust
ridiculousfish Jan 16, 2023
c18fb74
Fix rust-invoked build of c/cpp sources under FreeBSD
mqudsi Feb 2, 2023
60bd186
Fix linking errors under FreeBSD
mqudsi Feb 2, 2023
2dc2c8d
Fix FreeBSD CI builds of rust-enabled codebase
mqudsi Feb 2, 2023
91be748
CI: Disable some Cirrus CI jobs during RIIR transition
mqudsi Feb 3, 2023
a502cb1
ffi.rs: prevent rustfmt from breaking "use" statements
krobelus Feb 3, 2023
44d7540
build.rs: re-run autocxx if any ffi module changed
krobelus Feb 3, 2023
517d53d
Port util.cpp to Rust
krobelus Jan 30, 2023
132d99a
Call rust_init() in fish_indent too
krobelus Feb 3, 2023
83fd7ea
Port future_feature_flags.cpp to Rust
krobelus Feb 3, 2023
c2df63f
Remove an errant printf from fish_tests
ridiculousfish Feb 4, 2023
853649f
rust: fix issues reported by clippy
Xiretza Feb 4, 2023
35083c7
rust: silence some clippy warnings
Xiretza Feb 4, 2023
cba03fc
rust: remove unnecessary newline
Xiretza Feb 4, 2023
cee1353
rust: silence warnings on auto-generated FFI bindings
Xiretza Feb 4, 2023
8b48373
rust: fix doc comments
Xiretza Feb 5, 2023
8460b37
rust: util: use Ordering instead of integers
Xiretza Feb 5, 2023
ba1c5d4
util.rs: fix Yoda condition
krobelus Feb 5, 2023
476b12e
util.rs: simplify wcsfilecmp a bit further
krobelus Feb 5, 2023
7347c90
builtins.rs: correct error message on unknown option
krobelus Feb 4, 2023
a446a16
flog.rs: use qualified name in FLOG! macro
krobelus Feb 5, 2023
dcca3cf
Prefer taking native Rust strings instead of wcharz_t
krobelus Feb 4, 2023
c8bf2be
wchar_ffi.rs: implement from_ffi() for more FFI strings
krobelus Feb 4, 2023
f167ec9
clippy: silence manual_is_ascii_check
krobelus Feb 5, 2023
39c3fae
gettext.rs: make trailing comma actually optional
krobelus Feb 5, 2023
d7febd4
Use once_cell instead of lazy_static
mqudsi Feb 5, 2023
0b160eb
Drop lazy_static from Cargo.toml
mqudsi Feb 6, 2023
cfb5bb2
builtin: correctly flush streams after running Rust builtin
Xiretza Feb 5, 2023
4b85c2f
builtin: propagate status from Rust builtins
Xiretza Feb 5, 2023
a16e2ec
Port echo builtin to Rust
Xiretza Feb 5, 2023
bfa94bf
Fix rustc warning about auto deref
krobelus Feb 7, 2023
47cc98f
wutil.h: enable implicit conversion from wcharz_t to wcstring
krobelus Feb 5, 2023
29a2c4b
gettext.rs: allow translating non-literal strings
krobelus Feb 5, 2023
958ad3a
ffi.rs: silence warning about get_procs()
krobelus Feb 5, 2023
4639f7e
Follow Rust naming convention for some types
krobelus Feb 7, 2023
8fd1db0
Remove unused parse error code
krobelus Feb 7, 2023
9ca160e
Convert parse_error_code_t to a scoped enum
krobelus Feb 7, 2023
2581662
Port redirection.cpp to Rust
krobelus Feb 4, 2023
7f8d247
Port parse_constants.h to Rust
krobelus Feb 5, 2023
39f3c89
Port tokenizer.cpp to Rust
krobelus Feb 5, 2023
a8c9922
Document some porting bits
krobelus Feb 8, 2023
27c8845
rust: fix typos in documentation, add links
Xiretza Feb 5, 2023
3ed86fa
Port parse_help_only_cmd_opts to Rust
Xiretza Feb 10, 2023
5a76c7d
Port emit builtin to rust
Xiretza Feb 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ linux_task:
- ninja -j 6 fish fish_tests
- ninja fish_run_tests

only_if: $CIRRUS_REPO_OWNER == 'fish-shell'
# CI task disabled during RIIR transition
only_if: false && $CIRRUS_REPO_OWNER == 'fish-shell'

linux_arm_task:
matrix:
Expand All @@ -74,7 +75,8 @@ linux_arm_task:
- file ./fish
- ninja fish_run_tests

only_if: $CIRRUS_REPO_OWNER == 'fish-shell'
# CI task disabled during RIIR transition
only_if: false && $CIRRUS_REPO_OWNER == 'fish-shell'

freebsd_task:
matrix:
Expand All @@ -83,12 +85,14 @@ freebsd_task:
image_family: freebsd-14-0-snap
- name: FreeBSD 13
freebsd_instance:
image: freebsd-13-0-release-amd64
image: freebsd-13-1-release-amd64
- name: FreeBSD 12.3
freebsd_instance:
image: freebsd-12-3-release-amd64
tests_script:
- pkg install -y cmake devel/pcre2 devel/ninja misc/py-pexpect git
- pkg install -y cmake-core devel/pcre2 devel/ninja misc/py-pexpect git-lite
# libclang.so is a required build dependency for rust-c++ ffi bridge
- pkg install -y llvm
# BSDs have the following behavior: root may open or access files even if
# the mode bits would otherwise disallow it. For example root may open()
# a file with write privileges even if the file has mode 400. This breaks
Expand All @@ -99,8 +103,16 @@ freebsd_task:
- mkdir build && cd build
- chown -R fish-user ..
- sudo -u fish-user -s whoami
# FreeBSD's pkg currently has rust 1.66.0 while we need rust 1.67.0+. Use rustup to install
# the latest, but note that it only installs rust per-user.
- sudo -u fish-user -s fetch -qo - https://sh.rustup.rs > rustup.sh
- sudo -u fish-user -s sh ./rustup.sh -y --profile=minimal
# `sudo -s ...` does not invoke a login shell so we need a workaround to make sure the
# rustup environment is configured for subsequent `sudo -s ...` commands.
# For some reason, this doesn't do the job:
# - sudo -u fish-user sh -c 'echo source \$HOME/.cargo/env >> $HOME/.cshrc'
- sudo -u fish-user -s cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCTEST_PARALLEL_LEVEL=1 ..
- sudo -u fish-user -s ninja -j 6 fish fish_tests
- sudo -u fish-user -s ninja fish_run_tests
- sudo -u fish-user sh -c '. $HOME/.cargo/env; ninja -j 6 fish fish_tests'
- sudo -u fish-user sh -c '. $HOME/.cargo/env; ninja fish_run_tests'

only_if: $CIRRUS_REPO_OWNER == 'fish-shell'
25 changes: 23 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: SetupRust
uses: ATiltedTree/setup-rust@v1
with:
rust-version: beta
- name: Install deps
run: |
sudo apt install gettext libncurses5-dev libpcre2-dev python3-pip tmux
Expand All @@ -42,6 +46,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: SetupRust
uses: ATiltedTree/setup-rust@v1
with:
rust-version: beta
targets: "i686-unknown-linux-gnu" # setup-rust wants this space-separated
- name: Install deps
run: |
sudo apt update
Expand All @@ -53,10 +62,10 @@ jobs:
CFLAGS: "-m32"
run: |
mkdir build && cd build
cmake -DFISH_USE_SYSTEM_PCRE2=OFF ..
cmake -DFISH_USE_SYSTEM_PCRE2=OFF -DRust_CARGO_TARGET=i686-unknown-linux-gnu ..
- name: make
run: |
make
make VERBOSE=1
- name: make test
run: |
make test
Expand All @@ -67,6 +76,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: SetupRust
uses: ATiltedTree/setup-rust@v1
with:
rust-version: beta
- name: Install deps
run: |
sudo apt install gettext libncurses5-dev libpcre2-dev python3-pip tmux
Expand Down Expand Up @@ -101,6 +114,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: SetupRust
uses: ATiltedTree/setup-rust@v1
with:
rust-version: beta
- name: Install deps
run: |
sudo apt install gettext libncurses5-dev libpcre2-dev python3-pip tmux
Expand All @@ -127,6 +144,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: SetupRust
uses: ATiltedTree/setup-rust@v1
with:
rust-version: beta
- name: Install deps
run: |
sudo pip3 install pexpect
Expand Down
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,14 @@ __pycache__
/tags
xcuserdata/

# Generated by Cargo
# will have compiled files and executables
debug/
target/

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

33 changes: 24 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}")
endif()

include(cmake/Rust.cmake)

# Error out when linking statically, it doesn't work.
if (CMAKE_EXE_LINKER_FLAGS MATCHES ".*-static.*")
message(FATAL_ERROR "Fish does not support static linking")
Expand All @@ -43,6 +45,9 @@ endif()
# - address, because that occurs for our mkostemp check (weak-linking requires us to compare `&mkostemp == nullptr`).
add_compile_options(-Wall -Wextra -Wno-comment -Wno-address)

# Get extra C++ files from Rust.
get_property(FISH_EXTRA_SOURCES TARGET fish-rust PROPERTY fish_extra_cpp_files)

if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
add_compile_options(-Wunused-template -Wunused-local-typedef -Wunused-macros)
endif()
Expand All @@ -53,6 +58,9 @@ add_compile_options(-fno-exceptions)
# Undefine NDEBUG to keep assert() in release builds.
add_definitions(-UNDEBUG)

# Allow including Rust headers in normal (not bindgen) builds.
add_definitions(-DINCLUDE_RUST_HEADERS)

# Enable large files on GNU.
add_definitions(-D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE
Expand Down Expand Up @@ -95,32 +103,32 @@ set(FISH_BUILTIN_SRCS
src/builtins/bg.cpp src/builtins/bind.cpp src/builtins/block.cpp
src/builtins/builtin.cpp src/builtins/cd.cpp src/builtins/command.cpp
src/builtins/commandline.cpp src/builtins/complete.cpp src/builtins/contains.cpp
src/builtins/disown.cpp src/builtins/echo.cpp src/builtins/emit.cpp
src/builtins/disown.cpp
src/builtins/eval.cpp src/builtins/exit.cpp src/builtins/fg.cpp
src/builtins/function.cpp src/builtins/functions.cpp src/builtins/history.cpp
src/builtins/jobs.cpp src/builtins/math.cpp src/builtins/printf.cpp src/builtins/path.cpp
src/builtins/pwd.cpp src/builtins/random.cpp src/builtins/read.cpp
src/builtins/realpath.cpp src/builtins/return.cpp src/builtins/set.cpp
src/builtins/set_color.cpp src/builtins/source.cpp src/builtins/status.cpp
src/builtins/string.cpp src/builtins/test.cpp src/builtins/type.cpp src/builtins/ulimit.cpp
src/builtins/wait.cpp)
)

# List of other sources.
set(FISH_SRCS
src/ast.cpp src/abbrs.cpp src/autoload.cpp src/color.cpp src/common.cpp src/complete.cpp
src/env.cpp src/env_dispatch.cpp src/env_universal_common.cpp src/event.cpp
src/exec.cpp src/expand.cpp src/fallback.cpp src/fd_monitor.cpp src/fish_version.cpp
src/flog.cpp src/function.cpp src/future_feature_flags.cpp src/highlight.cpp
src/flog.cpp src/function.cpp src/highlight.cpp
src/history.cpp src/history_file.cpp src/input.cpp src/input_common.cpp
src/io.cpp src/iothread.cpp src/job_group.cpp src/kill.cpp
src/null_terminated_array.cpp src/operation_context.cpp src/output.cpp
src/pager.cpp src/parse_execution.cpp src/parse_tree.cpp src/parse_util.cpp
src/parser.cpp src/parser_keywords.cpp src/path.cpp src/postfork.cpp
src/proc.cpp src/re.cpp src/reader.cpp src/redirection.cpp src/screen.cpp
src/signal.cpp src/termsize.cpp src/timer.cpp src/tinyexpr.cpp
src/tokenizer.cpp src/topic_monitor.cpp src/trace.cpp src/utf8.cpp src/util.cpp
src/wait_handle.cpp src/wcstringutil.cpp src/wgetopt.cpp src/wildcard.cpp
src/wutil.cpp src/fds.cpp
src/proc.cpp src/re.cpp src/reader.cpp src/screen.cpp
src/signals.cpp src/termsize.cpp src/timer.cpp src/tinyexpr.cpp
src/trace.cpp src/utf8.cpp
src/wait_handle.cpp src/wcstringutil.cpp src/wgetopt.cpp src/wildcard.cpp
src/wutil.cpp src/fds.cpp src/rustffi.cpp
)

# Header files are just globbed.
Expand All @@ -133,6 +141,11 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config_cmake.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

# Pull in our src directory for headers searches, but only quoted ones.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -iquote ${CMAKE_CURRENT_SOURCE_DIR}/src")



# Set up standard directories.
include(GNUInstallDirs)
add_definitions(-D_UNICODE=1
Expand Down Expand Up @@ -175,8 +188,10 @@ endfunction(FISH_LINK_DEPS_AND_SIGN)
add_library(fishlib STATIC ${FISH_SRCS} ${FISH_BUILTIN_SRCS})
target_sources(fishlib PRIVATE ${FISH_HEADERS})
target_link_libraries(fishlib
fish-rust
${CURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS}
${PCRE2_LIB} ${Intl_LIBRARIES} ${ATOMIC_LIBRARY})
${PCRE2_LIB} ${Intl_LIBRARIES} ${ATOMIC_LIBRARY}
"fish-rust")
target_include_directories(fishlib PRIVATE
${CURSES_INCLUDE_DIRS})

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ Include What You Use
You should not depend on symbols being visible to a ``*.cpp`` module
from ``#include`` statements inside another header file. In other words
if your module does ``#include "common.h"`` and that header does
``#include "signal.h"`` your module should not assume the sub-include is
present. It should instead directly ``#include "signal.h"`` if it needs
``#include "signals.h"`` your module should not assume the sub-include is
present. It should instead directly ``#include "signals.h"`` if it needs
any symbol from that header. That makes the actual dependencies much
clearer. It also makes it easy to modify the headers included by a
specific header file without having to worry that will break any module
Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Dependencies

Compiling fish requires:

- Rust (version 1.67 or later)
- a C++11 compiler (g++ 4.8 or later, or clang 3.3 or later)
- CMake (version 3.5 or later)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the use of FindContent bumps CMake to 3.11 (unless corrosion gets included in the tree as discussed elsewhere)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current versions of corrosion require at least CMake 3.15. Some features are only available with CMake 3.19 and newer.

- a curses implementation such as ncurses (headers and libraries)
Expand Down
49 changes: 49 additions & 0 deletions cmake/Rust.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
include(FetchContent)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to make builds using OBS difficult; is it possible to include Corrosion in the tree and use it as a subdirectory instead?

Copy link

@Be-ing Be-ing Jan 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, distro packagers are not going to like this, but it's fine if you try find_package first:

find_package(Corrosion)
if (NOT Corrosion_FOUND)
   include(FetchContent)
   ...
endif()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, distro packagers are not going to like this, but it's fine if you try find_package first:

find_package(Corrosion)
if (NOT Corrosion_FOUND)
   include(FetchContent)
   ...
endif()

Distro packager for Arch Linux here, this would make our lives so much easier with the ability to use system libraries.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to add that, but my hope is that no distro packages fish while it uses Corrosion. This use is meant to be temporary during a single development cycle; by the next release I hope to have no CMake at all, and therefore no Corrosion.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an ambitious goal. Good luck.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to make builds using OBS difficult; is it possible to include Corrosion in the tree and use it as a subdirectory instead?

Corrosion can be added as a subdirectory/ submodule.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the use of a fork of Corrosion, and that it is intended as a temporary measure that won't be released, I think using Corrosion as a subdirectory would make sense.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, throwing myself into this conversation with some additional info that distro maintainers might find useful. FetchContent has always supported placing the source directory for any dependency in any location and then setting -DFETCHCONTENT_SOURCE_DIR_<uppercase-name>=<path>.

In this case, this would allow package maintainers to do -DFETCHCONTENT_SOURCE_DIR_CORROSION=<path/to/corrosion/sources> and not interrupt the workflow. No conditional find_package call is required.

Additionally, starting in CMake 3.24, it's possible to tell FetchContent_MakeAvailable to call find_package first (and vice versa where find_package calls FetchContent_MakeAvailable if no file was found).

Copy link
Member Author

@ridiculousfish ridiculousfish Feb 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this is helpful. For Corrosion, my preferences are (in order): use FetchContent as in the PR (perhaps using bruxisma's tips), or add Corrosion as a fish-shell submodule, or directly check in Corrosion. Not sure what's best for OBS.

We shouldn't use heroics to keep fish working on older platforms mid-port. That may mean turning off builders for certain platforms, and then turning them back on later when we're no longer obligated to support Corrosion/autocxx/etc.


# Don't let Corrosion's tests interfere with ours.
set(CORROSION_TESTS OFF CACHE BOOL "" FORCE)

FetchContent_Declare(
Corrosion
GIT_REPOSITORY https://github.com/ridiculousfish/corrosion
GIT_TAG fish
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably we want to have a SHA here, for reproducibility

)

FetchContent_MakeAvailable(Corrosion)

set(fish_rust_target "fish-rust")

set(fish_autocxx_gen_dir "${CMAKE_BINARY_DIR}/fish-autocxx-gen/")

corrosion_import_crate(
MANIFEST_PATH "${CMAKE_SOURCE_DIR}/fish-rust/Cargo.toml"
FEATURES "fish-ffi-tests"
)

# We need the build dir because cxx puts our headers in there.
# Corrosion doesn't expose the build dir, so poke where we shouldn't.
if (Rust_CARGO_TARGET)
set(rust_target_dir "${CMAKE_BINARY_DIR}/cargo/build/${_CORROSION_RUST_CARGO_TARGET}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that this is not always the correct path, depending on which Generator is used. Notably, it's not correct for Visual Studio generators and other Multi-config generators (e.g. Ninja-Multiconfig).

On a related note, have you considered using cxxbridge to generate the bindings from the CMake side?
On corrosion master there is a somewhat experimental function to add cxx bindings via cxxbridge. It's probably not production ready or anything, but it should be sufficient to showcase how to generate the bindings from the CMake side.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notably, it's not correct for Visual Studio generators

We don't support Visual Studio (or really Windows at all - it's either wsl or cygwin).

other Multi-config generators (e.g. Ninja-Multiconfig)

This seems to be a "ninja but you can do debug and release in one" thing? I think it would be fair to not support that until cmake is retired. The plan is to hopefully do that before the next release.

Unless of course you know how to easily get the correct path?

Copy link

@jschwe jschwe Jan 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless of course you know how to easily get the correct path?

Ignoring Visual Studio, the path currently is as below. This should be considered an implementation detail, but is also unlikely to change in the near future.

if(CMAKE_CONFIGURATION_TYPES)
        set (rust_target_dir  "${CMAKE_BINARY_DIR}/$<CONFIG>/cargo/build/${_CORROSION_RUST_CARGO_TARGET}")
else()
        set (rust_target_dir  "${CMAKE_BINARY_DIR}/cargo/build/${_CORROSION_RUST_CARGO_TARGET}")
endif()

else()
set(rust_target_dir "${CMAKE_BINARY_DIR}/cargo/build/${_CORROSION_RUST_CARGO_HOST_TARGET}")
corrosion_set_hostbuild(${fish_rust_target})
endif()

# Tell Cargo where our build directory is so it can find config.h.
corrosion_set_env_vars(${fish_rust_target} "FISH_BUILD_DIR=${CMAKE_BINARY_DIR}" "FISH_AUTOCXX_GEN_DIR=${fish_autocxx_gen_dir}" "FISH_RUST_TARGET_DIR=${rust_target_dir}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that the CMake script is intended as short-lived and soon-to-go-away — but this overlong 170-char line can be easily split:

Suggested change
corrosion_set_env_vars(${fish_rust_target} "FISH_BUILD_DIR=${CMAKE_BINARY_DIR}" "FISH_AUTOCXX_GEN_DIR=${fish_autocxx_gen_dir}" "FISH_RUST_TARGET_DIR=${rust_target_dir}")
corrosion_set_env_vars(${fish_rust_target}
"FISH_BUILD_DIR=${CMAKE_BINARY_DIR}"
"FISH_AUTOCXX_GEN_DIR=${fish_autocxx_gen_dir}"
"FISH_RUST_TARGET_DIR=${rust_target_dir}"
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I understand you mean well, and you have done a thorough review.

But as it stands, this is distracting from the discussion in the PR (unfortunately github is terrible at displaying this).

So I will be hiding this. Sorry!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, understood. No offense taken 🙌


target_include_directories(${fish_rust_target} INTERFACE
"${rust_target_dir}/cxxbridge/${fish_rust_target}/src/"
"${fish_autocxx_gen_dir}/include/"
)

# Tell fish what extra C++ files to compile.
define_property(
TARGET PROPERTY fish_extra_cpp_files
BRIEF_DOCS "Extra C++ files to compile for fish."
FULL_DOCS "Extra C++ files to compile for fish."
)

set_property(TARGET ${fish_rust_target} PROPERTY fish_extra_cpp_files
"${fish_autocxx_gen_dir}/cxx/gen0.cxx"
)
16 changes: 16 additions & 0 deletions cmake/Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,19 @@ foreach(PEXPECT ${PEXPECTS})
set_tests_properties(${PEXPECT} PROPERTIES ENVIRONMENT FISH_FORCE_COLOR=1)
add_test_target("${PEXPECT}")
endforeach(PEXPECT)

# Rust stuff.
add_test(
NAME "cargo-test"
COMMAND cargo test
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/fish-rust"
)
set_tests_properties("cargo-test" PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE})
add_test_target("cargo-test")

add_test(
NAME "cargo-test-widestring"
COMMAND cargo test
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/fish-rust/widestring-suffix/"
)
add_test_target("cargo-test-widestring")
Loading