Closed lroling8350 closed 8 years ago
Hi !
Supposedly you can already do the same with:
nuget {
nuspec {
metadata() {
delegate.version '1.0.0'
}
}
}
That doesn't work out for you ?
Scratch that, I missed the "different than the nuspec version" part, that's what I get for commenting too early :)
I didn't know you could upload packages to nuget with a version different than the nuspec one, may I ask how it works and how you manage snapshots like that ?
Our gradle build sees that it is a non release build and creates a unique version by appending a timestamp to the form of "-SNAPSHOT-
Ok, but then in the nupkg, the version from your nuspec is no longer there (only remains the version you passed as argument) no ?
Any fields you specify on the command that override a value in the nuspec, such as version, are written into the nuspec stored in the nupkg. So the version shows up correctly in the nupkg. I don't care that the version in the nupkg, which is the version passed in the command line, differs from the nuspec in source control because that is maintained by the gradle build.
But then in that case my earlier comment is still valid, if you do:
nuget {
nuspecFile = 'foo.nuspec'
nuspec {
metadata() {
delegate.version '1.0.0'
}
}
}
then it'll achieve the same, no ?
I am rather new to groovy but unless I am mistaken the method getNuspec looks for a nuspecFile and if it exists returns this files content and does not look at any information in the nuspec provided in the gradle build. I also tried testing this and the version used is the one from the nuspecFile.
Right, the entire nuspec block is ignored if you provide a file, my bad. Shouldn't we instead change that and make it so that when you specify both, it takes the nuspec file as a base and enriches it with the provided block ? (if it can be achieved) ?
I'll take a look into that, I would also like a way to modify the in gradle nuspec after evaluation.
My one concern though is when i want to call nuget directly on a csproj but change the version. That would get interesting because in that case a nuspec doesn't exist at all.
That's now implemented, I'll close this PR !
Thx
I need the ability to override the version to be different than either the project or nuspec version. This allows me to use a custom version which allows us to programmatically create snapshot versions before release.