Skip to content

Commit f24c187

Browse files
committed
Work in Progress
Signed-off-by: Yong Tang <[email protected]>
1 parent f0cd92c commit f24c187

File tree

5 files changed

+108
-7
lines changed

5 files changed

+108
-7
lines changed

BUILD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
load("@bazel_gazelle//:def.bzl", "gazelle")
2+
3+
# gazelle:prefix github.com/example/project
4+
gazelle(name = "gazelle")

WORKSPACE

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,3 +436,61 @@ http_archive(
436436
"https://download.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.gz",
437437
],
438438
)
439+
440+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
441+
http_archive(
442+
name = "io_bazel_rules_go",
443+
urls = [
444+
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz",
445+
"https://github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz",
446+
],
447+
sha256 = "f04d2373bcaf8aa09bccb08a98a57e721306c8f6043a2a0ee610fd6853dcde3d",
448+
)
449+
http_archive(
450+
name = "bazel_gazelle",
451+
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.17.0/bazel-gazelle-0.17.0.tar.gz"],
452+
sha256 = "3c681998538231a2d24d0c07ed5a7658cb72bfb5fd4bf9911157c0e9ac6a2687",
453+
)
454+
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
455+
go_rules_dependencies()
456+
go_register_toolchains()
457+
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
458+
gazelle_dependencies()
459+
460+
# Load and call Gazelle dependencies
461+
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
462+
gazelle_dependencies()
463+
464+
# Add a go repository
465+
go_repository(
466+
name = "com_github_pkg_errors",
467+
importpath = "github.com/pkg/errors", # Import path used in the .go files
468+
tag = "v0.8.1", # Specific tag, commits are also supported
469+
)
470+
471+
go_repository(
472+
name = "com_github_prometheus_client_golang",
473+
importpath = "github.com/prometheus/client_golang", # Import path used in the .go files
474+
tag = "v0.9.3", # Specific tag, commits are also supported
475+
)
476+
477+
go_repository(
478+
name = "com_github_modern_go_concurrent",
479+
importpath = "github.com/modern-go/concurrent", # Import path used in the .go files
480+
tag = "1.0.3", # Specific tag, commits are also supported
481+
)
482+
go_repository(
483+
name = "com_github_modern_go_reflect2",
484+
importpath = "github.com/modern-go/reflect2", # Import path used in the .go files
485+
tag = "v1.0.1", # Specific tag, commits are also supported
486+
)
487+
go_repository(
488+
name = "com_github_json_iterator_go",
489+
importpath = "github.com/json-iterator/go", # Import path used in the .go files
490+
tag = "v1.1.6", # Specific tag, commits are also supported
491+
)
492+
go_repository(
493+
name = "com_github_prometheus_common",
494+
importpath = "github.com/prometheus/common", # Import path used in the .go files
495+
tag = "v0.4.1", # Specific tag, commits are also supported
496+
)

tensorflow_io/grpc/BUILD

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_library")
2+
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
3+
14
licenses(["notice"]) # Apache 2.0
25

36
package(default_visibility = ["//visibility:public"])
@@ -18,11 +21,6 @@ genrule(
1821
output_to_bindir = True,
1922
)
2023

21-
proto_library(
22-
name = "_any_proto_only",
23-
deps = ["@com_google_protobuf//:any_proto"],
24-
)
25-
2624
cc_proto_library(
2725
name = "any_proto",
2826
deps = ["@com_google_protobuf//:any_proto"],
@@ -63,3 +61,22 @@ cc_binary(
6361
"@local_config_tf//:tf_header_lib",
6462
],
6563
)
64+
65+
proto_library(
66+
name = "endpoint_proto",
67+
srcs = ["endpoint.proto"],
68+
deps = ["@com_google_protobuf//:any_proto"],
69+
)
70+
71+
go_proto_library(
72+
name = "endpoint_go_proto",
73+
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
74+
importpath = "github.com/example/project/tensorflow_io/grpc",
75+
proto = ":endpoint_proto",
76+
)
77+
78+
go_library(
79+
name = "go_default_library",
80+
embed = [":endpoint_go_proto"],
81+
importpath = "github.com/example/project/tensorflow_io/grpc",
82+
)

tensorflow_io/prometheus/BUILD

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ package(default_visibility = ["//visibility:public"])
55
cc_library(
66
name = "prometheus_ops",
77
srcs = [
8-
"go/prometheus.a",
9-
"go/prometheus.h",
8+
#"//tensorflow_io/prometheus/go:prometheus.a",
9+
#"//tensorflow_io/prometheus/go:prometheus.h",
1010
"kernels/prometheus_input.cc",
1111
"ops/prometheus_ops.cc",
1212
],
@@ -21,5 +21,6 @@ cc_library(
2121
linkstatic = True,
2222
deps = [
2323
"//tensorflow_io/core:dataset_ops",
24+
"//tensorflow_io/prometheus/go:go_default_library",
2425
],
2526
)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
2+
3+
go_library(
4+
name = "go_default_library",
5+
srcs = ["prometheus.go"],
6+
cgo = True,
7+
importpath = "github.com/example/project/tensorflow_io/prometheus/go",
8+
visibility = ["//visibility:private"],
9+
deps = [
10+
"@com_github_prometheus_client_golang//api:go_default_library",
11+
"@com_github_prometheus_client_golang//api/prometheus/v1:go_default_library",
12+
"@com_github_prometheus_common//model:go_default_library",
13+
],
14+
)
15+
16+
go_binary(
17+
name = "go",
18+
embed = [":go_default_library"],
19+
linkmode = "c-archive",
20+
visibility = ["//visibility:public"],
21+
)

0 commit comments

Comments
 (0)