Skip to content

Conversation

@userhaptop
Copy link
Contributor

  1. 新增命令行参数
    --lib - 构建库目标
    --bin <名称> - 构建指定的二进制目标(支持通配符)
    --bins - 构建所有二进制目标
    --example <名称> - 构建指定的示例目标(支持通配符)
    --examples - 构建所有示例目标
    --all-targets - 构建所有目标

  2. Unix 通配符支持

  • 匹配任意字符序列(如 test* 匹配 test_app, tester)
  • 匹配单个字符(如 demo? 匹配 demo1, demo2)
  • 字符类匹配(如 test[123] 匹配 test1, test2, test3)
  1. 核心实现功能
    目标发现与过滤
    库目标识别:通过 rust_library 类型或名称包含 "lib" 的目标
    二进制目标识别:通过 rust_binary 类型或名称包含 "bin", "app", "main", "tool" 的目标
    示例目标识别:通过名称包含 "example" 的目标
    模式匹配:自定义 glob 到 regex 转换,提供通配符支持

@jjl9807 jjl9807 self-requested a review October 25, 2025 07:40
@genedna genedna requested a review from Copilot October 25, 2025 08:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds command-line target selection flags to the build command, enabling users to build specific subsets of targets (libraries, binaries, examples) with Unix-style wildcard pattern matching support.

Key changes:

  • New CLI flags: --lib, --bin, --bins, --example, --examples, --all-targets
  • Unix wildcard pattern matching (*, ?, [...]) for target selection
  • Target filtering logic to identify library, binary, and example targets

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/commands/build.rs Implements target selection flags, validation logic, pattern matching, and target filtering functions with comprehensive test coverage
Cargo.toml Adds glob dependency (though actual implementation uses regex)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@genedna genedna merged commit ed4d1f8 into buck2hub:main Oct 26, 2025
5 checks passed
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.

3 participants