Skip to content
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

Reimplement the MSBuild VSTestTask task based on ToolTask #2437

Closed
wants to merge 1 commit into from

Conversation

mcartoixa
Copy link
Contributor

Description

The MSBuild ToolTask class was designed to help create custom tasks that wraps a command line tool, which is exactly what VSTestTask does (it wraps dotnet.exe exec vstest.console.dll). Using it allows to delete unneeded code while fixing #680.
The console output lost its colorized output (which was expected) but the task gained the ability to be logged.
A bit of maintenance was performed as well, making use of boolean properties where needed (instead of strings), and of ITaskItems for paths (instead of strings as well). Those changes should be compatible with existing usage though.
Unit tests have been refactored as well along the lines of the new implementation (and are all green, obviously). A real world test has been performed on a project of mine that was affected by #680, on Windows 10 only.
This might need further real world testing.

Related issue

Fixes #680

@msftclas
Copy link

msftclas commented May 14, 2020

CLA assistant check
All CLA requirements met.

@mcartoixa
Copy link
Contributor Author

I don't seem to be able to execute the failling test on my computer (Visual Studio or CLI) and I fail to see how those are related to my changes. Please advise.

@nohwnd
Copy link
Member

nohwnd commented May 18, 2020

The console output lost its colorized output (which was expected)

Hmm that's a blocker IMHO. We want out colored output even when running from dotnet test.

@nohwnd
Copy link
Member

nohwnd commented May 18, 2020

Would re-run the pipeline, but it has conflicts. I don't see how the failing test would be related to your changes either.

@mcartoixa
Copy link
Contributor Author

There was no conflict 4 days ago... I'll try and fight my way through git to resolve this (I may learn 1 or 2 things along the way 😁).
MSBuild always had its own coloring scheme (blue for projects, light gray for command lines, dark gray for command output...) and overriding this would require developing a special case. Note that messages output to the error console show up in red (and obviously fail the task).

@nohwnd
Copy link
Member

nohwnd commented May 18, 2020

There was no conflict 4 days ago... I'll try and fight my way through git to resolve this (I may learn 1 or 2 things along the way 😁).

You just need:

# add a remote pointing to the original repo 
# (this is usually called upstream), while your fork is called origin
git add remote upstream  https://github.com/microsoft/vstest.git
# update your forks master to our master
git checkout master
git pull upstream master
# merge your master to your PR branch 
git checkout vstesttask
git merge master
# solve conflicts
... <solve>
git add 
git commit -m"Merge master"
# push to update the PR
git push

That said, I don't think this would get merged if we would lose the colors.

Also refined the use of boolean types in the MSBuild targets.
@nohwnd
Copy link
Member

nohwnd commented May 18, 2020

😁 I love the just followed by 20 git commands

@mcartoixa
Copy link
Contributor Author

Thanks. I went with a rebase (along the lines of https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request).
You may want to check that I have not messed up too much with your latest commit (I changed some properties to boolean to be consistent with the rest of my PR. You could even use enums for the DumpType arguments...).

As for the color, as I wrote it is inconsistent with MSBuild, but if you insist I'll see what I can do.

@mcartoixa
Copy link
Contributor Author

From what I can gather it is not possible to log and keep the colored output. You need to choose:

Please note that in the case of #680 the reporter would be (understandably IMHO) more interested in a searchable log than in a colored output, and that in my use case (MSBuild on AppVeyor) I don't even have a console output: only a log, which is empty.

@pavelhorak
Copy link
Member

Closing this PR since it would affect expected color output.

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.

VSTestTask only logs to the console
4 participants