cake-build / cake-build/cake

dotnet cake --tree requires manual bootstrapping of modules

Open
#3,140 0 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
1h 15m
Merged PRs (30d)
19

Description

`dotnet cake --tree` on Cake v1.0.0 doesn't work if the build script rely on modules that introduce new installers

### What You Are Seeing?

![image](https://user-images.githubusercontent.com/177608/107857493-fc7e6b00-6e04-11eb-8737-8d3d7aeab68a.png)

### What is Expected?

![image](https://user-images.githubusercontent.com/177608/107857498-0a33f080-6e05-11eb-9166-c4bee3657a14.png)

### What version of Cake are you using?

1.0.0

### Are you running on a 32 or 64 bit system?

N/A

### What environment are you running on? Windows? Linux? Mac?

N/A

### Are you running on a CI Server? If so, which one?

N/A

### How Did You Get This To Happen? (Steps to Reproduce)

```csharp
#module nuget:?package=Cake.DotNetTool.Module&version=0.4.0
#tool "dotnet:https://api.nuget.org/v3/index.json?package=GitReleaseManager.Tool&version=0.11.0"

Task("Clean")
.Does(() =>
{
Information("We're {0}!", "Cleaning");
});

Task("Build")
.IsDependentOn("Clean")
.Does(() =>
{
Information("We're {0}!", "Building");
});

RunTarget("Build");
```

### Output Log

```bash
Module directory does not exist.
Analyzing build script...
Analyzing /Users/augustoproiete/cake/tool/1.0.0/test-tree.cake...
Processing build script...
Installing tools...
Error: Cake.Core.CakeException: Could not find an installer for the 'dotnet' scheme.
at Cake.Core.Scripting.ScriptProcessor.InstallPackages(IReadOnlyCollection`1 modules, DirectoryPath installPath, PackageType packageType) in C:\projects\cake\src\Cake.Core\Scripting\ScriptProcessor.cs:line 195
at Cake.Core.Scripting.ScriptProcessor.InstallTools(IReadOnlyCollection`1 tools, DirectoryPath installPath) in C:\projects\cake\src\Cake.Core\Scripting\ScriptProcessor.cs:line 136
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(IRemainingArguments arguments, BuildFeatureSettings settings) in C:\projects\cake\src\Cake\Features\Building\BuildFeature.cs:line 99
at Cake.Features.Building.BuildFeature.Run(IRemainingArguments 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 72
```

Contributor guide

Open the contributing guide

Research direction

Start with the ScriptProcessor.InstallPackages and InstallTools stack-trace locations in src/Cake.Core/Scripting/ScriptProcessor.cs, then trace how BuildFeature invokes script processing for --tree. Reproduce with the supplied build script and verify that the module-provided installer is available before the dotnet tool is processed, with the expected tree output and no installer error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.