mirror of
https://github.com/chenhg5/cc-connect.git
synced 2026-10-25 17:36:43 +08:00
fix(build): normalize dash → underscore in AGENTS / PLATFORMS_INCLUDE / EXCLUDE (#1033)
Build tags use underscores (`no_foo_bar`) but ALL_AGENTS / ALL_PLATFORMS elements are bare names. When a plugin's registered name contains a dash (e.g. an agent named `foo-bar` whose build tag is `no_foo_bar`), the user-facing flag value `AGENTS=foo-bar` was passed through unchanged. The filter-out then failed to match `foo_bar` in the ALL list, so the agent was *added* to the exclusion set — i.e. the build silently dropped the very plugin the user asked to include. Introduce a tiny `_normalize` define that runs the comma-split and a dash→underscore fold in one step, and use it everywhere user-supplied plugin lists feed into filter-out / addprefix. Behaviour for existing underscore-or-bare names is unchanged. No new ALL_AGENTS / ALL_PLATFORMS entries are added by this commit; the fix is purely about input normalization so downstream additions with hyphenated names work as the help text suggests. Co-authored-by: Shuchao Shao <shaoshch@yonyou.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 file changed
+11
-3
@@ -44,20 +44,28 @@ COMMA := ,
|
||||
# Compute exclusion tags from AGENTS / PLATFORMS_INCLUDE / EXCLUDE variables
|
||||
_EXCLUDE_TAGS :=
|
||||
|
||||
# Normalize comma-separated user input into the form used by ALL_AGENTS /
|
||||
# ALL_PLATFORMS (space-separated, dashes folded to underscores). Without
|
||||
# the dash→underscore fold, an agent registered under a hyphenated name
|
||||
# (e.g. AGENTS=foo-bar with build tag `no_foo_bar`) would fail to match
|
||||
# `foo_bar` in the ALL list and silently emit `no_foo_bar` via filter-out
|
||||
# — excluding the very plugin the user asked to include.
|
||||
_normalize = $(subst -,_,$(subst $(COMMA), ,$(1)))
|
||||
|
||||
ifdef AGENTS
|
||||
_WANTED_AGENTS := $(subst $(COMMA), ,$(AGENTS))
|
||||
_WANTED_AGENTS := $(call _normalize,$(AGENTS))
|
||||
_EXCLUDE_AGENTS := $(filter-out $(_WANTED_AGENTS),$(ALL_AGENTS))
|
||||
_EXCLUDE_TAGS += $(addprefix no_,$(_EXCLUDE_AGENTS))
|
||||
endif
|
||||
|
||||
ifdef PLATFORMS_INCLUDE
|
||||
_WANTED_PLATFORMS := $(subst $(COMMA), ,$(PLATFORMS_INCLUDE))
|
||||
_WANTED_PLATFORMS := $(call _normalize,$(PLATFORMS_INCLUDE))
|
||||
_EXCLUDE_PLATFORMS := $(filter-out $(_WANTED_PLATFORMS),$(ALL_PLATFORMS))
|
||||
_EXCLUDE_TAGS += $(addprefix no_,$(_EXCLUDE_PLATFORMS))
|
||||
endif
|
||||
|
||||
ifdef EXCLUDE
|
||||
_EXCLUDE_TAGS += $(addprefix no_,$(subst $(COMMA), ,$(EXCLUDE)))
|
||||
_EXCLUDE_TAGS += $(addprefix no_,$(call _normalize,$(EXCLUDE)))
|
||||
endif
|
||||
|
||||
ifdef NO_WEB
|
||||
|
||||
Reference in new issue
Block a user