Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The examples/ dir has example bazel workspaces that show how to import
# remote-apis, and should not be treated as part of this workspace.
examples
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.1
9 changes: 8 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ jobs:

- name: Install bazelisk
run: |
curl -LO https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64
curl -LO https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64
mkdir -p "${HOME}/bin"
mv bazelisk-linux-amd64 "${HOME}/bin/bazel"
chmod +x "${HOME}/bin/bazel"

# TODO: Should this step assert that generated code == checked-in code?
- name: Check bindings generation
run: |
set -e
PATH=${HOME}/bin:$PATH ./hooks/pre-commit

- name: Check sample project build
run: |
set -e
cd examples/sample_project
bazel build //...
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
*~
# Ignore Vim swap files.
.*.sw*
# Ignore bazel directories
/bazel-bin
/bazel-genfiles
/bazel-out
/bazel-remote-apis
/bazel-testlogs
# Ignore bazel directories, including those in nested workspaces (such as the
# examples).
**/bazel-*
MODULE.bazel.lock
10 changes: 10 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@gazelle//:def.bzl", "gazelle")

# gazelle:prefix github.com/bazelbuild/remote-apis

# gazelle:resolve proto google/api/annotations.proto @googleapis//google/api:annotations_proto
# gazelle:resolve proto go google/api/annotations.proto @org_golang_google_genproto//googleapis/api/annotations

gazelle(
name = "gazelle",
)
29 changes: 29 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module(
name = "remoteapis",
Copy link

@mmorel-35 mmorel-35 Jun 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall it be this instead ?

Suggested change
name = "remoteapis",
name = "remote-apis",
repo_name = "bazel_remote_apis",

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i pulled the non-dash version because that's what bazel uses, any precedent for folks using the other one? I didn't need to mirror the repo_name since it's never accessed

version = "0",
)

bazel_dep(name = "gazelle", version = "0.35.0")
bazel_dep(name = "googleapis", version = "0.0.0-20240326-1c8d509c5", repo_name = "com_google_googleapis")
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_go", version = "0.44.2")
bazel_dep(name = "rules_java", version = "7.3.2")
bazel_dep(name = "rules_proto", version = "6.0.0-rc1")
bazel_dep(name = "rules_proto_grpc_cpp", version = "5.0.0-alpha2")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
"com_google_cloud_go_longrunning",
"org_golang_google_genproto",
"org_golang_google_genproto_googleapis_api",
"org_golang_google_genproto_googleapis_rpc",
"org_golang_google_grpc",
"org_golang_google_protobuf",
)

switched_rules = use_extension("@com_google_googleapis//:extensions.bzl", "switched_rules")
switched_rules.use_languages(go = True)
use_repo(switched_rules, "com_google_googleapis_imports")
107 changes: 1 addition & 106 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,106 +1 @@
workspace(name = "bazel_remote_apis")

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

http_archive(
name = "bazel_skylib",
sha256 = "66ffd9315665bfaafc96b52278f57c7e2dd09f5ede279ea6d39b2be471e7e3aa",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
],
)

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

# Pull in go rules, which we need in order to selectively pull in Go dependencies.
http_archive(
name = "io_bazel_rules_go",
sha256 = "d6ab6b57e48c09523e93050f13698f708428cfd5e619252e369d377af6597707",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.43.0/rules_go-v0.43.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.43.0/rules_go-v0.43.0.zip",
],
)

# Gazelle, which we need in order to selectively pull in Gazelle dependencies for Go.
http_archive(
name = "bazel_gazelle",
sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
],
)

# Needed for protobuf.
http_archive(
name = "com_google_protobuf",
sha256 = "535fbf566d372ccf3a097c374b26896fa044bf4232aef9cab37bd1cc1ba4e850",
strip_prefix = "protobuf-3.15.0",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.15.0.zip"],
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

# Needed for C++ gRPC.
http_archive(
name = "com_github_grpc_grpc",
sha256 = "b391a327429279f6f29b9ae7e5317cd80d5e9d49cc100e6d682221af73d984a6",
strip_prefix = "grpc-93e8830070e9afcbaa992c75817009ee3f4b63a0", # v1.24.3 with fixes
urls = ["https://github.com/grpc/grpc/archive/93e8830070e9afcbaa992c75817009ee3f4b63a0.zip"],
)

# Pull in all gRPC dependencies.
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()

# More gRPC dependencies. grpc_extra_deps does not work out of the box.
load("@upb//bazel:workspace_deps.bzl", "upb_deps")
load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies")
load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies")

upb_deps()

apple_rules_dependencies()

apple_support_dependencies()

load("@upb//bazel:repository_defs.bzl", "bazel_version_repository")

bazel_version_repository(
name = "bazel_version",
)

bind(
name = "grpc_cpp_plugin",
actual = "@com_github_grpc_grpc//:grpc_cpp_plugin",
)

bind(
name = "grpc_lib",
actual = "@com_github_grpc_grpc//:grpc++",
)

load("//:remote_apis_deps.bzl", "remote_apis_go_deps")

remote_apis_go_deps()

# Needed for the googleapis protos.
http_archive(
name = "googleapis",
sha256 = "b28c13e99001664eac5f1fb81b44d912d19fbc041e30772263251da131f6573c",
strip_prefix = "googleapis-bb964feba5980ed70c9fb8f84fe6e86694df65b0",
urls = ["https://github.com/googleapis/googleapis/archive/bb964feba5980ed70c9fb8f84fe6e86694df65b0.zip"],
)

load("@googleapis//:repository_rules.bzl", "switched_rules_by_language")

switched_rules_by_language(
name = "com_google_googleapis_imports",
)
"""Empty WORKSPACE file to denote the bazel workspace root"""
48 changes: 31 additions & 17 deletions build/bazel/remote/asset/v1/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package(default_visibility = ["//visibility:public"])

load("@rules_go//proto:def.bzl", "go_grpc_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_proto_grpc_cpp//:defs.bzl", "cpp_grpc_library")

# gazelle:ignore
package(default_visibility = ["//visibility:public"])

licenses(["notice"])

Expand All @@ -11,28 +15,38 @@ proto_library(
"//build/bazel/remote/execution/v2:remote_execution_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:timestamp_proto",
"@googleapis//google/api:annotations_proto",
"@googleapis//google/api:http_proto",
"@googleapis//google/rpc:status_proto",
"@com_google_googleapis//google/api:annotations_proto",
"@com_google_googleapis//google/api:http_proto",
"@com_google_googleapis//google/rpc:status_proto",
],
)

alias(
name = "remote_asset_java_proto",
actual = "//build/bazel/remote/asset/v1/java:remote_asset_java_proto",
)
go_grpc_library(
name = "remote_asset_go_grpc",
importpath = "github.com/bazelbuild/remote-apis/build/bazel/remote/asset/v1",
protos = [":remote_asset_proto"],
deps = [
"//build/bazel/remote/execution/v2:remote_execution_go_grpc",
"@org_golang_google_genproto_googleapis_api//annotations",
"@org_golang_google_genproto_googleapis_rpc//status",
],
) # keep

alias(
name = "remote_asset_cc_proto",
actual = "//build/bazel/remote/asset/v1/cc:remote_asset_cc_grpc",
name = "go_default_library",
actual = ":remote_asset_go_grpc",
)

alias(
name = "remote_asset_go_proto",
actual = "//build/bazel/remote/asset/v1/go:remote_asset_go_proto",
cpp_grpc_library(
name = "remote_asset_cpp_grpc",
protos = [":remote_asset_proto"],
deps = [
"//build/bazel/remote/execution/v2:remote_execution_cpp_grpc",
],
)

alias(
name = "go_default_library",
actual = "//build/bazel/remote/asset/v1/go:go_default_library",
# TODO: Include/replace with gRPC stub generation targets when feasible
java_proto_library(
name = "remote_asset_java_proto",
deps = [":remote_asset_proto"],
)
25 changes: 0 additions & 25 deletions build/bazel/remote/asset/v1/cc/BUILD

This file was deleted.

22 changes: 0 additions & 22 deletions build/bazel/remote/asset/v1/go/BUILD

This file was deleted.

6 changes: 0 additions & 6 deletions build/bazel/remote/asset/v1/java/BUILD

This file was deleted.

Loading