summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-08-26 17:02:34 -0400
committerGitHub <noreply@github.com>2019-08-26 17:02:34 -0400
commitf94900406d52a9d0a432ae9ebef65d46092afb41 (patch)
tree0a12b3201f8bdd0bbee1b6b1abf3f413d7d92e9f /cli
parentd8ada4d3fcc5dfe7f76103399a1d765fbab2ee45 (diff)
Remove flatbuffers (#2818)
Diffstat (limited to 'cli')
-rw-r--r--cli/BUILD.gn23
-rw-r--r--cli/Cargo.toml1
-rw-r--r--cli/build.rs17
-rw-r--r--cli/msg.fbs73
-rw-r--r--cli/msg.rs85
5 files changed, 85 insertions, 114 deletions
diff --git a/cli/BUILD.gn b/cli/BUILD.gn
index 8b8790386..cfc397d65 100644
--- a/cli/BUILD.gn
+++ b/cli/BUILD.gn
@@ -1,7 +1,5 @@
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import("//build/toolchain/cc_wrapper.gni")
-import("//build_extra/flatbuffers/flatbuffer.gni")
-import("//build_extra/flatbuffers/rust/rust_flatbuffer.gni")
import("//build_extra/rust/rust.gni")
import("//third_party/v8/gni/snapshot_toolchain.gni")
import("//third_party/v8/gni/v8.gni")
@@ -24,7 +22,6 @@ main_extern_rlib = [
"atty",
"clap",
"dirs",
- "flatbuffers",
"futures",
"http",
"hyper",
@@ -94,7 +91,6 @@ ts_sources = [
"../js/fetch.ts",
"../js/file_info.ts",
"../js/files.ts",
- "../js/flatbuffers.ts",
"../js/form_data.ts",
"../js/format_error.ts",
"../js/get_random_values.ts",
@@ -151,7 +147,6 @@ ts_sources = [
# targets. Cargo handles all Rust source files and the final linking step.
group("deno_deps") {
deps = [
- ":msg_rs",
":snapshot_compiler",
":snapshot_deno",
]
@@ -164,7 +159,6 @@ group("deno_deps_cross") {
deps = [
":compiler_bundle",
":main_bundle",
- ":msg_rs",
]
}
@@ -213,9 +207,6 @@ run_node("deno_runtime_declaration") {
outputs = [
"$out_dir/lib/lib.deno_runtime.d.ts",
]
- deps = [
- ":msg_ts",
- ]
inputs = ts_sources + [
"//tools/ts_library_builder/tsconfig.json",
"//tools/ts_library_builder/main.ts",
@@ -248,7 +239,6 @@ bundle("main_bundle") {
out_name = "main"
deps = [
":deno_runtime_declaration",
- ":msg_ts",
]
}
@@ -257,19 +247,6 @@ bundle("compiler_bundle") {
out_name = "compiler"
deps = [
":deno_runtime_declaration",
- ":msg_ts",
- ]
-}
-
-ts_flatbuffer("msg_ts") {
- sources = [
- "msg.fbs",
- ]
-}
-
-rust_flatbuffer("msg_rs") {
- sources = [
- "msg.fbs",
]
}
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index cc2286af5..632c60c13 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -22,7 +22,6 @@ ansi_term = "0.12.0"
atty = "0.2.13"
clap = "2.33.0"
dirs = "2.0.2"
-flatbuffers = "0.6.0"
futures = "0.1.28"
http = "0.1.18"
hyper = "0.12.33"
diff --git a/cli/build.rs b/cli/build.rs
index 8e05b2119..55451e6b7 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -6,15 +6,10 @@ mod gn {
fn main() {
let build = gn::Build::setup();
-
- let gn_target = if build.check_only {
- // When RLS is running "cargo check" to analyze the source code, we're not
- // trying to build a working executable, rather we're just compiling all
- // rust code. Therefore, make ninja build only 'msg_generated.rs'.
- "cli:msg_rs"
- } else {
- "cli:deno_deps"
- };
-
- build.run(gn_target);
+ // When RLS is running "cargo check" to analyze the source code, we're not
+ // trying to build a working executable, rather we're just compiling all
+ // rust code.
+ if !build.check_only {
+ build.run("cli:deno_deps");
+ }
}
diff --git a/cli/msg.fbs b/cli/msg.fbs
deleted file mode 100644
index ad0a6274b..000000000
--- a/cli/msg.fbs
+++ /dev/null
@@ -1,73 +0,0 @@
-enum ErrorKind: byte {
- NoError = 0,
-
- // io errors
-
- NotFound,
- PermissionDenied,
- ConnectionRefused,
- ConnectionReset,
- ConnectionAborted,
- NotConnected,
- AddrInUse,
- AddrNotAvailable,
- BrokenPipe,
- AlreadyExists,
- WouldBlock,
- InvalidInput,
- InvalidData,
- TimedOut,
- Interrupted,
- WriteZero,
- Other,
- UnexpectedEof,
- BadResource,
- CommandFailed,
-
- // url errors
-
- EmptyHost,
- IdnaError,
- InvalidPort,
- InvalidIpv4Address,
- InvalidIpv6Address,
- InvalidDomainCharacter,
- RelativeUrlWithoutBase,
- RelativeUrlWithCannotBeABaseBase,
- SetHostOnCannotBeABaseUrl,
- Overflow,
-
- // hyper errors
-
- HttpUser,
- HttpClosed,
- HttpCanceled,
- HttpParse,
- HttpOther,
- TooLarge,
-
- // custom errors
- InvalidUri,
- InvalidSeekMode,
- OpNotAvailable,
- WorkerInitFailed,
- UnixError,
- NoAsyncSupport,
- NoSyncSupport,
- ImportMapError,
- InvalidPath,
- ImportPrefixMissing,
- UnsupportedFetchScheme,
- TooManyRedirects,
-
- // other kinds
- Diagnostic,
- JSError,
-}
-
-enum MediaType: byte {
- JavaScript = 0,
- TypeScript,
- Json,
- Unknown
-}
diff --git a/cli/msg.rs b/cli/msg.rs
index db4c771f8..4416c7d71 100644
--- a/cli/msg.rs
+++ b/cli/msg.rs
@@ -1,8 +1,81 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-#![allow(dead_code)]
-#![cfg_attr(feature = "cargo-clippy", allow(clippy::all, clippy::pedantic))]
-use flatbuffers;
-// GN_OUT_DIR is set either by build.rs (for the Cargo build), or by
-// build_extra/rust/run.py (for the GN+Ninja build).
-include!(concat!(env!("GN_OUT_DIR"), "/gen/cli/msg_generated.rs"));
+// Warning! The values in this enum are duplicated in js/errors.ts
+// Update carefully!
+#[allow(non_camel_case_types)]
+#[repr(i8)]
+#[derive(Clone, Copy, PartialEq, Debug)]
+pub enum ErrorKind {
+ NoError = 0,
+ NotFound = 1,
+ PermissionDenied = 2,
+ ConnectionRefused = 3,
+ ConnectionReset = 4,
+ ConnectionAborted = 5,
+ NotConnected = 6,
+ AddrInUse = 7,
+ AddrNotAvailable = 8,
+ BrokenPipe = 9,
+ AlreadyExists = 10,
+ WouldBlock = 11,
+ InvalidInput = 12,
+ InvalidData = 13,
+ TimedOut = 14,
+ Interrupted = 15,
+ WriteZero = 16,
+ Other = 17,
+ UnexpectedEof = 18,
+ BadResource = 19,
+ CommandFailed = 20,
+ EmptyHost = 21,
+ IdnaError = 22,
+ InvalidPort = 23,
+ InvalidIpv4Address = 24,
+ InvalidIpv6Address = 25,
+ InvalidDomainCharacter = 26,
+ RelativeUrlWithoutBase = 27,
+ RelativeUrlWithCannotBeABaseBase = 28,
+ SetHostOnCannotBeABaseUrl = 29,
+ Overflow = 30,
+ HttpUser = 31,
+ HttpClosed = 32,
+ HttpCanceled = 33,
+ HttpParse = 34,
+ HttpOther = 35,
+ TooLarge = 36,
+ InvalidUri = 37,
+ InvalidSeekMode = 38,
+ OpNotAvailable = 39,
+ WorkerInitFailed = 40,
+ UnixError = 41,
+ NoAsyncSupport = 42,
+ NoSyncSupport = 43,
+ ImportMapError = 44,
+ InvalidPath = 45,
+ ImportPrefixMissing = 46,
+ UnsupportedFetchScheme = 47,
+ TooManyRedirects = 48,
+ Diagnostic = 49,
+ JSError = 50,
+}
+
+// Warning! The values in this enum are duplicated in js/compiler.ts
+// Update carefully!
+#[allow(non_camel_case_types)]
+#[repr(i8)]
+#[derive(Clone, Copy, PartialEq, Debug)]
+pub enum MediaType {
+ JavaScript = 0,
+ TypeScript = 1,
+ Json = 2,
+ Unknown = 3,
+}
+
+pub fn enum_name_media_type(mt: MediaType) -> &'static str {
+ match mt {
+ MediaType::JavaScript => "JavaScript",
+ MediaType::TypeScript => "TypeScript",
+ MediaType::Json => "Json",
+ MediaType::Unknown => "Unknown",
+ }
+}