-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add support for /t:Publish /p:NoBuild=true #2111
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
Conversation
@@ -36,9 +36,26 @@ Copyright (c) .NET Foundation. All rights reserved. | |||
The main publish entry point. | |||
============================================================ | |||
--> | |||
|
|||
<PropertyGroup Condition="'$(NoBuild)' != 'true'"> |
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 we use a less generic name for this property? Perhaps PublishWithoutBuild
or something?
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.
This matches pack --no-build so I think it's worth the consistency. Otherwise it should have been PackWithoutBuilding
.
} | ||
|
||
// capture modification time of all binaries before publish | ||
var modificationTimes = GetLastWriteTimesUtc(buildCommand, "*.exe", "*.dll", "*.resources", "*.pdb"); |
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.
There should probably be a "sleep until current time advances" loop here.
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.
Fixed.
var modificationTimes = GetLastWriteTimesUtc(buildCommand, "*.exe", "*.dll", "*.resources", "*.pdb"); | ||
|
||
// publish (with NoBuild set) | ||
publishCommand.Execute("/p:NoBuild=true").Should().Pass(); |
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.
As a sanity check for this test, have you tried running it without the /p:NoBuild=true
parameter and verified that it fails due to updated modification dates of the output files?
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.
Yes, I have. :) I also tried various combinations of not having the right targets in _BeforePublishTargets.
{ | ||
return searchPatterns.SelectMany( | ||
pattern => Directory.EnumerateFiles( | ||
Path.Combine(command.ProjectRootPath, ".."), |
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.
I'm guessing this is going up one level from the ProjectRootPath
in order to cover the referenced projects, but that's worth an explanatory comment.
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.
Correct. I will add a comment.
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.
Fixed.
}); | ||
|
||
testAsset.Restore(Log, "TestApp"); | ||
testAsset.Restore(Log, "TestLibrary"); |
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.
It shouldn't be necessary to restore TestLibrary separately from TestApp. (I know this is old code that you just moved)
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.
True. I'll fix it.
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.
Fixed.
820e9ca
to
e9c503a
Compare
8dbd0c6
to
6b242c2
Compare
@dsplaisted I think I've addressed all of your feedback. Mind taking another look? |
@nguerrera looks good, but I just noticed: Did you mean to target master with this PR? |
Yes, master is the right branch for this. release/2.1.3xx is for preview2 only at the moment. |
dotnet/sdk half of https://github.com/dotnet/cli/issues/5331
After this, we just need to wire --no-build to /p:NoBuild=true in dotnet/cli