Skip to content

Commit

Permalink
Reindeer import neon library for Rust/Node FFI
Browse files Browse the repository at this point in the history
Summary:
For VS Code, we are going to be writing native code in rust that needs to be exposed to NodeJS.  The Neon library (https://github.com/neon-bindings/neon) supports the FFI boundary requirements necessary to accomplish this.

 ---

Update cargo.toml to import external package neon v1.0.0 for Rust->Node FFI work.

Instructions from here:  https://www.internalfb.com/wiki/Rust/Third_Party_Libraries/Adding_or_Updating_Libraries

Modify rust.toml and run:
```
./fbcode/common/rust/tools/reindeer/vendor
```

Note that neon requires a newer version of semver, so this diff also updates that version from 1.0.17 to 1.0.23

Following the fixups instructions: https://www.internalfb.com/wiki/Rust/Third_Party_Libraries/Fixups, I added one for the env!() code in meta.rs due to this message from ```fbcode/common/rust/tools/scripts/third-party-check.sh```

```
Action failed: fbsource//third-party/rust:neon-1.0.0 (rustc check)
Remote command returned non-zero exit code 1
Reproduce locally: `frecli cas download-action 51770a2ed06955702573d8f9a28e85abc9cd77cb443c4ef69cdbb506fe96d2f5:145`
stdout:
stderr:
error: environment variable `CARGO_PKG_VERSION` not defined at compile time
 --> third-party/rust/vendor/neon-1.0.0/src/meta.rs:6:27
  |
6 | pub const VERSION: &str = env!("CARGO_PKG_VERSION");
  |                           ^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
 --> xplat/rust/toolchain/sysroot/1.81.0/library/core/src/macros/mod.rs:1083:5
  |
  = note: in this expansion of `env!`
  |
  = help: Cargo sets build script variables at run time. Use `std::env::var("CARGO_PKG_VERSION")` instead
```

Reviewed By: davidbarsky, cfsmp3

Differential Revision: D65178280

fbshipit-source-id: 3742c3f42e67cf841159dd8165d19ed95fb60868
  • Loading branch information
MarkZuber authored and facebook-github-bot committed Oct 31, 2024
1 parent e4b60bf commit 8016dad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ nom = "7.1"
proc-macro2 = { version = "1.0.70", features = ["span-locations"] }
rayon = "1.9.0"
rustsec = "0.26"
semver = { version = "1.0.17", features = ["serde"] }
semver = { version = "1.0.23", features = ["serde"] }
serde = { version = "1.0.185", features = ["derive", "rc"] }
serde_json = { version = "1.0.125", features = ["float_roundtrip", "unbounded_depth"] }
serde_starlark = "0.1.13"
Expand Down

0 comments on commit 8016dad

Please sign in to comment.