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

BuildConfig: remove manifest and use project.manifest #1156

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

ken-matsui
Copy link
Member

@ken-matsui ken-matsui commented Mar 8, 2025

Summary by CodeRabbit

  • Refactor
    • Improved the project build configuration by centralizing initialization and streamlining path resolutions.
    • Enhanced dependency installation and build setup logic for greater consistency.
    • Simplified the configuration interface by removing redundant parameters.

Copy link

coderabbitai bot commented Mar 8, 2025

Walkthrough

The changes update the project initialization and path handling in the BuildConfig module. In BuildConfig.cc, the Project object is now initialized with the manifest object instead of the current file system path. Consequently, all references that previously used path information from the manifest are replaced with references to the project’s root path. In BuildConfig.hpp, the manifest reference has been removed from both the class members and the constructor, with the remaining parameters reorganized to align with the updated initialization logic.

Changes

File Change Summary
src/BuildConfig.cc - Updated Project initialization to use manifest instead of fs::current_path().
- Replaced manifest-derived paths with project.rootPath in methods like emitCompdb, isUpToDate, mapHeaderToObj, and configureBuild.
- Adjusted dependency installation to reference project.manifest.
src/BuildConfig.hpp - Removed const Manifest& manifest member variable and its corresponding parameter in the constructor.
- Reordered constructor parameters to now accept BuildProfile, std::string libName, and Project only.

Sequence Diagram(s)

sequenceDiagram
    participant Caller as Build System
    participant BC as BuildConfig::init
    participant P as Project::init

    Caller->>BC: Call init(manifest, buildProfile)
    BC->>P: Initialize Project using manifest & buildProfile
    P-->>BC: Return Project object with rootPath
    BC->>Caller: Return configured BuildConfig instance
Loading

Possibly related PRs

Poem

I'm a busy bunny rewriting code,
Hopping through changes on every node.
Manifest gone, Project leads the way,
Paths aligned for a brighter day.
With carrot smiles and logical beats,
I celebrate the shift in our codey retreats!
🥕🐇


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bbdea99 and da1c8e7.

📒 Files selected for processing (2)
  • src/BuildConfig.cc (10 hunks)
  • src/BuildConfig.hpp (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/BuildConfig.hpp
🧰 Additional context used
🪛 Cppcheck (2.10-2)
src/BuildConfig.cc

[performance] 72-72: Function parameter 'other' should be passed by const reference.

(passedByValue)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: build & test (Apple Clang - macOS 14)
  • GitHub Check: build & test (Apple Clang - macOS 15)
  • GitHub Check: build & test (Clang 16)
  • GitHub Check: analyze (c-cpp)
  • GitHub Check: create
🔇 Additional comments (12)
src/BuildConfig.cc (12)

72-72: Use of manifest in Project initialization
This correctly aligns with the new approach of passing the manifest object directly to Project::init.

🧰 Tools
🪛 Cppcheck (2.10-2)

[performance] 72-72: Function parameter 'other' should be passed by const reference.

(passedByValue)


74-74: Passing resources by move
Moving buildProfile, libName, and project into the BuildConfig constructor is appropriate and avoids unnecessary copies.


238-238: Switching to project.rootPath
Using project.rootPath here cleanly centralizes path references and is consistent with the manifest-based configuration.


341-341: Replaced manifest path logic with project.rootPath / "src"
This change cleanly removes dependence on the manifest for source directory resolution.


346-346: Comparing project.manifest.path modification time
Ensuring the file is up to date by comparing the manifest's timestamp is logical and consistent.


417-418: Mapping headers relative to project.rootPath / "src"
Using fs::relative with the project’s root path standardizes the header-to-object mapping.


479-479: Installing dependencies from project.manifest
Invoking installDeps on project.manifest properly delegates dependency installation to the manifest.


528-529: Target base directory using project.rootPath / "src"
Consistent with the overall shift to deriving paths from the project’s root.


593-594: Locating test file base directory
Again uses project.rootPath / "src" as a consistent reference point for unit tests.


643-643: Using project.rootPath / "src"
Ensures we rely on the project’s root for locating sources.


699-699: Inserting package name into all
Associating the package name with the all-target set is coherent with how targets are managed.


743-743: Output path construction
Appending project.manifest.package.name to outBasePath properly organizes the build artifact.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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 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.

@ken-matsui ken-matsui force-pushed the remove-manifest-from-buildconfig branch from bbdea99 to f1d01bb Compare March 8, 2025 07:10
@ken-matsui ken-matsui force-pushed the remove-manifest-from-buildconfig branch from f1d01bb to da1c8e7 Compare March 8, 2025 07:10
@ken-matsui ken-matsui enabled auto-merge (squash) March 8, 2025 07:34
@ken-matsui ken-matsui merged commit 2564dc8 into main Mar 8, 2025
20 checks passed
@ken-matsui ken-matsui deleted the remove-manifest-from-buildconfig branch March 8, 2025 07:35
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