Skip to content

Commit 4204345

Browse files
authored
Simplify Bazel workspace. (#70)
Signed-off-by: Pengyuan Bian <bianpengyuan@google.com>
1 parent b5ff880 commit 4204345

File tree

4 files changed

+93
-49
lines changed

4 files changed

+93
-49
lines changed

WORKSPACE

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,9 @@
11
workspace(name = "proxy_wasm_cpp_sdk")
22

3-
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
4-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
3+
load("@proxy_wasm_cpp_sdk//bazel/dep:deps.bzl", "wasm_dependencies")
54

6-
BUILD_ZLIB = """filegroup(name = "zlib", srcs = glob(["**"]), visibility = ["//visibility:public"])"""
5+
wasm_dependencies()
76

8-
http_archive(
9-
name = "emscripten_toolchain",
10-
build_file = "//:emscripten-toolchain.BUILD",
11-
patch_cmds = [
12-
"./emsdk install 2.0.7",
13-
"./emsdk activate --embedded 2.0.7",
14-
],
15-
strip_prefix = "emsdk-2.0.7",
16-
url = "https://github.com/emscripten-core/emsdk/archive/2.0.7.tar.gz",
17-
sha256 = "ce7a5c76e8b425aca874cea329fd9ac44b203b777053453b6a37b4496c5ce34f"
18-
)
7+
load("@proxy_wasm_cpp_sdk//bazel/dep:deps_extra.bzl", "wasm_dependencies_extra")
198

20-
# required by com_google_protobuf
21-
http_archive(
22-
name = "bazel_skylib",
23-
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
24-
urls = [
25-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
26-
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
27-
],
28-
)
29-
30-
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
31-
32-
bazel_skylib_workspace()
33-
34-
git_repository(
35-
name = "com_google_protobuf",
36-
commit = "655310ca192a6e3a050e0ca0b7084a2968072260",
37-
remote = "https://github.com/protocolbuffers/protobuf",
38-
)
39-
40-
http_archive(
41-
name = "rules_proto",
42-
sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
43-
strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
44-
urls = [
45-
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
46-
"https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
47-
],
48-
)
49-
50-
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
51-
52-
rules_proto_dependencies()
53-
54-
rules_proto_toolchains()
9+
wasm_dependencies_extra()

bazel/dep/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
licenses(["notice"]) # Apache 2

bazel/dep/deps.bzl

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
16+
17+
def wasm_dependencies():
18+
_http_archive(
19+
name = "emscripten_toolchain",
20+
build_file = "@proxy_wasm_cpp_sdk//:emscripten-toolchain.BUILD",
21+
patch_cmds = [
22+
"./emsdk install 2.0.7",
23+
"./emsdk activate --embedded 2.0.7",
24+
],
25+
strip_prefix = "emsdk-2.0.7",
26+
url = "https://github.com/emscripten-core/emsdk/archive/2.0.7.tar.gz",
27+
sha256 = "ce7a5c76e8b425aca874cea329fd9ac44b203b777053453b6a37b4496c5ce34f"
28+
)
29+
30+
# required by com_google_protobuf
31+
_http_archive(
32+
name = "bazel_skylib",
33+
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
34+
urls = [
35+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
36+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
37+
],
38+
)
39+
40+
_http_archive(
41+
name = "rules_proto",
42+
sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
43+
strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
44+
urls = [
45+
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
46+
"https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
47+
],
48+
)
49+
50+
_http_archive(
51+
name = "com_google_protobuf",
52+
sha256 = "59621f4011a95df270748dcc0ec1cc51946473f0e140d4848a2f20c8719e43aa",
53+
strip_prefix = "protobuf-655310ca192a6e3a050e0ca0b7084a2968072260",
54+
url = "https://github.com/protocolbuffers/protobuf/archive/655310ca192a6e3a050e0ca0b7084a2968072260.tar.gz",
55+
)
56+
57+
def _http_archive(name, **kwargs):
58+
existing_rule_keys = native.existing_rules().keys()
59+
if name in existing_rule_keys:
60+
# This repository has already been defined.
61+
return
62+
63+
http_archive(
64+
name = name,
65+
**kwargs
66+
)

bazel/dep/deps_extra.bzl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
16+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
17+
18+
# Wasm deps that rely on a first stage of dependency loading in wasm_dependencies().
19+
def wasm_dependencies_extra():
20+
bazel_skylib_workspace()
21+
rules_proto_dependencies()
22+
rules_proto_toolchains()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy