Skip to content

Commit

Permalink
runtime/rust: add BUILD files for Rust crates
Browse files Browse the repository at this point in the history
Add BUILD files for the oak_abi and oak_runtime crates, mirroring
the dependencies from Cargo.toml into "//cargo:<dep>" equivalents
in the BUILD file.

Check that `bazel build //oak/server/rust/oak_abi` and
`bazel build //oak/server/rust/oak_run` work afterwards.
  • Loading branch information
daviddrysdale committed Apr 7, 2020
1 parent 9110b98 commit c160b48
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
33 changes: 33 additions & 0 deletions oak/server/rust/oak_abi/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright 2019 The Project Oak Authors
#
# 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:rust.bzl", "rust_library")

package(
default_visibility = ["//oak/server:__subpackages__"],
licenses = ["notice"],
)

rust_library(
name = "oak_abi",
srcs = glob(["src/**/*.rs"]),
crate_type = "rlib",
edition = "2018",
deps = [
"//cargo:hashbrown",
"//cargo:prost",
],
)
3 changes: 3 additions & 0 deletions oak/server/rust/oak_abi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ edition = "2018"
license = "Apache-2.0"

[dependencies]
# Note that if new dependencies are added here:
# - they need to be synced to //cargo/Cargo.toml
# - `cd cargo && cargo raze` needs re-running, and the results checked in
prost = "*"
hashbrown = "*"

Expand Down
38 changes: 38 additions & 0 deletions oak/server/rust/oak_runtime/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Copyright 2019 The Project Oak Authors
#
# 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:rust.bzl", "rust_library")

package(
default_visibility = ["//oak/server:__subpackages__"],
licenses = ["notice"],
)

rust_library(
name = "oak_runtime",
srcs = glob(["src/**/*.rs"]),
crate_type = "rlib",
edition = "2018",
deps = [
"//cargo:byteorder",
"//cargo:itertools",
"//cargo:log",
"//cargo:prost",
"//cargo:rand",
"//cargo:wasmi",
"//oak/server/rust/oak_abi",
],
)
3 changes: 3 additions & 0 deletions oak/server/rust/oak_runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ test_build = []
default = []

[dependencies]
# Note that if new dependencies are added here:
# - they need to be synced to //cargo/Cargo.toml
# - `cd cargo && cargo raze` needs re-running, and the results checked in
byteorder = { version = "*", default-features = false }
itertools = "*"
log = { version = "*" }
Expand Down

0 comments on commit c160b48

Please sign in to comment.