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

build: Add outcome and quickcpplib dependency. #39

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Bill-hbrhbr
Copy link
Collaborator

@Bill-hbrhbr Bill-hbrhbr commented Mar 17, 2025

Description

Summary

Adds a new dep outcome, which requires quickcpplib.

Before C++23 std::expected<T, E> becomes fully supported on all compilers and platforms, we use outcome for functions that wish to return either a value type or an error code type (preferably derived from ystdlib::error_handling::ErrorCode).

In CLP, the current way to use outcome is to clone the repo and use its single header file. However, this results in slower compilation time and execution time versus directly using a built and installed outcome library.

Implementation details:

  • deps:install-all is split into multiple tasks:
    • deps:install-all-init: Does all the preparation work before installing deps.
    • deps:install-all-run: Runs deps install in parallel, but respect the inter-dependencies between different packages.
    • deps:install-all-finish: Writes to a cmake settings file G_DEPS_CMAKE_SETTINGS_FILE that allows ystdlib-cpp to find all its required components.

Potential issues:

  • quickcpplib doesn't have any versioning or tag refs, and outcome always uses the master/main branch of quickcpplib because they are from the same author. This could result in our file256 hash becoming stale if the master is updated, but Task may fail to recognize that the deps need to be reinstalled.
    • Solution: We've decided to fix quickcpplib to a version that's compatible with our outcome version to ensure build robustness.
  • :utils:cmake:generate
    is unnecessarily triggered every time deps:install-all runs due to an md5sum mismatch of <packageName>-src.
    Since some dep packages clone their own dependencies during the CMake configure stage, this significantly increases build time.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • outcome and quickcpplib successfully found while building ystdlib-cpp.

Summary by CodeRabbit

  • New Features
    • Introduced new variables and tasks for managing the installation of Outcome and QuickCppLib libraries, enhancing dependency support.
  • Chores
    • Streamlined configuration settings and updated dependency paths to improve the build process's robustness and reliability.
    • Updated the regex pattern to include both catch2 and outcome for library header matching.

Copy link

coderabbitai bot commented Mar 17, 2025

Walkthrough

This pull request updates the build configuration and dependency management. In the CMake configuration, the dependency inclusion order is reorganized, the path for dependency settings is updated, and a new check for the Outcome library is introduced using find_package(outcome REQUIRED). Additionally, the YAML task configurations have been enhanced by adding new variables and tasks to support Outcome and QuickCppLib installations. The changes also refine the construction of the CMake settings file path and add subtasks to the overall dependency installation workflow. There are no changes to public interface declarations.

Changes

File(s) Change Summary
CMakeLists.txt - Reorganized inclusion order by moving ystdlib-cpp-helpers to the top
- Updated dependency settings path from build/deps/settings.cmake to build/deps/CMake/settings.cmake
- Added a block to check for the Outcome library using find_package(outcome REQUIRED), printing a status if found and triggering a fatal error otherwise
taskfiles/deps.yaml - Introduced new variables: G_OUTCOME_LIB_NAME, G_OUTCOME_WORK_DIR, G_QUICKCPPLIB_LIB_NAME, G_QUICKCPPLIB_WORK_DIR
- Modified the install-all task to include new subtasks: install-all-init, install-all-run, and install-all-finish
- Added tasks install-outcome, install-quickcpplib, and add-package-root-to-cmake-settings for managing dependency installation and setting package roots
taskfile.yaml - Added new variable G_DEPS_CMAKE_SETTINGS_DIR to construct the CMake settings directory
- Updated G_DEPS_CMAKE_SETTINGS_FILE to reference the new directory variable instead of a fixed path

Sequence Diagram(s)

Outcome Library Check in CMake

sequenceDiagram
    autonumber
    participant CMake as CMake Build System
    participant OutcomeLib as Outcome Library

    CMake->>OutcomeLib: find_package(outcome REQUIRED)
    alt Outcome Found
        OutcomeLib-->>CMake: Return success (print status)
    else Outcome Not Found
        OutcomeLib-->>CMake: Trigger fatal error
    end
Loading

Dependency Installation Workflow

sequenceDiagram
    autonumber
    participant User as User
    participant Engine as Task Engine
    participant Init as install-all-init
    participant Outcome as install-outcome
    participant QuickCpp as install-quickcpplib
    participant Finish as install-all-finish
    participant Settings as add-package-root-to-cmake-settings

    User->>Engine: Trigger install-all task
    Engine->>Init: Run install-all-init (create deps dir, remove old settings)
    Engine->>Outcome: Run install-outcome (download Outcome, verify checksum)
    Outcome->>Settings: Set package root for Outcome
    Engine->>QuickCpp: Run install-quickcpplib (download, verify checksum)
    QuickCpp->>Settings: Set package root for QuickCppLib
    Engine->>Finish: Run install-all-finish (append include statements)
    Engine-->>User: Installation completed
Loading

Possibly related PRs

Suggested reviewers

  • davidlion
  • kirkrodrigues

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Bill-hbrhbr Bill-hbrhbr changed the title Add outcome dependency build: Add outcome dependency. Mar 17, 2025
@Bill-hbrhbr Bill-hbrhbr changed the title build: Add outcome dependency. build: Add outcome and quickcpplib dependency. Mar 17, 2025
@Bill-hbrhbr Bill-hbrhbr marked this pull request as ready for review March 17, 2025 07:40
@Bill-hbrhbr Bill-hbrhbr requested a review from a team as a code owner March 17, 2025 07:40
Copy link

@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: 0

🧹 Nitpick comments (5)
CMakeLists.txt (1)

84-86: Module Path Inclusion Reordering
Moving the list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/CMake) statement so that it comes after the outcome dependency check is logically sound. However, adding a brief comment explaining why this reordering benefits the build (e.g. to avoid potential module conflicts) would help future maintainers.

taskfiles/deps.yaml (4)

6-9: Definition of New Variables
The new variables (G_OUTCOME_LIB_NAME, G_OUTCOME_WORK_DIR, G_QUICKCPPLIB_LIB_NAME, and G_QUICKCPPLIB_WORK_DIR) are clearly defined and follow an intuitive naming convention. Suggestion: Consider pinning the quickcpplib dependency to a specific version rather than using the master branch to enhance reproducibility and stability in builds.


18-27: Initial Dependency Setup Task
The install-all-init task correctly creates the required dependencies directory and removes any existing CMake settings file. The inclusion of a command to set CMP0074 is a good detail. Please verify that appending to the settings file does not lead to format issues if the file is empty or missing a trailing newline.


35-47: Centralised Package Root Setting
The add-package-root-to-settings task is implemented cleanly, using variables to dynamically insert the package root into the CMake settings file. The inclusion of comments about the atomicity of writes is appreciated. A slight enhancement could be to add a brief note on why this atomicity is critical (i.e. preventing race conditions during file writes).


84-100: QuickCppLib Installation Task
The task for installing QuickCppLib is well defined and resembles the structure of the other dependency tasks. Important Note: The URL uses the master branch (archive/master.tar.gz), which could lead to non-reproducible builds. It is recommended to pin this dependency to a stable release tag if one is available.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f43a3b and 1852ade.

📒 Files selected for processing (2)
  • CMakeLists.txt (2 hunks)
  • taskfiles/deps.yaml (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: unit-tests
CMakeLists.txt

[warning] 1-1: CMake Deprecation Warning: Compatibility with CMake < 3.10 will be removed from a future version of CMake.


[warning] 24-24: CMake Deprecation Warning: Compatibility with CMake < 3.10 will be removed from a future version of CMake.


[warning] 51-51: CMake Warning (dev): Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules are removed.


[warning] 92-92: WARNING: git submodule update failed with code 0, trying a direct git clone.


[warning] 24-24: CMake Deprecation Warning: Compatibility with CMake < 3.10 will be removed from a future version of CMake.


[warning] 24-24: CMake Deprecation Warning: Compatibility with CMake < 3.10 will be removed from a future version of CMake.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: lint-check (macos-15)
🔇 Additional comments (5)
CMakeLists.txt (1)

53-58: Dependency Check for Outcome
The addition of find_package(outcome REQUIRED) along with the clear conditional messaging is well implemented. This ensures that a fatal error is raised if the Outcome library is not available. Be sure that the outcome package is installed consistently across target environments.

taskfiles/deps.yaml (4)

14-17: Splitting the Installation Workflow
Dividing the install-all task into install-all-init and install-all-run improves modularity and clarity of the dependency installation process. This separation makes the flow easier to manage and debug.


28-34: Sequential Execution in Installation Run
Explicitly listing sub-tasks (install-Catch2, install-outcome, and install-quickcpplib) in the install-all-run task guarantees that dependencies are installed in the correct order. Confirm that the declared dependency of Outcome on QuickCppLib (via deps: "install-quickcpplib") is functioning as expected.


48-62: Catch2 Installation Task
The install-Catch2 task is structured well, integrating the remote tarball download and then setting the package root via the helper task. The commands and variables are consistent with the overall dependency management approach.


63-83: Outcome Installation with Dependent QuickCppLib
The install-outcome task specifies a dependency on install-quickcpplib, which aligns with Outcome’s requirements. The task sets detailed parameters (including SHA256, URL, GEN_ARGS, and JOBS) correctly. Please ensure that the provided SHA256 checksum is current and that the GEN_ARGS meet your build configuration needs.

Copy link

@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: 0

🧹 Nitpick comments (2)
taskfiles/deps.yaml (2)

4-9: New Dependency Variables for Outcome and QuickCppLib
The addition of G_OUTCOME_LIB_NAME, G_OUTCOME_WORK_DIR, G_QUICKCPPLIB_LIB_NAME, and G_QUICKCPPLIB_WORK_DIR is clear and consistent with the existing naming conventions. Note that the PR objectives mention the lack of versioning for quickcpplib; you might consider pinning a specific version or commit in the future to protect against compatibility issues.


84-100: QuickCppLib Installation Task & Versioning Consideration
The install-quickcpplib task is implemented cleanly using the remote tarball approach. However, note that downloading from the master branch may risk instability due to the lack of explicit versioning. It would be prudent to consider pinning to a specific release or commit hash in the future to ensure build reproducibility.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1852ade and 5025f7d.

📒 Files selected for processing (3)
  • CMakeLists.txt (3 hunks)
  • taskfile.yaml (1 hunks)
  • taskfiles/deps.yaml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • CMakeLists.txt
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build-ystdlib-cpp (macos-15)
  • GitHub Check: lint-check (ubuntu-24.04)
  • GitHub Check: lint-check (macos-15)
🔇 Additional comments (7)
taskfile.yaml (1)

14-17: Directory & Settings File Variables Updated
The new variable G_DEPS_CMAKE_SETTINGS_DIR is introduced and the definition of G_DEPS_CMAKE_SETTINGS_FILE has been updated accordingly. This change improves modularity by centralising the CMake settings into its own subdirectory.

taskfiles/deps.yaml (6)

12-17: Splitting the Install-All Task
Dividing the install-all task into install-all-init and install-all-run increases clarity and control over the dependency installation sequence. This modular structure aids in maintaining inter-dependencies effectively during the build process.


18-23: Initialization Task – install-all-init
The install-all-init task neatly ensures that the CMake settings directory exists and cleans up any pre-existing settings file. This is a good safeguard. Just confirm that removing the settings file does not conflict with any parallel processes.


24-30: Installation Run Task – install-all-run
Defining the install-all-run task with dependencies on install-Catch2, install-outcome, and install-quickcpplib provides a logical flow to the installation process. It correctly enforces that outcome and quickcpplib are installed in the intended order.


31-47: Task to Add Package Root Settings
The new task add-package-root-to-settings is well-architected. It encapsulates the commands to write package-specific root settings into their own file, then includes that file in the overall CMake settings. The in-line comments regarding atomic writes add useful context. Ensure that your directory variable (G_DEPS_CMAKE_SETTINGS_DIR) is consistently defined across all tasks.


48-62: Catch2 Installation Task Enhancements
The install-Catch2 task now includes a call to add-package-root-to-settings to set its installation prefix. This integration is smooth and consistent with the overall dependency management approach.


63-83: Outcome Library Installation Task
The new install-outcome task is clearly structured. It correctly depends on install-quickcpplib to enforce the necessary installation order. The use of additional generator arguments referencing quickcpplib’s settings is a smart solution, though please double-check that the referenced file path is exactly as intended.

Copy link

@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: 0

🔭 Outside diff range comments (1)
taskfiles/deps.yaml (1)

89-105: ⚠️ Potential issue

QuickCppLib Installation Task and Version Pinning Concern

The install-quickcpplib task is implemented correctly. However, the URL points to the master branch tarball, which may result in unstable builds due to changes not being version-pinned. It is recommended to specify a version or commit hash to ensure reproducibility and stability over time.

🧹 Nitpick comments (2)
taskfiles/deps.yaml (2)

32-41: Finalisation Step: Appending CMake Settings

The install-all-finish task appends the include statements for each dependency’s CMake settings file. Although the multi-line echo command works here, please verify that the formatting—for example, newline characters and any extra whitespace—does not affect CMake’s parsing of the settings file.


42-52: Configuration of Package Root via CMake Settings

The add-package-root-to-cmake-settings task provides a generic approach to setting the installation prefix for each package. One suggestion is to ensure that, if newline escapes are intended in the echo command, you might consider using echo -e for consistency with other sections; otherwise, double-check that the output format meets CMake’s expectations.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5025f7d and de442c3.

📒 Files selected for processing (1)
  • taskfiles/deps.yaml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: build-ystdlib-cpp (ubuntu-24.04)
  • GitHub Check: build-ystdlib-cpp (macos-15)
  • GitHub Check: build-ystdlib-cpp (ubuntu-22.04)
  • GitHub Check: lint-check (macos-15)
  • GitHub Check: lint-check (ubuntu-24.04)
🔇 Additional comments (6)
taskfiles/deps.yaml (6)

6-9: New Dependency Variables for Outcome and QuickCppLib Added

The new variables G_OUTCOME_LIB_NAME, G_OUTCOME_WORK_DIR, G_QUICKCPPLIB_LIB_NAME, and G_QUICKCPPLIB_WORK_DIR are introduced in a manner consistent with the existing Catch2 variables. This maintains clarity and consistency in naming conventions.


14-17: Modularised install-all Task

Segmenting the install-all task into sub-tasks—install-all-init, install-all-run, and install-all-finish—improves clarity and maintainability. Please ensure that any related documentation is updated to reflect this new structure.


19-24: Initialization Task for Dependency Setup

The install-all-init task appropriately creates the required directory and removes the existing CMake settings file. Verify that the removal of the settings file does not inadvertently discard other important configurations.


25-31: Run Task with Dependency Handling

The install-all-run task now invokes the sub-tasks for Catch2, Outcome, and QuickCppLib. This update aligns with the PR objectives. Ensure that any inter-dependencies (such as Outcome relying on QuickCppLib) are properly enforced by the defined dependencies, possibly double-checking the execution order.


53-67: Catch2 Installation Task Enhancement

The modifications to the install-Catch2 task now include an invocation of add-package-root-to-cmake-settings, which integrates well with the new dependency system. Ensure that the INSTALL_PREFIX is correctly computed for subsequent use during the build process.


68-88: Outcome Installation Task with QuickCppLib Dependency

Within the install-outcome task, a dependency on QuickCppLib is clearly defined via the deps field, and GEN_ARGS reference QuickCppLib’s CMake settings appropriately. Please verify that this dependency ordering guarantees QuickCppLib is installed prior to Outcome.

@Bill-hbrhbr
Copy link
Collaborator Author

32-41: Finalisation Step: Appending CMake Settings

The install-all-finish task appends the include statements for each dependency’s CMake settings file. Although the multi-line echo command works here, please verify that the formatting—for example, newline characters and any extra whitespace—does not affect CMake’s parsing of the settings file.

42-52: Configuration of Package Root via CMake Settings

The add-package-root-to-cmake-settings task provides a generic approach to setting the installation prefix for each package. One suggestion is to ensure that, if newline escapes are intended in the echo command, you might consider using echo -e for consistency with other sections; otherwise, double-check that the output format meets CMake’s expectations.

@coderabbitai
32-41 does not affect CMake parsing
42-52 there's no new line so -e is not needed

Copy link

coderabbitai bot commented Mar 18, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@Bill-hbrhbr Thanks for the clarification! You're absolutely right - the multi-line echo in lines 32-41 doesn't affect CMake parsing, and since there are no newline escapes in the echo command in lines 42-52, the -e flag isn't necessary. The current implementation looks good as-is.


🏁 Script executed:

#!/bin/bash
# Show lines 32-52 from taskfiles/deps.yaml to understand the formatting concerns
cat taskfiles/deps.yaml | head -52 | tail -21

Length of output: 728


@Bill-hbrhbr After reviewing the code in taskfiles/deps.yaml, I can confirm both your assessments are correct:

  1. For the install-all-finish task (lines 32-41): The multi-line echo command with -e flag properly formats the include statements. The \n escape sequences are handled correctly, and CMake parsing won't be affected by this approach.

  2. For the add-package-root-to-cmake-settings task (lines 42-52): There are indeed no escape sequences in this echo command that would require the -e flag. The natural line break in the YAML syntax is sufficient.

Your implementation looks solid as-is.

Copy link

@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: 0

🧹 Nitpick comments (1)
taskfiles/deps.yaml (1)

19-24: Directory Refresh in install-all-init
The commands to remove and recreate the CMake settings directory ensure a clean slate for each dependency installation. However, verify that the variable {{.G_DEPS_CMAKE_SETTINGS_DIR}} is correctly defined so that no unintended directories are affected.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between de442c3 and 2cfa5ae.

📒 Files selected for processing (1)
  • taskfiles/deps.yaml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: lint-check (ubuntu-24.04)
🔇 Additional comments (8)
taskfiles/deps.yaml (8)

6-9: Addition of New Dependency Variables
The new variables for Outcome and QuickCppLib are clearly added and follow the existing naming conventions. This improves clarity when referring to these dependencies throughout the tasks. Ensure that downstream tasks consistently use these variables.


14-17: Segmentation of Installation Tasks
Dividing the install-all task into install-all-init, install-all-run, and install-all-finish enhances modularity and readability. This clear separation helps manage concurrency and dependency inter-relations.


25-30: Ensuring Proper Dependency Order in install-all-run
Including the dependencies install-Catch2 and install-outcome is appropriate. Notably, since install-outcome declares a dependency on install-quickcpplib, the overall order should maintain correctness. It is advisable to double-check that the concurrency framework respects these inter-dependencies.


31-40: Appending Include Statements in install-all-finish
The loop appending include($file) statements to the CMake settings file is an effective solution. As discussed previously, please verify that the formatting (newlines, spacing) does not interfere with CMake parsing.


41-55: Modular Package Root Configuration
The add-package-root-to-cmake-settings task introduces a flexible way to add package root paths into the CMake settings. The multi-line echo command appears appropriately formatted; however, ensure that its layout meets CMake's parsing requirements.


56-70: Consistent Handling for Catch2 Installation
The Catch2 installation task leverages the shared utility to install the remote tar file and then correctly invokes the package-root addition task. This consistency supports maintainability.


71-93: Outcome Installation with Dependency Enforcement
The install-outcome task correctly specifies a dependency on install-quickcpplib to ensure proper build order. The use of GEN_ARGS to pass additional configuration options is clear—just confirm that referencing the QuickCppLib settings file via the -C flag is intended and effective.


94-112:

❓ Verification inconclusive

QuickCppLib Installation and Version Stability Consideration
The QuickCppLib installation follows the established pattern, including the configuration via the package root settings task. However, since the URL points to the master branch, consider whether version stability is a concern. Using a tagged release or commit hash may help prevent issues from future changes on master.


Ensure stable QuickCppLib versioning for consistent builds
The current installation task in taskfiles/deps.yaml (lines 94–112) is implemented correctly according to our established pattern. However, the URL currently points to the master branch—which risks incorporating unexpected changes over time. It is recommended to pin QuickCppLib to a specific tagged release or commit hash for improved version stability.

  • Verify that the selected version meets the project's stability requirements.
  • If proceeding with a stable release, update the URL and corresponding FILE_SHA256 accordingly.

@Bill-hbrhbr Bill-hbrhbr requested a review from davidlion March 20, 2025 07:39
Copy link

@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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2cfa5ae and 87ce470.

📒 Files selected for processing (3)
  • CMake/ystdlib-cpp-helpers.cmake (3 hunks)
  • CMakeLists.txt (3 hunks)
  • taskfiles/deps.yaml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • CMakeLists.txt
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: lint-check (macos-15)
🔇 Additional comments (9)
CMake/ystdlib-cpp-helpers.cmake (4)

17-52: Well-structured interface target function for third-party libraries

This new function is a clean way to expose include paths for third-party libraries. It properly checks for required variables and follows CMake best practices.


105-110: Good defensive coding with interface library validation

Adding this validation prevents a common CMake error where developers might try to specify private dependencies for interface (header-only) libraries.


117-117: Improved linking clarity for interface libraries

This explicit linking of public libraries for interface targets makes the intent clearer.


134-140: Better organization of library linking

Consolidating public and private links into a single call improves readability and maintainability.

taskfiles/deps.yaml (5)

6-9: Variables follow project conventions

The new variables for Outcome and QuickCppLib follow the established naming conventions in the project.


14-18: Good task decomposition

Breaking the installation task into initialization, execution, and finalization improves maintainability and makes the process more understandable.


32-41: Automated settings inclusion improves maintainability

This task cleverly automates the inclusion of dependency CMake settings files, making it easier to add new dependencies in the future without modifying this code.


42-55: DRY approach for package root settings

Creating a dedicated task for adding package roots to settings files reduces code duplication and centralizes this functionality.


88-89: Good use of CMake policies

Setting these policies is important for ensuring proper functionality with modern CMake features while maintaining compatibility with older code.

@Bill-hbrhbr
Copy link
Collaborator Author

By passing -BUILD_TESTING=OFF to deps:install-quickcpplib, the following artifact builds can be avoided.
image

@Bill-hbrhbr
Copy link
Collaborator Author

Bill-hbrhbr commented Mar 25, 2025

We pass -DCMAKE_BUILD_TYPE=Release to deps:install-quickcpplib and deps:install-outcome because they don't have a default CMAKE_BUILD_TYPE and the following error is generated if CMAKE_BUILD_TYPE is not present.

CMake Error at cmakelib/QuickCppLibSetupProject.cmake:4 (message):
  FATAL: CMAKE_BUILD_TYPE must be set on non-multi-config generators
Call Stack (most recent call first):
  CMakeLists.txt:28 (include)

See also

@Bill-hbrhbr
Copy link
Collaborator Author

Bill-hbrhbr commented Mar 25, 2025

We pass -DCMAKE_POLICY_DEFAULT_CMP0148=OLD to deps:install-quickcpplib and deps:install-outcome so that these quickcpplib-based cmake projects can use PYTHON to help their cmake workflows. Speficially, this line succeeds after we pass the flag, resulting in the definition of cmake variable PYTHON_EXECUTABLE and the ability for quickcpplib to do some preprocessing.
In the cmake module doc, it says:

Changed in version 3.27: This module is available only if policy CMP0148 is not set to NEW.
Deprecated since version 3.12: Use FindPython3, FindPython2 or FindPython instead.

This means for cmake version:

  • ver < 3.12: Works fine
  • 3.12 <= ver < 3.27: Works fine but no longer maintained. Should migrate to use the new modules.
  • ver >= 3.27: Needs to set policy to OLD since default is NEW

Copy link

@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: 0

🧹 Nitpick comments (1)
taskfiles/deps.yaml (1)

95-113: QuickCppLib installation is pinned to a specific commit.
The install-quickcpplib task now pins QuickCppLib to a specific commit (f3e452e) using its tarball URL and associated SHA256 checksum. This change enhances reproducibility by avoiding potential drift from using the master branch. It would be beneficial to add an inline comment or documentation note indicating the rationale for pinning to this commit for future maintainers.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d012072 and 0479886.

📒 Files selected for processing (1)
  • taskfiles/deps.yaml (2 hunks)
🔇 Additional comments (8)
taskfiles/deps.yaml (8)

6-9: New dependency variables are defined properly.
The new variables for Outcome and QuickCppLib (G_OUTCOME_LIB_NAME, G_OUTCOME_WORK_DIR, G_QUICKCPPLIB_LIB_NAME, and G_QUICKCPPLIB_WORK_DIR) follow the existing naming convention used for Catch2, which helps maintain clarity and consistency in dependency management.


14-18: Clear segmentation of installation phases.
Defining the install-all task to sequentially invoke install-all-init, install-all-run, and install-all-finish establishes a well-structured build process that handles preparation, concurrent installations, and final configuration. This approach aligns well with the PR objectives.


20-25: Initialisation task setup is appropriate.
The install-all-init task effectively cleans up any pre-existing CMake settings by removing the designated directory and subsequently recreating it. This ensures that the subsequent dependency configuration begins from a clean state.


26-31: Sequential dependency execution in the run task.
In the install-all-run task, the inclusion of dependencies for both Catch2 and Outcome (with Outcome itself depending on QuickCppLib) ensures that the installation order respects inter-dependencies. This sequencing is vital for a reliable build process.


32-41: Appending CMake settings is implemented correctly.
The install-all-finish task loops through the CMake settings files and appends include statements to the main settings file. This aggregation method is neat and should work as intended—just verify that the formatting remains acceptable for CMake parsing.


42-56: Reusable task for adding package roots.
The add-package-root-to-cmake-settings task is well abstracted: by requiring the NAME and INSTALL_PREFIX variables, it provides a generic mechanism to append the necessary configuration to the CMake settings file. This promotes reusability and consistency across different dependencies.


67-70: Consistent integration for Catch2.
In the install-Catch2 task, the subsequent call to add-package-root-to-cmake-settings ensures that the Catch2 installation is correctly referenced in the CMake settings file. The defined paths for Catch2 are consistent and maintainable.


72-94: Outcome installation task is correctly configured.
The install-outcome task uses the correct URL for Outcome v2.2.11 and provides essential build arguments (such as disabling testing, enforcing a Release build type, and setting the appropriate CMake policies). Its dependency on install-quickcpplib guarantees that the required QuickCppLib is installed first. Please ensure that the provided SHA256 checksum is verified against the downloaded archive.

@Bill-hbrhbr
Copy link
Collaborator Author

We pass -DCMAKE_POLICY_DEFAULT_CMP0148=OLD to deps:install-quickcpplib and deps:install-outcome so that these quickcpplib-based cmake projects can use PYTHON to help their cmake workflows. Speficially, this line succeeds after we pass the flag, resulting in the definition of cmake variable PYTHON_EXECUTABLE and the ability for quickcpplib to do some preprocessing. In the cmake module doc, it says:

Changed in version 3.27: This module is available only if policy CMP0148 is not set to NEW. Deprecated since version 3.12: Use FindPython3, FindPython2 or FindPython instead.

This means for cmake version:

  • ver < 3.12: Works fine
  • 3.12 <= ver < 3.27: Works fine but no longer maintained. Should migrate to use the new modules.
  • ver >= 3.27: Needs to set policy to OLD since default is NEW

As discussed offline, we are removing this policy since its benefits are not very obvious.

@Bill-hbrhbr
Copy link
Collaborator Author

When building outcome, given that we supply -Dquickcpplib_ROOT=<ystdlib-cpp>/build/deps/quickcpplib/quickcpplib-install:

  • If we set -DCMAKE_POLICY_DEFAULT_CMP0074=NEW, outcome uses our installed quickcpplib to build itself.
  • If we set -DCMAKE_POLICY_DEFAULT_CMP0074=OLD or omit the setting, outcome does a download of quickcpplib in its build directory, which can be found at <ystdlib-cpp>/build/deps/outcome/outcome-build/quickcpplib. And the following errors are generated.

For -DCMAKE_POLICY_DEFAULT_CMP0074=OLD:

loading initial cache file /home/bingranhu/fork/fork2/ystdlib-cpp/build/deps/CMake/quickcpplib.cmake
CMake Deprecation Warning at cmake/QuickCppLibBootstrap.cmake:23 (cmake_minimum_required):
  The OLD behavior for policy CMP0074 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:38 (include)

-- quickcpplib not found, cloning git repository and installing into /home/bingranhu/fork/fork2/ystdlib-cpp/build/deps/outcome/outcome-build/quickcpplib ...

For omitting the policy:

loading initial cache file /home/bingranhu/fork/fork2/ystdlib-cpp/build/deps/CMake/quickcpplib.cmake
CMake Warning (dev) at cmake/QuickCppLibBootstrap.cmake:32 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  
  Use the cmake_policy command to set the policy and suppress this warning.

  CMake variable quickcpplib_ROOT is set to:

    /home/bingranhu/fork/fork2/ystdlib-cpp/build/deps/quickcpplib/quickcpplib-install

  For compatibility, CMake is ignoring the variable.
Call Stack (most recent call first):
  CMakeLists.txt:38 (include)

This warning is for project developers. Use -Wno-dev to suppress it.

-- quickcpplib not found, cloning git repository and installing into: /home/bingranhu/fork/fork2/ystdlib-cpp/build/deps/outcome/outcome-build/quickcpplib

According to the policy doc:

This policy was introduced in CMake version 3.12. It may be set by cmake_policy() or cmake_minimum_required(). If it is not set, CMake warns, and uses OLD behavior.

outcome sets cmake_minimum_required(VERSION 3.9 FATAL_ERROR), which means that the policy is OLD by default for outcome. This means outcome cannot use the <PackageName>_ROOT feature unless we provide an explicit policy override.

@Bill-hbrhbr
Copy link
Collaborator Author

Bill-hbrhbr commented Mar 25, 2025

By including this policy, we ensure that outcome and ystdlib-cpp use the same version of quickcpplib, making our builds less prone to errors.
We also save time when building outcome because it no longer needs to download a copy of quickcpplib itself.

Copy link

@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: 0

🧹 Nitpick comments (4)
taskfiles/deps.yaml (4)

20-25: Initialization Task: Safe Directory Handling
In the “install-all-init” task, the commands to remove and recreate the CMake settings directory (lines 23–24) are standard. However, ensure that the variable {{.G_DEPS_CMAKE_SETTINGS_DIR}} is properly defined to avoid accidental deletion of unintended directories. Consider adding a comment or safeguard if there’s any risk of the variable being empty.


32-41: Iterative Inclusion in “install-all-finish”
The Bash loop (lines 36–40) appropriately iterates over all CMake settings files and conditionally appends them to the main settings file. For extra robustness, consider ensuring that filenames with spaces (if ever possible) are handled correctly by quoting the variable $file. Additionally, a brief inline comment could help future maintainers understand why the comparison with {{.G_DEPS_CMAKE_SETTINGS_FILE}} is required.


42-56: Generate CMake Package Root Settings
The “add-package-root-to-cmake-settings” task (lines 42–56) is a neat way to centralise the installation prefix for each dependency. Verify that the multi-line echo command produces a valid CMake snippet and consider whether multiple invocations could lead to duplicate entries in the settings file. A note or safeguard for idempotency might be beneficial.


94-111: Pin QuickCppLib to a Specific Commit for Reproducibility
The “install-quickcpplib” task (lines 94–111) now uses a fixed URL with a specific commit hash (f3e452e) for QuickCppLib. This ensures reproducible builds and aligns with the recent decision to pin to a specific version. It may be beneficial to include a comment indicating that this commit corresponds to the one used during Outcome v2.2.11’s release, so future maintainers understand the rationale behind this version choice.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0479886 and a9abea1.

📒 Files selected for processing (2)
  • src/.clang-format (1 hunks)
  • taskfiles/deps.yaml (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/.clang-format
🔇 Additional comments (5)
taskfiles/deps.yaml (5)

4-9: Define New Dependency Variables Consistently
The new variables for Outcome and QuickCppLib (lines 6–9) are clearly defined and follow the existing naming convention. This improves the clarity of dependency paths.


12-19: Group “install-all” Task Subdivisions
The “install-all” task now explicitly runs with the “once” flag and chains the sub-tasks (init, run, finish). This explicit grouping clarifies the sequential execution flow for installing all dependencies.


26-31: Define Dependency Order in “install-all-run”
The “install-all-run” task (lines 26–31) correctly includes dependencies ("install-Catch2" and "install-outcome"). The structure clarifies the required order. Just verify that these dependencies execute in the intended sequential order, particularly given that “install-outcome” depends on QuickCppLib.


57-71: Install Catch2 with Proper Settings
The “install-Catch2” task (lines 57–71) is well-configured, pinning to version v3.8.0 with an appropriate SHA256 checksum. The subsequent setting of its package root also helps with CMake integration. No further changes are necessary here, provided the version remains up to date.


72-93: Outcome Installation and Dependency Resolution
The “install-outcome” task (lines 72–93) correctly lists “install-quickcpplib” as a dependency, ensuring the proper build order. The GEN_ARGS include:

  • A reference to the QuickCppLib CMake settings file,
  • Disabling testing,
  • Setting the build type to Release, and
  • Enforcing the CMake policy (-DCMAKE_POLICY_DEFAULT_CMP0074=NEW).

These settings align with the integration requirements. Verify that these GEN_ARGS reliably configure Outcome against the pinned QuickCppLib version.

@Bill-hbrhbr Bill-hbrhbr requested a review from davidlion March 25, 2025 22:25
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