Duplicate Visual Studio 2017 hack for VS 2019
Needs ReviewPublic

Authored by sredman on Jun 4 2019, 9:26 PM.

Details

Reviewers
None
Group Reviewers
KDevelop
Summary

Like Visual Studio 2017, Visual Studio 2019 does not define a convenient environment variable for checking and getting the location of the environment variable-setting batch file. This patch duplicates the hack used for finding VS 2017 to find VS 2019

Test Plan

"It works for me" with VS 2019 Community installed

Diff Detail

Repository
R32 KDevelop
Branch
vs2019
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 12415
Build 12433: arc lint + arc unit
sredman created this revision.Jun 4 2019, 9:26 PM
Restricted Application added a project: KDevelop. · View Herald TranscriptJun 4 2019, 9:26 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald Transcript
sredman requested review of this revision.Jun 4 2019, 9:26 PM

LGTM, maybe @kfunk or @brauch know more?

Why did you replace the registry query by a fixed path?

echo Define which compiler for VS2017 to use. Possible architectures are:

VS2017 should change too. Any ideas if this should print the VS exact version or just a generic question?

Why did you replace the registry query by a fixed path?

Which part of the patch are you referring to? I didn't intentionally do anything differently than the VS2017 hack, I tried to just duplicated that same method for VS2019.
For VS2015 and earlier, it appears the installer defined an environment variable pointing to the tools which the previous versions of this script used. For VS2017+, that variable doesn't seem to exist
(I have VS2015 and VS2019 on my computer, which is my basis for making the above claims)

echo Define which compiler for VS2017 to use. Possible architectures are:

VS2017 should change too. Any ideas if this should print the VS exact version or just a generic question?

Oops. Good catch. Would it work to just say Define which toolchain to use. Possible architectures are: rather than me having to go any further into Windows Batch scripting than I have to? :)

Petross404 added a comment.EditedJun 10 2019, 6:39 PM

brauch is referring to this

for /f "usebackq tokens=3*" %%a in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" /s`) do (
     set vs15_path=%%a %%b
     if exist "!vs15_path!Common7\Tools\VsDevCmd.bat" (
	set "VS150COMNTOOLS=!vs15_path!Common7\Tools\"
	goto :end
     )
   )
)
:end

It's best to leave windows decide where VS is installed rather than guessing (even if it's successful for 99% of the cases). I used to install software which required many GB to another partition since C: was tiny.

About the message of the toolchain I think it's correct. Keep it simple ;) You might want to keep your changes as a backup and start over, but consult the devs too. Good luck!

EDIT: Wrong code quote

brauch is referring to this

for /f "usebackq tokens=3*" %%a in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" /s`) do (
     set vs15_path=%%a %%b
     if exist "!vs15_path!Common7\Tools\VsDevCmd.bat" (
	set "VS150COMNTOOLS=!vs15_path!Common7\Tools\"
	goto :end
     )
   )
)
:end

Oops. What happened here is I was hacking on the release version which looks more like the patch I posted. I'll see if I can make sense of the master branch version and make it more like that!

It's best to leave windows decide where VS is installed rather than guessing (even if it's successful for 99% of the cases). I used to install software which required many GB to another partition since C: was tiny.

About the message of the toolchain I think it's correct. Keep it simple ;) You might want to keep your changes as a backup and start over, but consult the devs too. Good luck!

Ping? Please keep hammering the iron while hot :)

Ping? Please keep hammering the iron while hot :)

I'm sorry. I haven't forgotten. I have just covered with hot irons for quite awhile :). I am currently on travel and I will be for several more weeks but when I am able to get my VM working again I will make sure to update this patch

Actually, there is a bit of a problem... The version of the file currently on master is bugged :(

See: https://phabricator.kde.org/D17908#492404

Actually, there is a bit of a problem... The version of the file currently on master is bugged :(

See: https://phabricator.kde.org/D17908#492404

Any progress with the MS tool?

Actually, there is a bit of a problem... The version of the file currently on master is bugged :(

See: https://phabricator.kde.org/D17908#492404

Any progress with the MS tool?

Not really. Here is a blog post which provides suggestions for how to use it: https://renenyffenegger.ch/notes/Windows/development/Visual-Studio/environment-variables/index

Things are going to be crazy for me until probably September, so if you want to have a look in to this I would appreciate it. I can probably test whatever you come up with if you ping me :)