跳到正文
cccskills
免费在 GitHub 公开中文介绍

bazel-test-migration

将 IntelliJ JPS 测试模块迁移到 Bazel,并排查仅在 Bazel 中出现的失败。根据症状检查依赖、插件、测试数据和 runfiles,重新生成并验证目标。

原文查看原文说明

Migrate IntelliJ JPS module tests to Bazel; debug Bazel-only failures.

JetBrains/intellij-community星标 20,685(GitHub 20,685 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • 将 JPS 测试模块迁移到 Bazel
  • 排查仅在 Bazel 中失败的测试
  • 检查测试依赖和数据配置

中文介绍

功能

本指南介绍如何将 IntelliJ JPS 测试模块迁移到 Bazel,并排查只在 Bazel 环境中出现的失败。流程包括确认实际测试模块和 Bazel 标签、以 .iml 作为依赖依据、重新生成 BUILD.bazel,并用计划运行的目标进行验证。指南还按常见症状指出需要检查的位置,例如编译期依赖缺失、运行时找不到类或资源、插件注册、测试数据以及 runfiles。对于 TeamCity 上变慢或超时的测试,也说明如何定位最先出现的耗时操作。可以先运行范围最小的失败测试,再验证整个迁移目标。

适用场景

迁移现有 JPS 测试模块、调查仅在 Bazel 中失败的测试,或确认迁移是否完成时,可以参考本指南。它也适用于检查依赖、插件和测试数据配置。

使用示例

  • “请整理这个 JPS 测试模块迁移到 Bazel 的步骤。”
  • “请查找这个仅在 Bazel 中失败的测试的依赖问题。”
  • “请检查这个迁移目标是否满足完成条件。”

注意事项

迁移和验证步骤需要使用 Bazel 命令及仓库中的构建脚本。指南建议不要通过排除测试或修改断言来掩盖失败。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

文档检查

AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。

安全性发送数据、删除文件、执行命令等是否有说明
A良好要求避免用排除测试掩盖失败,并先验证单项再验证整体。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足需要 Bazel 命令和仓库构建脚本。

不计入评分。 由 AI(OpenAI Codex)于 2026年10月28日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(1)

  • SKILL.md7.2 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

<!-- Generated by community/.ai/render-guides.mjs; edit community/.agents/skills/bazel-test-migration/SKILL.md -->

Bazel Test Migration

Use this skill when switching an IntelliJ JPS test module to Bazel, fixing a Bazel-only test failure, or reviewing migration wiring.

Core Workflow

  1. Identify the real test module and Bazel label.

    • From the Ultimate root, community packages usually need @community//....
    • From a standalone community checkout, use //....
    • Do not assume the unqualified label is equivalent in both repositories.
  2. Treat .iml as the source of truth.

    • Add module dependencies to the test module .iml first.
    • Prefer scope="TEST" for new test-only dependencies.
    • Use RUNTIME only when the dependency must be present as a runtime plugin/resource/classpath entry and TEST is not enough.
    • Do not hand-maintain generated BUILD.bazel sections except for intentionally custom jps_test sections protected by ### skip generation section.
  3. Regenerate after every .iml or BUILD.bazel metadata change.

community/tools/bun.cmd build/jps-module.mjs register path/to/module.iml --fix-iml-eof
./build/jpsModelToBazel.cmd
  1. Verify with the Bazel target the user will run.
./bazel.cmd test --cache_test_results=no @community//path/to/package:target_test

For a community-only module in a standalone community checkout, run the same package as //path/to/package:target_test.

BUILD.bazel Rules

  • Keep custom jps_test sections at the top when a module already needs custom test options.
  • Protect a custom test section with:
### skip generation section `test module.name`
  • Preserve required test attributes such as tags, timeout, env, jvm_flags, and data.
  • Add a module to community/build/bazel-migrated-test-modules.txt only after the target is fully migrated and verified. The community JPS aggregator then skips the module, and tests.cmd refuses it. The file documents its format.
  • Do not use copy_file to patch missing jars or descriptors into runfiles. Prefer normal .iml dependencies, target runtime/data dependencies, or the existing shared mechanism for that class of test.

Dependency Decisions

Use the smallest dependency that matches what failed:

  • Compile error: add a normal module dependency to .iml.
  • Test code compiles but class/resource is absent at runtime: add a TEST-scope dependency if generated Bazel runtime wiring is enough; otherwise use runtime/data wiring in the custom jps_test.
  • Plugin descriptor extension/action/inspection is missing: load the owning plugin or content module, not the implementation class by hand.
  • Product plugin wrapper is required: add the wrapper plugin/module dependency to the test module rather than depending only on its internal content module.
  • Testdata is missing: add the testdata as data or ensure the existing generator includes it; do not rely on source-tree paths under Bazel.

Before changing tests, verify whether the failure is really a test assertion issue or just missing runtime/plugin/testdata wiring.

Common Bazel-Only Failures

No tests found

Check that test classes are in the generated *_test_lib, the Bazel target points to that test library, and the class names match the runner convention. If the module truly has no tests, there may be nothing to migrate.

Missing extension, inspection, action, keymap action, or file type

Search for the extension/action/inspection id and identify the descriptor that registers it. Add the owning plugin/module dependency. Do not manually register production extensions in test setup unless the test is explicitly about a local fake extension.

Example: an action registered into EditorGutterVcsPopupMenu needs the VCS implementation descriptor that owns that group, not just VCS API classes.

Plugin action group is not registered

If plugin A registers an action into a group contributed by plugin/module B, plugin A must depend on B or move the action registration into a B-aware optional/content descriptor. Fix the descriptor dependency when production loading is also inconsistent; fix the test dependency only when the test product intentionally omits an otherwise valid product plugin.

JPS compile-server classpath failure

When integration tests invoke JPS compilation, failures like missing JPS jars or compile-server plugin classpaths usually mean Bazel runfiles cannot resolve a plugin/module path the same way JPS does.

  • Prefer the common Bazel target mapping/runfiles mechanism.
  • Ensure Bazel repo mapping from the parent process is propagated when nested Bazel/JPS logic needs to resolve labels.
  • Do not compare file contents to guess class roots.
  • Do not copy individual plugin jars into runfiles as one-off fixes.

Missing required Bazel properties

If code expects Bazel-only properties such as target mappings or runfiles metadata, pass them through the jps_test target using the established option (jvm_flags, env, or data) and add the backing file to runfiles.

Standalone community differs from Ultimate

Re-check labels, repo mappings, and generated runfiles. A target can pass as @community//... from Ultimate and fail as //... in standalone community if the test relies on parent-repo runfiles or missing repo mapping.

TeamCity-only slowdown or timeout

Look for the first expensive operation under Bazel: indexing, plugin loading, coroutine dispatch, first service initialization, or filesystem/runfiles traversal. Prefer moving one-time initialization to setup or making the test wait for the actual condition. Avoid raising timeouts as the first fix.

Test Changes

Keep test edits minimal.

  • Prefer dependency/plugin/testdata wiring over changing assertions.
  • Do not add filters or exclusions to hide failures during migration.
  • Use assumptions only for genuine environment-gated tests, and pass required environment variables through Bazel so developers can still run the tests without editing BUILD.bazel.
  • Avoid moving test classes between modules to satisfy Bazel discovery; fix dependencies or target roots instead.
  • Avoid broad helper abstractions unless the same migration problem repeats across modules and there is already an established local pattern.

Debugging Checklist

  1. Read the failing idea.log, test.log, and JUnit XML if present.
  2. Search for the missing id/class/resource in descriptors and .iml files.
  3. Inspect the test target's generated runtime_deps, deps, data, env, and jvm_flags.
  4. Compare JPS and Bazel classpaths only to identify missing ownership; fix ownership in .iml or plugin descriptors.
  5. Run the smallest failing class or method with --cache_test_results=no.
  6. Run the whole migrated target after the focused failure passes.
  7. Run git diff --check before finishing.

Migration Completion

A module is migrated only when:

  • the correct Bazel target runs with --cache_test_results=no;
  • required plugin/runtime/testdata dependencies are declared normally;
  • generated BUILD.bazel matches .iml;
  • no migration-only test exclusions were added;
  • aggregator lists are updated when required;
  • known unrelated broken tests are documented explicitly in the final report.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

actions

免费有简介

实现或修改 IntelliJ `AnAction`,并在 `plugin.xml` 中注册。将显示名称和说明写入消息资源文件,按需设置图标,并通过事件协程作用域启动挂起任务,避免同步处理阻塞 IDE。

  • 为 IDE 菜单添加操作
  • 修改操作注册或图标
  • 整理操作名称和说明
JetBrains/intellij-community2.1万2026年10月29日 更新

code-style

免费有简介

按 IntelliJ 项目规范编写或审查 Kotlin 和 Java 代码,涵盖语言选择、格式、密封类型、线程注解及控制流异常处理。

  • 按 IntelliJ 规范编写 Kotlin
  • 审查 Java 代码
  • 检查异常处理和密封类型分支
JetBrains/intellij-community2.1万2026年10月29日 更新

commits

免费有简介

本指南帮助您按 IntelliJ 项目规则拆分更改并撰写提交信息:有工单时使用编号和变更说明,无工单时使用标签与子系统名,并在需要时说明原因和决定。

  • 按项目格式编写带工单号的提交信息
  • 整理测试或文档提交并选择合适标签
  • 按规则修改已有提交信息
JetBrains/intellij-community2.1万2026年10月29日 更新

使用多个 Python 类型检查器比较代码片段或文件的类型推断和报错判断,并汇总各工具的结论、耗时与诊断信息,可保存为 Markdown 报告。

  • 比较不同检查器的类型推断
  • 确认代码是否会被判为类型错误
  • 查看多个工具的诊断差异
JetBrains/intellij-community2.1万2026年10月29日 更新

整理 Compose Desktop 界面中的状态和副作用,让可组合函数负责绘制,由展示器或协调器处理应用决策。了解状态归属、Effect、可复用组件接口、延迟列表键、动画和性能,适用于单项界面修改。

  • 分离界面绘制与展示器决策
  • 整理界面状态的归属
  • 检查 Effect 键和协程用法
JetBrains/intellij-community2.1万2026年10月29日 更新

compose-ui-audit

免费有简介

审查 Compose Desktop 界面代码的架构和运行时问题,检查状态管理、副作用、协程、延迟列表、动画与重组,并按优先级列出发现。

  • 审查 Compose 界面的状态管理
  • 检查副作用和协程用法
  • 调查延迟列表或重组性能
JetBrains/intellij-community2.1万2026年10月29日 更新

查看 JetBrains 的全部技能

报告此技能的问题