Skip to content

refactor(taskfiles)!: Require NAME to be set if CMAKE_SETTINGS_DIR is set in utils:cmake:install (fixes #50). #57

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

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

Conversation

davidlion
Copy link
Member

@davidlion davidlion commented May 17, 2025

Description

As title says.
Additional minor changes:

  • NAME is renamed to CMAKE_PACKAGE_NAME to avoid issues with WSL where the NAME environment variable is set by default.
  • CMAKE_SETTINGS_DIR no longer has a default value in utils:cmake:install-remote-tar to ensure it is set explicitly and intentionally.

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

Tested locally with log-surgeon.

Summary by CodeRabbit

  • Documentation

    • Updated parameter documentation to rename NAME to CMAKE_PACKAGE_NAME and clarify its requirement when CMAKE_SETTINGS_DIR is set.
  • New Features

    • Added a conditional check requiring CMAKE_PACKAGE_NAME only when CMAKE_SETTINGS_DIR is specified.
  • Chores

    • Adjusted default values and validation logic for install-related parameters to improve flexibility and unify naming conventions.

…s:cmake` by requiring explicit definition and checking it with a precondition.
@davidlion davidlion requested a review from a team as a code owner May 17, 2025 03:15
Copy link
Contributor

coderabbitai bot commented May 17, 2025

"""

Walkthrough

The changes unify the parameter naming by replacing NAME with CMAKE_PACKAGE_NAME in the install and install-remote-tar tasks. They add a precondition requiring CMAKE_PACKAGE_NAME if CMAKE_SETTINGS_DIR is set and remove default directory values for CMAKE_SETTINGS_DIR.

Changes

File(s) Change Summary
exports/taskfiles/utils/cmake.yaml Renamed NAME to CMAKE_PACKAGE_NAME in install and install-remote-tar tasks; added precondition for CMAKE_PACKAGE_NAME when CMAKE_SETTINGS_DIR is set; removed default directory for CMAKE_SETTINGS_DIR; updated variable references and task labels accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant InstallTask

    User->>InstallTask: Invoke install with parameters
    alt CMAKE_SETTINGS_DIR is set
        InstallTask->>InstallTask: Check CMAKE_PACKAGE_NAME is non-empty (precondition)
        InstallTask-->>User: Error if CMAKE_PACKAGE_NAME is empty
    else CMAKE_SETTINGS_DIR is not set
        InstallTask->>InstallTask: Proceed without CMAKE_PACKAGE_NAME
    end
    InstallTask-->>User: Complete installation
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers

  • kirkrodrigues
    """

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1b7b97b and c27b2e1.

📒 Files selected for processing (1)
  • exports/taskfiles/utils/cmake.yaml (6 hunks)
🔇 Additional comments (9)
exports/taskfiles/utils/cmake.yaml (9)

89-90: Consistent documentation for CMake settings file.
The updated comments now correctly reference {{.CMAKE_PACKAGE_NAME}}_ROOT and clearly describe the generated settings file.


100-101: Parameter doc clarifies required CMAKE_PACKAGE_NAME.
The @param annotation explicitly states that CMAKE_PACKAGE_NAME is required when CMAKE_SETTINGS_DIR is set, improving clarity.


111-120: Enforced precondition for CMAKE_PACKAGE_NAME presence.
Adding a preconditions block prevents runtime misconfigurations by ensuring CMAKE_PACKAGE_NAME is non-empty when CMAKE_SETTINGS_DIR is defined.


130-133: Template echo updated to use CMAKE_PACKAGE_NAME.
The snippet that writes the settings file now injects {{.CMAKE_PACKAGE_NAME}} appropriately in both the variable name and description.


162-162: Unified task label with CMAKE_PACKAGE_NAME.
Switching the install-remote-tar label to include {{.CMAKE_PACKAGE_NAME}} aligns it with the renamed parameter.


174-174: Explicit default for CMAKE_SETTINGS_DIR.
Changing the default to "" removes any implicit path, making the variable truly optional and user-defined.


179-181: Directory vars now depend on CMAKE_PACKAGE_NAME.
Interpolating {{.CMAKE_PACKAGE_NAME}} into BUILD_DIR, INSTALL_PREFIX, and SOURCE_DIR ensures consistent naming conventions across tasks.


184-185: Required vars updated for install-remote-tar.
The requires.vars list now correctly includes CMAKE_PACKAGE_NAME, replacing the old NAME parameter.


213-213: Propagate CMAKE_PACKAGE_NAME to install task.
Passing CMAKE_PACKAGE_NAME through to the install invocation guarantees the precondition and templating have the needed value.


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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

Copy link
Contributor

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7ba9bdc and 9b041fe.

📒 Files selected for processing (1)
  • exports/taskfiles/utils/cmake.yaml (3 hunks)
🔇 Additional comments (2)
exports/taskfiles/utils/cmake.yaml (2)

110-110: Removal of NAME from required vars aligns with new optional behaviour.

The prerequisite variables for install no longer include NAME, matching the conditional requirement introduced below. This change looks correct.


111-119: Conditional precondition enforces NAME when CMAKE_SETTINGS_DIR is set.

The preconditions block correctly checks that .NAME is non-empty when .CMAKE_SETTINGS_DIR is provided. Consider trimming whitespace or validating the variable further if needed, but the current check is sound.

kirkrodrigues
kirkrodrigues previously approved these changes May 17, 2025
Copy link
Member

@kirkrodrigues kirkrodrigues left a comment

Choose a reason for hiding this comment

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

For the PR title, how about:

refactor(taskfiles)!: Require `NAME` to be set if `CMAKE_SETTINGS_DIR` is set in `utils:cmake:install` (fixes #50).

@davidlion davidlion changed the title refactor(taskfiles)!: Improve CMAKE_SETTINGS_DIR behaviour in utils:cmake by requiring explicit definition and checking it with a precondition (fixes #50). refactor(taskfiles)!: Require NAME to be set if CMAKE_SETTINGS_DIR is set in utils:cmake:install (fixes #50). May 17, 2025
Copy link
Member

@kirkrodrigues kirkrodrigues left a comment

Choose a reason for hiding this comment

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

For the PR title, how about:

refactor(taskfiles)!: Rename `NAME` to `CMAKE_PACKAGE_NAME` and require it to be set if `CMAKE_SETTINGS_DIR` is set in `utils:cmake:install` (fixes #50).

# @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings
# file should be stored.
# @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the install command.
# @param {string} [CMAKE_PACKAGE_NAME] CMake project name (used in directory names and the CMake
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to re-alphabetize this now that the var name has changed?

# @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings
# file should be stored.
# @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the install command.
# @param {string} [CMAKE_PACKAGE_NAME] CMake project name (used in directory names and the CMake
# settings file). Required if `CMAKE_SETTINGS_DIR` is set.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# settings file). Required if `CMAKE_SETTINGS_DIR` is set.
# settings file). Required if `CMAKE_SETTINGS_DIR` is set.

@@ -201,7 +210,7 @@ tasks:
EXTRA_ARGS:
ref: ".CMAKE_INSTALL_ARGS"
INSTALL_PREFIX: "{{.INSTALL_PREFIX}}"
NAME: "{{.NAME}}"
CMAKE_PACKAGE_NAME: "{{.CMAKE_PACKAGE_NAME}}"
Copy link
Member

Choose a reason for hiding this comment

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

Could alphabetize?

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.

2 participants