Skip to content

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

Merged
merged 1 commit into from
Apr 4, 2018

Conversation

nguerrera
Copy link
Contributor

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

@nguerrera nguerrera requested review from dsplaisted, livarcocc and a team April 3, 2018 23:33
@@ -36,9 +36,26 @@ Copyright (c) .NET Foundation. All rights reserved.
The main publish entry point.
============================================================
-->

<PropertyGroup Condition="'$(NoBuild)' != 'true'">
Copy link
Member

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?

Copy link
Contributor Author

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");
Copy link
Member

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.

Copy link
Contributor Author

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();
Copy link
Member

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?

Copy link
Contributor Author

@nguerrera nguerrera Apr 3, 2018

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, ".."),
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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");
Copy link
Member

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)

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@nguerrera
Copy link
Contributor Author

@dsplaisted I think I've addressed all of your feedback. Mind taking another look?

@dsplaisted
Copy link
Member

@nguerrera looks good, but I just noticed: Did you mean to target master with this PR?

@livarcocc
Copy link
Contributor

Yes, master is the right branch for this. release/2.1.3xx is for preview2 only at the moment.

@nguerrera nguerrera merged commit f67788c into dotnet:master Apr 4, 2018
@nguerrera nguerrera deleted the publish-no-build branch April 4, 2018 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants