-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
Improve 'compilation required' check by checking source file dependencies #312
Improve 'compilation required' check by checking source file dependencies #312
Conversation
0bfe7fd
to
7aa5068
Compare
7aa5068
to
c965f5c
Compare
I've added some unit tests to show that it actually works. |
Did you see my comment on the File.Exist check? |
No, I don't see any comments at all. |
@madskristensen If you will point it out again I'll get it fixed :) |
src/WebCompiler/Config/Config.cs
Outdated
foreach (var file in dependencies[key].DependentOn.ToArray()) | ||
{ | ||
var fileInfo = new FileInfo(file); | ||
if (fileInfo.LastWriteTimeUtc > output.LastWriteTimeUtc) |
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.
Should there be a check for fileInfo.Exist before calling the LastWriteTimeUtc properties?
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.
According to the documentation if the file doesn't exist it will return 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC)
, but it would of course be good practice to just check if it exists and make the intention more clear.
I'll add the check.
Thanks |
This recursively check the last write time of all the files for which the input file depends on (e.g.
@import
etc.) instead of only the input file.Without this there can be situations where the input files has not been changed but dependent files have been changed outside Visual Studio (e.g. by source control) and would not be recompiled. This can often happen with the "build on compile" feature after switching branches or fetching updates.