# Native: How to get the ToolChain used/chosen by Gradle 4.4 for a build or a project?

**URL:** https://discuss.gradle.org/t/native-how-to-get-the-toolchain-used-chosen-by-gradle-4-4-for-a-build-or-a-project/24963
**Category:** Help/Discuss
**Tags:** native
**Created:** [November 30, 2017, 2:45pm UTC](https://discuss.gradle.org/t/native-how-to-get-the-toolchain-used-chosen-by-gradle-4-4-for-a-build-or-a-project/24963 "2017-11-30T14:45:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![zosrothko](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/zosrothko/32/5438_2.png) [@zosrothko](https://discuss.gradle.org/u/zosrothko)
#### Post date: [November 30, 2017, 2:45pm UTC](https://discuss.gradle.org/t/native-how-to-get-the-toolchain-used-chosen-by-gradle-4-4-for-a-build-or-a-project/24963/1 "2017-11-30T14:45:05Z")

</div>

Hi

Since Gradle 4.4 support the automatic discovery of the underlying toolchains (especially VisualSudio 2017), how a script can know which toolchain has been chosen by Gradle in a non compiling task (for exemple in the top level build, in a Exec task)?

---

<div class="post-metadata">

### Author: ![Stefan\_Wolf](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/stefan_wolf/32/5519_2.png) [@Stefan\_Wolf](https://discuss.gradle.org/u/Stefan_Wolf)
#### Post date: [December 1, 2017, 8:59am UTC](https://discuss.gradle.org/t/native-how-to-get-the-toolchain-used-chosen-by-gradle-4-4-for-a-build-or-a-project/24963/2 "2017-12-01T08:59:19Z")

</div>

Hi,

does the method `VisualCppToolChain.isVisualCpp2015()` help you? Still, that is no public API.  
I think there is currently no way how to obtain the version of VisualStudio via the public API.  
I guess your best bet is that [https://github.com/gradle/gradle-native/issues/324](https://github.com/gradle/gradle-native/issues/324) gets implemented.

Cheers,  
Stefan

---

<div class="post-metadata">

### Author: ![zosrothko](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/zosrothko/32/5438_2.png) [@zosrothko](https://discuss.gradle.org/u/zosrothko)
#### Post date: [December 1, 2017, 1:43pm UTC](https://discuss.gradle.org/t/native-how-to-get-the-toolchain-used-chosen-by-gradle-4-4-for-a-build-or-a-project/24963/3 "2017-12-01T13:43:07Z")

</div>

That’s some kind of property that I am looking for. But there should be also  
VisualCppToolChain.isVisualCpp2017()  
VisualCppToolChain.isVisualCpp2015()  
VisualCppToolChain.isVisualCpp2013()  
VisualCppToolChain.isVisualCpp2012()  
VisualCppToolChain.isVisualCpp2010()

and the same for gcc (version 4.7, 4.9, 5.1, etc…) & clang idem
