Add support for compile-time input files in java_binary and java_library
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- java
- 领域
- build-system
调研方向
从 java_binary 和 java_library 规则定义入手,跟踪 javacopts 和输入文件如何传递到 Java 编译器。将请求的行为与 C++ 规则的 additional_linker_inputs 和 user_link_flags 进行比较,然后验证编译时文件和位置展开在 processwrapper 沙箱下能够正常工作。
由索引模型根据 Issue 内容生成。
描述
Description of the feature request:
Introduce a new attribute, tentatively named java_compiler_inputs, that would specifically hold references to compile-time input files. Additionally, provide support for expanding these file paths using $(location) or similar mechanisms, either within the existing javacopts attribute or a potentially new, toolchain-flag-specific attribute.
Example: Code snippet
java_library(
name = "dummy_library",
srcs = ["src/abc.java"],
java_compiler_inputs = ["compile.properties"],
javacopts = [
"-properties",
"$(location //:compile.properties)",
],
)
Which category does this issue belong to?
java rules
What underlying problem are you trying to solve with this feature?
I am working with a custom Java toolchain (specifically, ECJ https://github.com/salesforce/bazel-jdt-java-toolchain) that supports compile-time options like -properties to consume configuration files during compilation. Currently, there is no dedicated way to provide such files to the Java compiler within Bazel's Java rules. Including these files in the srcs attribute works in some sandbox environments but leads to failures with the processwrapper sandbox.
This feature would improve flexibility when using custom Java toolchains and ensure compatibility across different sandboxing strategies within Bazel. It would be valuable to draw parallels with a similar mechanism already present in Bazel's C++ rules for linker inputs (additional_linker_inputs and user_link_flags).
Which operating system are you running Bazel on?
RHEL7
What is the output of bazel info release?
7.0.2
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse HEAD ?
No response
Have you found anything relevant by searching the web?
Discussion on providing -properties file, no answers: https://github.com/salesforce/bazel-jdt-java-toolchain/discussions/19
Any other information, logs, or outputs that you want to share?
[Sandbox Error]: with processwrapper sandbox
exec env - \
LC_CTYPE=en_US.UTF-8 \
PATH=/bin:/usr/bin:/usr/local/bin \
/usr/lib/jvm/java-17/bin/java --module-path external/ecj/ecj.jar -jar external/bazel_jdt_java_toolchain/compiler/export/JdtJavaBuilder_deploy.jar @bazel-out/k8-opt/bin/bin-SystemLoggerApi-class.jar-0.params @bazel-out/k8-opt/bin/dummy_library-class.jar-1.params)
# Configuration: b958e1a85833ddcf110c5efdbae2648181c90445ef232e2d460d4a581e0c3ee6
# Execution platform: //:linux_gcc_x86
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
properties file compile.properties does not exist
- 主要语言
- Starlark
- 星标
- 103
- 派生
- 102
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bazelbuild/rules_java 的其他 Issue
-
P4
难度 4/5 3-5 天 新手友好度 55/100
bazelbuild/rules_java#360 · 4 条评论 · 2 个 reaction ·
-
P4
难度 5/5 一周以上 新手友好度 35/100
bazelbuild/rules_java#354 · 8 条评论 ·
-
P3 question
难度 3/5 1-2 天 新手友好度 45/100
bazelbuild/rules_java#339 · 1 条评论 ·
-
P3
难度 4/5 3-5 天 新手友好度 35/100
bazelbuild/rules_java#325 · 8 条评论 ·
-
P4
难度 4/5 3-5 天 新手友好度 35/100
bazelbuild/rules_java#316 · 2 个 reaction ·
查看 bazelbuild/rules_java 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
agent-research-recommend agent-review-finding chore
难度 2/5 1-3 小时 新手友好度 75/100
jordansmall/spindrift#3717 · 1 条评论 ·
-
type/automation type/tech-debt
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 88/100
conda-forge/python-feedstock#934 ·