cake-build / cake

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

ReportGenerator not able to run on MacOS #3864

Open AdaskoTheBeAsT opened 2 years ago

AdaskoTheBeAsT commented 2 years ago

Prerequisites

Cake runner

Cake Frosting

Cake version

2.1

Operating system

macOS

Operating system architecture

64-Bit

CI Server

local

What are you seeing?

when I try to use ReportGenerator from cake I receive

Error: An error occurred trying to start process '/build/tools/dotnet-reportgenerator-globaltool.5.1.4/tools/netcoreapp3.1/any/ReportGenerator.exe' with working directory '/build'. Exec format error

What is expected?

when I checked by manual command ''' dotnet ./build/tools/dotnet-reportgenerator-globaltool.5.1.4/tools/net6.0/any/ReportGenerator.dll "-reports:" "-targetdir:" "-reporttypes:Cobertura" '''

all works - so after first investigation it seems that this is the line responsible for probems https://github.com/cake-build/cake/blob/48baa8a7dda744f694a209cd4f9ed5fa0471523d/src/Cake.Common/Tools/ReportGenerator/ReportGeneratorRunner.cs#L129

will it be possible to launch report generator by dotnet /ReportGenerator.dll instead? it would make report generator cross platform

Could you please advise?

Steps to Reproduce

any usage of context.ReportGenerator

for example. (where unitReport path is root folder for subfolders with xunit reports)

    var reportGeneratorSettings = new ReportGeneratorSettings
    {
        ReportTypes = new[] { ReportGeneratorReportType.Cobertura },
    };

    context.ReportGenerator(
        new GlobPattern($"{unitReportPath.FullPath}/**/coverage.cobertura.xml"),
        unitReportPath,
        reportGeneratorSettings);

Output log

Error: An error occurred trying to start process '/build/tools/dotnet-reportgenerator-globaltool.5.1.4/tools/netcoreapp3.1/any/ReportGenerator.exe' with working directory '/build'. Exec format error

gep13 commented 2 years ago

@AdaskoTheBeAsT can you confirm how you are installing the tool? Are you using the Cake pre-processor directive to do this, or is this being done elsewhere?

AdaskoTheBeAsT commented 2 years ago

@gep13 I use it in cake.frosting - it is installed by "InstallTool" method

return new CakeHost() .UseContext<BuildContext>() .InstallTool(new Uri("nuget:?package=dotnet-reportgenerator-globaltool&version=5.1.4&loaddependencies=true"))

Cheesebaron commented 11 months ago

I think this one can be closed. I've been using the dotnet-reportgenerator-globaltool for several years and don't have issues with it on macOS.