This is an archive of the discontinued LLVM Phabricator instance.

[buildbot, windows] Update the way the visual studio environment is set
AbandonedPublic

Authored by stella.stamenova on Oct 11 2018, 12:00 PM.

Details

Summary

With vs2017 there were several changes to the installation paths for VS including the vcvarsall.bat script used for setting the environment. To correctly get the paths for the newer versions of VS, we should use vswhere instead. This is similar to how the annotated builder sets the environment as well

Diff Detail

Repository
rL LLVM

Event Timeline

Stella,
Did you try the change with VS other than 2017?

This defaults to the original behavior when vswhere.exe doesn't exist (so older versions of Visual Studio).

gkistanova accepted this revision.Oct 16 2018, 12:00 PM

I see that in the code. The question was if you actually tested it with something older than VS 2015.
Anyway, LGTM.

This revision is now accepted and ready to land.Oct 16 2018, 12:00 PM
stella.stamenova added a comment.EditedOct 16 2018, 12:26 PM

I did test the snippet locally with 2015 and 2017. Is there a way to simulate the way the bots will execute the code as well?

It did occur to me after your question that this won't work if someone has vs2017 installed but wants to use an older version, so I need to re-think the logic a little bit. I'll send an update soon.

I updated the patch, so that it will not auto detect the VS installation unless explicitly requested. I also propagated the flag to all the builders that currently work with VS, so that it is available immediately if anyone chooses to create a buildbot with a newer VS installation.

Is there a way to test this (beyond running the logic locally) to make sure that all the bots will work correctly?

Thanks!

@gkistanova do you have a concern with the current changes or any additional testing you want me to do before I check this in?

This revision was automatically updated to reflect the committed changes.
gkistanova reopened this revision.Oct 25 2018, 4:39 PM

The latest changes look too invasive for the purpose. And it seems confusing to have two parameters, both supposedly controlling the Visual Studio selection, especially when one could be silently ignored in some cases.

Could you use the first argument as a selector instead please?
Something like command=builders_util.getVisualStudioEnvironment(vs="autodetect", target_arch) would be good.

In this case no need to change any build factory and everything would keep working exactly as it was before your change.

zorg/buildbot/builders/Util.py
27 ↗(On Diff #170137)

Please do not use OS specific path handling, as this gets evaluated on the build master. OS build master is running under, and the OS where the build happens are usually different.

This revision is now accepted and ready to land.Oct 25 2018, 4:39 PM
gkistanova requested changes to this revision.Oct 25 2018, 4:46 PM

Please revert r345309 and propose a smaller change.

This revision now requires changes to proceed.Oct 25 2018, 4:46 PM
zorg/buildbot/builders/Util.py
27 ↗(On Diff #170137)

Ok, so this is not the right change then as vswhere needs to run on the OS where the build is going to happen - otherwise, we will not correctly detect the version of visual studio. Is there a way to specify that we want the command to run on the build slave?

Hi Stella,

Please see my notes inline.

Unless you want to do this by yourself, I can prepare this change. I think I have developed a good understanding of what you are after.

zorg/buildbot/builders/Util.py
26 ↗(On Diff #170137)

This thing also would run on the build master, which does not look like what you want.

27 ↗(On Diff #170137)

You do build a command that would run on the build machine. But the Python script you write to build that command would be running on the build master.

In other words, whatever you put in vcvars_command would go to a remote host to execute.

Hi Stella,

Please see my notes inline.

Unless you want to do this by yourself, I can prepare this change. I think I have developed a good understanding of what you are after.

Thanks, Galina. If you think it will be easier for you to make the change, that sounds great.

zorg/buildbot/builders/Util.py
26 ↗(On Diff #170137)

Yes, that's where vswhere is called and it has to run on the machine that will run the build.

stella.stamenova abandoned this revision.Nov 19 2018, 2:01 PM