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

Emit an error for duplicate overrides. #1573

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

BillyONeal
Copy link
Member

@BillyONeal BillyONeal commented Jan 16, 2025

Also makes Json::IDeserializer no longer need a virtual dtor.

Before (first one wins):

PS D:\test> type vcpkg.json
{
  "dependencies": [
    "zlib"
  ],
  "overrides": [{"name": "zlib", "version": "1.2.13"}, {"name": "zlib", "version": "1.3.1"}]
}

[...]

Installing 2/2 zlib:[email protected]...
Building zlib:[email protected]...
C:\Users\bion\AppData\Local\vcpkg\registries\git-trees\ad5a49006f73b45b715299515f31164131b51982: info: installing overlay port from here
-- Using cached madler-zlib-v1.2.13.tar.gz.
-- Extracting source D:/vcpkg-downloads/madler-zlib-v1.2.13.tar.gz
-- Applying patch 0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch
-- Applying patch 0002-skip-building-examples.patch
-- Applying patch 0003-build-static-or-shared-not-both.patch
-- Applying patch 0004-android-and-mingw-fixes.patch
-- Using source at D:/vcpkg/buildtrees/zlib/src/v1.2.13-f30d2a168d.clean
-- Found external ninja('1.12.1').
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
-- Installing: D:/vcpkg/packages/zlib_x64-windows/share/zlib/vcpkg-cmake-wrapper.cmake
-- Fixing pkgconfig file: D:/vcpkg/packages/zlib_x64-windows/lib/pkgconfig/zlib.pc
-- Using cached msys2-mingw-w64-x86_64-pkgconf-1~2.3.0-1-any.pkg.tar.zst.
-- Using cached msys2-msys2-runtime-3.5.4-2-x86_64.pkg.tar.zst.
-- Using msys root at D:/vcpkg-downloads/tools/msys2/21caed2f81ec917b
-- Fixing pkgconfig file: D:/vcpkg/packages/zlib_x64-windows/debug/lib/pkgconfig/zlib.pc
-- Installing: D:/vcpkg/packages/zlib_x64-windows/share/zlib/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 93.9 ms.
Elapsed time to handle zlib:x64-windows: 3.7 s
zlib:x64-windows package ABI: a858cb84557b70b9fa3b3934233ce9667bef3fcf11c99b00070f799cc44bff14
Total install time: 3.7 s
The package zlib is compatible with built-in CMake targets:

    find_package(ZLIB REQUIRED)
    target_link_libraries(main PRIVATE ZLIB::ZLIB)

After: (an error)

D:\test\vcpkg.json: error: $.overrides[1] (an override): zlib already has an override
note: Extended documentation available at 'https://learn.microsoft.com/vcpkg/users/manifests?WT.mc_id=vcpkg_inproduct_cli'.

Resolves https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1665249

Also makes Json::IDeserializer no longer need a virtual dtor.

Before (first one wins):

PS D:\test> type vcpkg.json
{
  "dependencies": [
    "zlib"
  ],
  "overrides": [{"name": "zlib", "version": "1.2.13"}, {"name": "zlib", "version": "1.3.1"}]
}

Installing 2/2 zlib:[email protected]...
Building zlib:[email protected]...
C:\Users\bion\AppData\Local\vcpkg\registries\git-trees\ad5a49006f73b45b715299515f31164131b51982: info: installing overlay port from here
-- Using cached madler-zlib-v1.2.13.tar.gz.
-- Extracting source D:/vcpkg-downloads/madler-zlib-v1.2.13.tar.gz
-- Applying patch 0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch
-- Applying patch 0002-skip-building-examples.patch
-- Applying patch 0003-build-static-or-shared-not-both.patch
-- Applying patch 0004-android-and-mingw-fixes.patch
-- Using source at D:/vcpkg/buildtrees/zlib/src/v1.2.13-f30d2a168d.clean
-- Found external ninja('1.12.1').
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
-- Installing: D:/vcpkg/packages/zlib_x64-windows/share/zlib/vcpkg-cmake-wrapper.cmake
-- Fixing pkgconfig file: D:/vcpkg/packages/zlib_x64-windows/lib/pkgconfig/zlib.pc
-- Using cached msys2-mingw-w64-x86_64-pkgconf-1~2.3.0-1-any.pkg.tar.zst.
-- Using cached msys2-msys2-runtime-3.5.4-2-x86_64.pkg.tar.zst.
-- Using msys root at D:/vcpkg-downloads/tools/msys2/21caed2f81ec917b
-- Fixing pkgconfig file: D:/vcpkg/packages/zlib_x64-windows/debug/lib/pkgconfig/zlib.pc
-- Installing: D:/vcpkg/packages/zlib_x64-windows/share/zlib/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 93.9 ms.
Elapsed time to handle zlib:x64-windows: 3.7 s
zlib:x64-windows package ABI: a858cb84557b70b9fa3b3934233ce9667bef3fcf11c99b00070f799cc44bff14
Total install time: 3.7 s
The package zlib is compatible with built-in CMake targets:

    find_package(ZLIB REQUIRED)
    target_link_libraries(main PRIVATE ZLIB::ZLIB)

After: (an error)
D:\test\vcpkg.json: error: $.overrides[1] (an override): zlib already has a declared override
note: Extended documentation available at 'https://learn.microsoft.com/vcpkg/users/manifests?WT.mc_id=vcpkg_inproduct_cli'.

Resolves https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1665249
@Thomas1664
Copy link
Contributor

Thomas1664 commented Jan 16, 2025

I think this needs documentation

@BillyONeal
Copy link
Member Author

I think this needs documentation

microsoft/vcpkg-docs#438

@BillyONeal BillyONeal merged commit a5528f3 into microsoft:main Jan 17, 2025
6 checks passed
@BillyONeal BillyONeal deleted the bad-overrides-fix branch January 17, 2025 19:57
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