feat(meta): 添加依赖与能力目录语义匹配功能#1356
Merged
Merged
Conversation
…Config Add explicit task dependency so Gradle 9.5+ implicit dependency validation passes. The Lombok plugin's generateEffectiveLombokConfig reads lombok.config produced by iHubLombokConfig but didn't declare it as input. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
支持将项目依赖与 IHub 能力目录进行语义匹配,在输出 JSON 中附加组件语义信息。新增 includeCatalogContext 和 catalogFile 配置项,分别控制是否启用语义匹配和指定目录文件路径。当启用时,输出依赖信息将包含对应组件的 description、use_case、domain 等字段。
重构文件路径处理,使用更安全的project.file方法来创建File对象 捕获更具体的异常类型以提供更精确的错误处理
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1356 +/- ##
============================================
- Coverage 98.90% 95.01% -3.89%
- Complexity 288 352 +64
============================================
Files 52 63 +11
Lines 1372 1686 +314
Branches 155 203 +48
============================================
+ Hits 1357 1602 +245
- Misses 10 45 +35
- Partials 5 39 +34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
该 PR 为 ihub-meta 的 iHubMeta 元数据输出引入“依赖与 IHub 能力目录(catalog.json)语义匹配”的可选能力,在依赖条目中附加 catalog 组件上下文信息;同时在 ihub-java 中补充 Lombok 相关任务依赖声明以消除 Gradle 隐式依赖警告。
Changes:
- 为
iHubMeta新增includeCatalogContext与catalogFile配置,并在生成元数据时尝试加载 catalog 建索引。 - 依赖输出从字符串 GAV 列表扩展为对象结构(包含
gav与可选catalog字段)。 - 为 Lombok 的
generateEffectiveLombokConfig相关任务显式增加对iHubLombokConfig的依赖。
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| ihub-meta/src/main/groovy/pub/ihub/plugin/meta/IHubMetaTask.groovy | 加载 catalog 并在依赖输出中注入组件语义信息(新增任务输入)。 |
| ihub-meta/src/main/groovy/pub/ihub/plugin/meta/IHubMetaPlugin.groovy | 将新扩展配置映射到任务属性。 |
| ihub-meta/src/main/groovy/pub/ihub/plugin/meta/IHubMetaExtension.groovy | 新增扩展项与对应说明文档。 |
| ihub-java/src/main/groovy/pub/ihub/plugin/java/IHubJavaPlugin.groovy | 为 Lombok 生成 effective config 相关任务补充 dependsOn,避免隐式依赖告警。 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+251
to
+254
| Map<String, Object> entry = [gav: "${dep.group}:${dep.name}:${dep.version}"] | ||
| if (catalogIndex) { | ||
| def match = catalogIndex[dep.name] | ||
| if (match) { |
Comment on lines
+107
to
+111
| File cf = catalogFile.orNull?.asFile | ||
| if (!cf?.exists()) { | ||
| // 尝试默认位置:rootProject/gradle/ihub-catalog/catalog.json | ||
| cf = project.rootProject.file('gradle/ihub-catalog/catalog.json') | ||
| } |
Comment on lines
+118
to
+123
| Map<String, Map<String, Object>> index = [:] | ||
| (parsed.components as List<Map<String, Object>>).each { entry -> | ||
| def ref = entry.gradle_ref | ||
| List<String> refs = ref instanceof List ? ref as List<String> : [ref as String] | ||
| refs.each { r -> | ||
| if (r) { index[r] = entry } |
Comment on lines
+255
to
+260
| entry.catalog = [ | ||
| id : match.id, | ||
| domain : match.domain, | ||
| description: match.description, | ||
| status : match.status, | ||
| ] |
Comment on lines
+54
to
+55
| * 是否将项目已解析依赖与 IHub 能力目录进行语义匹配,并在输出中附加组件语义信息(默认关闭)。 | ||
| * 启用后,输出 JSON 中每条依赖将附加 catalog 中对应组件的 description、use_case、domain 等字段。 |
Comment on lines
+73
to
+78
| // 预加载 catalog(仅当启用语义注入时) | ||
| Map<String, Map<String, Object>> catalogIndex = [:] | ||
| if (includeCatalogContext.get()) { | ||
| catalogIndex = loadCatalogIndex() | ||
| logger.lifecycle('IHub Meta: catalog loaded, {} components indexed', catalogIndex.size()) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
支持将项目依赖与 IHub 能力目录进行语义匹配,在输出 JSON 中附加组件语义信息。新增 includeCatalogContext 和 catalogFile 配置项,分别控制是否启用语义匹配和指定目录文件路径。当启用时,输出依赖信息将包含对应组件的 description、use_case、domain 等字段。