chocolatey / Chocolatey.Cake.Recipe

A set of convention based Cake scripts for building Chocolatey projects
Apache License 2.0
5 stars 9 forks source link

Calling ChocolateyPack fails because it can't find choco.exe #160

Open flcdrg opened 3 weeks ago

flcdrg commented 3 weeks ago

Checklist

What You Are Seeing?

Building the choco source using ./build.ps1 fails because it can't find choco.exe

It appears to assume that Chocolatey CLI has been previously installed, which is a bit surprising given that we're trying to build Chocolatey CLI!

What is Expected?

The ToolPath should be updated to point to the locally built choco.exe so that can be used.

How Did You Get This To Happen?

  1. ./build.ps1

System Details

Installed Packages

n/a

Output Log

========================================
Prepare-NuGet-Packages
========================================

========================================
Create-Chocolatey-Packages
========================================
An error occurred when executing task 'Create-Chocolatey-Packages'.

----------------------------------------
Teardown
----------------------------------------
Starting Teardown...
Finished running tasks.
Error: One or more errors occurred.
        Could not locate choco.exe.

Additional Context

No response

TheCakeIsNaOH commented 3 weeks ago

It appears to assume that Chocolatey CLI has been previously installed, which is a bit surprising given that we're trying to build Chocolatey CLI!

It should be installed as a part of the setup.ps1 file: https://github.com/chocolatey/choco/blob/develop/setup.ps1

flcdrg commented 3 weeks ago

Wouldn't it be better to use the choco.exe that you've just built locally (to essentially dogfood it)?

I never even noticed setup.ps1! It also looks outdated (given it tries to install Pester v2). Best I can tell, it isn't mentioned at all in the docs in the choco repo either.

gep13 commented 2 weeks ago

@flcdrg @TheCakeIsNaOH this is a difficult one as well 😄

Chocolatey.Cake.Recipe is meant to be used on multiple projects, and the build of Chocolatey CLI only happens on one of those.

I like the idea of dog-fooding the build of Chocolatey CLI, to perform the pack of the Chocolatey packages though.

For now, I have updated the build instructions in this PR to mention that Chocolatey CLI is an expectation.

If we can make the addition of the dog-fooding generic enough that we can trigger it on the Chocolatey CLI build alone, I would be happy to proceed with that change.