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

IEP-1374 GH #1088: Launch in run mode does a redundant re-building even after build was triggered before that . #1107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sigmaaa
Copy link
Collaborator

@sigmaaa sigmaaa commented Jan 7, 2025

Description

In this PR, I have removed the cmakeListsModified field as it is no longer necessary, given that we do not utilize the default C/C++ indexer. The purpose of this field was to determine whether the CMake command should be executed. However, in scenarios such as opening sdkconfig, it is essential to run the CMake command to avoid redundancy, as idf.py flash would otherwise perform this step, resulting in an unnecessary rebuild of the project.

Additionally, I have removed all code related to this field and also deleted the cleanBuildDirectory(buildDir) method. This method is redundant because the build folder is now cleaned automatically when switching the target.

Fixes # (IEP-1374)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

  • Build project
  • open sdkconfig -> build project -> flash (no additional build is running during the flash)
  • open sdkconfig -> flash (build is running once)

Test Configuration:

  • ESP-IDF Version:
  • OS (Windows,Linux and macOS):

Dependent components impacted by this PR:

  • Build

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • Refactor

    • Simplified build configuration process.
    • Removed file modification tracking logic.
    • Streamlined CMake command execution.
    • Eliminated unnecessary method checks for project changes.
  • Chores

    • Removed deprecated methods related to build directory management and file change detection.

Copy link

coderabbitai bot commented Jan 7, 2025

Walkthrough

The pull request introduces significant simplifications to the IDFBuildConfiguration class in the Espressif IDF Core plugin. The changes primarily focus on streamlining the build process by removing complex modification tracking mechanisms. The cmakeListsModified boolean variable and associated methods for detecting file changes have been eliminated, resulting in a more direct approach to running CMake commands during the build process.

Changes

File Change Summary
bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java - Removed cmakeListsModified boolean variable
- Deleted elementChanged and processElementDelta methods
- Removed cleanDirectory and cleanBuildDirectory methods
- Simplified build process logic

Possibly related PRs

Suggested reviewers

  • AndriiFilippov
  • alirana01
  • kolipakakondal

Poem

🐰 Cmake's dance, once complex and tight,
Now simplified with rabbit's might!
No more tracking, no more fuss,
Build process clean, without a muss.
Hop, hop, hurray for code so bright! 🚀

Finishing Touches

  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • 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. (Beta)
  • @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
Collaborator

@kolipakakondal kolipakakondal left a comment

Choose a reason for hiding this comment

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

LGTM. @AndriiFilippov This needs in-depth testing to ensure we don't miss any use cases.

@AndriiFilippov
Copy link
Collaborator

@sigmaaa hi !

Tested under:
OS - Linux Ubuntu
ESP-IDF: v5.4

Issue still persist.
build project -> flash project -> it starts re-building project

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)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java (1)

336-338: Consider implementing build caching to prevent redundant rebuilds.

Given the feedback about persisting rebuild issues during flash operations, consider these optimizations:

  1. Implement build artifact caching
  2. Add build timestamp tracking
  3. Compare build artifacts before triggering rebuilds

This would help prevent unnecessary rebuilds while ensuring build consistency. Would you like me to provide a detailed implementation plan for these optimizations?

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3d6a0c1 and 7671f4f.

📒 Files selected for processing (1)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: build_macos
🔇 Additional comments (2)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java (2)

499-502: LGTM! Well-implemented ccache configuration.

The ccache configuration is properly implemented with:

  1. Correct environment variable check
  2. Proper default value handling ("0")
  3. Clear CMake variable setting

336-338: Verify the impact of unconditional CMake command execution.

The removal of modification checks simplifies the build process, but please verify that this doesn't skip necessary CMake reconfigurations in scenarios like:

  1. Changes to CMake cache variables
  2. Updates to toolchain files
  3. Changes to sdkconfig
✅ Verification successful

Unconditional CMake command execution is safe and beneficial

The codebase already has proper mechanisms to handle configuration changes:

  • Changes to sdkconfig are tracked through the configuration system
  • CMake cache variables are managed via CMakeCache.txt
  • The build system automatically handles toolchain updates

The removal of modification checks simplifies the build process without compromising functionality, as the system already ensures proper reconfiguration when needed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for CMake-related files that might require reconfiguration
echo "Searching for CMake-related files that might need reconfiguration..."
fd -e cmake -e sdkconfig

Length of output: 173


Script:

#!/bin/bash
# Search for CMake-related configuration handling
echo "Searching for CMake configuration patterns..."
ast-grep --pattern 'runCmakeCommand($$$)' 

echo -e "\nSearching for build configuration handling..."
rg "CMakeCache|sdkconfig" -A 3

echo -e "\nSearching for environment setup..."
ast-grep --pattern 'getEnvironment($$$)'

Length of output: 24108

@sigmaaa
Copy link
Collaborator Author

sigmaaa commented Jan 9, 2025

@sigmaaa hi !

Tested under: OS - Linux Ubuntu ESP-IDF: v5.4

Issue still persist. build project -> flash project -> it starts re-building project

Hi @AndriiFilippov, @kolipakakondal , @alirana01

I had a call with Andrew and discovered that the issue he encountered on Ubuntu was caused by the build running with DCCACHE_ENABLE=1 even when IDF_CCACHE_ENABLE was not specified.

To address this, I’ve fixed the use case in the latest commit. Now, the -DCCCACHE_ENABLE status is determined based on the value of IDF_CCACHE_ENABLE.

@AndriiFilippov
Copy link
Collaborator

@sigmaaa hi !
@kolipakakondal please, review. Let me know if there’s anything else I should include.

Tested under:
OS - Windows 11, Linux Ubuntu, Mac arm64
ESP-IDF: v5.4

cleaning of build directories behaves as expected ✅
custom build directories build ✅
after switch target - clean build folder as expected✅
CMakeLists.txt modifications are correctly detected and handled. ✅
sdkconfig file modifications are correctly saved and handled ✅
build, flash, monitor ✅

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.

Launch in run mode does a redundant re-building even after build was triggered before that . (IEP-1374)
3 participants