Skip to content

Commit

Permalink
Remove msg_generated hack (denoland#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk authored and ry committed Jul 26, 2018
1 parent 180170d commit 5562c36
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 1,877 deletions.
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
js/msg_generated.ts
js/flatbuffers.js
32 changes: 2 additions & 30 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ run_node("bundle") {
"js/dispatch.ts",
"js/globals.ts",
"js/main.ts",
"js/msg_generated.ts",
"js/os.ts",
"js/runtime.ts",
"js/types.ts",
"js/util.ts",
"src/msg.fbs",
"rollup.config.js",
"tsconfig.json",
]
Expand All @@ -207,7 +207,7 @@ run_node("bundle") {
out_dir + "main.js.map",
]
deps = [
":flatbufferjs",
":msg_ts",
]
args = [
"./node_modules/rollup/bin/rollup",
Expand Down Expand Up @@ -237,34 +237,6 @@ source_set("libdeno_nosnapshot") {
defines = [ "BUNDLE_LOCATION=\"$bundle_location\"" ]
}

# Generates flatbuffer TypeScript code.
# TODO(ry) Ideally flatc output files should be written into
# target_gen_dir, but its difficult to get this working in a way that the
# bundler can resolve their location. (The bundler does not support NODE_PATH?)
# Therefore this hack: write the msg_generated.ts output
# into the js/ folder, and we check it into the repo. Hopefully this hack can
# be removed at some point. If msg.fps is changed, commit changes to the
# generated JS files. The stamp file is just to make gn work.
action("flatbufferjs") {
script = "//tools/flatbufferjs_hack.py"
sources = [
"src/msg.fbs",
]
outputs = [
"$target_gen_dir/flatbufferjs_hack.stamp",
]

args = [
rebase_path("$target_gen_dir/msg_generated.ts", root_build_dir),
rebase_path("js/msg_generated.ts", root_build_dir),
rebase_path(outputs[0], root_build_dir),
]

deps = [
":msg_ts",
]
}

ts_flatbuffer("msg_ts") {
sources = [
"src/msg.fbs",
Expand Down
2 changes: 1 addition & 1 deletion js/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// tslint:disable-next-line:no-reference
/// <reference path="deno.d.ts" />
import { flatbuffers } from "flatbuffers";
import { deno as fbs } from "./msg_generated";
import { deno as fbs } from "gen/msg_generated";
import { assert, log } from "./util";
import * as runtime from "./runtime";

Expand Down
Loading

0 comments on commit 5562c36

Please sign in to comment.