Skip to content

build: dont check submodules to build module #1927

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

Merged
merged 1 commit into from
Nov 27, 2024
Merged

Conversation

AndyTWF
Copy link
Contributor

@AndyTWF AndyTWF commented Nov 27, 2024

The only git submodule we need is ably-common, and this is only used as part of testing to create test apps. We don't use it when building (despite it being a build check).

This check during build prevents other SDKs from depending on a branch of ably-js, as it doesn't have the submodules, and can't init them.

This change therefore removes the submodules check when building the library, allowing SDKs to depend on branch versions, if they want to.

Summary by CodeRabbit

  • New Features
    • Simplified the build process by removing the prerequisite check for Git submodules, streamlining the build registration.

This change enhances the overall efficiency of the build process for users.

The only git submodule we need is ably-common, and this is only used as part of testing to create
test apps. We don't use it when building (despite it being a build check).

This check during build prevents other SDKs from depending on a branch of ably-js, as it doesn't have
the submodules, and can't init them.

This change therefore removes the submodules check when building the library, allowing SDKs to depend on branch
versions, if they want to.
Copy link

coderabbitai bot commented Nov 27, 2024

Walkthrough

The changes involve a modification to the Gruntfile.js, specifically the removal of the checkGitSubmodules task from the build task registration. This adjustment simplifies the build process by eliminating the requirement for checking Git submodules before proceeding with the build tasks. The rest of the Gruntfile.js remains unchanged, with all other task definitions intact.

Changes

File Change Summary
Gruntfile.js Removed checkGitSubmodules from the build task registration. Updated line from grunt.registerTask('build', ['checkGitSubmodules', 'webpack:all', 'build:browser', 'build:node', 'build:push']); to grunt.registerTask('build', ['webpack:all', 'build:browser', 'build:node', 'build:push']);

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Grunt
    participant Webpack
    participant Build

    User->>Grunt: Execute build task
    Grunt->>Webpack: Run webpack:all
    Grunt->>Build: Run build:browser
    Grunt->>Build: Run build:node
    Grunt->>Build: Run build:push
Loading

🐰 In the meadow where bunnies play,
The build has changed, hip-hip-hooray!
No more checks for submodules to find,
Just run the tasks, and peace of mind.
With webpack and builds, we hop along,
A simpler path where we belong! 🌼


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

@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 and nitpick comments (1)
Gruntfile.js (1)

Line range hint 44-60: Consider improving submodule check error messages.

Since the submodule is now only required for testing, the error messages could be more specific to avoid confusion:

         grunt.log.writeln('%s : while checking submodule path!', error.message);
-        grunt.log.writeln('Probably, git submodule at %s are not initialized?', pathToSubmodule);
-        grunt.log.writeln('Please, initialize it with `git submodule init & git submodule update`!');
+        grunt.log.writeln('Git submodule at %s is required for running tests but not for building.', pathToSubmodule);
+        grunt.log.writeln('If you need to run tests, initialize it with `git submodule init & git submodule update`');
         return done(false);
       }
       if (stats.isDirectory()) {
         grunt.log.writeln('Git submodule at %s is found!', pathToSubmodule);
         return done();
       }
       grunt.log.writeln('Git submodule at %s is not initialized!', pathToSubmodule);
-      grunt.log.writeln('Please, initialize it with `git submodule init & git submodule update`!');
+      grunt.log.writeln('This is only required for running tests. If you need to run tests, initialize it with `git submodule init & git submodule update`');
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 18a2559 and 8248411.

📒 Files selected for processing (1)
  • Gruntfile.js (1 hunks)
🔇 Additional comments (2)
Gruntfile.js (2)

76-76: LGTM! Build task modification aligns with PR objectives.

The removal of the checkGitSubmodules task from the build sequence successfully eliminates the submodule dependency during build, which should resolve the issues faced by SDKs depending on specific branches.


Line range hint 134-139: Verify retention of submodule check in test:webserver task.

The checkGitSubmodules task remains in the test:webserver task, which aligns with the PR objectives since the submodule is still required for testing. This appears intentional, but please confirm.

✅ Verification successful

Retention of checkGitSubmodules in test:webserver task is correctly implemented

The verification confirms that checkGitSubmodules is intentionally and correctly retained only in the test:webserver task, while being removed from the build process. This aligns with the task dependencies where:

  • test:webserver requires the submodule for testing purposes
  • The task is properly sequenced after browser builds and before mocha tests
  • No other build tasks depend on the submodule check
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all remaining uses of checkGitSubmodules to ensure they're intentionally retained
rg "checkGitSubmodules" -A 2 -B 2

Length of output: 512


Script:

#!/bin/bash
# Let's verify the PR description and changes to understand the context better
gh pr view --json title,body

# Also check the changes in the Gruntfile to see the complete picture
rg "test:webserver|build:" -A 2 -B 2 Gruntfile.js

Length of output: 761

@lawrence-forooghian
Copy link
Collaborator

Have you confirmed that, with this change, you're successfully able to depend on a branch of ably-js?

@AndyTWF
Copy link
Contributor Author

AndyTWF commented Nov 27, 2024

Have you confirmed that, with this change, you're successfully able to depend on a branch of ably-js?

Yes - ably/ably-chat-js#417 fixed a few broken tests because it brought in new changes not yet released :)

@AndyTWF AndyTWF merged commit dce28af into main Nov 27, 2024
14 checks passed
@AndyTWF AndyTWF deleted the submodule-check-build branch November 27, 2024 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants