Skip to content

Conversation

Bill-hbrhbr
Copy link
Contributor

@Bill-hbrhbr Bill-hbrhbr commented Oct 3, 2025

Description

Background

Library install tasks in main.yaml are designed to be reusable, but they were only used to build the project clp-core via task deps:core.

With the introduction of a new project task deps:spider in #1318 , we quickly realized that the library installation utilities in both this repo and in yscope-dev-utils were designed in a way that prevents easily adding a second CPP project.

Specifically, there were several problems:

  • Race conditions could occur when core and spider share install tasks and utilities.
  • Only one checksums directory, instead of one for each project.
    • Only one combined checksums to decide if task deps:core is up-to-date.
    • Checksums are not properly implemented to detect up-to-date status of individual lib installation.
  • Only a single cmake-settings directory, instead of one for each project:

Solution

Changes in yscope-dev-utils are required first, and then we use the new utilities to fix the race conditions above:

To make the future bug fix logic clearer for review, this PR introduces a purely cosmetic refactorization of main.yaml first.
Later, when we finally bump the yscope-dev-utils version, we will open subsequent PRs for actual fixes:

Main structural changes

Previously, all dependency tasks were bundled inside a single main.yaml. Now, we split the tasks into modular, categorized files:

  • Major project target files:
    • core.yaml
    • spider.yaml
    • log-viewer.yaml
  • Individual library component tasks:
    • artifacts.yaml — only require downloading but not installations
    • cmake-libs.yaml — directly use utils:install-remote-cmake-lib due to well-written CMake project structure.
    • misc-libs.yaml — use other install methods due to not fully conforming to the nice CMake structure.

Miscellaneous Changes

Other than the structural copy-paste refactoring, this PR also includes several one big and several small adjustments.

Big adjustment:

  • The following libraries have been modified to be installable via utils:install-remote-cmake-lib
    • antlr-runtime: instead of extracting the downloaded tar and removing the external layers outside the Cpp directory, we directly specify the directory where CMakelists.txt lives.
    • utfcpp: being an interface-only library, is still installable. We now install it as a regular library.

Small adjustments:

  • deps:core and deps:spider-dep no longer resets the cmake settings directory, which is already done by yscope-dev-utils:cmake:install-deps-and-generate-settings
  • The deps: section of deps:<target>-all-parallel now iterates over a list variable.
    • Easier to add common arguments to deps tasks in the future.
  • The utils:init task has been moved into main.yaml and is now only invoked by the top-level deps tasks:
    • deps:core
    • deps:spider:spider-dep
  • Tasks prefixed with utils: and yscope-dev-utils: inside some taskfiles are now prefixed with a leading colon (:) to align with updated namespaces.

Summary

Restructuring in this PR improves clarity, modularity, and maintainability, and lays the groundwork for properly supporting multiple independent CPP project targets in the future.

For the prototype of the final version, see:

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

  • Existing workflows pass after refactorizations.

Summary by CodeRabbit

  • New Features

    • One-click install tasks for many C/C++ libraries (absl, antlr-runtime, catch2, date, fmt, liblzma, log-surgeon, lz4, mariadb-connector-cpp, microsoft.gsl, mongocxx, msgpack-cxx, nlohmann_json, simdjson, spdlog, utfcpp, yaml-cpp, ystdlib, zlib, zstd, Boost, SQLite, ANTLR jar, log‑viewer).
    • Platform-aware installs, multi-variant build options, and checksum‑verified downloads with dedicated per‑library install flows and inter‑library dependency handling; parallelized per‑dependency execution for faster setups.
  • Chores

    • Reorganized dependency orchestration; centralized CMake/settings and checksum handling and simplified initialization/utility wiring.

Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Adds many dependency task definitions and reorganizes dependency orchestration: new CMake-based library tasks, misc library tasks, artifact download tasks, and refactored init/utility wiring to centralize checksum and CMake-settings generation and installation flows.

Changes

Cohort / File(s) Summary
CMake-based third-party libs
taskfiles/deps/cmake-libs.yaml
Added ~20 one-shot internal tasks (absl, antlr-runtime, catch2, date, fmt, liblzma, log-surgeon, lz4, mariadb-connector-cpp, microsoft.gsl, mongocxx, msgpack-cxx, nlohmann_json, simdjson, spdlog, utfcpp, yaml-cpp, ystdlib, zlib, zstd) defining versioned tarball URLs and SHA256s, CMake generation args, optional build variants, platform constraints, inter-library dependencies, and per-library install subtasks.
Core orchestrator
taskfiles/deps/core.yaml
New core workflow that initializes state, runs :yscope-dev-utils:cmake:install-deps-and-generate-settings with CMAKE settings dir/file, defines core-all-parallel to enumerate CPP core tasks and expand per-item tasks, then combines CPP checksum files.
Spider orchestrator
taskfiles/deps/spider.yaml
New spider workflow: default → spider (Linux/Ubuntu precondition); spider-dep prepares settings and combines checksums; spider-all-parallel enumerates spider component tasks; spider runs remote CMake install for the Spider artifact with supplied CMake args.
Main deps entrypoint refactor
taskfiles/deps/main.yaml
Reorganized includes (adds core, spider, log-viewer), removed utils-only include, added G_DEPS_CPP_CHECKSUMS_DIR, removed G_DEPS_LOG_VIEWER_CHECKSUM_FILE, consolidated init into single internal init task, and added mkdir steps for deps directories.
Misc libraries & special installs
taskfiles/deps/misc-libs.yaml
Added boost (selective Boost component download/install) and sqlite3 (amalgamation download, extraction, include symlink, and cmake cache entries) with versioning and checksum validation.
Log viewer artifact
taskfiles/deps/log-viewer.yaml
New task to download/extract yscope-log-viewer tarball with SHA256 validation and CHECKSUM_FILE integration.
Utils wiring updates
taskfiles/deps/utils.yaml
Removed public init, replaced local task references with fully-qualified :yscope-dev-utils: references, adjusted run: "once" placement for checksum cleanup, and removed top-level includes mapping.
Artifacts (ANTLR jar)
taskfiles/deps/artifacts.yaml
New internal antlr-jar artifact: checksum validation step, download of ANTLR complete jar to OUTPUT_FILE, and final checksum computation/recording.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer
  participant Main as deps/main.yaml
  participant Core as deps/core.yaml:core
  participant Utils as :yscope-dev-utils
  participant CMakeLibs as deps/cmake-libs.yaml
  participant Misc as deps/misc-libs.yaml
  participant Checks as checksum-aggregator

  Dev->>Main: run deps (default)
  Main->>Core: invoke core
  Core->>Utils: cmake:install-deps-and-generate-settings (CMAKE_SETTINGS_DIR, FILE)
  Utils->>CMakeLibs: trigger per-lib download/build/install
  Utils->>Misc: trigger misc lib installs/artifacts
  CMakeLibs->>Checks: emit per-lib checksum files
  Misc->>Checks: emit per-lib checksum files
  Core->>Checks: combine-cpp-checksum-files
  Core-->>Dev: complete
Loading
sequenceDiagram
  autonumber
  participant Dev as Developer
  participant Spider as deps/spider.yaml:spider
  participant SpiderDep as deps/spider.yaml:spider-dep
  participant Utils as :yscope-dev-utils
  participant Installer as cmake-installer

  Dev->>Spider: run spider (linux/Ubuntu)
  Spider->>SpiderDep: ensure deps & settings
  SpiderDep->>Utils: clean-outdated-cpp-checksum-files
  SpiderDep->>Utils: cmake:install-deps-and-generate-settings
  SpiderDep->>Utils: combine-cpp-checksum-files
  Spider->>Installer: install-remote-tar (Spider artifact, URL, SHA256, CMAKE args)
  Installer-->>Dev: Spider installed
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 inconclusive)
Check name Status Explanation Resolution
Linked Issues Check ❓ Inconclusive Linked issue #1384 contains no concrete requirements or coding objectives, so it is not possible to assess whether the changes satisfy its intended goals. Please update issue #1384 with specific coding objectives or checklist items to enable a clear compliance evaluation.
Out of Scope Changes Check ❓ Inconclusive Without defined objectives in the linked issue, it is unclear which changes are intended to address its scope, making it impossible to determine if any modifications are out of scope. Define the scope and requirements in the linked issue or break out unrelated refactor changes into a separate pull request to clarify the intended scope.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title concisely describes the primary change by summarising both the split of the main dependency Taskfile into category-specific modules and the migration of antlr-runtime and utfcpp to use the utils:install-remote-cmake-lib task.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • 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

Comment @coderabbitai help to get the list of available commands and usage tips.

@Bill-hbrhbr Bill-hbrhbr changed the title refactor(taskfile): Modularize deps tasks. refactor(taskfile): Split dependency installation tasks into modular categorized taskfiles. Oct 5, 2025
@Bill-hbrhbr Bill-hbrhbr changed the title refactor(taskfile): Split dependency installation tasks into modular categorized taskfiles. refactor(taskfile): Split main dependency Taskfile into category-specific modules. Oct 5, 2025
@Bill-hbrhbr Bill-hbrhbr marked this pull request as ready for review October 5, 2025 09:48
@Bill-hbrhbr Bill-hbrhbr requested a review from a team as a code owner October 5, 2025 09:48
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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
taskfile.yaml (1)

130-162: Restore the dependency on the Spider build task.

deps:spider:spider-dep stops after installing Spider’s prerequisites; it never runs the spider build that produces {{.G_SPIDER_BUILD_DIR}}/spider-build/src/spider/spider_scheduler and spider_worker. The rsync in the package recipe will therefore fail with missing inputs. Please depend on the full Spider build (e.g., deps:spider) so these binaries exist before packaging.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 212200a and 9160b55.

📒 Files selected for processing (8)
  • taskfile.yaml (1 hunks)
  • taskfiles/deps/cmake-libs.yaml (1 hunks)
  • taskfiles/deps/core.yaml (1 hunks)
  • taskfiles/deps/log-viewer.yaml (1 hunks)
  • taskfiles/deps/main.yaml (1 hunks)
  • taskfiles/deps/misc-libs.yaml (1 hunks)
  • taskfiles/deps/spider.yaml (1 hunks)
  • taskfiles/deps/utils.yaml (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-05-28T18:33:30.155Z
Learnt from: anlowee
PR: y-scope/clp#925
File: taskfiles/deps/main.yaml:97-106
Timestamp: 2025-05-28T18:33:30.155Z
Learning: In the taskfiles dependency system (taskfiles/deps/main.yaml), echo commands are used to generate .cmake settings files that are consumed by the main CMake build process. These files set variables like ANTLR_RUNTIME_HEADER to point to dependency locations for use during compilation.

Applied to files:

  • taskfiles/deps/misc-libs.yaml
📚 Learning: 2025-07-23T09:54:45.185Z
Learnt from: Bill-hbrhbr
PR: y-scope/clp#1122
File: components/core/src/clp/clp/CMakeLists.txt:175-195
Timestamp: 2025-07-23T09:54:45.185Z
Learning: In the CLP project, when reviewing CMakeLists.txt changes that introduce new compression library dependencies (BZip2, LibLZMA, LZ4, ZLIB), the team prefers to address conditional linking improvements in separate PRs rather than expanding the scope of focused migration PRs like the LibArchive task-based installation migration.

Applied to files:

  • taskfiles/deps/cmake-libs.yaml
⏰ 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). (6)
  • GitHub Check: package-image
  • GitHub Check: musllinux_1_2-x86_64-static-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: musllinux_1_2-x86_64-dynamic-linked-bins
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: build-macos (macos-15, true)

@davidlion
Copy link
Member

davidlion commented Oct 6, 2025

If I understand correctly the scenario is that:

  • In the package spider and clp are two separate projects/entities.
  • The tasks changes from spider and clp in feat(clp-package): Add Spider and its dependencies to the build. #1318 called their dependencies tasks as if they were separate projects.
  • The install-deps-and-generate-settings task is made to be called once CMAKE_SETTINGS_FILE.
    • If install-deps-and-generate-settings is called from multiple projects with the same CMAKE_SETTINGS_DIR and different CMAKE_SETTINGS_FILEs any shared deps will be handled correctly (but the files may include unnecessary deps from other projects).
  • The dependency tasks for spider were added as if spider was a shared dependency of clp (in order to share dependencies between the projects).
    • This is the root of the problem.

Is it correct to say the fix in this PR is splitting all.cmake into two files (basically changing 2 lines) and all other changes are organizational/visual improvements? If my understanding is correct, we should separate the fix into its own PR as this PR is currently both a fix and a refactor.

====

(Assuming my understanding above is correct.)
We should open an issue in dev-utils to track/remember this problem (add better support for dependencies shared between multiple projects aka multiple install-deps-and-generate-settings calls). However, I think a proper solution for shared-deps in non-trivial and the solution in this PR is probably fine in the few cases we have multiple projects inside one repo.

====

On a side note, in the future only request a single reviewer at a time to reduce confusion and prevent duplicate comments. The yscope-maintainers group automatically notifies a bunch of people, but you probably want to talk to people to figure out the order of reviews (if you want multiple) or who has time.

@sitaowang1998
Copy link
Contributor

@CodeRabbit Open a PR in yscope-dev-utils repo to better support dependency sharing between multiple projects.

Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Tip

For best results, initiate chat on the files or code changes.

@sitaowang1998: I want to clarify your request. Based on the comment chain, davidlion mentioned opening an issue to track this problem. However, you mentioned opening a PR.

I can help you:

  • Open an issue in the yscope-dev-utils repository to track the need for better support for dependency sharing between multiple projects
  • Cannot open a PR - I'm not able to create pull requests with code changes

Would you like me to open an issue in the yscope-dev-utils repository to track this enhancement? If so, I'll create it with:

  • A clear description of the problem (multiple projects sharing dependencies with different CMAKE_SETTINGS_FILE values)
  • Reference to this PR and the discussion
  • Assignee as you requested

Please confirm if you'd like me to proceed with creating an issue.

@sitaowang1998
Copy link
Contributor

@CodeRabbit. Sorry I meant opening an issue

Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Create an issue in yscope-dev-utils repository for tracking dependency sharing support

gh issue create \
  --repo y-scope/yscope-dev-utils \
  --title "Better support for dependencies shared between multiple projects" \
  --assignee sitaowang1998 \
  --body "## Problem

When multiple projects within a single repository (e.g., \`spider\` and \`clp\`) call \`install-deps-and-generate-settings\` with:
- The same \`CMAKE_SETTINGS_DIR\`
- Different \`CMAKE_SETTINGS_FILE\` values (e.g., \`all-core.cmake\` and \`all-spider.cmake\`)

The current implementation handles shared dependencies correctly, but the generated CMake settings files may include unnecessary dependencies from other projects.

## Context

This issue was identified during the refactoring of dependency tasks in y-scope/clp#1377. The PR works around the limitation by splitting dependency tasks into separate modular files, but a proper solution in dev-utils would provide better support for this use case.

## Requested Enhancement

Add better support for scenarios where multiple projects in the same repository share dependencies and need to call \`install-deps-and-generate-settings\` multiple times with different output files.

## References

- PR discussion: https://github.com/y-scope/clp/pull/1377#discussion_r1871429583
- Original PR introducing spider deps: y-scope/clp#1318
- Follow-up mitigation: y-scope/clp#1331
- Requested by: @sitaowang1998"

Length of output: 53


@sitaowang1998: No problem! I've created the issue in the yscope-dev-utils repository to track better support for dependency sharing between multiple projects:

🔗 Issue #89: y-scope/yscope-dev-utils#89

The issue includes:

The issue is now ready for tracking and future implementation.

@sitaowang1998
Copy link
Contributor

sitaowang1998 commented Oct 6, 2025

Is it correct to say the fix in this PR is splitting all.cmake into two files (basically changing 2 lines) and all other changes are organizational/visual improvements? If my understanding is correct, we should separate the fix into its own PR as this PR is currently both a fix and a refactor.

This is already done in #1331. This PR is just a refactor of the taskfile structure with some minor fixes.

The main problem is that install-deps-and-generate-settings removes and recreates the CMAKE_SETTING_DIR. This leads to concurrency issue when both core and spider-deps executes this task, which might crash the workflow.

The problem of including unnecessary settings in combined cmake setting files is not a big issue, as it does not affect the correctness of the build system.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2b0917 and 07914d6.

📒 Files selected for processing (3)
  • taskfiles/deps/artifacts.yaml (1 hunks)
  • taskfiles/deps/main.yaml (1 hunks)
  • taskfiles/deps/misc-libs.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-05-28T18:33:30.155Z
Learnt from: anlowee
PR: y-scope/clp#925
File: taskfiles/deps/main.yaml:97-106
Timestamp: 2025-05-28T18:33:30.155Z
Learning: In the taskfiles dependency system (taskfiles/deps/main.yaml), echo commands are used to generate .cmake settings files that are consumed by the main CMake build process. These files set variables like ANTLR_RUNTIME_HEADER to point to dependency locations for use during compilation.

Applied to files:

  • taskfiles/deps/misc-libs.yaml
⏰ 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). (17)
  • GitHub Check: package-image
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: musllinux_1_2-x86_64-static-linked-bins
  • GitHub Check: musllinux_1_2-x86_64-dynamic-linked-bins
  • GitHub Check: manylinux_2_28-x86_64-static-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: manylinux_2_28-x86_64-dynamic-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: build-macos (macos-14, true)
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: build-macos (macos-14, false)
  • GitHub Check: rust-checks (macos-15)
  • GitHub Check: rust-checks (ubuntu-22.04)
  • GitHub Check: rust-checks (ubuntu-24.04)
  • GitHub Check: lint-check (macos-15)
  • GitHub Check: lint-check (ubuntu-24.04)

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 07914d6 and 9d462b7.

📒 Files selected for processing (4)
  • taskfiles/deps/artifacts.yaml (1 hunks)
  • taskfiles/deps/cmake-libs.yaml (1 hunks)
  • taskfiles/deps/main.yaml (1 hunks)
  • taskfiles/deps/misc-libs.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-05-28T18:33:30.155Z
Learnt from: anlowee
PR: y-scope/clp#925
File: taskfiles/deps/main.yaml:97-106
Timestamp: 2025-05-28T18:33:30.155Z
Learning: In the taskfiles dependency system (taskfiles/deps/main.yaml), echo commands are used to generate .cmake settings files that are consumed by the main CMake build process. These files set variables like ANTLR_RUNTIME_HEADER to point to dependency locations for use during compilation.

Applied to files:

  • taskfiles/deps/misc-libs.yaml
📚 Learning: 2025-07-23T09:54:45.185Z
Learnt from: Bill-hbrhbr
PR: y-scope/clp#1122
File: components/core/src/clp/clp/CMakeLists.txt:175-195
Timestamp: 2025-07-23T09:54:45.185Z
Learning: In the CLP project, when reviewing CMakeLists.txt changes that introduce new compression library dependencies (BZip2, LibLZMA, LZ4, ZLIB), the team prefers to address conditional linking improvements in separate PRs rather than expanding the scope of focused migration PRs like the LibArchive task-based installation migration.

Applied to files:

  • taskfiles/deps/cmake-libs.yaml
⏰ 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). (4)
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: rust-checks (ubuntu-22.04)
  • GitHub Check: rust-checks (ubuntu-24.04)
  • GitHub Check: build-macos (macos-14, false)

Comment on lines +160 to +167
preconditions:
# NOTE: The MariaDB connector is only required for building Spider, which is only supported on
# Ubuntu. `INSTALL_LAYOUT` is currently hardcoded to "DEB". To support other Linux distros:
# - Update the precondition accordingly.
# - Make `INSTALL_LAYOUT` configurable.
- >-
source /etc/os-release && [[ "$ID" == "ubuntu" ]]
run: "once"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix bashisms in precondition.

Task preconditions run under /bin/sh, so source and [[ … ]] are undefined and the check exits 127 even on Ubuntu, blocking the install. Use POSIX-compatible syntax instead.

-      - >-
-        source /etc/os-release && [[ "$ID" == "ubuntu" ]]
+      - >-
+        . /etc/os-release && [ "$ID" = "ubuntu" ]
📝 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
preconditions:
# NOTE: The MariaDB connector is only required for building Spider, which is only supported on
# Ubuntu. `INSTALL_LAYOUT` is currently hardcoded to "DEB". To support other Linux distros:
# - Update the precondition accordingly.
# - Make `INSTALL_LAYOUT` configurable.
- >-
source /etc/os-release && [[ "$ID" == "ubuntu" ]]
run: "once"
preconditions:
# NOTE: The MariaDB connector is only required for building Spider, which is only supported on
# Ubuntu. `INSTALL_LAYOUT` is currently hardcoded to "DEB". To support other Linux distros:
# - Update the precondition accordingly.
# - Make `INSTALL_LAYOUT` configurable.
- >-
. /etc/os-release && [ "$ID" = "ubuntu" ]
run: "once"
🤖 Prompt for AI Agents
In taskfiles/deps/cmake-libs.yaml around lines 160 to 167, the precondition uses
bash-only constructs (`source` and `[[ … ]]`) which fail under /bin/sh; replace
them with POSIX equivalents: use `. /etc/os-release` instead of `source
/etc/os-release`, and use `[ "$ID" = "ubuntu" ]` (single `=`) instead of `[[
"$ID" == "ubuntu" ]]`; ensure the whole command exits with the appropriate
success/failure status (e.g., chain the dot and test so the test runs only if
the file exists).

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 c07595e and 5664d7c.

📒 Files selected for processing (2)
  • taskfiles/deps/core.yaml (1 hunks)
  • taskfiles/deps/spider.yaml (1 hunks)

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

♻️ Duplicate comments (1)
taskfiles/deps/cmake-libs.yaml (1)

165-167: Replace bashisms in the MariaDB precondition.

source and [[ … ]] aren’t available in /bin/sh, so this guard fails even on Ubuntu. Use POSIX syntax so the task can run.

-      - >-
-        source /etc/os-release && [[ "$ID" == "ubuntu" ]]
+      - >-
+        [ -r /etc/os-release ] && . /etc/os-release && [ "$ID" = "ubuntu" ]
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5338f73 and 7d42269.

📒 Files selected for processing (4)
  • taskfiles/deps/cmake-libs.yaml (1 hunks)
  • taskfiles/deps/core.yaml (1 hunks)
  • taskfiles/deps/misc-libs.yaml (1 hunks)
  • taskfiles/deps/spider.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: anlowee
PR: y-scope/clp#925
File: taskfiles/deps/main.yaml:97-106
Timestamp: 2025-05-28T18:33:30.155Z
Learning: In the taskfiles dependency system (taskfiles/deps/main.yaml), echo commands are used to generate .cmake settings files that are consumed by the main CMake build process. These files set variables like ANTLR_RUNTIME_HEADER to point to dependency locations for use during compilation.
📚 Learning: 2025-07-23T09:54:45.185Z
Learnt from: Bill-hbrhbr
PR: y-scope/clp#1122
File: components/core/src/clp/clp/CMakeLists.txt:175-195
Timestamp: 2025-07-23T09:54:45.185Z
Learning: In the CLP project, when reviewing CMakeLists.txt changes that introduce new compression library dependencies (BZip2, LibLZMA, LZ4, ZLIB), the team prefers to address conditional linking improvements in separate PRs rather than expanding the scope of focused migration PRs like the LibArchive task-based installation migration.

Applied to files:

  • taskfiles/deps/cmake-libs.yaml
📚 Learning: 2025-05-28T18:33:30.155Z
Learnt from: anlowee
PR: y-scope/clp#925
File: taskfiles/deps/main.yaml:97-106
Timestamp: 2025-05-28T18:33:30.155Z
Learning: In the taskfiles dependency system (taskfiles/deps/main.yaml), echo commands are used to generate .cmake settings files that are consumed by the main CMake build process. These files set variables like ANTLR_RUNTIME_HEADER to point to dependency locations for use during compilation.

Applied to files:

  • taskfiles/deps/misc-libs.yaml
⏰ 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). (17)
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: package-image
  • GitHub Check: manylinux_2_28-x86_64-static-linked-bins
  • GitHub Check: manylinux_2_28-x86_64-dynamic-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: musllinux_1_2-x86_64-dynamic-linked-bins
  • GitHub Check: musllinux_1_2-x86_64-static-linked-bins
  • GitHub Check: rust-checks (ubuntu-24.04)
  • GitHub Check: rust-checks (ubuntu-22.04)
  • GitHub Check: lint-check (ubuntu-24.04)
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: build-macos (macos-14, true)
  • GitHub Check: build-macos (macos-14, false)
  • GitHub Check: build-macos (macos-15, true)

Comment on lines +15 to +16
source /etc/os-release && [[ "$ID" == "ubuntu" ]]
cmds:
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 7, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Use POSIX-compatible precondition syntax.

source and [[ … ]] are bash-only, so this precondition exits under /bin/sh, blocking the task on Ubuntu. Switch to POSIX forms so the check succeeds where it should.

-      - >-
-        source /etc/os-release && [[ "$ID" == "ubuntu" ]]
+      - >-
+        [ -r /etc/os-release ] && . /etc/os-release && [ "$ID" = "ubuntu" ]
📝 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
source /etc/os-release && [[ "$ID" == "ubuntu" ]]
cmds:
- >-
[ -r /etc/os-release ] && . /etc/os-release && [ "$ID" = "ubuntu" ]
cmds:
🤖 Prompt for AI Agents
In taskfiles/deps/spider.yaml around lines 15–16, the precondition uses
bash-only syntax ("source" and "[[ ... ]]") which breaks under /bin/sh; replace
with POSIX-compatible forms: use ". /etc/os-release" (or "if [ -r
/etc/os-release ]; then . /etc/os-release; fi") and the single-bracket string
test "[ "$ID" = "ubuntu" ]" (or use grep/awk to check ID from /etc/os-release)
so the conditional runs correctly under /bin/sh.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sitaowang1998 Does this comment make sense to you?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Contributor

Choose a reason for hiding this comment

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

It is ok to use bash only commands. No one is really using the plain old sh, not even the GitHub workflows.

Copy link
Contributor Author

@Bill-hbrhbr Bill-hbrhbr left a comment

Choose a reason for hiding this comment

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

several nit picks to be merged together with future review address commits

Comment on lines +15 to +16
source /etc/os-release && [[ "$ID" == "ubuntu" ]]
cmds:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sitaowang1998 Does this comment make sense to you?

@Bill-hbrhbr Bill-hbrhbr changed the title refactor(taskfile): Split main dependency Taskfile into category-specific modules. refactor(taskfile): Split main dependency Taskfile into category-specific modules; Migrate antlr-runtime and utfcpp to use utils:install-remote-cmake-lib. Oct 7, 2025
Copy link
Contributor

@sitaowang1998 sitaowang1998 left a comment

Choose a reason for hiding this comment

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

The PR description is much border than what this PR is targeting. Maybe we could open an issue in clp to track the problem, which links the issue and PRs in yscope-dev-utils and this PR.

Comment on lines +36 to +37
- "-DANTLR4_INSTALL=ON"
- "-DCMAKE_BUILD_TYPE=Release"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- "-DANTLR4_INSTALL=ON"
- "-DCMAKE_BUILD_TYPE=Release"
- "-DANTLR4_INSTALL=ON"
- "-DBUILD_TESTING=OFF"
- "-DCMAKE_BUILD_TYPE=Release"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BUILD_TESTING does not exist in antlr4-runtime.

Copy link
Contributor

@sitaowang1998 sitaowang1998 Oct 13, 2025

Choose a reason for hiding this comment

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

BUILD_TESTING is a variable in CTest. If a project use enable_testing, we can set BUILD_TESTING to turn off the test build. See https://cmake.org/cmake/help/latest/variable/BUILD_TESTING.html.

liblzma:
internal: true
vars:
COMMON_CMAKE_GEN_ARGS:
Copy link
Contributor

Choose a reason for hiding this comment

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

COMMON_CMAKE_GEN_ARGS sounds like general arguments for all cmake libraries.

Suggested change
COMMON_CMAKE_GEN_ARGS:
LIBLZMA_CMAKE_GEN_ARGS:

vars:
BUILD_SHARED_LIBS: true
COMMON_CMAKE_GEN_ARGS:
ref: ".COMMON_CMAKE_GEN_ARGS"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ref: ".COMMON_CMAKE_GEN_ARGS"
ref: ".LIBLZMA_CMAKE_GEN_ARGS"

Comment on lines 300 to 302
- "-DSPDLOG_BUILD_EXAMPLE=OFF"
- "-DSPDLOG_BUILD_EXAMPLE_HO=OFF"
- "-DSPDLOG_FMT_EXTERNAL=ON"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- "-DSPDLOG_BUILD_EXAMPLE=OFF"
- "-DSPDLOG_BUILD_EXAMPLE_HO=OFF"
- "-DSPDLOG_FMT_EXTERNAL=ON"
- "-DSPDLOG_BUILD_EXAMPLE=OFF"
- "-DSPDLOG_BUILD_EXAMPLE_HO=OFF"
- "-DSPDLOG_BUILD_TESTS=OFF"
- "-DSPDLOG_BUILD_TESTS_HO=OFF"
- "-DSPDLOG_FMT_EXTERNAL=ON"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SPDLOG_BUILD_EXAMPLE_HO is already OFF so we don't need it anymore

vars:
CMAKE_GEN_ARGS:
- "-DCMAKE_BUILD_TYPE=Release"
- "-DCMAKE_INSTALL_MESSAGE=LAZY"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- "-DCMAKE_INSTALL_MESSAGE=LAZY"
- "-DCMAKE_INSTALL_MESSAGE=LAZY"
- "-DUTF8CPP_ENABLE_TESTS=OFF"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UTF8CPP_ENABLE_TESTS is not in utfcpp v4.0.6 but in v4.0.8

Copy link
Contributor

Choose a reason for hiding this comment

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

Look like no way to stop test from building in v4.0.6. Maybe we can leave this here with a comment in case we bump the version later.

- "-DCMAKE_BUILD_TYPE=Release"
- "-DCMAKE_INSTALL_MESSAGE=LAZY"
- "-DCMAKE_INSTALL_PREFIX={{.G_DEPS_CPP_DIR}}/{{.LIB_NAME}}-install"
- "-DZLIB_BUILD_EXAMPLES=OFF"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- "-DZLIB_BUILD_EXAMPLES=OFF"
- "-DZLIB_BUILD_EXAMPLES=OFF"
- "-DZLIB_BUILD_TESTING=OFF"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ZLIB_BUILD_TESTING is not present in zlib-1.3.1

Copy link
Contributor

Choose a reason for hiding this comment

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

In 1.3.1, zlib uses enable_testing. However, it does not build test if example build if off. Same with utf8, let's leave it here with a comment.

Comment on lines +45 to 46
- "spider"
- "log-viewer"
Copy link
Contributor

Choose a reason for hiding this comment

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

Sort tasks in lexical order. @LinZhihao-723 Could you confirm if we should keep spider as a default task?

Suggested change
- "spider"
- "log-viewer"
- "log-viewer"
- "spider"

Copy link
Member

Choose a reason for hiding this comment

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

Yeah we should. If log-viewer is then Spider should also be.

Comment on lines +15 to +16
source /etc/os-release && [[ "$ID" == "ubuntu" ]]
cmds:
Copy link
Contributor

Choose a reason for hiding this comment

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

It is ok to use bash only commands. No one is really using the plain old sh, not even the GitHub workflows.

vars:
BUILD_SHARED_LIBS: false
COMMON_CMAKE_GEN_ARGS:
ref: ".COMMON_CMAKE_GEN_ARGS"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
ref: ".COMMON_CMAKE_GEN_ARGS"
ref: ".LIBLZMA_CMAKE_GEN_ARGS"

@Bill-hbrhbr
Copy link
Contributor Author

@sitaowang1998 @kirkrodrigues

To provide some context:
Kirk and I discussed when to add flags/options to the library CMake generate step.
Our criteria for adding a flag are:

  • The flag exists in CMakeLists.txt (or a file it includes).
  • We intend to change its default value (e.g., ON → OFF or OFF → ON).
  • Exceptions (always include):
    • -DCMAKE_BUILD_TYPE=Release
    • -DCMAKE_INSTALL_MESSAGE=LAZY

Many libraries expose test-related flags, but most are already OFF. To recognize Sitao’s effort
collecting them, I added a commit that includes all valid suggestions for our current lib versions:

Policy options we can adopt going forward:

  1. Make -DBUILD_TESTING=OFF universal, and turn off all related testing flags.
  2. Not universal, but always disable testing flags when present, regardless of their defaults.
    This is what the code does now after the commit above.
  3. Only disable testing flags that default to ON.
    This is what main currently does.

Thoughts or preferences?

@Bill-hbrhbr
Copy link
Contributor Author

As a side note, I'm trying to avoid scope creep in this PR. We should do as much copy-paste and moving code around as possible.

But I guess I did modify the install methods of two libraries (utfcpp, antlr4-runtime) to shorten the future PR pipeline length.

@sitaowang1998
Copy link
Contributor

Policy options we can adopt going forward:

1. **Make `-DBUILD_TESTING=OFF` universal**, and turn off all related testing flags.

2. **Not universal, but always disable testing flags** when present, regardless of their defaults.
   _This is what the code does now after the commit above._

3. **Only disable testing flags that default to `ON`.**
   _This is what `main` currently does._

For 1. I think we can only apply -DBUILD_TESTING=OFF to the libraries where this is the one and only way to turn off test building.
I am ok with either 2 or 3.

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.

4 participants