Skip to content

Commit

Permalink
Improve incremental compile time
Browse files Browse the repository at this point in the history
  • Loading branch information
pfoerster committed Apr 12, 2020
1 parent d13c550 commit 0fba51b
Show file tree
Hide file tree
Showing 144 changed files with 602 additions and 501 deletions.
120 changes: 105 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 8 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,47 @@ authors = [
edition = "2018"

[workspace]
members = [
"crates/bibutils_sys",
"crates/futures_boxed",
"crates/jsonrpc_derive"
]
members = ["crates/*"]

[lib]
doctest = false

[dependencies]
aovec = "1.1"
base64 = "0.12"
bibutils-sys = { path = "crates/bibutils_sys" }
byteorder = "1.3"
bytes = "0.5"
citeproc = { git = "https://github.com/cormacrelf/citeproc-rs", rev = "68c7a7c16088b5d7751641ab37299ad064cdb221" }
citeproc-db = { git = "https://github.com/cormacrelf/citeproc-rs", rev = "68c7a7c16088b5d7751641ab37299ad064cdb221" }
citeproc-io = { git = "https://github.com/cormacrelf/citeproc-rs", rev = "68c7a7c16088b5d7751641ab37299ad064cdb221" }
chashmap = "2.2"
clap = "2.33"
csl = { git = "https://github.com/cormacrelf/citeproc-rs", rev = "68c7a7c16088b5d7751641ab37299ad064cdb221" }
fnv = "1.0"
futures = "0.3"
futures-boxed = { path = "crates/futures_boxed" }
html2md = "0.2"
image = "0.23"
itertools = "0.8"
jsonrpc = { path = "crates/jsonrpc" }
jsonrpc-derive = { path = "crates/jsonrpc_derive" }
lalrpop-util = "0.18"
log = "0.4"
lsp-types = "0.73.0"
nom = "5.1"
once_cell = "1.3"
petgraph = { version = "0.5", features = ["serde-1"] }
rayon = "1.3"
regex = "1.3"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
serde_repr = "0.1"
stderrlog = "0.4"
tempfile = "3.1"
texlab-citeproc = { path = "crates/texlab_citeproc" }
texlab-components = { path = "crates/texlab_components" }
texlab-protocol = { path = "crates/texlab_protocol" }
texlab-syntax = { path = "crates/texlab_syntax" }
texlab-tex = { path = "crates/texlab_tex" }
thiserror = "1.0"
titlecase = "1.1"
tokio = { version = "0.2", features = ["blocking", "fs", "io-std", "io-util", "macros", "process", "stream", "time"] }
tokio = { version = "0.2", features = ["full"] }
tokio-util = { version = "0.2", features = ["codec"] }
url = "2.1"
uuid = { version = "0.8", features = ["v4"] }

[dev-dependencies]
criterion = "0.3"
indoc = "0.3"

[build-dependencies]
lalrpop = { version = "0.18", features = ["lexer"] }

[profile.release]
lto = true

Expand Down
2 changes: 1 addition & 1 deletion benches/benchmarks/open_bibtex.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::test_data::TEST_BIBTEX;
use criterion::Criterion;
use texlab::syntax::bibtex;
use texlab_syntax::bibtex;

fn criterion_benchmark(criterion: &mut Criterion) {
criterion.bench_function("BibTeX Parser", |b| b.iter(|| bibtex::open(&TEST_BIBTEX)));
Expand Down
8 changes: 3 additions & 5 deletions benches/benchmarks/open_latex.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use super::test_data::TEST_LATEX;
use criterion::Criterion;
use std::env;
use texlab::{
protocol::{Options, Uri},
syntax::latex,
tex::Resolver,
};
use texlab_protocol::{Options, Uri};
use texlab_syntax::latex;
use texlab_tex::Resolver;

fn criterion_benchmark(criterion: &mut Criterion) {
let uri = Uri::parse("file:///home/user/main.tex").unwrap();
Expand Down
4 changes: 0 additions & 4 deletions build.rs

This file was deleted.

20 changes: 20 additions & 0 deletions crates/jsonrpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "jsonrpc"
version = "0.1.0"
authors = [
"Eric Förster <efoerster@users.noreply.github.com>",
"Patrick Förster <pfoerster@users.noreply.github.com>"]
edition = "2018"

[lib]
doctest = false

[dependencies]
chashmap = "2.2"
futures = "0.3"
futures-boxed = { path = "../futures_boxed" }
log = "0.4"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
serde_repr = "0.1"
tokio = { version = "0.2", features = ["full"] }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion crates/jsonrpc_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ proc-macro = true
doctest = false

[dependencies]
futures-boxed = { path = "../futures_boxed" }
syn = "1.0"
quote = "1.0"
22 changes: 11 additions & 11 deletions crates/jsonrpc_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ pub fn jsonrpc_server(_attr: TokenStream, item: TokenStream) -> TokenStream {
let tokens = quote! {
#impl_

impl #generics crate::jsonrpc::RequestHandler for #self_ty {
impl #generics jsonrpc::RequestHandler for #self_ty {
#[futures_boxed::boxed]
async fn handle_request(&self, request: crate::jsonrpc::Request) -> crate::jsonrpc::Response {
use crate::jsonrpc::*;
async fn handle_request(&self, request: jsonrpc::Request) -> jsonrpc::Response {
use jsonrpc::*;

match request.method.as_str() {
#(#requests),*,
Expand All @@ -80,7 +80,7 @@ pub fn jsonrpc_server(_attr: TokenStream, item: TokenStream) -> TokenStream {
}

#[futures_boxed::boxed]
async fn handle_notification(&self, notification: crate::jsonrpc::Notification) {
async fn handle_notification(&self, notification: jsonrpc::Notification) {
match notification.method.as_str() {
#(#notifications),*,
_ => log::warn!("{}: {}", "Method not found", notification.method),
Expand All @@ -105,14 +105,14 @@ pub fn jsonrpc_client(attr: TokenStream, item: TokenStream) -> TokenStream {
#trait_

pub struct #struct_ident {
client: crate::jsonrpc::Client
client: jsonrpc::Client
}

impl #struct_ident
{
pub fn new(output: futures::channel::mpsc::Sender<String>) -> Self {
Self {
client: crate::jsonrpc::Client::new(output),
client: jsonrpc::Client::new(output),
}
}
}
Expand All @@ -122,10 +122,10 @@ pub fn jsonrpc_client(attr: TokenStream, item: TokenStream) -> TokenStream {
#(#stubs)*
}

impl crate::jsonrpc::ResponseHandler for #struct_ident
impl jsonrpc::ResponseHandler for #struct_ident
{
#[futures_boxed::boxed]
async fn handle(&self, response: crate::jsonrpc::Response) -> () {
async fn handle(&self, response: jsonrpc::Response) -> () {
self.client.handle(response).await
}
}
Expand Down Expand Up @@ -156,7 +156,7 @@ fn generate_server_skeletons(items: &Vec<ImplItem>) -> (Vec<TokenStream2>, Vec<T
self.#ident(param).await
};

crate::jsonrpc::handle_request(request, handler).await
jsonrpc::handle_request(request, handler).await
}
));
}
Expand All @@ -167,7 +167,7 @@ fn generate_server_skeletons(items: &Vec<ImplItem>) -> (Vec<TokenStream2>, Vec<T
self.#ident(param).await;
};

crate::jsonrpc::handle_notification(notification, handler).await;
jsonrpc::handle_notification(notification, handler).await;
}
));
}
Expand All @@ -192,7 +192,7 @@ fn generate_client_stubs(items: &Vec<TraitItem>) -> Vec<TokenStream2> {
#[futures_boxed::boxed]
#sig {
let result = self.client.send_request(#name.to_owned(), #param).await?;
serde_json::from_value(result).map_err(|_| crate::jsonrpc::Error::deserialize_error())
serde_json::from_value(result).map_err(|_| jsonrpc::Error::deserialize_error())
}
),
MethodKind::Notification => quote!(
Expand Down
Loading

0 comments on commit 0fba51b

Please sign in to comment.