Skip to content
This repository was archived by the owner on Dec 16, 2020. It is now read-only.

Build rust wasm data with Bazel #516

Merged
merged 51 commits into from
Aug 8, 2020
Merged

Conversation

Shikugawa
Copy link
Member

For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md

Description: Build rust wasm data with bazel. Note that we can't execute this with RBE, and we use private fork of rules_rust because we can't overcome the build problem (see bazelbuild/rules_rust#312) with current version of it.
Risk Level: Low
Testing:
Docs Changes:
Release Notes:
[Optional Fixes #Issue]
[Optional Deprecated:]

@jplevyak
Copy link
Contributor

Looks good. Just need to fix the formatting.

Shikugawa added 3 commits May 13, 2020 08:39
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Shikugawa added 3 commits May 14, 2020 03:45
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
Signed-off-by: shikugawa <[email protected]>
@Shikugawa Shikugawa requested a review from dio as a code owner May 21, 2020 15:33
Shikugawa added 4 commits May 21, 2020 15:44
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
@@ -6,44 +6,45 @@ use proxy_wasm;
#[no_mangle]
pub fn proxy_abi_version_0_1_0() {}

use log::{debug, error, info, trace, warn};
use log::*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, log crate has private helper macros. In Rust 2018, we can available external macros with use syntax. But it works only there is no private helper macros. We should import them when we use log macros. But it will cause more complexity and confusion. In this case, we don't have any problem to use *. https://doc.rust-lang.org/edition-guide/rust-2018/macros/macro-changes.html#local-helper-macros

srcs = glob(["*.wasm"]),
rust_library(
name = "proxy_wasm",
srcs = ["proxy_wasm.rs"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a better place to comment on this, but this proxy_wasm.rs is NOT Proxy-Wasm.

You can copy the contents of that file into logging_rust.rs, since it implements the ABI directly... or at the very least use a different name to avoid confusion.

Ideally, we should rewrite this test to use proxy-wasm-rust-sdk, but that's probably too big change, and should be done in a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add TODO here and fix when proxy-wasm-rust-sdk bazel support is merged.

Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
# "skip_on_windows",
# # Precompiled WASM code which is required to compile with wee8_compiler
# # which is needed to build as position independent code. It is not supported on macos.
# "skip_on_macos",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I don't think you should disable this test.
  2. wee8_compile builds fine on macOS (at least it worked last time I checked).
  3. Precompilation is only enabled on Linux-x86_64. This is guarded in wee8_compile tool and in the V8 code loading the .wasm module, so this test should pass on macOS just fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you could just skip the precompile step on macOS.

INSTANTIATE_TEST_SUITE_P(RuntimesAndLanguages, WasmTestMatrix,
testing::Combine(testing::Values("v8"
#if defined(ENVOY_WASM_WAVM)
,
"wavm"
#endif
),
testing::Values("cpp", "rust")));
testing::Values("cpp")));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this PR disables wasm_vm_test and removes rust from wasm_test, then there are no Rust tests executed at all...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasm_test is temporary disabled for my debugging of OOM killed in CI.

Shikugawa and others added 9 commits August 7, 2020 08:12
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Shikugawa <[email protected]>
Signed-off-by: Lizan Zhou <[email protected]>
Signed-off-by: Lizan Zhou <[email protected]>
Signed-off-by: Lizan Zhou <[email protected]>
Signed-off-by: Lizan Zhou <[email protected]>
@lizan
Copy link
Member

lizan commented Aug 7, 2020

@PiotrSikora I fixed all build stuff, ptal.

Copy link
Contributor

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks that this PR builds and precompiles the self-contained test/extensions/common/wasm/test_data/test_rust.wasm, but not the recently added tests written using Rust SDK.

I think it's fine to merge this now, and add the migration of the new tests to Bazel in a subsequent PR using cargo raze, but right now this PR adds some unnecessary files and breaks building the new tests, which should be fixed before merging.

Signed-off-by: Lizan Zhou <[email protected]>
@lizan
Copy link
Member

lizan commented Aug 8, 2020

@PiotrSikora I reverted those unnecessary changes

Signed-off-by: Lizan Zhou <[email protected]>
Copy link
Contributor

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@PiotrSikora PiotrSikora merged commit 19589f5 into envoyproxy:master Aug 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants