feat(rpc): port RPC repo to bazel monorepo

This commit is contained in:
41666 2020-10-11 05:53:35 -04:00
parent e33e6f8574
commit 2d919c6053
17 changed files with 111 additions and 82 deletions

View file

@ -1,7 +1,7 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_typescript_proto//:index.bzl", "typescript_proto_library")
load("//:hack/tsproto.bzl", "ts_proto")
proto_library(
name = "auth_proto",
@ -23,7 +23,6 @@ go_library(
visibility = ["//visibility:public"],
)
typescript_proto_library(
name = "ts",
ts_proto(
proto = ":auth_proto",
)

View file

@ -1,7 +1,7 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_typescript_proto//:index.bzl", "typescript_proto_library")
load("//:hack/tsproto.bzl", "ts_proto")
proto_library(
name = "backend_proto",
@ -32,7 +32,6 @@ go_library(
visibility = ["//visibility:public"],
)
typescript_proto_library(
name = "ts",
ts_proto(
proto = ":backend_proto",
)

View file

@ -1,7 +1,7 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_typescript_proto//:index.bzl", "typescript_proto_library")
load("//:hack/tsproto.bzl", "ts_proto")
proto_library(
name = "client_proto",
@ -10,7 +10,6 @@ proto_library(
deps = [
"//src/rpc/auth:auth_proto",
"//src/rpc/shared:shared_proto",
"@com_google_protobuf//:empty_proto",
],
)
@ -33,7 +32,6 @@ go_library(
visibility = ["//visibility:public"],
)
typescript_proto_library(
name = "ts",
ts_proto(
proto = ":client_proto",
)

View file

@ -4,12 +4,12 @@ package roleypoly.auth.client;
option go_package = "github.com/roleypoly/roleypoly/src/auth/client";
import "src/rpc/shared/internal.proto";
import "google/protobuf/empty.proto";
import "src/rpc/shared/shared.proto";
import "src/rpc/auth/shared.proto";
service AuthClient {
rpc GetClientToken(google.protobuf.Empty) returns (roleypoly.auth.Token) {}
rpc GetUserSession(google.protobuf.Empty) returns (roleypoly.RoleypolySession) {}
rpc GetClientToken(roleypoly.Empty) returns (roleypoly.auth.Token) {}
rpc GetUserSession(roleypoly.Empty) returns (roleypoly.RoleypolySession) {}
rpc ResolveSessionKey(roleypoly.auth.Token) returns (roleypoly.auth.Token) {}
rpc AuthorizeChallenge(roleypoly.auth.AuthChallenge) returns (roleypoly.auth.Token) {}
}

View file

@ -1,13 +1,13 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_typescript_proto//:index.bzl", "typescript_proto_library")
load("//:hack/tsproto.bzl", "ts_proto")
proto_library(
name = "ctf_proto",
srcs = ["ctf.proto"],
visibility = ["//visibility:public"],
deps = ["@com_google_protobuf//:empty_proto"],
deps = ["//src/rpc/shared:shared_proto"],
)
go_proto_library(
@ -16,6 +16,7 @@ go_proto_library(
importpath = "github.com/roleypoly/roleypoly/src/rpc/ctf",
proto = ":ctf_proto",
visibility = ["//visibility:public"],
deps = ["//src/rpc/shared"],
)
go_library(
@ -25,7 +26,6 @@ go_library(
visibility = ["//visibility:public"],
)
typescript_proto_library(
name = "ts",
ts_proto(
proto = ":ctf_proto",
)

View file

@ -3,13 +3,13 @@ syntax = "proto3";
package roleypoly.ctf;
option go_package = "github.com/roleypoly/roleypoly/src/rpc/ctf";
import "google/protobuf/empty.proto";
import "src/rpc/shared/shared.proto";
service CTF {
rpc GetRingFlags (Ring) returns (Flags) {}
rpc CreateFlag (Flag) returns (Flag) {}
rpc PromoteFlag (Flag) returns (Flag) {}
rpc RemoveFlag (Flag) returns (google.protobuf.Empty) {}
rpc RemoveFlag (Flag) returns (roleypoly.Empty) {}
}
message Flags {

View file

@ -1,16 +1,17 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_typescript_proto//:index.bzl", "typescript_proto_library")
load("//:hack/tsproto.bzl", "ts_proto")
package(default_visibility = [
"//hack/fixtures:__subpackages__",
])
proto_library(
name = "discord_proto",
srcs = ["discord.proto"],
visibility = ["//visibility:public"],
deps = [
"//src/rpc/shared:shared_proto",
"@com_google_protobuf//:empty_proto",
],
deps = ["//src/rpc/shared:shared_proto"],
)
go_proto_library(
@ -29,7 +30,6 @@ go_library(
visibility = ["//visibility:public"],
)
typescript_proto_library(
name = "ts",
ts_proto(
proto = ":discord_proto",
)

View file

@ -3,11 +3,10 @@ syntax = "proto3";
package roleypoly.discord;
option go_package = "github.com/roleypoly/roleypoly/src/rpc/discord";
import "google/protobuf/empty.proto";
import "src/rpc/shared/shared.proto";
service Discord {
rpc ListGuilds(google.protobuf.Empty) returns (GuildList) {}
rpc ListGuilds(roleypoly.Empty) returns (GuildList) {}
rpc GetGuild(roleypoly.IDQuery) returns (Guild) {}
rpc GetGuildRoles(roleypoly.IDQuery) returns (GuildRoles) {}
rpc GetGuildsByMember(roleypoly.IDQuery) returns (GuildList) {}
@ -17,7 +16,7 @@ service Discord {
rpc UpdateMember(Member) returns (Member) {} // deprecated 4 MAR 2020
rpc UpdateMemberRoles(RoleTransaction) returns (RoleTransactionResult) {}
rpc OwnUser(google.protobuf.Empty) returns (roleypoly.DiscordUser) {}
rpc OwnUser(roleypoly.Empty) returns (roleypoly.DiscordUser) {}
}
message GuildMembers {

View file

@ -1,7 +1,7 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_typescript_proto//:index.bzl", "typescript_proto_library")
load("//:hack/tsproto.bzl", "ts_proto")
proto_library(
name = "platform_proto",
@ -10,7 +10,6 @@ proto_library(
deps = [
"//src/rpc/discord:discord_proto",
"//src/rpc/shared:shared_proto",
"@com_google_protobuf//:empty_proto",
],
)
@ -33,7 +32,6 @@ go_library(
visibility = ["//visibility:public"],
)
typescript_proto_library(
name = "ts",
ts_proto(
proto = ":platform_proto",
)

View file

@ -5,15 +5,14 @@ option go_package = "github.com/roleypoly/roleypoly/src/rpc/platform";
import "src/rpc/shared/shared.proto";
import "src/rpc/discord/discord.proto";
import "google/protobuf/empty.proto";
service Platform {
rpc EnumerateMyGuilds(google.protobuf.Empty) returns (GuildEnumeration) {}
rpc EnumerateMyGuilds(roleypoly.Empty) returns (GuildEnumeration) {}
rpc GetGuildSlug(roleypoly.IDQuery) returns (roleypoly.Guild) {}
rpc GetGuild(roleypoly.IDQuery) returns (PresentableGuild) {}
rpc UpdateMyRoles(UpdateRoles) returns (google.protobuf.Empty) {}
rpc UpdateGuildData(GuildData) returns (google.protobuf.Empty) {}
rpc UpdateMyRoles(UpdateRoles) returns (roleypoly.Empty) {}
rpc UpdateGuildData(GuildData) returns (roleypoly.Empty) {}
}
message GuildEnumeration { repeated PresentableGuild guilds = 1; }

View file

@ -1,7 +1,12 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_typescript_proto//:index.bzl", "typescript_proto_library")
load("//:hack/tsproto.bzl", "ts_proto")
package(default_visibility = [
"//hack/fixtures:__subpackages__",
"//src/design-system/atoms/role:__subpackages__",
])
proto_library(
name = "shared_proto",
@ -26,7 +31,6 @@ go_library(
visibility = ["//visibility:public"],
)
typescript_proto_library(
name = "ts",
ts_proto(
proto = ":shared_proto",
)

View file

@ -2,6 +2,8 @@ syntax = "proto3";
package roleypoly;
option go_package = "github.com/roleypoly/roleypoly/src/rpc/shared";
message Empty {}
message IDQuery {
string MemberID = 1;
string GuildID = 2;