cake
cake copied to clipboard
Feature request: built-in scheme for #tool to download an arbitrary HTTPS .zip file
Parameters
-
Version parameter: no. There would be no notion of the downloaded tool having a version, so no
version
orprerelease
parameters. -
Format parameter: maybe The format could be autodetected from the content type or file contents in case you eventually support archive formats other than .zip. There probably wouldn't be a need for a
type
/format
parameter but it might be desirable. -
Checksum parameter: I want this. Even if the download is over HTTPS, it's nice to know if something else starts getting served. This would make HTTP/FTP URLs safe too. If the checksum is missing, Cake could download the file and then include the checksum in an error message requiring the checksum to be present in the .cake file.
Since query parameters in the same URL would collide with the URL to use for the download whether or not they are excluded when downloading, there would need to be a new way to handle this.
Proposal
#tool download:
followed by a URL. If the URL contains a comma, it must be URL-encoded.
A parameter may be specified no more than once. Some parameters are required. To specify a parameter, add a comma to the end of the line followed by the parameter name, an equals sign, and a parameter value. If the parameter value contains a double quote character or comma, the whole parameter value must be double-quoted.
Valid parameter names:
-
checksum
: Required. Value must start withSHA256:
and the remainder must be 32 hex characters, case-insensitive. Future checksums may be supported.
#tool download:http://static.wixtoolset.org/releases/v3.14.0.3910/wix314-binaries.zip, checksum=SHA256:0904A88A4BCD9DD3C2274CAABE73989CD72767EE90C8FA0BF813D004EEC90D32
Questions
-
Is a
format
parameter desirable even if multiple formats become supported? -
Should there be support for the
file
scheme or absolute or relative or Windows UNC paths? -
Should
checksum
be allowed to be omitted for HTTPS downloads? What about HTTP/FTP/file schemes?
I think this initially best would be implemented and tested as Cake module. Example of Cake modules: https://github.com/cake-contrib/Cake.DotNetTool.Module
https://github.com/cake-contrib/Cake.Chocolatey.Module
Documentation around modules here https://cakebuild.net/docs/fundamentals/modules
@devlead Sounds good. I'm probably not up for it at this time, but maybe this proposal could interest someone else. Would you prefer this issue to be closed or stay open?
(I would be happy to help build a lexer and parser if needed though—those are fun.)
@jnm2 there is another module that could be used as a reference is this one:
https://www.nuget.org/packages/Cake.UrlLoadDirective.Module/
Which does something similar.