Skip to content

Commit 61d3648

Browse files
authored
Wrap Wasm related library import into a rule (#3107)
* orgnize bazel * format
1 parent dea1dc0 commit 61d3648

File tree

4 files changed

+55
-16
lines changed

4 files changed

+55
-16
lines changed

Diff for: WORKSPACE

+3-16
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ workspace(name = "io_istio_proxy")
1919
# http_archive is not a native function since bazel 0.19
2020
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
2121
load(
22-
"//:repositories.bzl",
22+
"//bazel:repositories.bzl",
2323
"docker_dependencies",
2424
"googletest_repositories",
2525
"istioapi_dependencies",
@@ -134,19 +134,6 @@ container_pull(
134134

135135
# End of docker dependencies
136136

137-
FLAT_BUFFERS_SHA = "a83caf5910644ba1c421c002ef68e42f21c15f9f"
137+
load("//bazel:wasm.bzl", "wasm_dependencies")
138138

139-
http_archive(
140-
name = "com_github_google_flatbuffers",
141-
sha256 = "b8efbc25721e76780752bad775a97c3f77a0250271e2db37fc747b20e8b0f24a",
142-
strip_prefix = "flatbuffers-" + FLAT_BUFFERS_SHA,
143-
url = "https://github.com/google/flatbuffers/archive/" + FLAT_BUFFERS_SHA + ".tar.gz",
144-
)
145-
146-
http_file(
147-
name = "com_github_nlohmann_json_single_header",
148-
sha256 = "3b5d2b8f8282b80557091514d8ab97e27f9574336c804ee666fda673a9b59926",
149-
urls = [
150-
"https://github.com/nlohmann/json/releases/download/v3.7.3/json.hpp",
151-
],
152-
)
139+
wasm_dependencies()

Diff for: bazel/BUILD

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2020 Istio Authors. All Rights Reserved.
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+
################################################################################
16+
#
File renamed without changes.

Diff for: bazel/wasm.bzl

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2020 Google Inc. All Rights Reserved.
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+
################################################################################
16+
#
17+
18+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
19+
20+
def wasm_dependencies():
21+
FLAT_BUFFERS_SHA = "a83caf5910644ba1c421c002ef68e42f21c15f9f"
22+
23+
http_archive(
24+
name = "com_github_google_flatbuffers",
25+
sha256 = "b8efbc25721e76780752bad775a97c3f77a0250271e2db37fc747b20e8b0f24a",
26+
strip_prefix = "flatbuffers-" + FLAT_BUFFERS_SHA,
27+
url = "https://github.com/google/flatbuffers/archive/" + FLAT_BUFFERS_SHA + ".tar.gz",
28+
)
29+
30+
http_file(
31+
name = "com_github_nlohmann_json_single_header",
32+
sha256 = "3b5d2b8f8282b80557091514d8ab97e27f9574336c804ee666fda673a9b59926",
33+
urls = [
34+
"https://github.com/nlohmann/json/releases/download/v3.7.3/json.hpp",
35+
],
36+
)

0 commit comments

Comments
 (0)