-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add additional Squirrel parameters #2431
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,9 +29,15 @@ type ReleasifyParams = { | |
/// The full path to an optional icon, which will be used for the generated installer. | ||
SetupIcon : string option | ||
|
||
/// Don't generate delta packages to save time | ||
NoDelta : bool | ||
|
||
/// Do not create an MSI file | ||
NoMsi : bool | ||
|
||
/// Mark the MSI as 64-bit, which is useful in Enterprise deployment scenarios | ||
MsiWin64 : bool | ||
|
||
/// The path to Squirrel: `squirrel.exe` | ||
ToolPath : string | ||
|
||
|
@@ -46,6 +52,12 @@ type ReleasifyParams = { | |
|
||
/// The secret key for the code signing certificate | ||
SigningSecret : string option | ||
|
||
/// Set the required .NET framework version, e.g. net461 | ||
FrameworkVersion : string option | ||
|
||
/// Add other arguments, in case Squirrel adds new arguments in future | ||
AdditionalArguments : string list | ||
} | ||
|
||
let internal defaultParams = lazy( | ||
|
@@ -55,12 +67,16 @@ let internal defaultParams = lazy( | |
BootstrapperExe = None | ||
LoadingGif = None | ||
SetupIcon = None | ||
FrameworkVersion = None | ||
NoDelta = false | ||
NoMsi = false | ||
MsiWin64 = false | ||
ToolPath = Tools.findToolInSubPath toolname ( Directory.GetCurrentDirectory() </> "tools" </> "Squirrel") | ||
TimeOut = TimeSpan.FromMinutes 10. | ||
SignExecutable = None | ||
SigningKeyFile = None | ||
SigningSecret = None }) | ||
SigningSecret = None | ||
AdditionalArguments = [] }) | ||
|
||
let private createSigningArgs (parameters : ReleasifyParams) = | ||
new StringBuilder() | ||
|
@@ -72,12 +88,19 @@ let private createSigningArgs (parameters : ReleasifyParams) = | |
|> StringBuilder.toText | ||
|
||
let internal buildSquirrelArgs parameters nugetPackage = | ||
new StringBuilder() | ||
let sb = new StringBuilder() | ||
|
||
parameters.AdditionalArguments |> Seq.iter (fun arg -> StringBuilder.appendIfNotNullOrEmpty arg "" sb |> ignore) | ||
|
||
sb | ||
|> StringBuilder.appendIfNotNullOrEmpty nugetPackage "--releasify=" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd recommend updating this to the Arguments/CreateProcess API as the StringBuilder is a bit unsafe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have now added a commit that uses the CreateProcess API and uses only a string option for the args |
||
|> StringBuilder.appendIfNotNullOrEmpty parameters.ReleaseDir "--releaseDir=" | ||
|> StringBuilder.appendIfSome parameters.FrameworkVersion (sprintf "--framework-version=%s") | ||
|> StringBuilder.appendIfSome parameters.LoadingGif (sprintf "\"--loadingGif=%s\"") | ||
|> StringBuilder.appendIfSome parameters.SetupIcon (sprintf "\"--setupIcon=%s\"") | ||
|> StringBuilder.appendIfTrue parameters.NoDelta "--no-delta" | ||
|> StringBuilder.appendIfTrue parameters.NoMsi "--no-msi" | ||
|> StringBuilder.appendIfTrue parameters.MsiWin64 "--msi-win64" | ||
|> StringBuilder.appendIfSome parameters.BootstrapperExe (sprintf "\"--bootstrapperExe=%s\"") | ||
|> StringBuilder.appendIfSome parameters.SignExecutable (fun _ -> createSigningArgs parameters) | ||
|> StringBuilder.toText | ||
|
@@ -109,7 +132,7 @@ module internal ResultHandling = | |
/// Target.create "CreatePackage" (fun _ -> | ||
/// Squirrel.releasify "./my.nupkg" (fun p -> { p with ReleaseDir = "./squirrel_release") | ||
/// ) | ||
/// | ||
/// | ||
/// ## Defaults for setParams | ||
/// | ||
/// - `ReleaseDir` - `""` | ||
|
@@ -138,5 +161,5 @@ let releasify (nugetPackage: string) (setParams: ReleasifyParams -> ReleasifyPar | |
parameters.TimeOut | ||
|
||
ResultHandling.failBuildIfSquirrelReportedError result | ||
|
||
__.MarkSuccess() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we have any combination of this name already, besides the one you have chosen 💃
Expecto:
DotCover:
CustomParameters: string
OpenCover:
InnoSetup
Npm/Yarn
Chocolatey
I'm not sure but at least we should be consistent and I might enforce a name via contribution guidelines. Do you like any of the existing ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I'm not sure if it should be a list or just a string (and leave escaping to the user).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Facepalm for me... I'm sorry.
I think I would prefer AdditionalParameters. The way it is implemented right now, each parameter will be string escaped and surrounded with quotes. Not doing that is easy of course. In that case, I would change it to a string option. Do you have any preference between string option and string list? I can do the change on Sunday or Monday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was more pointing out the bad quality of the existing code base than the name you have chosen. In fact I think one more name doesn't even matter at this point, but we should work in unifying this in the next version and I'd "lock" the one we choose now in the contribution guidelines :D
There are some tools where the "escaping" will actually break them so I tend to just provide a simple
string
here, but I'm open for arguments for using a list, which I guess would be more "safe".