forked from portier/portier-broker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add serde_codegen and build script for stable Rust
This is necessary because stable Rust does not yet support custom #[derive] implementations, which are needed for Serde's Serialize/Deserialize traits. Serde has a macro package and compiler plugin which handle those, but compiler plugins are *also* not availble in stable Rust, so we instead have to generate code at build time using serde_codegen. Bug for `custom_derive` feature: rust-lang/rust#29644 Bug for compiler plugins: rust-lang/rust#29597
- Loading branch information
Showing
4 changed files
with
400 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,10 @@ | |
name = "ladaemon" | ||
version = "0.1.0" | ||
authors = ["Dirkjan Ochtman <[email protected]>"] | ||
build = "build.rs" | ||
|
||
[build-dependencies] | ||
serde_codegen = "0.7.10" | ||
|
||
[dependencies] | ||
docopt = "0.6.81" | ||
|
@@ -14,7 +18,8 @@ rand = "0.3.14" | |
redis = "0.5.3" | ||
router = "0.1.1" | ||
rustc-serialize = "0.3.19" | ||
serde_json = "0.7.0" | ||
serde = "0.7.10" | ||
serde_json = "0.7.1" | ||
time = "0.1.35" | ||
url = "1.1.0" | ||
urlencoded = "0.3.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Stable Rust 1.9 doesn't support the custom_derive feature, so we generate | ||
// code for structures which #[derive] Serde's Serialize/Deserialize traits. | ||
|
||
extern crate serde_codegen; | ||
|
||
use std::env; | ||
use std::path::Path; | ||
|
||
pub fn main() { | ||
let out_dir = env::var_os("OUT_DIR").unwrap(); | ||
|
||
let src = Path::new("src/lib.rs.in"); | ||
let dst = Path::new(&out_dir).join("lib.rs"); | ||
|
||
serde_codegen::expand(&src, &dst).unwrap(); | ||
} |
Oops, something went wrong.