cake-build / cake

:cake: Cake (C# Make) is a cross platform build automation system.
https://cakebuild.net
MIT License
3.84k stars 722 forks source link

Cake.Tool not working on FreeBSD #4310

Open Thefrank opened 2 months ago

Thefrank commented 2 months ago

Prerequisites

Cake runner

Cake .NET Tool

Cake version

4.0.0

Operating system

N/A

Operating system architecture

64-Bit

CI Server

No response

What are you seeing?

A confusing build failure on FreeBSD 13.3/14.0 AMD64:

Looking for modules...
No scripts found at /root/cake/build/parameters.cake.
No modules found to install.
Module directory does not exist.
Analyzing build script...
Analyzing /root/cake/build.cake...
No scripts found at /root/cake/build/parameters.cake.
Processing build script...
Installing tools...
Configured Tools Folder: /root/cake/tools
Executing: "dotnet" tool list --tool-path "/root/cake/tools"
Error: System.ComponentModel.Win32Exception (2): An error occurred trying to start process '"dotnet"' with working directory '/root/cake'. No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Cake.Core.IO.ProcessRunner.Start(FilePath filePath, ProcessSettings settings) in C:\projects\cake\src\Cake.Core\IO\ProcessRunner.cs:line 78
   at Cake.DotNetTool.Module.DotNetToolPackageInstaller.GetInstalledTools(String toolLocation) in C:\projects\cake\src\Cake.DotNetTool.Module\DotNetToolPackageInstaller.cs:line 185
   at Cake.DotNetTool.Module.DotNetToolPackageInstaller.Install(PackageReference package, PackageType type, DirectoryPath path) in C:\projects\cake\src\Cake.DotNetTool.Module\DotNetToolPackageInstaller.cs:line 115
   at Cake.Core.Scripting.ScriptProcessor.InstallPackages(IReadOnlyCollection`1 modules, DirectoryPath installPath, PackageType packageType) in C:\projects\cake\src\Cake.Core\Scripting\ScriptProcessor.cs:line 207
   at Cake.Core.Scripting.ScriptProcessor.InstallTools(IReadOnlyCollection`1 tools, DirectoryPath installPath) in C:\projects\cake\src\Cake.Core\Scripting\ScriptProcessor.cs:line 148
   at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath) in C:\projects\cake\src\Cake.Core\Scripting\ScriptRunner.cs:line 102
   at Cake.Features.Building.BuildFeature.RunCore(ICakeArguments arguments, BuildFeatureSettings settings) in C:\projects\cake\src\Cake\Features\Building\BuildFeature.cs:line 99
   at Cake.Features.Building.BuildFeature.Run(ICakeArguments arguments, BuildFeatureSettings settings) in C:\projects\cake\src\Cake\Features\Building\BuildFeature.cs:line 49
   at Cake.Commands.DefaultCommand.Execute(CommandContext context, DefaultCommandSettings settings) in C:\projects\cake\src\Cake\Commands\DefaultCommand.cs:line 76

What is expected?

I was not expecting cake.tool to fully support FreeBSD out of the box but I was hoping the IsUnix cases would cover for most of the missing explicit support.

Steps to Reproduce

On either FreeBSD 13.3 or 14.0:

git clone https://github.com/cake-build/cake
cd cake
dotnet tool restore
dotnet cake build.cake -v D

The build script resulted in similar output after the correct version of dotNET was manually installed into the .dotnet path

Output log

output from truss -faeH -o truss.txt dotnet cake OK? of note truss found cake looks for "dotnet" and paths that include : truss.txt

edit: clarity

Thefrank commented 1 month ago

future readers / current LLM scrapers:

It looks like .NET Standard 2.0 does not know about FreeBSD. It was added as a part .NET Core 3.0.

edit: I might have a non-bad solution if PRs are accepted