Export codegen from main juniper crate

Use a trick for re-exporting proc-macros to supply juniper_derive as a
dependency of juniper.

Users will now just have to depend on juniper directly.
This commit is contained in:
theduke 2017-12-02 02:27:41 +01:00
parent c4ded5781d
commit 141292ad91
5 changed files with 25 additions and 8 deletions

View file

@ -20,16 +20,25 @@ harness = false
path = "benches/bench.rs"
[features]
codegen = ["juniper_codegen"]
nightly = []
expose-test-schema = []
default = ["chrono", "url", "uuid"]
default = [
"codegen",
"chrono",
"url",
"uuid"
]
[dependencies]
juniper_codegen = { version = "0.8.1", path = "../juniper_codegen" , optional = true}
fnv = "1.0.3"
chrono = { version = "^0.4.0", optional = true }
ordermap = { version = "^0.2.11", features = ["serde-1"] }
serde = { version = "^1.0.8" }
serde_derive = {version="^1.0.8" }
chrono = { version = "^0.4.0", optional = true }
serde_json = { version="^1.0.2", optional = true }
url = { version = "^1.5.1", optional = true }
uuid = { version = "0.5.1", optional = true }

View file

@ -136,6 +136,17 @@ extern crate url;
#[cfg(any(test, feature = "uuid"))]
extern crate uuid;
// If the "codegen" feature is enabled, depend on juniper_codegen and re-export everything in it.
// This allows users to just depend on juniper and get the derive funcationality automatically.
#[cfg(feature = "codegen")]
#[allow(unused_imports)]
#[macro_use]
extern crate juniper_codegen;
#[cfg(feature = "codegen")]
#[doc(hidden)]
pub use juniper_codegen::*;
use std::borrow::Cow;
#[macro_use]

View file

@ -11,8 +11,8 @@ repository = "https://github.com/graphql-rust/juniper"
proc-macro = true
[dependencies]
syn = "0.11.11"
quote = "0.3.15"
syn = "0.11"
quote = "0.3"
[badges]
travis-ci = { repository = "graphql-rust/juniper" }

View file

@ -4,8 +4,7 @@ version = "0.1.0"
[dependencies]
juniper = { path = "../juniper" }
juniper_codegen = { path = "../juniper_codegen" }
serde_json = { version = "^1.0.2" }
serde_json = { version = "1" }
[dev-dependencies]
fnv = "1.0.3"

View file

@ -1,7 +1,5 @@
#[macro_use]
extern crate juniper;
#[macro_use]
extern crate juniper_codegen;
extern crate serde_json;
#[cfg(test)]