feat(java): standalone nvcf_java_rules + nv_boot_parent Bazel modules#376
Closed
balajinvda wants to merge 1 commit into
Closed
feat(java): standalone nvcf_java_rules + nv_boot_parent Bazel modules#376balajinvda wants to merge 1 commit into
balajinvda wants to merge 1 commit into
Conversation
Move the Java tree off the shared root Maven hub and onto independent Bazel modules, so every Java library and service builds, tests, and pins its own dependencies from its own directory with no reference to the repo root. This brings Java to parity with the Go and Rust services, which are already self-contained nested modules with their own MODULE.bazel and CI matrix row. Modules created: - rules/java -> nvcf_java_rules: shared macros (nvcf_java_library, nvcf_spring_boot_image), platform.bzl (SPRING_BOOT_BOM, MAVEN_REPOSITORIES, version constants), a vendored self-contained create_oci_image (drops the //rules/oci dependency), and bom_alignment_test. - src/libraries/java/nv-boot-parent -> nv_boot_parent: the Spring platform library, its own @maven hub + maven_install.json, notice tooling repointed at the module-local lockfile. - src/control-plane-services/cloud-tasks -> nvct_cloud_tasks: the service, its own @maven hub (incl. gRPC codegen), depends on nvcf_java_rules + nv_boot_parent. - examples/java-spring-boot-service -> nvcf_java_example: the reference/template service, its own @maven hub. Migrated because it also consumed //rules/java and @nv_third_party_deps and would otherwise break the root build. Maven BOM alignment: load() is forbidden in MODULE.bazel, so each module inlines the canonical BOM list and guards it with bom_alignment_test, which fails the build if a module's boms drift from SPRING_BOOT_BOM in platform.bzl. This keeps the independent per-module resolutions in agreement without a shared hub. Root wiring: the four Java module paths (except rules/java, which declares no root-referencing targets) are added to .bazelignore; cloud-tasks is dropped from ROOT_GLOBS and src/libraries/ is narrowed to src/libraries/go/ so Java no longer rides the root row. bazel.yml gains nv-boot-parent, cloud-tasks, and java-spring-boot-service matrix rows (build + test); like all non-root rows they get EC2 Buildbarn cache hits via the workflow's remote-cache injection. CI image: ci/Dockerfile.bazel gains an additive remotejdk_25 + Bazel 9.1.1 pre-warm so the Java rows start warm; bazel-ci-image.yml bumps to 0.13.0 (builds on this PR, publishes on merge). The bazel.yml consumer ref stays at 0.12.0 until 0.13.0 is published, to keep the matrix from pinning an unpublished image. Maven jars are not baked (per-subtree actions/cache for now; see #373). Verified standalone from each module directory: nvcf_java_rules builds; nv_boot_parent builds + 17 non-docker tests pass (incl. bom_alignment_test, notice_check_test); nvct_cloud_tasks builds (gRPC codegen + nv_boot_parent consumed as a module) + bom_alignment_test passes; nvcf_java_example builds + 3 tests pass. Root workspace analyzes clean with the Java dirs ignored. Refs: #372 Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
🌿 Preview your docs: https://nvidia-preview-feat-java-standalone-modules.docs.buildwithfern.com/nvcf |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Java was the last language in the repo still on a shared root Maven hub
(
@nv_third_party_deps) and absolute cross-subtree source labels(
//src/libraries/java/nv-boot-parent/...). Go and Rust services are alreadyself-contained nested Bazel modules with their own
MODULE.bazel, lockfile, andCI matrix row. This makes Java match that pattern so each library and service
builds, tests, and pins its own dependencies from its own directory, and so
nv_boot_parentis reusable by every Java service (in-tree vialocal_path_override, out-of-tree viagit_override+strip_prefix).Foundation of the target architecture in
docs/bazel-java-architecture.md.What changed
Four standalone Bazel modules:
rules/java->nvcf_java_rules: shared macros (nvcf_java_library,nvcf_spring_boot_image),platform.bzl(SPRING_BOOT_BOM,MAVEN_REPOSITORIES, version constants), a vendored self-containedcreate_oci_image(drops the//rules/ocidependency), andbom_alignment_test.src/libraries/java/nv-boot-parent->nv_boot_parent: the Spring platformlibrary with its own
@mavenhub +maven_install.json; notice toolingrepointed at the module-local lockfile.
src/control-plane-services/cloud-tasks->nvct_cloud_tasks: the service,own
@mavenhub incl. gRPC codegen,bazel_deps bothnvcf_java_rulesandnv_boot_parent.examples/java-spring-boot-service->nvcf_java_example: the referencetemplate. Migrated because it also consumed
//rules/java+@nv_third_party_depsand would otherwise break the root build.Maven BOM alignment:
load()is forbidden inMODULE.bazel, so each moduleinlines the canonical BOM list and guards it with
bom_alignment_test, whichfails the build if a module's
bomsdrift fromSPRING_BOOT_BOMinplatform.bzl. This keeps the independent per-module resolutions in agreementwithout a shared hub.
Root + CI wiring: the three app/lib module paths are added to
.bazelignore(
rules/javais not, since it declares no root-referencing targets); cloud-tasksis dropped from
ROOT_GLOBSandsrc/libraries/is narrowed tosrc/libraries/go/.bazel.ymlgainsnv-boot-parent,cloud-tasks, andjava-spring-boot-servicerows (build + test); like all non-root rows they getEC2 Buildbarn cache hits via the workflow's remote-cache injection.
ci/Dockerfile.bazelgains an additiveremotejdk_25+ Bazel 9.1.1 pre-warm;bazel-ci-image.ymlbumps to 0.13.0 (builds on this PR, publishes on merge). Thebazel.ymlconsumer ref stays at 0.12.0 until 0.13.0 is published, so the matrixnever pins an unpublished image.
Customer Release Notes
Not customer visible (build/CI only).
Plan Summary
Not applicable.
Usage
Re-pin a module after editing its
maven.install:REPIN=1 bazel run @maven//:pin.Testing
Verified standalone from each module directory (local, cache-cold):
nvcf_java_rules:bazel build //...OK.nv_boot_parent:bazel build //...OK (42 targets);bazel test //... --test_tag_filters=-requires-docker-> 17/17 pass incl.bom_alignment_testand
notice_check_test.nvct_cloud_tasks:bazel build //...OK (1743 actions, gRPC codegen +nv_boot_parentconsumed as a module);bom_alignment_testpasses.nvcf_java_example:bazel build //...+ 3 tests pass incl.bom_alignment_test.bazel build --nobuild //...analyzes clean with the Java dirsignored.
Notes
bazel.ymlimage ref -> 0.13.0 is a fast-follow oncethe CI image publishes on merge (staged to keep this PR's matrix green).
actions/cachefor now (eviction caveat), durable remote-downloader fix tracked in byoo-otel-collector re-downloads Go SDK + collector dep graph every CI build (repo-cache eviction) #373.
References
#372
Related Merge Requests/Pull Requests
Stacked on the cloud-tasks Bazel work (#343).
Dependencies
No new third-party libraries. Adds Bazel module deps already used elsewhere in
the repo (rules_java 9.3.0, rules_jvm_external 7.0, contrib_rules_jvm 0.33.0,
rules_oci, rules_pkg, aspect_bazel_lib, rules_proto_grpc[_java], toolchains_protoc).