Skip to content
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

Split googleapis into per-language modules #3472

Draft
wants to merge 11 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
14 changes: 14 additions & 0 deletions modules/googleapis-cc/0.1.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module(
name = "googleapis-cc",
version = "0.1.0",
bazel_compatibility = [">=7.2.1"],
)

bazel_dep(name = "googleapis", version = "0.0.0-20241220-5e258e33")
bazel_dep(name = "protobuf", version = "27.0")

switched_rules = use_extension("@googleapis//private/extensions:switched_rules.bzl", "switched_rules")
switched_rules.register(
name = "cc_proto_library",
file = "@protobuf//bazel:cc_proto_library.bzl",
)
1 change: 1 addition & 0 deletions modules/googleapis-cc/0.1.0/overlay/MODULE.bazel
9 changes: 9 additions & 0 deletions modules/googleapis-cc/0.1.0/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tasks:
verify_targets:
name: Empty test
platform: ubuntu2404
bazel: 8.x
build_flags:
- "--nobuild"
build_targets:
- "//..."
7 changes: 7 additions & 0 deletions modules/googleapis-cc/0.1.0/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"integrity": "sha256-hznHbmgfkAkjuQDJ3w73XPQh05yrtUZQxLmtGbanbYU=",
"url": "https://github.com/fmeum/bazel-central-registry/releases/download/v1.0.0/empty.zip",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: Replace with a better source after #3474.

Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't we just allow url to be not set when overlay is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but that would require raising the minimum Bazel version to at least 8.1.0 (the earliest we can ship this).

"overlay": {
"MODULE.bazel": "sha256-0t8JSjSK94lSCfY8NkTpv+I+/akmQIiNWGxmJE3grHQ="
}
}
16 changes: 16 additions & 0 deletions modules/googleapis-cc/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"homepage": "https://github.com/googleapis/googleapis",
"maintainers": [
{
"email": "[email protected]",
"name": "No Maintainer Specified"
}
],
"repository": [
"github:googleapis/googleapis"
],
"versions": [
"0.1.0"
],
"yanked_versions": {}
}
14 changes: 14 additions & 0 deletions modules/googleapis-go/0.1.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module(
name = "googleapis-go",
version = "0.1.0",
bazel_compatibility = [">=7.2.1"],
)

bazel_dep(name = "googleapis", version = "0.0.0-20241220-5e258e33")
bazel_dep(name = "rules_go", version = "0.50.1")

switched_rules = use_extension("@googleapis//private/extensions:switched_rules.bzl", "switched_rules")
switched_rules.register(
name = "go_proto_library",
file = "@rules_go//proto:def.bzl",
)
1 change: 1 addition & 0 deletions modules/googleapis-go/0.1.0/overlay/MODULE.bazel
9 changes: 9 additions & 0 deletions modules/googleapis-go/0.1.0/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tasks:
verify_targets:
name: Empty test
platform: ubuntu2404
bazel: 8.x
build_flags:
- "--nobuild"
build_targets:
- "//..."
7 changes: 7 additions & 0 deletions modules/googleapis-go/0.1.0/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"integrity": "sha256-hznHbmgfkAkjuQDJ3w73XPQh05yrtUZQxLmtGbanbYU=",
"url": "https://github.com/fmeum/bazel-central-registry/releases/download/v1.0.0/empty.zip",
"overlay": {
"MODULE.bazel": "sha256-5BkG4nNFeIILQLDDXpVPuSJ2NACAspxl8CTjxkveT1o="
}
}
16 changes: 16 additions & 0 deletions modules/googleapis-go/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"homepage": "https://github.com/googleapis/googleapis",
"maintainers": [
{
"email": "[email protected]",
"name": "No Maintainer Specified"
}
],
"repository": [
"github:googleapis/googleapis"
],
"versions": [
"0.1.0"
],
"yanked_versions": {}
}
14 changes: 14 additions & 0 deletions modules/googleapis-grpc-cc/0.1.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module(
name = "googleapis-grpc-cc",
version = "0.1.0",
bazel_compatibility = [">=7.2.1"],
)

bazel_dep(name = "googleapis", version = "0.0.0-20241220-5e258e33")
bazel_dep(name = "grpc", version = "1.69.0")

switched_rules = use_extension("@googleapis//private/extensions:switched_rules.bzl", "switched_rules")
switched_rules.register(
name = "cc_grpc_library",
file = "@grpc//bazel:cc_grpc_library.bzl",
)
1 change: 1 addition & 0 deletions modules/googleapis-grpc-cc/0.1.0/overlay/MODULE.bazel
9 changes: 9 additions & 0 deletions modules/googleapis-grpc-cc/0.1.0/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tasks:
verify_targets:
name: Empty test
platform: ubuntu2404
bazel: 8.x
build_flags:
- "--nobuild"
build_targets:
- "//..."
7 changes: 7 additions & 0 deletions modules/googleapis-grpc-cc/0.1.0/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"integrity": "sha256-hznHbmgfkAkjuQDJ3w73XPQh05yrtUZQxLmtGbanbYU=",
"url": "https://github.com/fmeum/bazel-central-registry/releases/download/v1.0.0/empty.zip",
"overlay": {
"MODULE.bazel": "sha256-OtTzO+YModGNxMzZm53YuAcqKpIRv92mY0g/xFb4Wdc="
}
}
16 changes: 16 additions & 0 deletions modules/googleapis-grpc-cc/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"homepage": "https://github.com/googleapis/googleapis",
"maintainers": [
{
"email": "[email protected]",
"name": "No Maintainer Specified"
}
],
"repository": [
"github:googleapis/googleapis"
],
"versions": [
"0.1.0"
],
"yanked_versions": {}
}
14 changes: 14 additions & 0 deletions modules/googleapis-grpc-java/0.1.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module(
name = "googleapis-grpc-java",
version = "0.1.0",
bazel_compatibility = [">=7.2.1"],
)

bazel_dep(name = "googleapis", version = "0.0.0-20241220-5e258e33")
bazel_dep(name = "grpc-java", version = "1.66.0")

switched_rules = use_extension("@googleapis//private/extensions:switched_rules.bzl", "switched_rules")
switched_rules.register(
name = "java_grpc_library",
file = "@grpc-java//:java_grpc_library.bzl",
)
1 change: 1 addition & 0 deletions modules/googleapis-grpc-java/0.1.0/overlay/MODULE.bazel
9 changes: 9 additions & 0 deletions modules/googleapis-grpc-java/0.1.0/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tasks:
verify_targets:
name: Empty test
platform: ubuntu2404
bazel: 8.x
build_flags:
- "--nobuild"
build_targets:
- "//..."
7 changes: 7 additions & 0 deletions modules/googleapis-grpc-java/0.1.0/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"integrity": "sha256-hznHbmgfkAkjuQDJ3w73XPQh05yrtUZQxLmtGbanbYU=",
"url": "https://github.com/fmeum/bazel-central-registry/releases/download/v1.0.0/empty.zip",
"overlay": {
"MODULE.bazel": "sha256-6OS1YB5nWgVsNnucanTpPJ9n+eF2Xy2VS/sJF53lIs0="
}
}
16 changes: 16 additions & 0 deletions modules/googleapis-grpc-java/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"homepage": "https://github.com/googleapis/googleapis",
"maintainers": [
{
"email": "[email protected]",
"name": "No Maintainer Specified"
}
],
"repository": [
"github:googleapis/googleapis"
],
"versions": [
"0.1.0"
],
"yanked_versions": {}
}
14 changes: 14 additions & 0 deletions modules/googleapis-java/0.1.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module(
name = "googleapis-java",
version = "0.1.0",
bazel_compatibility = [">=7.2.1"],
)

bazel_dep(name = "googleapis", version = "0.0.0-20241220-5e258e33")
bazel_dep(name = "protobuf", version = "27.0")

switched_rules = use_extension("@googleapis//private/extensions:switched_rules.bzl", "switched_rules")
switched_rules.register(
name = "java_proto_library",
file = "@protobuf//bazel:java_proto_library.bzl",
)
1 change: 1 addition & 0 deletions modules/googleapis-java/0.1.0/overlay/MODULE.bazel
9 changes: 9 additions & 0 deletions modules/googleapis-java/0.1.0/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tasks:
verify_targets:
name: Empty test
platform: ubuntu2404
bazel: 8.x
build_flags:
- "--nobuild"
build_targets:
- "//..."
7 changes: 7 additions & 0 deletions modules/googleapis-java/0.1.0/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"integrity": "sha256-hznHbmgfkAkjuQDJ3w73XPQh05yrtUZQxLmtGbanbYU=",
"url": "https://github.com/fmeum/bazel-central-registry/releases/download/v1.0.0/empty.zip",
"overlay": {
"MODULE.bazel": "sha256-LCZExIuJd49TLk0a5I0dGzF0nOSIBSyQhvPOrIaV7+4="
}
}
16 changes: 16 additions & 0 deletions modules/googleapis-java/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"homepage": "https://github.com/googleapis/googleapis",
"maintainers": [
{
"email": "[email protected]",
"name": "No Maintainer Specified"
}
],
"repository": [
"github:googleapis/googleapis"
],
"versions": [
"0.1.0"
],
"yanked_versions": {}
}
14 changes: 14 additions & 0 deletions modules/googleapis-python/0.1.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module(
name = "googleapis-python",
version = "0.1.0",
bazel_compatibility = [">=7.2.1"],
)

bazel_dep(name = "googleapis", version = "0.0.0-20241220-5e258e33")
bazel_dep(name = "protobuf", version = "27.0")

switched_rules = use_extension("@googleapis//private/extensions:switched_rules.bzl", "switched_rules")
switched_rules.register(
name = "py_proto_library",
file = "@protobuf//bazel:py_proto_library.bzl",
)
1 change: 1 addition & 0 deletions modules/googleapis-python/0.1.0/overlay/MODULE.bazel
9 changes: 9 additions & 0 deletions modules/googleapis-python/0.1.0/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tasks:
verify_targets:
name: Empty test
platform: ubuntu2404
bazel: 8.x
build_flags:
- "--nobuild"
build_targets:
- "//..."
7 changes: 7 additions & 0 deletions modules/googleapis-python/0.1.0/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"integrity": "sha256-hznHbmgfkAkjuQDJ3w73XPQh05yrtUZQxLmtGbanbYU=",
"url": "https://github.com/fmeum/bazel-central-registry/releases/download/v1.0.0/empty.zip",
"overlay": {
"MODULE.bazel": "sha256-fC+GNs2HlOkSgVnPLlwrnh2Y+ueI5YlwQRC4c8lcej0="
}
}
16 changes: 16 additions & 0 deletions modules/googleapis-python/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"homepage": "https://github.com/googleapis/googleapis",
"maintainers": [
{
"email": "[email protected]",
"name": "No Maintainer Specified"
}
],
"repository": [
"github:googleapis/googleapis"
],
"versions": [
"0.1.0"
],
"yanked_versions": {}
}
19 changes: 19 additions & 0 deletions modules/googleapis/0.0.0-20241220-5e258e33/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module(
name = "googleapis",
version = "0.0.0-20241220-5e258e33",
repo_name = "com_google_googleapis",
bazel_compatibility = [">=7.2.1"],
)

# Only needed for well-known protos.
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")

# Only needed for proto_library.
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")

switched_rules = use_extension("//private/extensions:switched_rules.bzl", "switched_rules")
use_repo(
switched_rules,
"com_google_googleapis_imports",
"io_bazel_rules_go",
)
30 changes: 30 additions & 0 deletions modules/googleapis/0.0.0-20241220-5e258e33/overlay/extensions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
_use_languages_tag = tag_class(
attrs = {
"cc": attr.bool(default = False),
"csharp": attr.bool(default = False),
"gapic": attr.bool(default = False),
"go": attr.bool(default = False),
"go_test": attr.bool(default = False),
"grpc": attr.bool(default = False),
"java": attr.bool(default = False),
"nodejs": attr.bool(default = False),
"php": attr.bool(default = False),
"python": attr.bool(default = False),
"ruby": attr.bool(default = False),
},
)

def _switched_rules_impl(_ctx):
fail("""
The 'switched_rules' extension is no longer supported due to problems inherent to its design.
Instead, add 'bazel_dep(name = "googleapis-<lang>", version = "0.1.0")' to your MODULE.bazel file to use '<lang>_proto_library' targets in 'googleapis'.
To see error messages with the exact 'bazel_dep's to add, remove the 'switched_rules' usage and build your project.
The available individual modules can be found at https://registry.bazel.build/search?q=googleapis.
""")

switched_rules = module_extension(
implementation = _switched_rules_impl,
tag_classes = {
"use_languages": _use_languages_tag,
},
)
Loading
Loading