Add better support for generated resources
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system
Research direction
Start by reading java/common/rules/impl/basic_java_library_impl.bzl around the resource_jars field and trace how java_library.srcs and java_library.resources handle generated inputs. Compare the proposed approaches and define the completed behavior as preserving Java sources while including .properties files found inside .srcjar outputs.
Written by the indexing model from the issue text.
Description
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_jarsfield that could perhaps be reused for this effect (at the moment it seems to always be forced as empty)? However, straight including.srcjarfiles in this field won't achieve the desired outcome as this can result in.javafiles appearing inside the final.jarfile. Maybe somehow expose this field to users? -
Support something like
.resourcejarfiles injava_library.resources. This would be a breaking change 😔.
- Dominant language
- Starlark
- Stars
- 103
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bazelbuild/rules_java
-
P4
Difficulty 4/5 3-5 days Newbie friendliness 55/100
bazelbuild/rules_java#360 · 4 comments · 2 reactions ·
-
P4
Difficulty 5/5 Over a week Newbie friendliness 35/100
bazelbuild/rules_java#354 · 8 comments ·
-
P3 question
Difficulty 3/5 1-2 days Newbie friendliness 45/100
bazelbuild/rules_java#339 · 1 comment ·
-
P3
Difficulty 4/5 3-5 days Newbie friendliness 35/100
bazelbuild/rules_java#325 · 8 comments ·
-
P4
Difficulty 4/5 3-5 days Newbie friendliness 35/100
bazelbuild/rules_java#316 · 2 reactions ·
All issues in bazelbuild/rules_java
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
package-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
oSoWoSo/vOid_Community_repOsitory#147 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
agentic-workflows cascade-suspected
Difficulty 1/5 Under an hour Newbie friendliness 88/100