Skip to content

avoid rebuilding qtkeychain on each build - #512

Merged
nschimme merged 1 commit into
MUME:masterfrom
nschimme:fix-qtkeychain
Apr 11, 2026
Merged

avoid rebuilding qtkeychain on each build#512
nschimme merged 1 commit into
MUME:masterfrom
nschimme:fix-qtkeychain

Conversation

@nschimme

@nschimme nschimme commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Avoid rebuilding the bundled QtKeychain external project when its compiled artifacts already exist and expose consistent include and library paths from the build directory.

Enhancements:

  • Guard the QtKeychain ExternalProject configuration with an existence check on the built shared library to skip redundant rebuilds across CMake reconfigurations.
  • Normalize and export QtKeychain include and library directory variables based on the fixed qtkeychain-build location instead of ExternalProject-derived paths.

@sourcery-ai

sourcery-ai Bot commented Apr 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adjusts the qtkeychain ExternalProject integration in CMake so that previously built artifacts are reused instead of rebuilding qtkeychain on every configure/build, while centralizing binary/include path handling and preserving Windows deployment logic.

File-Level Changes

Change Details Files
Reuse an existing qtkeychain build if its shared library already exists, instead of always configuring an ExternalProject build.
  • Define QTKEYCHAIN_SHARED_LIBRARY and QTKEYCHAIN_LIBRARY paths directly from CMAKE_CURRENT_BINARY_DIR instead of querying ExternalProject properties.
  • Introduce an EXISTS check on the computed shared library path to decide between creating dummy targets and configuring ExternalProject_Add.
  • When the library already exists, create no-op qtkeychain_repo and qtkeychain targets while still wiring qtkeychain to depend on qtkeychain_repo for compatibility.
external/qtkeychain/CMakeLists.txt
Refine ExternalProject_Add configuration and related CMake variables for qtkeychain, keeping build settings but preventing unnecessary rebuilds.
  • Replace the deprecated ALWAYS argument with BUILD_ALWAYS 0 in ExternalProject_Add to avoid unconditional rebuilds.
  • Use QTKEYCHAIN_SHARED_LIBRARY and explicit .lib path in BUILD_BYPRODUCTS instead of hard-coded template paths.
  • Ensure QTKEYCHAIN_LIBRARIES, QTKEYCHAIN_LIBRARY, QTKEYCHAIN_INCLUDE_DIR, and QTKEYCHAIN_LIBRARY_DIR are set using consistent qtkeychain-build locations and exported to the parent scope.
external/qtkeychain/CMakeLists.txt
Preserve and slightly restructure Windows-specific deployment of the qtkeychain DLL while hooking it into the new build flow.
  • Move the Windows deployment custom command and qtkeychain_copy target inside the new else-branch that runs when qtkeychain needs to be built.
  • Keep MSVC vs non-MSVC handling of the deployment destination path while updating dependencies so qtkeychain still depends on qtkeychain_copy and qtkeychain_repo.
  • Ensure the DLL copy step uses the computed QTKEYCHAIN_SHARED_LIBRARY path under qtkeychain-build/bin.
external/qtkeychain/CMakeLists.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Changing ALWAYS 0 to BUILD_ALWAYS 0 in ExternalProject_Add may not be a recognized option for ExternalProject in some CMake versions; double‑check the correct keyword (likely ALWAYS) to avoid silently breaking the rebuild behavior.
  • When QTKEYCHAIN_SHARED_LIBRARY already exists, the Windows‑only copy step (qtkeychain_copy / DLL deployment) is skipped in the new flow; consider wiring the deploy/copy logic to run in the 'already built' path as well so the runtime output directory stays in sync.
  • The assignments of QTKEYCHAIN_INCLUDE_DIR and QTKEYCHAIN_LIBRARY_DIR are duplicated (once before the if(EXISTS ...) and again at the end); you can remove the redundancy to keep the CMake logic simpler and less error‑prone.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Changing `ALWAYS 0` to `BUILD_ALWAYS 0` in `ExternalProject_Add` may not be a recognized option for `ExternalProject` in some CMake versions; double‑check the correct keyword (likely `ALWAYS`) to avoid silently breaking the rebuild behavior.
- When `QTKEYCHAIN_SHARED_LIBRARY` already exists, the Windows‑only copy step (`qtkeychain_copy` / DLL deployment) is skipped in the new flow; consider wiring the deploy/copy logic to run in the 'already built' path as well so the runtime output directory stays in sync.
- The assignments of `QTKEYCHAIN_INCLUDE_DIR` and `QTKEYCHAIN_LIBRARY_DIR` are duplicated (once before the `if(EXISTS ...)` and again at the end); you can remove the redundancy to keep the CMake logic simpler and less error‑prone.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov

codecov Bot commented Apr 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 25.21%. Comparing base (5d245c3) to head (aabbbde).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #512      +/-   ##
==========================================
- Coverage   25.21%   25.21%   -0.01%     
==========================================
  Files         512      512              
  Lines       42367    42367              
  Branches     4577     4579       +2     
==========================================
- Hits        10683    10681       -2     
- Misses      31684    31686       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nschimme
nschimme merged commit 4de6287 into MUME:master Apr 11, 2026
20 checks passed
@nschimme
nschimme deleted the fix-qtkeychain branch April 11, 2026 21:46
nschimme added a commit to nschimme/MMapper that referenced this pull request Apr 14, 2026
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.

1 participant