diff --git a/BUILD b/BUILD index e9d434b2..840ccd3a 100644 --- a/BUILD +++ b/BUILD @@ -1,4 +1,5 @@ -load("//:bazel/variables.bzl", "COPTS", "LINKOPTS") +load("@rules_cc//cc:defs.bzl", "cc_library") +load("@proxy_wasm_cpp_host//bazel:variables.bzl", "COPTS") licenses(["notice"]) # Apache 2 diff --git a/WORKSPACE b/WORKSPACE index 874d39b1..77ecd3a0 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,89 +1,9 @@ workspace(name = "proxy_wasm_cpp_host") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +load("@proxy_wasm_cpp_host//bazel:repositories.bzl", "proxy_wasm_cpp_host_repositories") -git_repository( - name = "proxy_wasm_cpp_sdk", - commit = "1b5f69ce1535b0c21f88c4af4ebf0ec51d255abe", - remote = "https://github.com/proxy-wasm/proxy-wasm-cpp-sdk", -) +proxy_wasm_cpp_host_repositories() -http_archive( - name = "com_google_absl", - sha256 = "19391fb4882601a65cb648d638c11aa301ce5f525ef02da1a9eafd22f72d7c59", - strip_prefix = "abseil-cpp-37dd2562ec830d547a1524bb306be313ac3f2556", - # 2020-01-29 - urls = ["https://github.com/abseil/abseil-cpp/archive/37dd2562ec830d547a1524bb306be313ac3f2556.tar.gz"], -) +load("@proxy_wasm_cpp_host//bazel:dependencies.bzl", "proxy_wasm_cpp_host_dependencies") -# required by com_google_protobuf -http_archive( - name = "bazel_skylib", - sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", - ], -) - -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") - -bazel_skylib_workspace() - -# rust rules -http_archive( - name = "io_bazel_rules_rust", - sha256 = "7401878bf966325bbec5224eeb4ff7e8762681070b401acaa168da68d383563a", - strip_prefix = "rules_rust-9741a32e50a8c50c504c0931111bb6048d6d6888", - url = "https://github.com/bazelbuild/rules_rust/archive/9741a32e50a8c50c504c0931111bb6048d6d6888.tar.gz", -) - -load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") - -rust_repositories() - -load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace") - -rust_workspace() - -load("//bazel/cargo:crates.bzl", "proxy_wasm_cpp_host_raze__fetch_remote_crates") - -proxy_wasm_cpp_host_raze__fetch_remote_crates() - -git_repository( - name = "com_google_protobuf", - commit = "655310ca192a6e3a050e0ca0b7084a2968072260", - remote = "https://github.com/protocolbuffers/protobuf", - shallow_since = "1565024848 -0700", -) - -http_archive( - name = "boringssl", - sha256 = "bb55b0ed2f0cb548b5dce6a6b8307ce37f7f748eb9f1be6bfe2d266ff2b4d52b", - strip_prefix = "boringssl-2192bbc878822cf6ab5977d4257a1339453d9d39", - urls = ["https://github.com/google/boringssl/archive/2192bbc878822cf6ab5977d4257a1339453d9d39.tar.gz"], -) - -http_archive( - name = "com_google_googletest", - sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb", - strip_prefix = "googletest-release-1.10.0", - urls = ["https://github.com/google/googletest/archive/release-1.10.0.tar.gz"], -) - -http_archive( - name = "wasmtime", - build_file = "@proxy_wasm_cpp_host//bazel/external:wasmtime.BUILD", - sha256 = "7874feb1026bbef06796bd5ab80e73f15b8e83752bde8dc93994f5bc039a4952", - strip_prefix = "wasmtime-0.21.0", - url = "https://github.com/bytecodealliance/wasmtime/archive/v0.21.0.tar.gz", -) - -http_archive( - name = "wasm_c_api", - build_file = "@proxy_wasm_cpp_host//bazel/external:wasm-c-api.BUILD", - sha256 = "aea8cd095e9937f1e14f2c93e026317b197eb2345e7a817fe3932062eb7b792c", - strip_prefix = "wasm-c-api-d9a80099d496b5cdba6f3fe8fc77586e0e505ddc", - url = "https://github.com/WebAssembly/wasm-c-api/archive/d9a80099d496b5cdba6f3fe8fc77586e0e505ddc.tar.gz", -) +proxy_wasm_cpp_host_dependencies() diff --git a/bazel/BUILD b/bazel/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/bazel/dependencies.bzl b/bazel/dependencies.bzl new file mode 100644 index 00000000..ef2163cf --- /dev/null +++ b/bazel/dependencies.bzl @@ -0,0 +1,20 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") +load("@proxy_wasm_cpp_host//bazel/cargo:crates.bzl", "proxy_wasm_cpp_host_raze__fetch_remote_crates") + +def proxy_wasm_cpp_host_dependencies(): + rust_repositories() + proxy_wasm_cpp_host_raze__fetch_remote_crates() diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl new file mode 100644 index 00000000..93eabfe1 --- /dev/null +++ b/bazel/repositories.bzl @@ -0,0 +1,75 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +def proxy_wasm_cpp_host_repositories(): + http_archive( + name = "proxy_wasm_cpp_sdk", + sha256 = "b97e3e716b1f38dc601487aa0bde72490bbc82b8f3ad73f1f3e69733984955df", + strip_prefix = "proxy-wasm-cpp-sdk-956f0d500c380cc1656a2d861b7ee12c2515a664", + urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/archive/956f0d500c380cc1656a2d861b7ee12c2515a664.tar.gz"], + ) + + http_archive( + name = "boringssl", + sha256 = "bb55b0ed2f0cb548b5dce6a6b8307ce37f7f748eb9f1be6bfe2d266ff2b4d52b", + strip_prefix = "boringssl-2192bbc878822cf6ab5977d4257a1339453d9d39", + urls = ["https://github.com/google/boringssl/archive/2192bbc878822cf6ab5977d4257a1339453d9d39.tar.gz"], + ) + + http_archive( + name = "com_google_googletest", + sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb", + strip_prefix = "googletest-release-1.10.0", + urls = ["https://github.com/google/googletest/archive/release-1.10.0.tar.gz"], + ) + + http_archive( + name = "wasmtime", + build_file = "@proxy_wasm_cpp_host//bazel/external:wasmtime.BUILD", + sha256 = "7874feb1026bbef06796bd5ab80e73f15b8e83752bde8dc93994f5bc039a4952", + strip_prefix = "wasmtime-0.21.0", + url = "https://github.com/bytecodealliance/wasmtime/archive/v0.21.0.tar.gz", + ) + + http_archive( + name = "wasm_c_api", + build_file = "@proxy_wasm_cpp_host//bazel/external:wasm-c-api.BUILD", + sha256 = "aea8cd095e9937f1e14f2c93e026317b197eb2345e7a817fe3932062eb7b792c", + strip_prefix = "wasm-c-api-d9a80099d496b5cdba6f3fe8fc77586e0e505ddc", + url = "https://github.com/WebAssembly/wasm-c-api/archive/d9a80099d496b5cdba6f3fe8fc77586e0e505ddc.tar.gz", + ) + + http_archive( + name = "com_google_absl", + sha256 = "19391fb4882601a65cb648d638c11aa301ce5f525ef02da1a9eafd22f72d7c59", + strip_prefix = "abseil-cpp-37dd2562ec830d547a1524bb306be313ac3f2556", + # 2020-01-29 + urls = ["https://github.com/abseil/abseil-cpp/archive/37dd2562ec830d547a1524bb306be313ac3f2556.tar.gz"], + ) + + http_archive( + name = "io_bazel_rules_rust", + sha256 = "442a102e2a6f6c75e10d43f21c0c30218947a3e827d91529ced7380c5fec05f0", + strip_prefix = "rules_rust-39523e32ac0bd64f5d60154114a42e61e58ffd17", + url = "https://github.com/bazelbuild/rules_rust/archive/39523e32ac0bd64f5d60154114a42e61e58ffd17.tar.gz", + ) + + http_archive( + name = "com_google_protobuf", + sha256 = "59621f4011a95df270748dcc0ec1cc51946473f0e140d4848a2f20c8719e43aa", + strip_prefix = "protobuf-655310ca192a6e3a050e0ca0b7084a2968072260", + url = "https://github.com/protocolbuffers/protobuf/archive/655310ca192a6e3a050e0ca0b7084a2968072260.tar.gz", + ) diff --git a/test/test_data/wasm.bzl b/bazel/wasm.bzl similarity index 100% rename from test/test_data/wasm.bzl rename to bazel/wasm.bzl diff --git a/test/BUILD b/test/BUILD index 803e59e9..82daf715 100644 --- a/test/BUILD +++ b/test/BUILD @@ -1,5 +1,5 @@ load("@rules_cc//cc:defs.bzl", "cc_test") -load("//:bazel/variables.bzl", "COPTS", "LINKOPTS") +load("@proxy_wasm_cpp_host//bazel:variables.bzl", "COPTS", "LINKOPTS") cc_test( name = "null_vm_test", diff --git a/test/test_data/BUILD b/test/test_data/BUILD index d6797368..051f051c 100644 --- a/test/test_data/BUILD +++ b/test/test_data/BUILD @@ -1,4 +1,4 @@ -load("//test/test_data:wasm.bzl", "wasm_rust_binary") +load("@proxy_wasm_cpp_host//bazel:wasm.bzl", "wasm_rust_binary") package(default_visibility = ["//visibility:public"]) diff --git a/test/test_data/trap.rs b/test/test_data/trap.rs index 8fb2a413..2be4cab2 100644 --- a/test/test_data/trap.rs +++ b/test/test_data/trap.rs @@ -17,7 +17,7 @@ pub extern "C" fn trigger() { one(); } #[no_mangle] -pub extern "C" fn trigger2(val: i32) -> i32 { +pub extern "C" fn trigger2(_val: i32) -> i32 { three(); 0 }