Files
apple-foundationdb/cmake/CompileCoverageTool.cmake
VXTLS 31d7eadd52 Make FDB_USE_CSHARP_TOOLS authoritative and consistently honored across the build (#12615)
* Make FDB_USE_CSHARP_TOOLS authoritative across the build

Historically, FDB_USE_CSHARP_TOOLS acted as a preference hint, and parts of the build could still probe for or assume the presence of C# tooling even when it was disabled.

This change makes the option authoritative and consistently honored across the build system. C# tooling is now used only when explicitly enabled and available, and all downstream assumptions are gated accordingly.

The default configuration and tool preference order remain unchanged.

* cmake files changes

* WIP: tmp test

* Honor reviewer feedback on C# toolchain detection and actor comparison

- Stop assuming C# tooling availability on Windows; explicitly probe for
  .NET using find_program.
- Prefer .NET over mono on all platforms, with mono used only as a fallback.
- Fail explicitly when FDB_USE_CSHARP_TOOLS=ON but no C# toolchain is found.
- Preserve Python/C# actor output comparison when C# tooling is available,
  skipping it only when C# is explicitly disabled or unavailable.
- Simplify Python argument parsing and remove unnecessary textwrap usage.
2026-01-06 20:55:33 -08:00

50 lines
1.8 KiB
CMake

set(COVERAGETOOL_CSPROJ
${CMAKE_CURRENT_SOURCE_DIR}/flow/coveragetool/coveragetool.csproj)
set(COVERAGETOOL_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/flow/coveragetool/Program.cs
${CMAKE_CURRENT_SOURCE_DIR}/flow/coveragetool/Properties/AssemblyInfo.cs)
set(coveragetool_command "")
if(WIN32)
add_executable(coveragetool ${COVERAGETOOL_SRCS})
target_compile_options(coveragetool PRIVATE "/langversion:6")
set_property(
TARGET coveragetool
PROPERTY VS_DOTNET_REFERENCES
"System"
"System.Core"
"System.Xml.Linq"
"System.Data.DataSetExtensions"
"Microsoft.CSharp"
"System.Data"
"System.Xml")
elseif(CSHARP_USE_MONO)
set(COVERAGETOOL_COMPILER_REFERENCES
"-r:System,System.Core,System.Xml.Linq,System.Data.DataSetExtensions,Microsoft.CSharp,System.Data,System.Xml"
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/coveragetool.exe
COMMAND ${CSHARP_COMPILER_EXECUTABLE} ARGS ${COVERAGETOOL_COMPILER_REFERENCES}
${COVERAGETOOL_SRCS} "-target:exe" "-out:coveragetool.exe"
DEPENDS ${COVERAGETOOL_SRCS}
COMMENT "Compile coveragetool"
VERBATIM)
add_custom_target(coveragetool
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/coveragetool.exe)
set(coveragetool_exe "${CMAKE_CURRENT_BINARY_DIR}/coveragetool.exe")
set(coveragetool_command ${MONO_EXECUTABLE} ${coveragetool_exe})
else()
dotnet_build(${COVERAGETOOL_CSPROJ} SOURCE ${COVERAGETOOL_SRCS})
set(coveragetool_exe "${coveragetool_EXECUTABLE_PATH}")
set(coveragetool_command ${dotnet_EXECUTABLE} ${coveragetool_exe})
endif()
if(NOT coveragetool_command)
set(coveragetool_command ${coveragetool_exe})
endif()
set(coveragetool_command
${coveragetool_command}
CACHE INTERNAL "Command to run coveragetool")