bazelbuild / bazelbuild/rules_java
Add better support for generated resources
- Ngôn ngữ chính
- Starlark
- Star
- 103
- Fork
- 102
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
[`java_library.srcs`](https://bazel.build/reference/be/java#java_library.srcs) supports `.srcjar` files to facilitate including generated sources. `.properties` files included in `java_library.srcs` are filtered and included in `java_library.resources`. Consider extending the current behaviour so that `.properties` files included in `.srcjar` files are also included in `java_library.resources`. This will facilitate the usage of generated resources.
For example, I have a `genrule` that generates `.java` and `.properties` files and I don't necessarily know all of them during the analysis phase for declaration purposes. For this reason, my rule instead generates a `.srcjar` file. However, the `.properties` files inside that `.srcjar` file are being skipped.
There are other alternative ways of going about it:
- There's already an internal [`resource_jars`](https://github.com/bazelbuild/rules_java/blob/8.9.0/java/common/rules/impl/basic_java_library_impl.bzl#L95) field that could perhaps be reused for this effect (at the moment it seems to always be forced as empty)? However, straight including `.srcjar` files in this field won't achieve the desired outcome as this can result in `.java` files appearing inside the final `.jar` file. Maybe somehow expose this field to users?
- Support something like `.resourcejar` files in `java_library.resources`. This would be a breaking change :pensive:.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách đọc java/common/rules/impl/basic_java_library_impl.bzl xung quanh trường resource_jars và theo dõi cách java_library.srcs và java_library.resources xử lý các đầu vào được tạo. So sánh các cách tiếp cận được đề xuất và xác định hành vi hoàn chỉnh là giữ nguyên các mã nguồn Java đồng thời bao gồm các tệp .properties được tìm thấy bên trong các đầu ra .srcjar.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- build-system
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100