drop rules_java dependency
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- build-system
Hướng nghiên cứu
Start by reading MODULE.bazel and locating the current rules_java dependency and the PlantUML targets that use it. The body proposes a standalone Bazel tool, but marks its draft as unreviewed and leaves both artifact checksums as placeholders. Confirm the intended approach and supported platforms with maintainers; done means the dependency is removed and PlantUML remains usable by the project’s documentation workflow.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
rules_java is a FAT dependency. Investigate dropping it.
Unreviewed ChatGPT below.
PlantUML as a standalone Bazel tool
Provide PlantUML as a single executable Bazel target, bundling a pinned Java Runtime (JRE) and the PlantUML JAR.
Goals:
- No
rules_javadependency - No additional Bzlmod module dependencies
- Reproducible Java and PlantUML versions
- No system-wide Java installation required
- Usable through
bazel runand as a tool in other Bazel targets - Compatible with Sphinx /
sphinxcontrib-plantuml
1. Download JRE and PlantUML
In MODULE.bazel:
http_archive = use_repo_rule(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive",
)
http_file = use_repo_rule(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_file",
)
http_archive(
name = "plantuml_jre",
urls = [
"https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.9%2B10/OpenJDK21U-jre_x64_linux_hotspot_21.0.9_10.tar.gz",
],
sha256 = "<JRE_SHA256>",
strip_prefix = "jdk-21.0.9+10-jre",
build_file_content = """
package(default_visibility = ["//visibility:public"])
exports_files(["bin/java"])
filegroup(
name = "runtime",
srcs = glob(["**"]),
)
""",
)
http_file(
name = "plantuml_jar",
urls = [
"https://github.com/plantuml/plantuml/releases/download/v1.2026.9/plantuml-1.2026.9.jar",
],
sha256 = "<PLANTUML_SHA256>",
downloaded_file_path = "plantuml.jar",
)
Replace SHA-256 placeholders with verified checksums from the respective release artifacts.
Both dependencies are registered as external repositories without introducing additional Bzlmod module dependencies.
2. Create an executable Starlark rule
Create tools/plantuml.bzl:
def _runfile_path(file):
path = file.short_path
return path[3:] if path.startswith("../") else path
def _plantuml_impl(ctx):
launcher = ctx.actions.declare_file(ctx.label.name)
ctx.actions.write(
output = launcher,
is_executable = True,
content = """#!/usr/bin/env bash
set -euo pipefail
root="${{RUNFILES_DIR:-$0.runfiles}}"
exec "$root/{java}" -Djava.awt.headless=true -jar "$root/{jar}" "$@"
""".format(
java = _runfile_path(ctx.executable.java),
jar = _runfile_path(ctx.file.jar),
),
)
runfiles = ctx.runfiles(
files = [ctx.executable.java, ctx.file.jar],
transitive_files = ctx.attr.jre[DefaultInfo].files,
)
return DefaultInfo(
executable = launcher,
runfiles = runfiles,
)
plantuml_binary = rule(
implementation = _plantuml_impl,
executable = True,
attrs = {
"java": attr.label(
default = "@plantuml_jre//:bin/java",
executable = True,
cfg = "exec",
),
"jre": attr.label(
default = "@plantuml_jre//:runtime",
),
"jar": attr.label(
default = "@plantuml_jar//file",
allow_single_file = True,
),
},
)
The rule:
- Generates an executable shell launcher.
- Includes the complete JRE in its runfiles.
- Includes the PlantUML JAR.
- Executes the bundled Java runtime with
-jar. - Forwards all command-line arguments to PlantUML.
This implementation targets Linux with runfiles directories.
3. Expose PlantUML as a Bazel target
Create tools/BUILD.bazel:
load(":plantuml.bzl", "plantuml_binary")
plantuml_binary(
name = "plantuml",
visibility = ["//visibility:public"],
)
Usage:
bazel run //tools:plantuml -- -version
Generate an SVG:
bazel run //tools:plantuml -- -tsvg diagram.puml
4. Integrate with Sphinx
For sphinxcontrib-plantuml, the executable is configured through:
extensions = ["sphinxcontrib.plantuml"]
plantuml = "/path/to/bazel/plantuml"
The path must point to the executable inside the Bazel execution environment.
When integrating with a custom Bazel docs() rule:
- Declare
//tools:plantumlas an executable tool dependency. - Include the tool's runfiles in the documentation runtime.
- Resolve the executable path at runtime.
- Pass that path into the Sphinx configuration.
Sphinx does not need to know that PlantUML is implemented in Java.
5. Benefits and limitations
| Property | Result |
|---|---|
rules_java required |
No |
| Additional Bzlmod dependencies | None |
| Java installation on host | Not required |
| Java version | Pinned |
| PlantUML version | Pinned |
Usable with bazel run |
Yes |
| Usable in other Bazel targets | Yes |
| Remote execution | Possible with appropriate tool/runfiles integration |
| Cross-platform | Requires platform-specific JREs |
| Graphviz | May be required for some diagram types |
6. Alternative: Native PlantUML executable
PlantUML also publishes experimental native executables.
These could eliminate the Java Runtime entirely:
//tools:plantuml
└── Native PlantUML executable
However, the JAR + pinned JRE approach is preferable if compatibility and reproducibility are more important than minimizing the runtime size.
References
- Ngôn ngữ chính
- Python
- Star
- 11
- Fork
- 39
- Merge trung bình
- 1 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 46
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của eclipse-score/docs-as-code
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
eclipse-score/docs-as-code#1031 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
eclipse-score/docs-as-code#1029 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
intentionally-limited
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
eclipse-score/docs-as-code#1019 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Graph-check unit tests fail under direct pytest because logger fixtures assume Bazel runfilesCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
eclipse-score/docs-as-code#999 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
eclipse-score/docs-as-code#920 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của eclipse-score/docs-as-code
Issue tương tự
-
cli good first issue help wanted python up-for-grabs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
andrewsiah/agentswarm-data-tasks#36 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug drawing-tools
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
cofade/open-garden-planner#827 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Methodology pageĐang mởdocumentation site texts
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Krasnopjorovs/temet#66 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày