diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index dcaf7963..7219ce70 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,7 +57,7 @@ jobs: ~/.cargo/.crates2.json ~/.cargo/bin ~/.cargo/registry - key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.lock') }} + key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }} - name: Build (wasm32-unknown-unknown) run: bazelisk --bazelrc=/dev/null build --platforms=@io_bazel_rules_rust//rust/platform:wasm //... diff --git a/WORKSPACE b/WORKSPACE index 569182ad..4261aeed 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,22 +1,9 @@ workspace(name = "proxy_wasm_rust_sdk") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@proxy_wasm_rust_sdk//bazel:repositories.bzl", "proxy_wasm_rust_sdk_repositories") -http_archive( - name = "io_bazel_rules_rust", - sha256 = "17dbf791f4dab0fd4496ce5345af35e9ce2f6d011c1c8423436da517d019a3ea", - strip_prefix = "rules_rust-2f97db595b05b1ee8cc44bde5bdf03c00bd169fb", - url = "https://github.com/bazelbuild/rules_rust/archive/2f97db595b05b1ee8cc44bde5bdf03c00bd169fb.tar.gz", -) +proxy_wasm_rust_sdk_repositories() -load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") +load("@proxy_wasm_rust_sdk//bazel:dependencies.bzl", "proxy_wasm_rust_sdk_dependencies") -rust_repositories() - -load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace") - -rust_workspace() - -load("//bazel/cargo:crates.bzl", "raze_fetch_remote_crates") - -raze_fetch_remote_crates() +proxy_wasm_rust_sdk_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..b8f2b84d --- /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_rust_sdk//bazel/cargo:crates.bzl", "raze_fetch_remote_crates") + +def proxy_wasm_rust_sdk_dependencies(): + rust_repositories() + raze_fetch_remote_crates() diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl new file mode 100644 index 00000000..6ddf170f --- /dev/null +++ b/bazel/repositories.bzl @@ -0,0 +1,23 @@ +# 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_rust_sdk_repositories(): + http_archive( + name = "io_bazel_rules_rust", + sha256 = "5cb2fbcc3debebc7b68f5f66c1b7ef741bdcca87c70594de688d4518538c36c8", + strip_prefix = "rules_rust-aa7c6938cf1cc2973bc065c7532f89874bf09818", + url = "https://github.com/bazelbuild/rules_rust/archive/aa7c6938cf1cc2973bc065c7532f89874bf09818.tar.gz", + )