Skip to content

Commit

Permalink
Update rust examples (#515)
Browse files Browse the repository at this point in the history
* Add bazel support (#1)
* Fix CMake build for Rust (#3)
* Rust: update everest-framework (#17)
* Update framework version in bazel dependencies
* Update framework revision in rust

---------

Signed-off-by: Dima Dorezyuk <ddo@qwello.eu>
Signed-off-by: Evgeny Petrov <evgeny@epetrov.net>
Co-authored-by: Dima Dorezyuk <ddo@qwello.eu>
  • Loading branch information
golovasteek and Dima Dorezyuk committed Feb 6, 2024
1 parent dd3f4c5 commit d40971c
Show file tree
Hide file tree
Showing 25 changed files with 405 additions and 672 deletions.
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.4.0
18 changes: 18 additions & 0 deletions .github/workflows/bazel_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Bazel Build
run-name: ${{ github.actor }} is building with bazel
on: [pull_request]
jobs:
bazel-build:
runs-on: ubuntu-22.04
steps:
- run: echo branch name is ${{ github.ref }}
- name: Checkout
uses: actions/checkout@v4.1.0
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "~/.cache/bazel"
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE.bazel', 'third-party/bazel/*') }}
- name: Build all
run: >
bazelisk build //...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.cache/
workspace.yaml
.vscode/
/bazel-*
16 changes: 16 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package(default_visibility = ["//visibility:public"])

filegroup(
name = "types",
srcs = glob(["types/**/*.yaml"]),
)

filegroup(
name = "interfaces",
srcs = glob(["interfaces/**/*.yaml"]),
)

filegroup(
name = "errors",
srcs = glob(["errors/**/*.yaml"]),
)
59 changes: 59 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
workspace(name = "everest-core")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_rust",
sha256 = "36ab8f9facae745c9c9c1b33d225623d976e78f2cc3f729b7973d8c20934ab95",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.31.0/rules_rust-v0.31.0.tar.gz"],
)

load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")

rules_rust_dependencies()

rust_register_toolchains(
versions = ["1.74.0"],
)

load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")

crate_universe_dependencies()

load("@rules_rust//crate_universe:defs.bzl", "crates_repository", "crate")

crates_repository(
name = "crate_index",
cargo_lockfile = "//modules/rust_examples:Cargo.lock",
isolated = False,
manifests = [
"//modules/rust_examples:Cargo.toml",
"//modules/rust_examples/RsExample:Cargo.toml",
"//modules/rust_examples/RsExampleUser:Cargo.toml",
],
annotations = {
"everestrs": [crate.annotation(
crate_features = ["build_bazel"],
)],
},
)

load("@crate_index//:defs.bzl", "crate_repositories")

crate_repositories()

load("//third-party/bazel:repos.bzl", "everest_core_repos")

everest_core_repos()

load("//third-party/bazel:defs.bzl", "everest_core_defs")

everest_core_defs()

load("@everest-framework//third-party/bazel:repos.bzl", "everest_framework_repos")

everest_framework_repos()

load("@everest-framework//third-party/bazel:defs.bzl", "everest_framework_deps")

everest_framework_deps()
2 changes: 2 additions & 0 deletions cmake/everest-generate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ if (EVEREST_ENABLE_RS_SUPPORT)
echo "[workspace.dependencies]" >> Cargo.toml
COMMAND
echo "everestrs = { path = \"$<TARGET_PROPERTY:everest::everestrs_sys,EVERESTRS_DIR>\" }" >> Cargo.toml
COMMAND
echo "everestrs-build = { path = \"$<TARGET_PROPERTY:everest::everestrs_sys,EVERESTRS_BUILD_DIR>\" }" >> Cargo.toml
COMMAND
echo $<TARGET_FILE:everest::framework> > .everestrs_link_dependencies
COMMAND
Expand Down
Empty file.

0 comments on commit d40971c

Please sign in to comment.