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 件 担当者 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 を短くまとめたダイジェスト。