Skip to content

Remove capy auto-fetch so FetchContent consumers provide it themselves#221

Merged
sgerbino merged 1 commit intocppalliance:developfrom
sgerbino:pr/cmake-deps
Mar 31, 2026
Merged

Remove capy auto-fetch so FetchContent consumers provide it themselves#221
sgerbino merged 1 commit intocppalliance:developfrom
sgerbino:pr/cmake-deps

Conversation

@sgerbino
Copy link
Copy Markdown
Collaborator

@sgerbino sgerbino commented Mar 31, 2026

The three-tier capy resolution (target check, find_package, FetchContent) introduced order dependence and network non-determinism at configure time. Consumers now provide Boost::capy via their own mechanism; CMake resolves the target reference at generation time regardless of declaration order.

Resolves #217.

Summary by CodeRabbit

  • Documentation

    • Clarified CMake consumption instructions to require providing Capy and added an example showing both projects made available before linking.
  • Build Changes

    • Simplified dependency resolution so Corosio no longer fetches Capy automatically; installer now treats missing provided Capy as a library+headers-only install path.
  • CI/CD Updates

    • CI workflows updated to generate and consume a provider for consistent Capy configuration across build, coverage, and static-analysis matrix entries.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

📝 Walkthrough

Walkthrough

Removes Corosio's automatic Capy fetching; consumers must provide Capy themselves. CI gains steps that generate a top-level provide-capy.cmake and export Capy paths for specific matrix jobs; README updated to document explicit Capy provisioning via FetchContent or find_package.

Changes

Cohort / File(s) Summary
CI Workflow
​.github/workflows/ci.yml
Adds conditional step for build-cmake, coverage, and clang-tidy matrix entries to generate provide-capy.cmake, export COROSIO_CI_PROVIDE_CAPY and COROSIO_CI_CAPY_DIR, and pass -D CMAKE_PROJECT_boost_corosio_INCLUDE=... / -D COROSIO_CI_CAPY_SOURCE_DIR=... to standalone CMake invocations.
CMake Build Configuration
cmake/CorosioBuild.cmake
Removes auto-fetch/find_package logic for Capy from corosio_resolve_deps() so Corosio no longer fetches Capy; corosio_install() now detects an imported boost_capy target and otherwise limits install to libs+headers (removes boost_capy_FOUND fallback behavior).
Documentation
README.md
Deletes "Standalone build" section and updates "Consume via CMake" to state Capy must be provided by the consumer; adds FetchContent_Declare(capy ...) example and shows FetchContent_MakeAvailable(capy corosio).

Sequence Diagram(s)

sequenceDiagram
participant CI as GitHub Actions
participant Runner as Job Runner
participant Repo as corosio repo
participant CMake as CMake configure
participant Capy as Capy source (cloned/provided)

CI->>Runner: start matrix job (build-cmake / coverage / clang-tidy)
Runner->>Repo: checkout corosio
Runner->>Repo: generate provide-capy.cmake and set env vars
Runner->>Capy: expose COROSIO_CI_CAPY_DIR (cloned source)
Runner->>CMake: invoke cmake with -D CMAKE_PROJECT_boost_corosio_INCLUDE=provide-capy.cmake and -D COROSIO_CI_CAPY_SOURCE_DIR
CMake->>Repo: include provided capy provider
CMake->>Capy: add_subdirectory(...) or consume provided target
CMake-->>Runner: configure completes using provided Capy
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hop, I nudged the fetch away,

Now you bring Capy to the play.
Compose your builds in any order bright,
CI hands a provider to set things right.
Hooray—carrots for reproducible nights! 🥕

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing capy auto-fetch logic and shifting responsibility to FetchContent consumers to provide it themselves.
Linked Issues check ✅ Passed All coding requirements from issue #217 are met: auto-fetch fallback logic removed from corosio_resolve_deps, three-tier capy resolution eliminated, order independence achieved, and README updated with migration guidance.
Out of Scope Changes check ✅ Passed All changes are directly scoped to requirements in #217: removing auto-fetch logic, updating CMake configuration, modifying CI workflows for standalone builds, and updating README documentation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cppalliance-bot
Copy link
Copy Markdown

cppalliance-bot commented Mar 31, 2026

An automated preview of the documentation is available at https://221.corosio.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-03-31 21:42:10 UTC

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.github/workflows/ci.yml (1)

631-632: Quote injected CMake path values for path-safety.

These -D arguments work in current runners, but quoting makes them robust for workspace paths containing spaces.

🛠️ Suggested hardening patch
-            -D CMAKE_PROJECT_boost_corosio_INCLUDE=${{ env.COROSIO_CI_PROVIDE_CAPY }}
-            -D COROSIO_CI_CAPY_SOURCE_DIR=${{ env.COROSIO_CI_CAPY_DIR }}
+            -D CMAKE_PROJECT_boost_corosio_INCLUDE="${{ env.COROSIO_CI_PROVIDE_CAPY }}"
+            -D COROSIO_CI_CAPY_SOURCE_DIR="${{ env.COROSIO_CI_CAPY_DIR }}"
...
-            -D CMAKE_PROJECT_boost_corosio_INCLUDE=${{ env.COROSIO_CI_PROVIDE_CAPY }}
-            -D COROSIO_CI_CAPY_SOURCE_DIR=${{ env.COROSIO_CI_CAPY_DIR }}
+            -D CMAKE_PROJECT_boost_corosio_INCLUDE="${{ env.COROSIO_CI_PROVIDE_CAPY }}"
+            -D COROSIO_CI_CAPY_SOURCE_DIR="${{ env.COROSIO_CI_CAPY_DIR }}"

Also applies to: 657-658

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 631 - 632, The CMake -D arguments pass
unquoted path variables which can break when workspace paths contain spaces;
update the invocations that set CMAKE_PROJECT_boost_corosio_INCLUDE and
COROSIO_CI_CAPY_SOURCE_DIR (and the similar occurrences for the other two
occurrences at the later block) to wrap the injected env values in quotes so the
entire path is treated as a single argument by CMake; locate the -D
CMAKE_PROJECT_boost_corosio_INCLUDE and -D COROSIO_CI_CAPY_SOURCE_DIR
occurrences and add quoting around the ${...} expansions.
README.md (1)

18-33: Add a short explanation of the FetchContent arguments after the snippet.

The command block is good, but readers still need a brief explanation of why GIT_TAG and GIT_SHALLOW are set and what FetchContent_MakeAvailable(capy corosio) guarantees.

✍️ Suggested documentation patch
 FetchContent_MakeAvailable(capy corosio)

 target_link_libraries(my_app Boost::corosio)

+This configuration fetches both dependencies and makes their targets available in
+the current build so Boost::corosio can resolve its Boost::capy link target.
+GIT_TAG selects the branch to fetch, and GIT_SHALLOW TRUE reduces clone depth
+to speed up dependency retrieval in CI and local configure runs.

</details>


As per coding guidelines: “In documentation, place all commands on their own line in a code block. Precede with a description of what the command does. After the command, explain arguments and why they're used.”

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @README.md around lines 18 - 33, Add a short explanatory paragraph
immediately after the CMake snippet that briefly states that the
FetchContent_Declare calls fetch the capy and corosio dependencies and that
FetchContent_MakeAvailable(capy corosio) makes their CMake targets available in
the current build so Boost::corosio can resolve its Boost::capy link target;
also explain that GIT_TAG selects the branch or commit to fetch and GIT_SHALLOW
TRUE reduces clone depth to speed up CI/local configure runs.


</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/ci.yml:

  • Around line 631-632: The CMake -D arguments pass unquoted path variables which
    can break when workspace paths contain spaces; update the invocations that set
    CMAKE_PROJECT_boost_corosio_INCLUDE and COROSIO_CI_CAPY_SOURCE_DIR (and the
    similar occurrences for the other two occurrences at the later block) to wrap
    the injected env values in quotes so the entire path is treated as a single
    argument by CMake; locate the -D CMAKE_PROJECT_boost_corosio_INCLUDE and -D
    COROSIO_CI_CAPY_SOURCE_DIR occurrences and add quoting around the ${...}
    expansions.

In @README.md:

  • Around line 18-33: Add a short explanatory paragraph immediately after the
    CMake snippet that briefly states that the FetchContent_Declare calls fetch the
    capy and corosio dependencies and that FetchContent_MakeAvailable(capy corosio)
    makes their CMake targets available in the current build so Boost::corosio can
    resolve its Boost::capy link target; also explain that GIT_TAG selects the
    branch or commit to fetch and GIT_SHALLOW TRUE reduces clone depth to speed up
    CI/local configure runs.

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: Path: .coderabbit.yaml

**Review profile**: CHILL

**Plan**: Pro

**Run ID**: `0e13edb6-10f4-42e9-8f70-be02121cd008`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 7d29b692ec1e6e17491308dc52beafeb55a81813 and f9ecacd2339c494274d3c823ef946ac9ece8af56.

</details>

<details>
<summary>📒 Files selected for processing (3)</summary>

* `.github/workflows/ci.yml`
* `README.md`
* `cmake/CorosioBuild.cmake`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@cppalliance-bot
Copy link
Copy Markdown

cppalliance-bot commented Mar 31, 2026

GCOVR code coverage report https://221.corosio.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://221.corosio.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://221.corosio.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-03-31 21:49:56 UTC

The three-tier capy resolution (target check, find_package, FetchContent)
introduced order dependence and network non-determinism at configure time.
Consumers now provide Boost::capy via their own mechanism; CMake resolves
the target reference at generation time regardless of declaration order.
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 21-31: Add explanatory prose around the CMake snippet: for each
FetchContent_Declare call (capy and corosio) add short descriptions of the
keyword arguments GIT_REPOSITORY (where sources are cloned from), GIT_TAG (which
commit/branch/tag to checkout and why 'develop' was chosen), and GIT_SHALLOW
(that it performs a shallow clone to reduce download size), and a sentence after
FetchContent_MakeAvailable explaining that it downloads, configures and makes
the declared projects available to the build (and why calling it here is
necessary). Reference the existing symbols FetchContent_Declare, GIT_REPOSITORY,
GIT_TAG, GIT_SHALLOW, and FetchContent_MakeAvailable in the prose so readers can
map each explanation to the exact command/argument in the snippet.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 53ea5c4f-22dc-44db-9e4a-0bf1734f81a0

📥 Commits

Reviewing files that changed from the base of the PR and between f9ecacd and 151dcdf.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • README.md
  • cmake/CorosioBuild.cmake

Comment on lines +21 to 31
FetchContent_Declare(capy
GIT_REPOSITORY https://github.com/cppalliance/capy.git
GIT_TAG develop
GIT_SHALLOW TRUE)
FetchContent_Declare(corosio
GIT_REPOSITORY https://github.com/cppalliance/corosio.git
GIT_TAG develop
GIT_SHALLOW TRUE)
FetchContent_MakeAvailable(corosio)

FetchContent_MakeAvailable(capy corosio)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add command/argument explanations around the CMake snippet

The snippet is correct, but it does not explain what each command/argument does (for example GIT_TAG, GIT_SHALLOW, and FetchContent_MakeAvailable(...)) or why those values are used. This repo’s doc rules require that detail for reader guidance.

Suggested doc patch
 include(FetchContent)

+# Declare Capy first so CMake knows where to download it from.
+# `GIT_TAG` selects the branch or tag to check out.
+# `GIT_SHALLOW TRUE` reduces clone size and speeds up configure time.
 FetchContent_Declare(capy
     GIT_REPOSITORY https://github.com/cppalliance/capy.git
     GIT_TAG develop
     GIT_SHALLOW TRUE)
+# Declare Corosio in the same way.
 FetchContent_Declare(corosio
     GIT_REPOSITORY https://github.com/cppalliance/corosio.git
     GIT_TAG develop
     GIT_SHALLOW TRUE)

+# Make both dependencies available to the current build.
+# This ensures `Boost::capy` exists when `Boost::corosio` is linked.
 FetchContent_MakeAvailable(capy corosio)

As per coding guidelines, “every command includes detailed explanation, and every code block is followed by prose explaining what it does and why.”

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 21 - 31, Add explanatory prose around the CMake
snippet: for each FetchContent_Declare call (capy and corosio) add short
descriptions of the keyword arguments GIT_REPOSITORY (where sources are cloned
from), GIT_TAG (which commit/branch/tag to checkout and why 'develop' was
chosen), and GIT_SHALLOW (that it performs a shallow clone to reduce download
size), and a sentence after FetchContent_MakeAvailable explaining that it
downloads, configures and makes the declared projects available to the build
(and why calling it here is necessary). Reference the existing symbols
FetchContent_Declare, GIT_REPOSITORY, GIT_TAG, GIT_SHALLOW, and
FetchContent_MakeAvailable in the prose so readers can map each explanation to
the exact command/argument in the snippet.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.89%. Comparing base (7d29b69) to head (151dcdf).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #221   +/-   ##
========================================
  Coverage    77.89%   77.89%           
========================================
  Files           96       96           
  Lines         7369     7369           
  Branches      1794     1794           
========================================
  Hits          5740     5740           
  Misses        1110     1110           
  Partials       519      519           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d29b69...151dcdf. Read the comment docs.

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

@sgerbino sgerbino merged commit 5b59fe9 into cppalliance:develop Mar 31, 2026
42 checks passed
@sgerbino sgerbino deleted the pr/cmake-deps branch March 31, 2026 22:05
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.

FetchContent consumers should provide capy dependency themselves

2 participants