clairernovotny / ReferenceGenerator

MIT License
75 stars 13 forks source link

nuspec diff noise due to lack of sorting #22

Open AArnott opened 8 years ago

AArnott commented 8 years ago

I am frequently seeing changes to my .nuspec source file from a build because the ReferenceGenerator reorders dependencies, such as this one:

-        <dependency id="Microsoft.VisualStudio.Threading" version="14.1.114" />
-        <dependency id="Newtonsoft.Json" version="6.0.6" />
         <dependency id="System.AppContext" version="4.0.0" />
         <dependency id="System.Collections" version="4.0.10" />
         <dependency id="System.Diagnostics.Debug" version="4.0.10" />
         <dependency id="System.Diagnostics.Process" version="4.0.0-beta-23409" />
         <dependency id="System.Globalization" version="4.0.10" />
         <dependency id="System.IO" version="4.0.10" />
         <dependency id="System.IO.FileSystem" version="4.0.0" />
         <dependency id="System.Linq" version="4.0.0" />
         <dependency id="System.Net.Primitives" version="4.0.10" />
         <dependency id="System.Runtime" version="4.0.20" />
         <dependency id="System.Runtime.Extensions" version="4.0.10" />
         <dependency id="System.Security.Claims" version="4.0.0" />
         <dependency id="System.Security.Cryptography.Algorithms" version="4.0.0-beta-23409" />
         <dependency id="System.Security.Cryptography.Primitives" version="4.0.0-beta-23409" />
         <dependency id="System.Security.Principal.Windows" version="4.0.0-beta-23409" />
         <dependency id="System.Text.Encoding" version="4.0.10" />
         <dependency id="System.Threading" version="4.0.10" />
         <dependency id="System.Threading.Tasks" version="4.0.10" />
+        <dependency id="Microsoft.VisualStudio.Threading" version="14.1.114" />
+        <dependency id="Newtonsoft.Json" version="6.0.6" />

If I let that get checked in, the next build may switch it back. And so it goes, back and forth.

Can this build step please consistently sort?

clairernovotny commented 8 years ago

It's supposed to be sorting alphabetically by package id, so I'm not sure what's going on. I have seen this a few times but can't repro it:

https://github.com/onovotny/ReferenceGenerator/blob/master/src/ReferenceGenerator/Program.cs#L98

AArnott commented 8 years ago

It looks like you don't sort the whole list. You only sort your insertion into the list. So your list's position relative to other elements (that I've added myself) evidently is undefined?

https://github.com/onovotny/ReferenceGenerator/blob/master/src/ReferenceGenerator/Program.cs#L157