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

Allow parallel compilation of serde and serde_derive #343

Merged
merged 1 commit into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion rinja/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ itoa = "1.0.11"

# needed by feature "serde_json"
serde = { version = "1.0", optional = true, default-features = false }
serde_json = { version = "1.0", optional = true, default-features = false, features = [] }
serde_json = { version = "1.0", optional = true, default-features = false }

# needed by feature "urlencode"
percent-encoding = { version = "2.1.0", optional = true, default-features = false }
Expand Down
5 changes: 3 additions & 2 deletions rinja_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ parser = { package = "rinja_parser", version = "=0.3.5", path = "../rinja_parser

basic-toml = { version = "0.1.1", optional = true }
pulldown-cmark = { version = "0.12.0", optional = true, default-features = false }
serde = { version = "1.0", optional = true, features = ["derive"] }
serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }

memchr = "2"
quote = { version = "1", default-features = false }
Expand All @@ -41,7 +42,7 @@ syn = { version = "2.0.3", features = ["full"] }
alloc = []
blocks = ["syn/full"]
code-in-doc = ["dep:pulldown-cmark"]
config = ["dep:serde", "dep:basic-toml", "parser/config"]
config = ["dep:basic-toml", "dep:serde", "dep:serde_derive", "parser/config"]
urlencode = []
serde_json = []
std = ["alloc"]
Expand Down
4 changes: 2 additions & 2 deletions rinja_derive/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use parser::node::Whitespace;
use parser::{ParseError, Parsed, Syntax, SyntaxBuilder};
use proc_macro2::Span;
#[cfg(feature = "config")]
use serde::Deserialize;
use serde_derive::Deserialize;

use crate::{CompileError, FileInfo, OnceMap};

Expand Down Expand Up @@ -314,7 +314,7 @@ impl RawConfig<'_> {
}
}

#[cfg_attr(feature = "config", derive(serde::Deserialize))]
#[cfg_attr(feature = "config", derive(Deserialize))]
struct General<'a> {
#[cfg_attr(feature = "config", serde(borrow))]
dirs: Option<Vec<&'a str>>,
Expand Down
5 changes: 3 additions & 2 deletions rinja_derive_standalone/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ parser = { package = "rinja_parser", version = "=0.3.5", path = "../rinja_parser

basic-toml = { version = "0.1.1", optional = true }
pulldown-cmark = { version = "0.12.0", optional = true, default-features = false }
serde = { version = "1.0", optional = true, features = ["derive"] }
serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }

memchr = "2"
quote = { version = "1", default-features = false }
Expand All @@ -48,7 +49,7 @@ __standalone = []

blocks = ["syn/full"]
code-in-doc = ["dep:pulldown-cmark"]
config = ["dep:serde", "dep:basic-toml", "parser/config"]
config = ["dep:basic-toml", "dep:serde", "dep:serde_derive", "parser/config"]
urlencode = []
serde_json = []

Expand Down
5 changes: 3 additions & 2 deletions rinja_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ harness = false

[dependencies]
memchr = "2"
serde = { version = "1.0", optional = true, features = ["derive"] }
serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
winnow = "0.7.0"

[dev-dependencies]
criterion = "0.5"

[features]
config = ["dep:serde"]
config = ["dep:serde", "dep:serde_derive"]
2 changes: 1 addition & 1 deletion rinja_parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ fn fmt_syntax(name: &str, inner: &InnerSyntax<'_>, f: &mut fmt::Formatter<'_>) -
}

#[derive(Debug, Default, Clone, Copy, Hash, PartialEq)]
#[cfg_attr(feature = "config", derive(serde::Deserialize))]
#[cfg_attr(feature = "config", derive(serde_derive::Deserialize))]
pub struct SyntaxBuilder<'a> {
pub name: &'a str,
pub block_start: Option<&'a str>,
Expand Down
2 changes: 1 addition & 1 deletion rinja_parser/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ impl<'a> CondTest<'a> {
}

#[derive(Clone, Copy, Default, PartialEq, Eq, Debug, Hash)]
#[cfg_attr(feature = "config", derive(serde::Deserialize))]
#[cfg_attr(feature = "config", derive(serde_derive::Deserialize))]
#[cfg_attr(feature = "config", serde(field_identifier, rename_all = "lowercase"))]
pub enum Whitespace {
#[default]
Expand Down
Loading