Skip to content

Commit

Permalink
fix(dependencies): use working version of serde-codegen
Browse files Browse the repository at this point in the history
This update fixes the build on stable, and allows builds
on nightly as usual.

The trick is to use the latest version of serde-codegen,
which keeps the syntex version internal, preventing clashes
between libraries that might have different requirements.
  • Loading branch information
Byron committed Jul 17, 2016
1 parent 850e115 commit 3921b6a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ env:
global:
secure: Plj5DqAQX/4+KPM+nOAZ2sCbGIsoSrHo1YggfesQnU7paR734XO/4IayWnsNO/3q6bDi4GIcn56RUZAD3xBJJBNLia2CYIickIIYORRqLWbLdbzQaxBbD670ahtzEuUSFJTRKURPwFteAnsWYgNMNzwXOVNwLS5IUBqWTcS+N0g=
matrix:
- FEATURE=with-syntex
- FEATURE=with-serde-codegen
- FEATURE=nightly
13 changes: 6 additions & 7 deletions src/mako/Cargo.toml.mako
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mime = "^ 0.2.0"
serde = "^ 0.7.5"
serde_json = "^ 0.7.0"
yup-oauth2 = { version = "^ 0.6.0", optional = true, default-features = false }
serde_macros = { version = "0.7.5", optional = true }
serde_macros = { version = "^ 0.7.5", optional = true }
% for dep in cargo.get('dependencies', list()):
${dep}
% endfor
Expand All @@ -43,20 +43,19 @@ ${dep}
crate_name_we_depend_on = None
nightly_features = ["serde_macros", "yup-oauth2/nightly"]
default_features = ["serde_codegen", "syntex", "yup-oauth2/with-syntex"]
default_features = ["serde_codegen", "yup-oauth2/with-serde-codegen"]
if make.depends_on_suffix is not None:
crate_name_we_depend_on = library_to_crate_name(api_name, suffix=make.depends_on_suffix)
nightly_features.append(crate_name_we_depend_on + '/nightly')
default_features.append(crate_name_we_depend_on + '/with-syntex')
default_features.append(crate_name_we_depend_on + '/with-serde-codegen')
%>\
default = ["with-syntex"]
default = ["with-serde-codegen"]
nightly = [${','.join(enclose_in('"', nightly_features))}]
with-syntex = [${','.join(enclose_in('"', default_features))}]
with-serde-codegen = [${','.join(enclose_in('"', default_features))}]

[build-dependencies]
syntex = { version = "= 0.32", optional = true }
serde_codegen = { version = "= 0.7.5", optional = true }
serde_codegen = { version = "^ 0.7.14", optional = true }

% if make.depends_on_suffix is not None:

Expand Down
10 changes: 3 additions & 7 deletions src/mako/api/build.rs.mako
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<%namespace name="util" file="../lib/util.mako"/>\
#[cfg(feature = "with-syntex")]
#[cfg(feature = "with-serde-codegen")]
mod inner {
extern crate syntex;
extern crate serde_codegen;

use std::env;
Expand All @@ -13,13 +11,11 @@ mod inner {
let src = Path::new("src/lib.rs.in");
let dst = Path::new(&out_dir).join("lib.rs");

let mut registry = syntex::Registry::new();
serde_codegen::register(&mut registry);
registry.expand("${util.crate_name()}", &src, &dst).unwrap();
serde_codegen::expand(&src, &dst).unwrap();
}
}

#[cfg(not(feature = "with-syntex"))]
#[cfg(not(feature = "with-serde-codegen"))]
mod inner {
pub fn main() {}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mako/api/lib.rs.mako
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ ${lib.docs(c)}
#[cfg(feature = "nightly")]
include!("lib.rs.in");

#[cfg(feature = "with-syntex")]
#[cfg(feature = "with-serde-codegen")]
include!(concat!(env!("OUT_DIR"), "/lib.rs"));

0 comments on commit 3921b6a

Please sign in to comment.