Skip to content

Provide better diagnostics to non-admin users of 'integrate install'. #1036

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

Merged
merged 8 commits into from
May 2, 2023
Merged

Provide better diagnostics to non-admin users of 'integrate install'. #1036

merged 8 commits into from
May 2, 2023

Conversation

dubejf
Copy link
Contributor

@dubejf dubejf commented Apr 23, 2023

Building up on #1034, this PR treats failures as warnings in integrate_install_msbuild14().

1) Happy path

.\vcpkg.exe integrate install
[green] Applied user-wide integration for this vcpkg root.
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=..../vcpkg/scripts/buildsystems/vcpkg.cmake"

All MSBuild C++ projects can now #include any installed libraries. Linking will be handled automatically. Installing new libraries will make them instantly available.

No change. This is fine.

2) With %LOCALAPPDATA%\vcpkg set as read-only

.\vcpkg.exe integrate install
[red] write_contents("C:\Users\...\AppData\Local\vcpkg\vcpkg.user.props"): permission denied

No change. This failure mode seems unlikely, and the simplicity of a hard error is reasonable to me.

3) Declining UAC elevation to modify MSBuild14 files under to C:\Program Files (x86)\

.\vcpkg.exe integrate install
[yellow] warning: failed to install system targets file to C:\Program Files (x86)\MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props
[yellow] warning: Integration was not applied.
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=...../vcpkg/scripts/buildsystems/vcpkg.cmake"

All MSBuild C++ projects can now #include any installed libraries. Linking will be handled automatically. Installing new libraries will make them instantly available.

For users only interested in VS2017 and later toolchains, this is more informative than the current version, which fails with either

[current version]
.\vcpkg.exe integrate install
[yellow] warning: Integration was not applied.

or

[current version]
.\vcpkg.exe integrate install
[red] failed to install system targets file to C:\Program Files (x86)\MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props

IMO the text in the new version should be improved ("Integration was not applied" should talk about partial success, "All MSBuild C++ projects..." is not strictly true here), but I didn't want to introduce new strings.

What do you think?

@dubejf
Copy link
Contributor Author

dubejf commented Apr 23, 2023

@microsoft-github-policy-service agree

BillyONeal
BillyONeal previously approved these changes Apr 27, 2023
@BillyONeal BillyONeal requested a review from ras0219-msft April 27, 2023 05:55
Copy link
Contributor

@ras0219-msft ras0219-msft left a comment

Choose a reason for hiding this comment

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

Sorry for the piecemeal review -- I didn't review closely enough the first time.

In your proposal, it seems like your intent is to keep all the "external" behavior the same (failures are still failures, successes are successes), but just change the messages displayed to the user to be more helpful. In that case, we need the exit codes to remain the same so that scripts/CI systems will react in the same way.

Thanks for the PR! It does look good to me after the exit code issue is resolved.

@BillyONeal BillyONeal dismissed their stale review May 1, 2023 19:57

Robert convinced me otherwise

@BillyONeal BillyONeal enabled auto-merge (squash) May 2, 2023 21:02
@BillyONeal BillyONeal merged commit 93e42ae into microsoft:main May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants