Change NuGetPack call signature to avoid "kempejada" #554
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This set of changes streamline
NuGetHelper
functions, in particular the usage ofNuGetPack
towards the usage ofNuGet
. A rudimentary approach to intergration testing ofNugetHelper
is provided as well.Problem
Creating nuget packages is a fairly common task. FAKE provides nice helpers to do this, in particular the
NuGet
function, which sort of is a "all in" function to create and publish the package in one go. However, if one were to provide two separate targets for creating and publishing the package, theNuGet
function needs to be called twice. Obviously with thePublish
property being set tofalse
in first call andtrue
on the second call.Interestingly, FAKE NuGetHelpers provide two additional functions:
NuGetPack
andNuGetPush
. As the names already say it,NuGetPack
creates the package, whileNuGetPush
publishes it.Given the user would like to use
NuGetPack
andNuGetPush
for separate targets instead ofNuGet
, a specific API divergence bubbles up to the public surface:NuGet
expects a nuspec template to be passed and processes it by replacing theNugetParams
accordingly. In constrast,NuGetPack
has the same call signature asNuGet
, but expects a complete and valid nuspec file as opposed to a nuspec template file. This kempejada forces the user to useNuGet
twice instead of (intuitively) useNuGetPack
andNuGetPush
for separate targets.Note: This "API divergence" is called kempejada here (just out of fun).
Solution
NuGetPack
now performs the same package creation process asNuGet
does. For a minimum level of verification, an integration is provided. For the integration test some helper functions were needed for function conversion (CSharpHelper.fs
). I don't like that I've put them right into FakeLib, but I didn't knew a better place to tuck it in.This change preserves compatibility to any prior
NuGetPack
usage since a complete (non-templated) nuspec file is just processed and passed along to the pack function.Windows and Mono builds / tests pass. Please review thoroughly. Feedback and comments appreciated.