-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathMODULE.bazel
More file actions
189 lines (170 loc) · 10.6 KB
/
Copy pathMODULE.bazel
File metadata and controls
189 lines (170 loc) · 10.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# SPDX-FileCopyrightText: Copyright (c) NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""NVCF monorepo Bazel module definition.
Phase 1 scope: native Go subtrees only.
- src/clis/nvcf-cli (Go binary)
- src/libraries/go/lib (Go library)
- src/libraries/go/worker (Go worker library)
Subtrees with authoritative_source: upstream in imports.yaml are intentionally
not wired here.
"""
module(
name = "nvcf",
version = "0.0.1",
)
bazel_dep(name = "rules_python", version = "1.4.1")
bazel_dep(name = "rules_shell", version = "0.8.0")
# ============================================================================
# OCI containers (multi-arch). Used by go_oci_image for nvcf-cli.
# ============================================================================
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_oci", version = "2.2.7")
bazel_dep(name = "rules_pkg", version = "1.2.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.19.3")
bazel_dep(name = "hermetic_cc_toolchain", version = "4.1.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
ignore_root_user_error = True,
python_version = "3.11",
)
# ============================================================================
# Prebuilt protoc toolchain.
#
# Without this, the proto_toolchain resolution that fires whenever any
# transitive dep declares a proto_library (today: grpc-gateway-v2's
# protoc-gen-openapiv2/options:options_proto) builds the entire C++
# protobuf compiler from source. That is ~1500 actions on a cold build
# and tens of MB of object files that get uploaded to Buildbarn for no
# benefit, since we only consume protoc as a tool.
#
# toolchains_protoc downloads the official prebuilt protoc binary from
# the protocolbuffers/protobuf GitHub releases for each host platform
# and registers a proto_toolchain that points at it. The C++ build of
# protoc is no longer reachable from any of our targets.
#
# Prebuilt protoc pin. Bazel 9.1.1 resolves the protobuf module to 33.4;
# toolchains_protoc 0.6.1 (latest) ships v33.0 but not the 33.4 patch, so we pin
# protoc v33.0 (same major, compiles 33.4's protos) and allow the 33.0-vs-33.4
# skew via --allow_nonstandard_protoc in .bazelrc. protobuf is declared directly
# with repo_name com_google_protobuf so that .bazelrc flag reference resolves.
# ============================================================================
bazel_dep(name = "toolchains_protoc", version = "0.6.1")
bazel_dep(name = "protobuf", version = "33.4", repo_name = "com_google_protobuf")
protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc")
protoc.toolchain(
google_protobuf = "com_google_protobuf",
version = "v33.0",
)
# ============================================================================
# Go
# ============================================================================
bazel_dep(name = "rules_go", version = "0.60.0")
bazel_dep(name = "gazelle", version = "0.48.0")
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.25.0")
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_work = "//:go.work.bazel")
# use_repo entries below are auto-managed by `bazel mod tidy`. Re-run after
# adding new imports in nvcf-cli, src/libraries/go/lib, or
# src/libraries/go/worker.
use_repo(go_deps, "cat_dario_mergo", "com_github_aws_aws_sdk_go_v2", "com_github_aws_aws_sdk_go_v2_config", "com_github_aws_aws_sdk_go_v2_credentials", "com_github_aws_smithy_go", "com_github_awslabs_amazon_ecr_credential_helper_ecr_login", "com_github_carlmjohnson_versioninfo", "com_github_cenkalti_backoff_v4", "com_github_charmbracelet_bubbles", "com_github_charmbracelet_bubbletea", "com_github_charmbracelet_lipgloss", "com_github_dustin_go_humanize", "com_github_felixge_httpsnoop", "com_github_fsnotify_fsnotify", "com_github_go_co_op_gocron", "com_github_go_jose_go_jose_v4", "com_github_go_kit_kit", "com_github_go_viper_mapstructure_v2", "com_github_goccy_go_json", "com_github_golang_jwt_jwt_v5", "com_github_google_go_containerregistry", "com_github_google_shlex", "com_github_google_uuid", "com_github_gorilla_mux", "com_github_grpc_ecosystem_go_grpc_middleware", "com_github_grpc_ecosystem_grpc_gateway_v2", "com_github_hashicorp_go_cleanhttp", "com_github_hashicorp_go_retryablehttp", "com_github_hellofresh_health_go_v5", "com_github_jarcoal_httpmock", "com_github_kimmachinegun_automemlimit", "com_github_klauspost_compress", "com_github_madappgang_httplog", "com_github_madappgang_httplog_zap", "com_github_masterminds_semver_v3", "com_github_mattn_go_isatty", "com_github_mitchellh_go_homedir", "com_github_muesli_termenv", "com_github_nats_io_nats_go", "com_github_nats_io_nats_server_v2", "com_github_nats_io_nkeys", "com_github_nvidia_nvcf_src_libraries_go_lib", "com_github_oklog_oklog", "com_github_openzipkin_zipkin_go", "com_github_prometheus_client_golang", "com_github_prometheus_client_model", "com_github_quic_go_quic_go", "com_github_samber_lo", "com_github_senseyeio_duration", "com_github_sirupsen_logrus", "com_github_spf13_cobra", "com_github_spf13_pflag", "com_github_spf13_viper", "com_github_stretchr_testify", "com_github_urfave_cli_v2", "com_github_valyala_bytebufferpool", "com_github_volcengine_volcengine_go_sdk", "in_gopkg_yaml_v3", "in_yaml_go_yaml_v3", "io_k8s_api", "io_k8s_apiextensions_apiserver", "io_k8s_apimachinery", "io_k8s_client_go", "io_k8s_sigs_yaml", "io_opentelemetry_go_contrib_instrumentation_github_com_gorilla_mux_otelmux", "io_opentelemetry_go_contrib_instrumentation_google_golang_org_grpc_otelgrpc", "io_opentelemetry_go_contrib_instrumentation_host", "io_opentelemetry_go_contrib_instrumentation_net_http_httptrace_otelhttptrace", "io_opentelemetry_go_contrib_instrumentation_net_http_otelhttp", "io_opentelemetry_go_otel", "io_opentelemetry_go_otel_exporters_otlp_otlptrace_otlptracegrpc", "io_opentelemetry_go_otel_exporters_prometheus", "io_opentelemetry_go_otel_sdk", "io_opentelemetry_go_otel_sdk_metric", "io_opentelemetry_go_otel_trace", "io_opentelemetry_go_proto_otlp", "land_oras_oras_go_v2", "org_golang_google_genproto_googleapis_rpc", "org_golang_google_grpc", "org_golang_google_grpc_cmd_protoc_gen_go_grpc", "org_golang_google_protobuf", "org_golang_x_net", "org_golang_x_oauth2", "org_golang_x_sync", "org_golang_x_term", "org_uber_go_automaxprocs", "org_uber_go_zap")
# ============================================================================
# C++ cross-compilation (multi-arch container builds).
# Only register the cross toolchain; native arch uses host gcc.
# ============================================================================
zig = use_extension("@hermetic_cc_toolchain//toolchain:ext.bzl", "toolchains")
use_repo(zig, "zig_sdk")
register_toolchains(
"@zig_sdk//toolchain:linux_arm64_gnu.2.38",
)
# ============================================================================
# OCI base images (pinned by digest).
# ============================================================================
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
oci.pull(
name = "ubuntu_noble",
digest = "sha256:ef59d9e82939bbce08973bdffb8761b025f75369fb7d2882cdc4938b5a9e992e",
image = "public.ecr.aws/ubuntu/ubuntu",
platforms = [
"linux/arm64/v8",
"linux/amd64",
],
)
use_repo(
oci,
"ubuntu_noble",
"ubuntu_noble_linux_amd64",
"ubuntu_noble_linux_arm64_v8",
)
# JRE base image for Java service containers (multi-arch). Sourced from the
# AWS public ECR mirror of the Docker official eclipse-temurin image to avoid
# Docker Hub anonymous pull limits, matching the ubuntu_noble choice above.
oci.pull(
name = "temurin_jre",
image = "public.ecr.aws/docker/library/eclipse-temurin",
platforms = [
"linux/arm64/v8",
"linux/amd64",
],
tag = "21-jre",
)
use_repo(
oci,
"temurin_jre",
"temurin_jre_linux_amd64",
"temurin_jre_linux_arm64_v8",
)
# ============================================================================
# Java / JVM
#
# Foundation for Spring Boot (and plain Java) services: Maven dependency
# resolution via rules_jvm_external, JUnit 5 test support via contrib_rules_jvm,
# and the nvcf_spring_boot_image macro in //rules/java. A new Java service wires
# in by adding its Maven coordinates to maven.install below (re-pin with
# `bazel run @maven//:pin`) and calling the macro from its BUILD.bazel.
#
# The pinned lock file (//:maven_install.json) makes resolution reproducible and
# lets `bazel mod` run offline. Repositories intentionally lists only Maven
# Central so the foundation builds anywhere, including the public GitHub mirror.
# Internal services that depend on nv-boot add the internal Artifactory virtual
# repo here; see rules/java/README.md.
# ============================================================================
bazel_dep(name = "rules_java", version = "8.14.0")
bazel_dep(name = "rules_jvm_external", version = "7.0")
bazel_dep(name = "contrib_rules_jvm", version = "0.33.0")
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
name = "maven",
artifacts = [
"org.springframework.boot:spring-boot-starter-web:3.3.5",
"org.springframework.boot:spring-boot-starter-test:3.3.5",
"org.junit.jupiter:junit-jupiter-api:5.11.3",
"org.junit.jupiter:junit-jupiter-engine:5.11.3",
"org.junit.platform:junit-platform-launcher:1.11.3",
"org.junit.platform:junit-platform-reporting:1.11.3",
],
lock_file = "//:maven_install.json",
repositories = [
# Public Central mirrors only. This is the public GitHub mirror; its
# hosted runners cannot resolve the internal Artifactory host, so the
# pinned closure must fetch from public repositories. The Google-hosted
# Central mirror is primary (not IP-rate-limited like repo1.maven.org);
# Maven Central is the fallback. Internal builds that need NVIDIA
# artifacts add the Artifactory virtual repo in their own overlay.
"https://maven-central.storage-download.googleapis.com/maven2",
"https://repo.maven.apache.org/maven2",
],
)
use_repo(maven, "maven")