Skip to content

Commit

Permalink
Split the relay-client binary into a binary and library. (#200)
Browse files Browse the repository at this point in the history
This simplifies testing in the future.
  • Loading branch information
hauke76 authored Aug 11, 2023
1 parent 45e6858 commit b5df508
Show file tree
Hide file tree
Showing 5 changed files with 825 additions and 647 deletions.
21 changes: 4 additions & 17 deletions src/go/cmd/http-relay-client/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_oci//oci:defs.bzl", "oci_image")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")

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

go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/googlecloudrobotics/core/src/go/cmd/http-relay-client",
visibility = ["//visibility:private"],
deps = [
"//src/go/cmd/http-relay-client/client:go_default_library",
"//src/proto/http-relay:go_default_library",
"@com_github_cenkalti_backoff//:go_default_library",
"@io_opencensus_go//plugin/ochttp:go_default_library",
Expand All @@ -24,20 +25,6 @@ go_library(
],
)

go_test(
name = "go_default_test",
size = "small",
srcs = ["main_test.go"],
embed = [":go_default_library"],
visibility = ["//visibility:private"],
deps = [
"//src/proto/http-relay:go_default_library",
"@com_github_onsi_gomega//:go_default_library",
"@in_gopkg_h2non_gock_v1//:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
],
)

go_binary(
name = "http-relay-client-app",
embed = [":go_default_library"],
Expand Down
36 changes: 36 additions & 0 deletions src/go/cmd/http-relay-client/client/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

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

go_library(
name = "go_default_library",
srcs = ["client.go"],
importpath = "github.com/googlecloudrobotics/core/src/go/cmd/http-relay-client/client",
deps = [
"//src/proto/http-relay:go_default_library",
"@com_github_cenkalti_backoff//:go_default_library",
"@io_opencensus_go//plugin/ochttp:go_default_library",
"@io_opencensus_go//plugin/ochttp/propagation/tracecontext:go_default_library",
"@io_opencensus_go//trace:go_default_library",
"@io_opencensus_go_contrib_exporter_stackdriver//:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
"@org_golang_x_net//context:go_default_library",
"@org_golang_x_net//http2:go_default_library",
"@org_golang_x_oauth2//:go_default_library",
"@org_golang_x_oauth2//google:go_default_library",
],
)

go_test(
name = "go_default_test",
size = "small",
srcs = ["client_test.go"],
embed = [":go_default_library"],
visibility = ["//visibility:private"],
deps = [
"//src/proto/http-relay:go_default_library",
"@com_github_onsi_gomega//:go_default_library",
"@in_gopkg_h2non_gock_v1//:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
],
)
Loading

0 comments on commit b5df508

Please sign in to comment.