bazelbuild / bazelbuild/rules_java

java_test: make it work for multiple junit tests and non tests sources without Skylark wrapper and dependent library

未关闭
#330 21 条评论 10 个 reaction 已指派 0 人 在 GitHub 查看
P3
主要语言
Starlark
星标
103
派生
102
PR 合并指标
30 天内没有已合并 PR

描述

`java_test` rule doesn't work as I would expect it should. I would expect to write this and provide mixed Junit tests and utility (also not tests classes) to the `srcs` glob.

Buck version:

```
java_test(
name = 'evict_cache_tests',
srcs = glob(['src/test/java/**/*.java']),
)
```

This doesn't work. Instead, I need this Skylark wrapper to generate JUnit Suites for me: [1]. Even then, it doesn't work because I must separate the utility library with non test sources from the JUnit test sources.

Bazel version:

```
load("//tools/bzl:junit.bzl", "junit_tests")

java_library(
name = "evict_test_utills",
srcs = glob([]),
)

junit_tests(
name = "evict_cache_tests",
srcs = glob(["src/test/java/**/*Test.java"]),# this would only pick test sources
deps = [":evict_test_utills"],
)
```

[1] https://github.com/GerritCodeReview/gerrit/blob/master/tools/bzl/junit.bzl

贡献指南

打开贡献指南

调研方向

Start by examining the java_test rule and the referenced tools/bzl:junit.bzl wrapper in the issue. Trace how mixed JUnit test and utility sources are handled, including the separate java_library dependency, and define done as allowing the shown java_test glob without a Skylark wrapper or separate dependent library.

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
build-system, testing
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。