Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] build: add cargo feature to drop various tools #8381

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d49ccda
Feature gate tools
bartlomieju Nov 14, 2020
2531c45
Temp
bartlomieju Nov 14, 2020
9e82c61
dedup
bartlomieju Nov 14, 2020
d689693
more feature gating
bartlomieju Nov 14, 2020
d630f3b
format
bartlomieju Nov 14, 2020
cc4f148
Merge branch 'master' into cargo_features
bartlomieju Nov 14, 2020
85ae68b
rename
bartlomieju Nov 14, 2020
ffe81e7
fix
bartlomieju Nov 14, 2020
8188dcc
temp
bartlomieju Nov 15, 2020
3e90841
Merge branch 'master' into cargo_features
bartlomieju Nov 17, 2020
bef9b85
fmt and lint
bartlomieju Nov 17, 2020
1f8a821
strip more
bartlomieju Nov 17, 2020
858b966
lint
bartlomieju Nov 18, 2020
20abe7a
Merge branch 'master' into cargo_features
bartlomieju Nov 19, 2020
3465d6b
fix
bartlomieju Nov 19, 2020
8dda9d7
Merge branch 'master' into cargo_features
bartlomieju Nov 20, 2020
3a4aaab
remove cfg from inspector
bartlomieju Nov 20, 2020
b696cc5
Merge branch 'master' into cargo_features
bartlomieju Nov 22, 2020
fdc131c
reorg imports
bartlomieju Nov 22, 2020
954def6
wildcard match
bartlomieju Nov 22, 2020
a2780c4
reorg main.rs
bartlomieju Nov 22, 2020
d4b5ca2
remove unwrap
bartlomieju Nov 22, 2020
9d53924
Merge branch 'master' into cargo_features
bartlomieju Nov 25, 2020
b4c3289
Merge branch 'master' into cargo_features
bartlomieju Nov 25, 2020
08c2c15
fix
bartlomieju Nov 25, 2020
ee97a22
Merge branch 'master' into cargo_features
bartlomieju Nov 26, 2020
20fc996
fixes
bartlomieju Nov 26, 2020
470e9c4
fixes
bartlomieju Nov 26, 2020
78ef2a3
Merge branch 'master' into cargo_features
bartlomieju Nov 27, 2020
c8239c9
Merge branch 'master' into cargo_features
bartlomieju Nov 28, 2020
fc67677
Merge branch 'master' into cargo_features
bartlomieju Nov 28, 2020
9d70130
fmt
bartlomieju Nov 28, 2020
93b3a5c
factor out lib
bartlomieju Nov 28, 2020
aa8a1f0
lint
bartlomieju Nov 28, 2020
3e885d4
add basic ci check for "no-tools" mode
bartlomieju Nov 28, 2020
2eee3b2
dont remap stack trace if no tools
bartlomieju Nov 28, 2020
623faaa
Merge branch 'master' into cargo_features
bartlomieju Nov 30, 2020
f9c8251
Merge branch 'master' into cargo_features
bartlomieju Dec 1, 2020
259e849
lint notools
bartlomieju Dec 1, 2020
c4923d3
Merge branch 'master' into cargo_features
bartlomieju Dec 2, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more feature gating
  • Loading branch information
bartlomieju committed Nov 14, 2020
commit d689693090b2cdb3a3ff8a79e15d8bba7ba880c4
4 changes: 2 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ name = "deno"
path = "main.rs"

[features]
default = ["deno_doc","deno_lint","dprint-plugin-typescript", "swc_bundler", "swc_ecmascript", "swc_common", "jsonc-parser"]
no_tools = []
tools = ["deno_doc","deno_lint","dprint-plugin-typescript", "swc_bundler", "swc_ecmascript", "swc_common", "jsonc-parser"]
default = ["tools"]

[[bench]]
name = "deno_bench"
Expand Down
8 changes: 4 additions & 4 deletions cli/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! Diagnostics are compile-time type errors, whereas JsErrors are runtime
//! exceptions.

#[cfg(not(feature="no_tools"))]
#[cfg(feature="tools")]
use crate::ast::DiagnosticBuffer;
use crate::import_map::ImportMapError;
use deno_core::error::AnyError;
Expand Down Expand Up @@ -147,7 +147,7 @@ fn get_serde_json_error_class(
}
}

#[cfg(not(feature="no_tools"))]
#[cfg(feature="tools")]
fn get_diagnostic_class(_: &DiagnosticBuffer) -> &'static str {
"SyntaxError"
}
Expand Down Expand Up @@ -211,10 +211,10 @@ pub(crate) fn get_error_class_name(e: &AnyError) -> &'static str {
.map(get_serde_json_error_class)
})
.or_else(|| {
#[cfg(not(feature="no_tools"))]
#[cfg(feature="tools")]
let maybe_get_error = || e.downcast_ref::<DiagnosticBuffer>().map(get_diagnostic_class);

#[cfg(feature="no_tools")]
#[cfg(not(feature="tools"))]
let maybe_get_error = || Option::<&'static str>::None;

(maybe_get_error)()
Expand Down
5 changes: 5 additions & 0 deletions cli/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ impl Future for DenoInspectorSession {

/// A local inspector session that can be used to send and receive protocol messages directly on
/// the same thread as an isolate.
#[cfg(feature="tools")]
pub struct InspectorSession {
v8_channel: v8::inspector::ChannelBase,
v8_session: v8::UniqueRef<v8::inspector::V8InspectorSession>,
Expand All @@ -829,19 +830,22 @@ pub struct InspectorSession {
notification_queue: Vec<Value>,
}

#[cfg(feature="tools")]
impl Deref for InspectorSession {
type Target = v8::inspector::V8InspectorSession;
fn deref(&self) -> &Self::Target {
&self.v8_session
}
}

#[cfg(feature="tools")]
impl DerefMut for InspectorSession {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.v8_session
}
}

#[cfg(feature="tools")]
impl v8::inspector::ChannelImpl for InspectorSession {
fn base(&self) -> &v8::inspector::ChannelBase {
&self.v8_channel
Expand Down Expand Up @@ -880,6 +884,7 @@ impl v8::inspector::ChannelImpl for InspectorSession {
fn flush_protocol_notifications(&mut self) {}
}

#[cfg(feature="tools")]
impl InspectorSession {
const CONTEXT_GROUP_ID: i32 = 1;

Expand Down
16 changes: 8 additions & 8 deletions cli/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ pub const TS_VERSION: &str = env!("TS_VERSION");

pub static CLI_SNAPSHOT: &[u8] =
include_bytes!(concat!(env!("OUT_DIR"), "/CLI_SNAPSHOT.bin"));
#[cfg(not(feature="no_tools"))]
#[cfg(feature="tools")]
pub static COMPILER_SNAPSHOT: &[u8] =
include_bytes!(concat!(env!("OUT_DIR"), "/COMPILER_SNAPSHOT.bin"));
#[cfg(not(feature="no_tools"))]
#[cfg(feature="tools")]
pub static DENO_NS_LIB: &str = include_str!("dts/lib.deno.ns.d.ts");
#[cfg(not(feature="no_tools"))]
#[cfg(feature="tools")]
pub static DENO_WEB_LIB: &str = include_str!(env!("DENO_WEB_LIB_PATH"));
#[cfg(not(feature="no_tools"))]
#[cfg(feature="tools")]
pub static DENO_FETCH_LIB: &str = include_str!(env!("DENO_FETCH_LIB_PATH"));
#[cfg(not(feature="no_tools"))]
#[cfg(feature="tools")]
pub static SHARED_GLOBALS_LIB: &str =
include_str!("dts/lib.deno.shared_globals.d.ts");
#[cfg(not(feature="no_tools"))]
#[cfg(feature="tools")]
pub static WINDOW_LIB: &str = include_str!("dts/lib.deno.window.d.ts");
#[cfg(not(feature="no_tools"))]
#[cfg(feature="tools")]
pub static UNSTABLE_NS_LIB: &str = include_str!("dts/lib.deno.unstable.d.ts");

pub fn deno_isolate_init() -> Snapshot {
Expand All @@ -29,7 +29,7 @@ pub fn deno_isolate_init() -> Snapshot {
Snapshot::Static(data)
}

#[cfg(not(feature="no_tools"))]
#[cfg(feature="tools")]
pub fn compiler_isolate_init() -> Snapshot {
debug!("Deno compiler isolate init with snapshots.");
let data = COMPILER_SNAPSHOT;
Expand Down
Loading