realvizu/NsDepCop

If no source file have changed then do not execute the analysis.

realvizu opened this issue · 2 comments

Similarly to incremental compilation NsDepCop should not run when no source file have changed.

Currently analysis is run after the build target.
<Target Name="NsDepCop" AfterTargets="AfterBuild">

Maybe it would be better to make it part of the compilation?

<PropertyGroup>
  <TargetsTriggeredByCompilation>
    $(TargetsTriggeredByCompilation);
    NsDepCop
  </TargetsTriggeredByCompilation>
</PropertyGroup>

Still it does not take into account whether config.nsdecop was changed or not.

Implemented the above change in 1.8.1-beta1 but it has the flaw that it won't reanalyse when only config.nsdepcop has changed (and no sources have changed).
I guess to fix it I should pass all source files + config.nsdepcop to NsDepCop msbuild Task's Input attribute and pass the project's output file to Output attribute (?).

Introduced an ItemGroup for NsDepCop config files and a property for a dummy output file (a zero-byte file just to know when the last successful analysis happed.
Adding NsDepCopTask with AfterTargets="CoreCompile".