gradle / gradle/gradle-native

Gradle 4.6 does not accept legacy Visual Studio toolchain

Open
#620 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
94
Forks
7
PR merge metrics
No merged PRs in 30d

Description

### Expected Behavior

Gradle should accept a user specified legacy Visual Studio Toolchain, even if Visual Studio has not been installed on the system.

### Current Behavior

On our build machines we do not install Visual Studio, but instead deploy the installation directory of Visual Studio manually. When using this directory with the Visual Studio toolchain, Gradle is not able to recognize Visual Studio and responds with:

> Tool chain 'visualStudio' (Visual Studio): The specified installation directory 'C:\Users\joerkeja\AppData\Local\Temp\.gradle-test-kit-joerkeja\caches\hgl\deploy\compiler\win64\VisualStudio\2013' does not appear to contain a Visual Studio installation.

### More Details
The method `org.gradle.nativeplatform.toolchain.internal.msvcpp.version.VisualStudioVersionDeterminer.getVisualStudioMetadataFromInstallDir(File)` sets the version information for legacy versions of Visual Studio to `org.gradle.util.VersionNumber.UNKNOWN`.
As a consequence of this, the method `org.gradle.nativeplatform.toolchain.internal.msvcpp.DefaultVisualStudioLocator.addInstallIfValid(VisualStudioMetadata, String)` rejects the user specified installation directory.

### Context

On our buildmachines we want to use multiple version of Visual Studio and in some cases multiple versions of the same Visual Studio version with different patch levels. We therefore only install Microsoft Visual C++ Redistributable Packages on the build servers and deploy multiple Visual Studio installations manually, without actively installing them.

### Steps to Reproduce (for bugs)
In theory:
- Copy the installation directory of Visual Studion 2012 to a system on which no Visual Studio has been installed.
- Install the corresponding Visual Studion 2012 C++ redistributable package on that system.
- Try to build any C++ application with gradle in order to trigger the problem.

### Your Environment

- Windows 10 x64
- Different Visual Studio versions installed (2010, 2012, 2014, 2017)

### Proposed solution
For our usecase it would be most benificial to us, if we could manually define the installation directory of visual studio and optionally add more information about the kind of the visual studio installation to ease the recognition process of gradle.

Contributor guide

Open the contributing guide

Research direction

Start with org.gradle.nativeplatform.toolchain.internal.msvcpp.version.VisualStudioVersionDeterminer.getVisualStudioMetadataFromInstallDir(File) and DefaultVisualStudioLocator.addInstallIfValid(VisualStudioMetadata, String), which are identified as causing the rejection. Reproduce with a manually deployed Visual Studio 2012 directory and its redistributable on Windows without an installed Visual Studio instance. Done means the specified legacy installation is recognized and accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.