Skip to content

Conversation

@sitaowang1998
Copy link
Collaborator

@sitaowang1998 sitaowang1998 commented Jul 23, 2025

Description

Add tasks to install Antlr jar and C++ runtime.

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

  • GitHub workflows pass
  • Antlr jar and C++ runtime are installed
  • Rerun the task won't trigger re-download and rebuild.
  • C++ runtime can be found by find_package(antlr4-runtime)

Summary by CodeRabbit

  • Chores
    • Added managed ANTLR dependency with automated install tasks integrated into the main setup, reducing manual steps.
    • Automatic download and checksum validation of ANTLR artifacts to improve security and reproducibility.
    • Automated build and isolated install of the ANTLR C++ runtime for cleaner environments.
    • Install flow now ensures ANTLR components are prepared once and reused, improving reliability and setup speed.
    • Development environment now installs OpenJDK 11 to support ANTLR tooling.

@sitaowang1998 sitaowang1998 requested a review from a team as a code owner July 23, 2025 14:07
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 23, 2025

Walkthrough

Adds ANTLR support and Java JDK to the install flow: new globals for ANTLR version and jar path, two internal run-once tasks to download the ANTLR jar and build/install the ANTLR4 C++ runtime with checksum handling and integration into install flows; also adds openjdk-11-jdk to the Linux dev install script.

Changes

Cohort / File(s) Summary
ANTLR dependency management
dep-tasks.yaml
Added globals G_ANTLR_VERSION and G_ANTLR_JAR_FILE. Added tasks install-antlr-jar (validate/download jar, compute/store checksum) and install-antlr-runtime (validate prefix, download release tarball, extract runtime/Cpp subtree, CMake configure/build/install to dedicated prefix, compute checksum). Updated install-all-run and lib_install to depend on these tasks.
Linux dev install script
tools/scripts/lib_install/linux/install-dev.sh
Added openjdk-11-jdk to the apt-get install --no-install-recommends -y package list. No other logic changes.

Sequence Diagram(s)

sequenceDiagram
  actor Dev as Developer
  participant Tasks as install-all-run
  participant Jar as install-antlr-jar
  participant Rt as install-antlr-runtime
  participant Net as Remote Repos
  participant FS as Filesystem
  participant CMake as CMake/Build

  Dev->>Tasks: invoke
  activate Tasks
  Tasks->>Jar: run (once)
  activate Jar
  Jar->>FS: check existing checksum/jar
  alt checksum invalid or missing
    Jar->>Net: download ANTLR jar (versioned URL)
    Jar->>FS: save jar
    Jar->>FS: compute/store checksum
  end
  deactivate Jar

  Tasks->>Rt: run (once)
  activate Rt
  Rt->>FS: validate install prefix/dirs (checksum)
  alt prefix invalid or missing
    Rt->>Net: download ANTLR runtime tarball (GitHub release)
    Rt->>FS: extract runtime/Cpp subtree to SOURCE_DIR
    Rt->>CMake: configure (Release, no tests, CMP0135, lazy install)
    CMake-->>FS: build artifacts
    Rt->>CMake: install to INSTALL_PREFIX
    Rt->>FS: compute/store checksum of installed files
  end
  deactivate Rt
  deactivate Tasks
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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: 3

🔭 Outside diff range comments (1)
lint-tasks.yaml (1)

48-56: Exclude auto-generated DSL code from clang-format sources

The sources anchor now sweeps {{.G_SRC_SPIDER_DIR}}/**/*, {{.G_EXAMPLES_DIR}}/**/*, and {{.G_TEST_DIR}}/**/*. Per our earlier learning, the ANTLR-generated C++ living under G_SRC_DSL_DIR ( src/stdl ) must never be linted. If src/stdl sits inside src/spider, these glob patterns will inadvertently pick it up.

Consider adding an explicit negative pattern or moving the generated folder outside the globbed roots.

♻️ Duplicate comments (1)
.github/workflows/code-linting-checks.yaml (1)

50-52: Same parallelism comment as in unit-tests workflow

Confirm that SPIDER_DEP_BUILD_PARALLELISM="1" is really what you want for linting CI; bumping it to the runner CPU count can dramatically cut wall time.

🧹 Nitpick comments (2)
lint-tasks.yaml (1)

62-66: Anchor naming collisions can confuse future edits

The list of ROOT_PATHS is anchored as &cpp_source_files, which is semantically close to the earlier &cpp_lint_source_files. The near-identical names make it easy to misuse one for the other later.

Renaming one of the anchors to something unambiguous (e.g., &cpp_format_root_paths) will reduce cognitive load.

dep-tasks.yaml (1)

118-119: Default G_DEP_BUILD_PARALLELISM when unset

JOBS: "{{.G_DEP_BUILD_PARALLELISM}}" is great for CI throttling, but on a developer machine the variable may be undefined, causing serial builds. Add a Taskfile fallback, e.g.,

vars:
  G_DEP_BUILD_PARALLELISM: "{{default .NUM_CPU 1}}"

so contributors automatically get sensible parallelism.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fdfd8f2 and 9adc6a3.

📒 Files selected for processing (7)
  • .github/workflows/code-linting-checks.yaml (1 hunks)
  • .github/workflows/unit-tests.yaml (1 hunks)
  • dep-tasks.yaml (6 hunks)
  • lint-tasks.yaml (3 hunks)
  • taskfile.yaml (1 hunks)
  • tools/scripts/lib_install/linux/install-dev.sh (1 hunks)
  • tools/yscope-dev-utils (1 hunks)
🧠 Learnings (1)
lint-tasks.yaml (1)

Learnt from: sitaowang1998
PR: #168
File: lint-tasks.yaml:62-65
Timestamp: 2025-07-17T19:44:06.132Z
Learning: ANTLR-generated C++ code in the G_SRC_DSL_DIR (src/stdl) should not be included in linting tasks because it's auto-generated code that doesn't follow manual coding standards.

🧰 Additional context used
🧠 Learnings (1)
lint-tasks.yaml (1)

Learnt from: sitaowang1998
PR: #168
File: lint-tasks.yaml:62-65
Timestamp: 2025-07-17T19:44:06.132Z
Learning: ANTLR-generated C++ code in the G_SRC_DSL_DIR (src/stdl) should not be included in linting tasks because it's auto-generated code that doesn't follow manual coding standards.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: lint
  • GitHub Check: non-storage-unit-tests (ubuntu-22.04)
  • GitHub Check: non-storage-unit-tests (ubuntu-24.04)
🔇 Additional comments (5)
tools/yscope-dev-utils (1)

1-1: Submodule reference update looks good

The new commit hash is cleanly recorded. Provided the corresponding commit exists on the remote and CI runs git submodule update --init --recursive, no further action is required.

.github/workflows/unit-tests.yaml (1)

53-55: Verify that forcing SPIDER_DEP_BUILD_PARALLELISM=1 achieves the intended throttling

Setting the variable to "1" limits every CMake dependency build to a single job. Confirm this is deliberate for CI resource control; otherwise you may be paying with longer runtimes.

taskfile.yaml (1)

23-25: Empty G_DEP_BUILD_PARALLELISM may lead to malformed -j flags

If downstream tasks do make -j{{.G_DEP_BUILD_PARALLELISM}} and this variable is empty, the command becomes -j, which GNU make interprets as unlimited jobs – opposite of your CI throttling goal.

Ensure dep-tasks guard against an empty string (e.g., use {{if ne .G_DEP_BUILD_PARALLELISM ""}}-j{{.G_DEP_BUILD_PARALLELISM}}{{end}}).

dep-tasks.yaml (2)

74-90: Directory-level checksum may yield false negatives

INCLUDE_PATTERNS: ["{{.INSTALL_PREFIX}}"] points at a directory, not individual files.
If utils:checksum:validate walks files in an undefined order, timestamp-only changes (e.g., from reinstalling without rebuild) could alter the directory mtime and force an unnecessary rebuild despite an identical payload.

Consider hashing the file set (e.g., *.a, *.so, *.cmake, *.h) rather than the directory node itself, or reuse the CMake install manifest for deterministic input.


111-114: Policy CMP0135 requires CMake ≥ 3.24

Setting -DCMAKE_POLICY_DEFAULT_CMP0135=NEW will fail on hosts with an older CMake, breaking local builds that don’t mirror the CI container. Please either:

  1. Guard the flag with a CMake version check, or
  2. Document the minimum supported CMake version in the BUILDING guide.

Comment on lines 85 to 108
sources: *cpp_lint_source_files
deps: [":config-cmake-project", "cpp-configs", "venv"]
cmds:
- task: ":utils:cpp-lint:clang-tidy-find"
vars:
FLAGS:
- "--config-file '{{.ROOT_DIR}}/.clang-tidy'"
- "-p '{{.G_SPIDER_COMPILE_COMMANDS_DB}}'"
INCLUDE_PATTERNS:
- "{{.G_SRC_SPIDER_DIR}}/**"
- "{{.G_TEST_DIR}}/**"
INCLUDE_FILENAME_PATTERNS: ["*.cpp", "*.h", "*.hpp", "*.inc"]
OUTPUT_DIR: "{{.G_LINT_CLANG_TIDY_DIR}}"
ROOT_PATHS: *cpp_source_files
ROOT_PATHS:
- "{{.G_SRC_SPIDER_DIR}}"
- "{{.G_TEST_DIR}}"
VENV_DIR: "{{.G_LINT_VENV_DIR}}"
- task: ":utils:cpp-lint:clang-tidy-find"
vars:
FLAGS:
- "--config-file '{{.ROOT_DIR}}/.clang-tidy'"
- "-p '{{.G_EXAMPLES_COMPILE_COMMANDS_DB}}'"
INCLUDE_PATTERNS:
- "{{.G_EXAMPLES_DIR}}/**"
INCLUDE_FILENAME_PATTERNS: ["*.cpp", "*.h", "*.hpp", "*.inc"]
OUTPUT_DIR: "{{.G_LINT_CLANG_TIDY_DIR}}"
ROOT_PATHS: *cpp_source_files
ROOT_PATHS:
- "{{.G_EXAMPLES_DIR}}"
VENV_DIR: "{{.G_LINT_VENV_DIR}}"
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Duplicate ROOT_PATHS fragments – use the anchor you already defined

cpp-static-check hard-codes the same directory lists that were captured in &cpp_source_files, causing duplication and a maintenance hazard if paths change.

-          ROOT_PATHS:
-            - "{{.G_SRC_SPIDER_DIR}}"
-            - "{{.G_TEST_DIR}}"
+          ROOT_PATHS: *cpp_source_files

Apply similarly to the second clang-tidy-find invocation.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sources: *cpp_lint_source_files
deps: [":config-cmake-project", "cpp-configs", "venv"]
cmds:
- task: ":utils:cpp-lint:clang-tidy-find"
vars:
FLAGS:
- "--config-file '{{.ROOT_DIR}}/.clang-tidy'"
- "-p '{{.G_SPIDER_COMPILE_COMMANDS_DB}}'"
INCLUDE_PATTERNS:
- "{{.G_SRC_SPIDER_DIR}}/**"
- "{{.G_TEST_DIR}}/**"
INCLUDE_FILENAME_PATTERNS: ["*.cpp", "*.h", "*.hpp", "*.inc"]
OUTPUT_DIR: "{{.G_LINT_CLANG_TIDY_DIR}}"
ROOT_PATHS: *cpp_source_files
ROOT_PATHS:
- "{{.G_SRC_SPIDER_DIR}}"
- "{{.G_TEST_DIR}}"
VENV_DIR: "{{.G_LINT_VENV_DIR}}"
- task: ":utils:cpp-lint:clang-tidy-find"
vars:
FLAGS:
- "--config-file '{{.ROOT_DIR}}/.clang-tidy'"
- "-p '{{.G_EXAMPLES_COMPILE_COMMANDS_DB}}'"
INCLUDE_PATTERNS:
- "{{.G_EXAMPLES_DIR}}/**"
INCLUDE_FILENAME_PATTERNS: ["*.cpp", "*.h", "*.hpp", "*.inc"]
OUTPUT_DIR: "{{.G_LINT_CLANG_TIDY_DIR}}"
ROOT_PATHS: *cpp_source_files
ROOT_PATHS:
- "{{.G_EXAMPLES_DIR}}"
VENV_DIR: "{{.G_LINT_VENV_DIR}}"
sources: *cpp_lint_source_files
deps: [":config-cmake-project", "cpp-configs", "venv"]
cmds:
- task: ":utils:cpp-lint:clang-tidy-find"
vars:
FLAGS:
- "--config-file '{{.ROOT_DIR}}/.clang-tidy'"
- "-p '{{.G_SPIDER_COMPILE_COMMANDS_DB}}'"
INCLUDE_FILENAME_PATTERNS: ["*.cpp", "*.h", "*.hpp", "*.inc"]
OUTPUT_DIR: "{{.G_LINT_CLANG_TIDY_DIR}}"
ROOT_PATHS: *cpp_source_files
VENV_DIR: "{{.G_LINT_VENV_DIR}}"
- task: ":utils:cpp-lint:clang-tidy-find"
vars:
FLAGS:
- "--config-file '{{.ROOT_DIR}}/.clang-tidy'"
- "-p '{{.G_EXAMPLES_COMPILE_COMMANDS_DB}}'"
INCLUDE_FILENAME_PATTERNS: ["*.cpp", "*.h", "*.hpp", "*.inc"]
OUTPUT_DIR: "{{.G_LINT_CLANG_TIDY_DIR}}"
ROOT_PATHS:
- "{{.G_EXAMPLES_DIR}}"
VENV_DIR: "{{.G_LINT_VENV_DIR}}"
🤖 Prompt for AI Agents
In lint-tasks.yaml around lines 85 to 108, the ROOT_PATHS lists are duplicated
in both clang-tidy-find tasks, which risks maintenance issues. Refactor by
replacing the hard-coded ROOT_PATHS arrays with references to the existing
anchor &cpp_source_files or a similar anchor that captures these directory
lists. Apply this change to both clang-tidy-find invocations to avoid
duplication and ensure consistency.

@sitaowang1998 sitaowang1998 added the on hold On hold temporarily label Jul 23, 2025
@sitaowang1998
Copy link
Collaborator Author

On hold. Include changes in #166.

@sitaowang1998 sitaowang1998 removed the on hold On hold temporarily label Aug 19, 2025
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: 0

♻️ Duplicate comments (1)
tools/scripts/lib_install/linux/install-dev.sh (1)

41-43: curl | sh is a supply-chain risk — fetch, verify checksum, then execute.

This was flagged previously and remains unresolved. Please avoid piping remote scripts directly to a shell.

Apply a fetch-and-verify flow with a pinned version. Example:

-# Install uv
-curl -LsSf https://astral.sh/uv/install.sh | sh
+# Install uv (fetch, verify, then execute; pin version)
+UV_VERSION="0.4.20"  # example: set to a vetted version
+UV_INSTALLER="/tmp/uv-install.sh"
+UV_INSTALLER_SHA256="<EXPECTED_SHA256_FOR_${UV_VERSION}>"
+
+curl -LsSf "https://astral.sh/uv/install.sh" -o "${UV_INSTALLER}"
+echo "${UV_INSTALLER_SHA256}  ${UV_INSTALLER}" | sha256sum -c -
+bash "${UV_INSTALLER}" --version "${UV_VERSION}"
+rm -f "${UV_INSTALLER}"

Notes:

  • Replace <EXPECTED_SHA256_FOR_${UV_VERSION}> with the official checksum published by the vendor for the selected version.
  • Pinning the version and verifying the checksum prevents MITM and compromised upstream incidents.
🧹 Nitpick comments (1)
tools/scripts/lib_install/linux/install-dev.sh (1)

29-29: Use a smaller, distro-portable Java runtime

We didn’t find any references to javac, javadoc or other JDK-only tools in the repo. For runtime-only needs, prefer a headless JRE to reduce image size and track the distro’s LTS:

  • File: tools/scripts/lib_install/linux/install-dev.sh, line 29
-    openjdk-11-jdk \
+    default-jre-headless \

If you later need the full JDK (e.g. for compilation), swap in:

-    openjdk-11-jdk \
+    default-jdk \
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1667814 and a4a0911.

📒 Files selected for processing (1)
  • tools/scripts/lib_install/linux/install-dev.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: non-storage-unit-tests (ubuntu-22.04)
  • GitHub Check: non-storage-unit-tests (ubuntu-24.04)
  • GitHub Check: lint

Copy link
Member

@LinZhihao-723 LinZhihao-723 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:

build: Add Antlr jar and C++ runtime dependencies.

@sitaowang1998 sitaowang1998 changed the title build: Install Antlr jar and C++ runtime. build: Add Antlr jar and C++ runtime dependencies. Aug 19, 2025
@LinZhihao-723 LinZhihao-723 merged commit beba635 into y-scope:main Aug 19, 2025
6 checks passed
@sitaowang1998 sitaowang1998 deleted the antlr branch August 19, 2025 22:47
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