Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msvc: Allow building with Visual Studio Preview versions #1711

Merged
merged 3 commits into from
Dec 22, 2023

Conversation

sankhesh
Copy link
Contributor

@sankhesh sankhesh commented Sep 27, 2023

This change allows compiling ycmd against latest Visual Studio Preview versions.

Tested against Visual Studio 2022 Community version 17.8.0 Preview 2.0.


This change is Reviewable

@bstaletic
Copy link
Collaborator

Thanks for the pull request.
While I am not at all against this, I would like to know what -prerelease does.
Apologies, but I do not have a Windows machine handy.

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 2 LGTMs obtained (waiting on @sankhesh)


build.py line 129 at r1 (raw file):

      print( "Calling vswhere -latest -installationVersion" )
    latest_full_v = subprocess.check_output(
      [ VSWHERE_EXE, '-latest', '-prerelease', '-property', 'installationVersion' ]

Please can you explain canonically what this does? We don’t want to always use prerelease versions. In fact I’d rather not support them at all as we will never test with them. I’m happy to make it work by chance or by opt-in, but not by default.

@sankhesh
Copy link
Contributor Author

With -prerelease, vswhere also returns any prereleases/preview versions along with the release versions.
See doc: https://github.com/microsoft/vswhere/blob/f791b32483204ad3b0ff3cdce57a0c85ee119a8f/src/vswhere.lib/vswhere.lib.rc#L80

The current code defaults to the latest without user opt-in/choice if there are multiple versions. This change just extends it further to allow latest Preview versions as well. Note that without this change, if I just have VS Preview version installed (with valid MSVC compiler), ycmd build fails with the error that MSVC could not be found.

@puremourning
Copy link
Member

With -prerelease, vswhere also returns any prereleases/preview versions along with the release versions.

See doc: https://github.com/microsoft/vswhere/blob/f791b32483204ad3b0ff3cdce57a0c85ee119a8f/src/vswhere.lib/vswhere.lib.rc#L80

The current code defaults to the latest without user opt-in/choice if there are multiple versions. This change just extends it further to allow latest Preview versions as well. Note that without this change, if I just have VS Preview version installed (with valid MSVC compiler), ycmd build fails with the error that MSVC could not be found.

If I have both a released and pre-release version, which is picked?

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 2 LGTMs obtained (waiting on @sankhesh)

a discussion (no related file):
Flake8 error means ci is broken. Line too long.


@sankhesh
Copy link
Contributor Author

sankhesh commented Oct 3, 2023

If I have both a released and pre-release version, which is picked?

I am not an expert but IMHO, because of the -latest flag, the later of the two versions will be picked i.e. between VS2019 Preview and VS 2022, the latter will be chosen.

Flake8 error means ci is broken. Line too long.

Thanks, I'll fix that.

Copy link
Collaborator

@bstaletic bstaletic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am in favour of this. MS takes ages between two non-preview releases and I know that some people do use latest preview only. Plus MS likes to write blog posts about how latest preview versions are the bestest.

:lgtm:

@sankhesh Would you mind using reviewable for the review. It helps keep discussion threads in order and has some nice features.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: 1 of 2 LGTMs obtained (waiting on @sankhesh)

Copy link
Contributor Author

@sankhesh sankhesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure 👍

Reviewable status: 0 of 2 LGTMs obtained (and 1 stale) (waiting on @bstaletic and @puremourning)

a discussion (no related file):

Previously, puremourning (Ben Jackson) wrote…

Flake8 error means ci is broken. Line too long.

Done.



build.py line 129 at r1 (raw file):

Previously, puremourning (Ben Jackson) wrote…

Please can you explain canonically what this does? We don’t want to always use prerelease versions. In fact I’d rather not support them at all as we will never test with them. I’m happy to make it work by chance or by opt-in, but not by default.

Done

@sankhesh
Copy link
Contributor Author

sankhesh commented Oct 6, 2023

Hmm.. I don't know why that CI is failing.

@bstaletic
Copy link
Collaborator

It happens. Windows jobs are a little flakey.

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Merging #1711 (aba1b1d) into master (e755af6) will decrease coverage by 0.01%.
Report is 16 commits behind head on master.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1711      +/-   ##
==========================================
- Coverage   95.42%   95.41%   -0.01%     
==========================================
  Files          83       83              
  Lines        8123     8131       +8     
  Branches      164      165       +1     
==========================================
+ Hits         7751     7758       +7     
  Misses        322      322              
- Partials       50       51       +1     

@sankhesh
Copy link
Contributor Author

@bstaletic @puremourning Good to merge?

@bstaletic
Copy link
Collaborator

I am ok with this pull request, but @puremourning said he would prefer this to be opt-in.

I’m happy to make it work by chance or by opt-in, but not by default.

So could you add an option like --preview-msvc (or smothing, naming is hard) to the argument parser in build.py?

This flag allows compiling against the latest MSVC preview version. By
default, this is disabled; meaning only the latest stable MSVC release
is used.
@sankhesh
Copy link
Contributor Author

sankhesh commented Dec 1, 2023

@bstaletic @puremourning The latest commit adds the --preview-msvc option.

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

thanks!

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: 1 of 2 LGTMs obtained (and 1 stale) (waiting on @sankhesh)

@puremourning puremourning added the Ship It! Manual override to merge a PR by maintainer label Dec 12, 2023
Copy link
Contributor Author

@sankhesh sankhesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 2 of 2 LGTMs obtained (and 1 stale) (waiting on @puremourning)

Copy link
Contributor Author

@sankhesh sankhesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! 2 of 2 LGTMs obtained (and 1 stale) (waiting on @puremourning)

Copy link
Contributor

mergify bot commented Dec 22, 2023

Thanks for sending a PR!

1 similar comment
Copy link
Contributor

mergify bot commented Dec 22, 2023

Thanks for sending a PR!

@sankhesh
Copy link
Contributor Author

@bstaletic @puremourning Anything else needed here?

@puremourning
Copy link
Member

@bstaletic @puremourning Anything else needed here?

Well, CI is failing, so we will need to resolve that before merging.

Copy link
Contributor

mergify bot commented Dec 22, 2023

Thanks for sending a PR!

@mergify mergify bot merged commit f4cfdb8 into ycm-core:master Dec 22, 2023
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ship It! Manual override to merge a PR by maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants