bazelbuild / bazelbuild/rules_java

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

Aperta
#330 21 commenti 10 reazioni 0 assegnatari Vedi su GitHub
P3
Lingua principale
Starlark
Stelle
103
Fork
102
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

`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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.