Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Update all the workspace dependencies #12

Merged
merged 4 commits into from
Aug 13, 2019
Merged
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
101 changes: 58 additions & 43 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,69 +1,84 @@
workspace(name = "bootcamp")

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

# grpc dependencies
git_repository(
http_archive(
name = "io_grpc_grpc_java",
commit = "a2cda8d15d752624180460d3e7e7d7322da13a2d",
remote = "https://github.com/grpc/grpc-java.git",
urls = [
"https://github.com/grpc/grpc-java/archive/v1.22.1.tar.gz",
],
sha256 = "6e63bd6f5a82de0b84c802390adb8661013bad9ebf910ad7e1f3f72b5f798832",
strip_prefix = "grpc-java-1.22.1",
)
load("@io_grpc_grpc_java//:repositories.bzl", "grpc_java_repositories")
grpc_java_repositories()



# go dependencies
http_archive(
name = "io_bazel_rules_go",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz"],
sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.19.1/rules_go-0.19.1.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/0.19.1/rules_go-0.19.1.tar.gz",
],
sha256 = "8df59f11fb697743cbb3f26cfb8750395f30471e9eabde0d174c3aebc7a1cd39",
)
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()

http_archive(
name = "bazel_gazelle",
urls = [
"https://github.com/bazelbuild/bazel-gazelle/releases/download/0.18.1/bazel-gazelle-0.18.1.tar.gz",
],
sha256 = "be9296bfd64882e3c08e3283c58fcb461fa6dd3c171764fcc4cf322f60615a9b",
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
gazelle_dependencies()

go_repository(
name = "org_golang_google_grpc",
build_file_proto_mode = "disable",
importpath = "google.golang.org/grpc",
sum = "h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw=",
version = "v1.22.0",
)
go_repository(
name = "org_golang_x_net",
importpath = "golang.org/x/net",
sum = "h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=",
version = "v0.0.0-20190311183353-d8887717615a",
)
go_repository(
name = "org_golang_x_text",
importpath = "golang.org/x/text",
sum = "h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=",
version = "v0.3.0",
)


# typescript dependencies
# http_archive(
# name = "build_bazel_rules_nodejs",
# sha256 = "73325a155c16bfbde29fb2ffcaf59d9d5a1c13b06ada386d3edd5a9d82bda702",
# urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.29.1/rules_nodejs-0.29.1.tar.gz"],
# )

# load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install")

# yarn_install(
# name = "npm",
# package_json = "//typescript:package.json",
# yarn_lock = "//typescript:yarn.lock",
# )

# load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
# install_bazel_dependencies()

# load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
# ts_setup_workspace()

# BEGIN: typescript dependencies
#http_archive(
# name = "build_bazel_rules_nodejs",
# urls = [
# "https://github.com/bazelbuild/rules_nodejs/releases/download/0.35.0/rules_nodejs-0.35.0.tar.gz",
# ],
# sha256 = "6625259f9f77ef90d795d20df1d0385d9b3ce63b6619325f702b6358abb4ab33",
#)

#load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install")

# android dependencies -- uncomment these lines if you wish to build the
# android portion of the project
#android_sdk_repository(
# name = "androidsdk",
#yarn_install(
# name = "npm",
# package_json = "//typescript:package.json",
# yarn_lock = "//typescript:yarn.lock",
#)
#
#GMAVEN_TAG = "20180916-1"
#load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
#install_bazel_dependencies()
#
#http_archive(
# name = "gmaven_rules",
# strip_prefix = "gmaven_rules-%s" % GMAVEN_TAG,
# url = "https://github.com/bazelbuild/gmaven_rules/archive/%s.tar.gz" % GMAVEN_TAG,
#)
#
#load("@gmaven_rules//:gmaven.bzl", "gmaven_rules")
#
#gmaven_rules()

#load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
#ts_setup_workspace()
# END: typescript dependencies
159 changes: 66 additions & 93 deletions generate_build_files.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is used for Bazel CI to write the BUILD files for the project.

# You can use it to see the final solutions but note that it will delete your existing
# BUILD files if you started working.
# BUILD files if you started working.


# generate Go BUILD file
Expand All @@ -10,13 +10,13 @@ cat > go/cmd/server/BUILD <<EOF
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_binary(
name = "go-server",
srcs = ["server.go"],
deps = [
"//proto/logger:logger_go_proto",
"@com_github_golang_protobuf//jsonpb:go_default_library_gen",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//reflection:go_default_library",
name = "go-server",
srcs = ["server.go"],
deps = [
"//proto/logger:logger_go_proto",
"@com_github_golang_protobuf//jsonpb:go_default_library_gen",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//reflection:go_default_library",
],
visibility = ["//visibility:public"]
)
Expand All @@ -26,38 +26,38 @@ EOF
# generate java BUILD file
cat > java/src/main/java/bazel/bootcamp/BUILD <<EOF
java_binary(
name = "HelloBazelBootcamp",
srcs = ["HelloBazelBootcamp.java"],
name = "HelloBazelBootcamp",
srcs = ["HelloBazelBootcamp.java"],
)

java_library(
name = "JavaLoggingClientLibrary",
srcs = ["JavaLoggingClientLibrary.java"],
deps = [
"//proto/logger:logger_java_proto",
"//proto/logger:logger_java_grpc",
"@io_grpc_grpc_java//core",
"@io_grpc_grpc_java//netty",
]
name = "JavaLoggingClientLibrary",
srcs = ["JavaLoggingClientLibrary.java"],
deps = [
"//proto/logger:logger_java_proto",
"//proto/logger:logger_java_grpc",
"@io_grpc_grpc_java//core",
"@io_grpc_grpc_java//netty",
]
)

java_binary(
name = "JavaLoggingClient",
srcs = ["JavaLoggingClient.java"],
deps = [":JavaLoggingClientLibrary"],
visibility = ["//visibility:public"]
name = "JavaLoggingClient",
srcs = ["JavaLoggingClient.java"],
deps = [":JavaLoggingClientLibrary"],
visibility = ["//visibility:public"]
)

java_test(
name = "JavaLoggingClientLibraryTest",
srcs = ["JavaLoggingClientLibraryTest.java"],
deps = [":JavaLoggingClientLibrary"]
name = "JavaLoggingClientLibraryTest",
srcs = ["JavaLoggingClientLibraryTest.java"],
deps = [":JavaLoggingClientLibrary"]
)

java_test(
name = "JavaLoggingClientTest",
srcs = ["JavaLoggingClientTest.java"],
deps = [":JavaLoggingClient"]
name = "JavaLoggingClientTest",
srcs = ["JavaLoggingClientTest.java"],
deps = [":JavaLoggingClient"]
)
EOF

Expand All @@ -72,97 +72,70 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@npm_bazel_typescript//:index.bzl", "ts_proto_library")

proto_library(
name = "logger_proto",
srcs = ["logger.proto"]
name = "logger_proto",
srcs = ["logger.proto"]
)

go_proto_library(
name = "logger_go_proto",
proto = ":logger_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "bootcamp/proto/logger"
name = "logger_go_proto",
proto = ":logger_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "bootcamp/proto/logger"
)

java_proto_library(
name = "logger_java_proto",
deps = [":logger_proto"]
name = "logger_java_proto",
deps = [":logger_proto"]
)

java_grpc_library(
name = "logger_java_grpc",
srcs = [":logger_proto"],
deps = [":logger_java_proto"],
name = "logger_java_grpc",
srcs = [":logger_proto"],
deps = [":logger_java_proto"],
)

ts_proto_library(
name = "logger_ts_proto",
deps = [":logger_proto"]
name = "logger_ts_proto",
deps = [":logger_proto"]
)
EOF


# write shell test
cat > tests/BUILD <<EOF
sh_test(
name = "integration_test",
srcs = ["integrationtest.sh"],
data = [
"//go/cmd/server:go-server",
"//java/src/main/java/bazel/bootcamp:JavaLoggingClient",
],
tags = ["exclusive"]
name = "integration_test",
srcs = ["integrationtest.sh"],
data = [
"//go/cmd/server:go-server",
"//java/src/main/java/bazel/bootcamp:JavaLoggingClient",
],
tags = ["exclusive"]
)
EOF


# write WORKSPACE file
cat > WORKSPACE <<EOF
workspace(name = "bootcamp")

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

# grpc dependencies
git_repository(
name = "io_grpc_grpc_java",
commit = "a2cda8d15d752624180460d3e7e7d7322da13a2d",
remote = "https://github.com/grpc/grpc-java.git",
)
load("@io_grpc_grpc_java//:repositories.bzl", "grpc_java_repositories")
grpc_java_repositories()


cat > typescript/BUILD <<EOF
load("@npm_bazel_typescript//:index.bzl", "ts_library", "ts_devserver")

# go dependencies
http_archive(
name = "io_bazel_rules_go",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz"],
sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329",
ts_devserver(
name = "devserver",
bootstrap = ["@npm_bazel_typescript//:protobufjs_bootstrap_scripts"],
entry_module = "bootcamp/typescript/app",
port = 8088,
deps = [":app"],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()



# typescript dependencies
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "73325a155c16bfbde29fb2ffcaf59d9d5a1c13b06ada386d3edd5a9d82bda702",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.29.1/rules_nodejs-0.29.1.tar.gz"],
)

load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install")

yarn_install(
name = "npm",
package_json = "//typescript:package.json",
yarn_lock = "//typescript:yarn.lock",
ts_library(
name = "app",
srcs = ["app.ts"],
deps = [
"//proto/logger:logger_ts_proto",
],
)

load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
install_bazel_dependencies()
exports_files(["tsconfig.json"])
EOF

load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
ts_setup_workspace()
EOF
# write WORKSPACE file
${SHELL} ./generate_workspace.sh
Loading