Skip to content

Commit

Permalink
Upgrade Flatbuffers.
Browse files Browse the repository at this point in the history
Use msg_generated.rs as mod instead of crate.
  • Loading branch information
ry committed Oct 31, 2018
1 parent 0fbee30 commit 8b375ee
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 6 deletions.
5 changes: 4 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ main_extern = [
"$rust_build:tokio_threadpool",
"$rust_build:url",
"//build_extra/flatbuffers/rust:flatbuffers",
":msg_rs",
]

ts_sources = [
Expand Down Expand Up @@ -124,8 +123,12 @@ ts_sources = [
rust_executable("deno") {
source_root = "src/main.rs"
extern = main_extern
data = [
"$target_gen_dir/msg_generated.rs",
]
deps = [
":libdeno",
":msg_rs_gen",
":snapshot",
]
}
Expand Down
17 changes: 17 additions & 0 deletions build_extra/rust/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python
# This file just executes its arguments, except that it extracts a special
# argument --env-out-dir so as to pass it to the given command via environmental
# variable. This backflip is to have compatibility with cargo.
import subprocess
import argparse
import sys
import os

parser = argparse.ArgumentParser()
parser.add_argument("--env-out-dir", dest="env_out_dir")
flags, args_rest = parser.parse_known_args()

assert os.path.isdir(flags.env_out_dir)
os.environ["OUT_DIR"] = flags.env_out_dir

sys.exit(subprocess.call(args_rest, env=os.environ))
8 changes: 7 additions & 1 deletion build_extra/rust/rust.gni
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ template("rust_crate") {
"crate_type",
"crate_version",
"deps",
"data",
"features",
"is_test",
"libs",
Expand Down Expand Up @@ -151,7 +152,7 @@ template("rust_crate") {
}

action(action_name) {
script = "//third_party/v8/tools/run.py"
script = "//build_extra/rust/run.py"
sources = [
source_root,
]
Expand All @@ -169,6 +170,8 @@ template("rust_crate") {
args += [
"rustc",
rebase_path(source_root, root_build_dir),
"--env-out-dir",
rebase_path(root_out_dir),
"--crate-name=$crate_name",
"--crate-type=$crate_type",
"--emit=$emit_type,dep-info",
Expand Down Expand Up @@ -204,6 +207,9 @@ template("rust_crate") {
if (defined(invoker.args)) {
args += invoker.args
}
if (defined(invoker.data)) {
data += invoker.data
}

if (defined(features)) {
foreach(f, features) {
Expand Down
2 changes: 1 addition & 1 deletion gclient_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'cpplint'
}, {
'url':
'https://github.com/google/flatbuffers.git@d840856093fa7b935b0d6378c436bd633d006c8c',
'https://github.com/google/flatbuffers.git@160e8f2fdc9d5989e652709fae3fac0bd9aaed14',
'name':
'flatbuffers'
}]
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ extern crate getopts;
extern crate hyper;
extern crate hyper_rustls;
extern crate libc;
extern crate msg_rs as msg;
extern crate rand;
extern crate remove_dir_all;
extern crate ring;
Expand All @@ -31,6 +30,7 @@ mod fs;
mod http_util;
mod isolate;
mod libdeno;
mod msg;
pub mod ops;
mod permissions;
mod resources;
Expand Down
4 changes: 4 additions & 0 deletions src/msg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#![allow(unused_imports)]
#![allow(dead_code)]
use flatbuffers;
include!(concat!(env!("OUT_DIR"), "/gen/msg_generated.rs"));
2 changes: 1 addition & 1 deletion third_party
Submodule third_party updated 112 files
2 changes: 1 addition & 1 deletion tools/sync_third_party.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

third_party.run_yarn()
third_party.run_cargo()
third_party.run_pip()
#third_party.run_pip()
third_party.run_gclient_sync()

0 comments on commit 8b375ee

Please sign in to comment.