Skip to content

go/resourceusage: add a client for the Resource Usage API #379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ jobs:
shell: bash
run: cp infra/bazelrc .bazelrc.user

- name: Generate python requirements lock
shell: bash
run: bazel run //python:requirements.update

- name: Build and test
env:
ARCH: ${{ matrix.arch }}
Expand Down
2 changes: 2 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ load("@gazelle//:def.bzl", "gazelle")

gazelle(name = "gazelle")

# gazelle:build_file_name BUILD,BUILD.bazel
# gazelle:exclude buck2
# gazelle:exclude java
71 changes: 45 additions & 26 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
"""EngFlow example project"""

module(name = "engflow-example", version = "0.0.0")
module(
name = "engflow-example",
version = "0.0.0",
)

http_file = use_repo_rule(
"@bazel_tools//tools/build_defs/repo:http.bzl", "http_file"
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_file",
)

http_archive = use_repo_rule(
"@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive"
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive",
)

# Some file dependencies
Expand Down Expand Up @@ -40,6 +47,18 @@ http_archive(

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "engflowapis-java", version = "2025.01.17-13.50.20")

# TODO(BZL-7): apply patch upstream and replace this http_archive with a
# plain bazel_dep.
http_archive(
name = "engflowapis-go",
urls = ["https://github.com/EngFlow/engflowapis/releases/download/2025.01.17-16.55.05/engflowapis-2025.01.17-16.55.05.tar.gz"],
sha256 = "ddf8fd5e9fc14520d6182319dcec6a8228e510c37fe4615a53c87fdcb702a99d",
strip_prefix = "go",
patches = ["//go/proto:engflowapis-go.patch"],
patch_args = ["--strip", "1"],
)

bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(
name = "protobuf",
Expand All @@ -62,33 +81,27 @@ bazel_dep(name = "rules_cc", version = "0.0.9")

# https://github.com/googleapis/googleapis/pull/855
# https://github.com/bazelbuild/bazel-central-registry/pull/1699
bazel_dep(
name = "googleapis",
version = "0.0.0-20240326-1c8d509c5",
repo_name = "com_google_googleapis",
)

bazel_dep(name = "googleapis", version = "0.0.0-20240326-1c8d509c5")
bazel_dep(name = "engflowapis", version = "2024.11.04-11.10.20")
bazel_dep(name = "rules_python", version = "1.0.0")

PYTHON_VERSION = "3.12"

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
is_default = True,
python_version = PYTHON_VERSION,
)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

pip.parse(
hub_name = "pip",
python_version = PYTHON_VERSION,
requirements_lock = "//python:requirements_lock.txt",
)

use_repo(pip, "pip")

bazel_dep(name = "rules_proto", version = "6.0.2")

bazel_dep(name = "rules_dotnet", version = "0.15.1")

dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet")
Expand All @@ -98,18 +111,27 @@ use_repo(dotnet, "dotnet_toolchains")
register_toolchains("@dotnet_toolchains//:all")

# https://github.com/bazelbuild/rules_go/blob/master/docs/go/core/bzlmod.md
bazel_dep(name = "rules_go", version = "0.48.1")
bazel_dep(name = "gazelle", version = "0.37.0")
bazel_dep(name = "rules_go", version = "0.52.0")
bazel_dep(name = "gazelle", version = "0.41.0")

GO_VERSION = "1.22.5"
GO_VERSION = "1.23.4"

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = GO_VERSION)

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")

use_repo(go_deps, "com_github_google_go_cmp")
use_repo(
go_deps,
"com_github_google_go_cmp",
# TODO(BZL-7): remove direct dependencies on modules that are only needed
# by the engflowapis-go patch.
"org_golang_google_genproto",
"org_golang_google_genproto_googleapis_api",
"org_golang_google_genproto_googleapis_rpc",
"org_golang_google_grpc",
"org_golang_google_protobuf",
)

bazel_dep(name = "rules_java", version = "7.9.1")

Expand All @@ -135,33 +157,28 @@ maven.install(
# When updating versions, run `REPIN=1 bazel run @maven//:pin`
fail_if_repin_required = True,
lock_file = "//:maven_install.json",

strict_visibility = True,
repositories = [
"https://repo.maven.apache.org/maven2/",
],
strict_visibility = True,
)
use_repo(maven, "maven")

bazel_dep(name = "rules_kotlin", version = "1.9.6")
bazel_dep(name = "rules_perl", version = "0.2.0")

bazel_dep(
name = "rules_swift",
version = "1.18.0",
repo_name = "build_bazel_rules_swift"
repo_name = "build_bazel_rules_swift",
)

bazel_dep(name = "aspect_rules_ts", version = "2.4.2")

rules_ts_ext = use_extension(
"@aspect_rules_ts//ts:extensions.bzl",
"ext",
dev_dependency = True,
)

rules_ts_ext.deps()

use_repo(rules_ts_ext, "npm_typescript")

# rules_scala is not yet bzlmod compatible:
Expand Down Expand Up @@ -259,15 +276,16 @@ use_repo(rules_ts_ext, "npm_typescript")

http_archive(
name = "io_bazel_rules_scala",
patch_args = ["-p1"],
patches = ["//scala:rules_scala-6.6.0.patch"],
sha256 = "e734eef95cf26c0171566bdc24d83bd82bdaf8ca7873bec6ce9b0d524bdaf05d",
strip_prefix = "rules_scala-6.6.0",
url = "https://github.com/bazelbuild/rules_scala/releases/download/v6.6.0/rules_scala-v6.6.0.tar.gz",
patches = ["//scala:rules_scala-6.6.0.patch"],
patch_args = ["-p1"],
)

# This constant matches the default Scala version from rules_scala for now.
SCALA_VERSION = "2.13.12"

SCALA_VERSIONS = [SCALA_VERSION]

scala_config = use_extension("//scala/extensions:config.bzl", "scala_config")
Expand Down Expand Up @@ -306,6 +324,7 @@ toolchains = [
]

scala_deps = use_extension("//scala/extensions:deps.bzl", "scala_deps")

[
(
[use_repo(scala_deps, repo + suffix) for repo in repos],
Expand Down
Loading