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

Conversation

bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Nov 14, 2020

This is really a prototype and is not intended to be landed.

This commit adds default cargo feature called "tools". When building with --no-default-features flag most of the tools included in the regular binary won't be included (TS support, doc generator, formatter, linter, bundler, file watcher) and produced binary will be able to load file only from local disk (so effectively no URL support and only "deno run" subcommand is operational). This reduces binary size from about 45Mb to 30Mb (on macOS).

There are still about 50 "unused" warnings left.

To try out locally:

cd cli  // this is required - cannot build workspace with features
cargo build --no-default-features

@bartlomieju
Copy link
Member Author

Update:

When building with --no-default-features results as follows:

  • release binary 27Mb; zipped 14Mb
  • release binary without debug info 16Mb; zipped 6.8Mb

@@ -135,8 +135,8 @@ impl DiagnosticBuffer {
#[derive(Debug, Clone)]
pub struct ErrorBuffer(Arc<RwLock<Vec<Diagnostic>>>);

impl ErrorBuffer {
pub fn new() -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aside: shouldn't this result in a clippy error currently?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect so, but it seems that's only the case when having lib.rs

@bartlomieju
Copy link
Member Author

Closing in favor of #8640

@bartlomieju bartlomieju closed this Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants