Native Binaries: detect toolchain version used (visualcpp)

(Hoobajoob) #1

For the msvc toolchain, is there a way to tell within the dsl what version of visual studio gradle has selected to run with?

I can tell by output inspection if I run gradle in debug mode, but how can I tell within build.gradle?

(Hoobajoob) #2

@Daniel_L: do you know if there’s any way to tell what version of VS is in use during a build?

(Daniel Lacasse) #3

I didn’t had a need for that so I don’t really know. I usually set the installDir so I get the exact version I need. I wouldn’t recommend doing that for every project but just the one you have explicit requirements. You can always have a look at the code for the toolchain here:

I hope this help.

(Hoobajoob) #4

ok - I suppose it would be good practice to at least set the install dir whenever you have a specific minimum version required. The only thing is that the install dir is more a kind of coarse-grained hint in some cases.

For example, we recently encountered problems that could only be avoided by ensuring that a project was built with VS2013 Update 4 or later. With Visual Studio’s solution files we’re able to specify a minimum acceptable version and this would produce errors attempting to build the solution with earlier versions.

Was hoping to be able to do something equivalent with the gradle builds, but I’m not sure I’ll be able at the moment.

(Daniel Lacasse) #5

For sure this is going to be a feature that is going to be include in the future. I see value in that. I may look at this pretty soon as for us we would like to have the compilers pulled by Gradle so we really know what compiler we are using and prevent us from installing VS on build agent.

It would still be nice to expose the information from the Visual Studio locator but we may want better model which could be used for Gcc and Clang too.

(Phil McArdle) #6

I’ve been trying to set the installDir following the syntax from the samples here, but Gradle seems to be completely ignoring it, whether I set it to something invalid or a different version than latest Gradle continues to call the latest version of cl.exe it can find. Any ideas?

(Phil McArdle) #7

Nevermind, I had bad syntax from another forum post :slight_smile:

I had ‘VC’ on the end of my path.