Skip to content

Commit

Permalink
imp(serde):use proc_macros and serde-derive
Browse files Browse the repository at this point in the history
With Rust 1.15, proc macros have been stabilized. Therefore
custom build scripts are not required anymore.

This commit removes all the previous machinery and the
need for nightly.
  • Loading branch information
Byron committed Feb 3, 2017
1 parent d4ebbc4 commit 59584b2
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 206 deletions.
1 change: 0 additions & 1 deletion .rustc.version

This file was deleted.

16 changes: 1 addition & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,11 @@ os:
rust:
- stable
- nightly
matrix:
exclude:
- rust: stable
env: FEATURE=nightly
allow_failures:
- os: osx
- rust: nightly
env: FEATURE=nightly
before_script:
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/Library/Python/2.7/bin:$HOME/.local/bin:$PATH
script:
- travis-cargo test -- --features $FEATURE --no-default-features
- travis-cargo test
- travis-cargo build -- --manifest-path examples/drive_example/Cargo.toml
- travis-cargo build -- --manifest-path examples/service_account/Cargo.toml
after_success:
- "[[ $TRAVIS_OS_NAME = linux ]] && travis-cargo --only stable coveralls"
env:
global:
- TRAVIS_CARGO_NIGHTLY_FEATURE=""
matrix:
- FEATURE=with-serde-codegen
- FEATURE=nightly
121 changes: 25 additions & 96 deletions Cargo.lock

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

15 changes: 3 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ description = "An oauth2 implementation, providing the 'device', 'service accoun
documentation = "https://docs.rs/yup-oauth2/"
keywords = ["google", "oauth", "v2"]
license = "MIT OR Apache-2.0"
build = "src/build.rs"

[dependencies]
base64 = "0.2"
Expand All @@ -17,19 +16,11 @@ hyper = "0.10.2"
itertools = "0.4"
log = "0.3"
openssl = "0.9.6"
serde = "0.8"
serde_json = "0.8"
serde_derive = { version = "0.8", optional = true }
serde = "0.9"
serde_json = "0.9"
serde_derive = "0.9"
url = "0.5"

[features]
default = ["with-serde-codegen"]
nightly = ["serde_derive"]
with-serde-codegen = ["serde_codegen"]

[build-dependencies]
serde_codegen = { version = "^ 0.8", optional = true }

[dev-dependencies]
getopts = "0.2"
open = "1.1"
Expand Down
11 changes: 0 additions & 11 deletions Makefile

This file was deleted.

26 changes: 0 additions & 26 deletions src/build.rs

This file was deleted.

43 changes: 36 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
//! authorize future API requests to the same scopes.
//!
//! ```test_harness,no_run
//! #![cfg_attr(feature = "nightly", feature(proc_macro))]
//! #[cfg(feature = "nightly")]
//! #[macro_use]
//! extern crate serde_derive;
//!
Expand Down Expand Up @@ -67,10 +65,41 @@
//! # }
//! ```
//!
#![cfg_attr(feature = "nightly", feature(proc_macro))]
#[macro_use]
extern crate serde_derive;

#[cfg(feature = "nightly")]
include!("lib.rs.in");
extern crate serde;
extern crate serde_json;

extern crate base64;
extern crate chrono;
extern crate openssl;
extern crate hyper;
#[cfg(test)]
extern crate log;
#[cfg(test)]
extern crate yup_hyper_mock;
extern crate url;
extern crate itertools;

mod authenticator;
mod authenticator_delegate;
mod device;
mod helper;
mod installed;
mod refresh;
mod service_account;
mod storage;
mod types;

pub use device::{GOOGLE_DEVICE_CODE_URL, DeviceFlow};
pub use refresh::{RefreshFlow, RefreshResult};
pub use types::{Token, FlowType, ApplicationSecret, ConsoleApplicationSecret, Scheme, TokenType};
pub use installed::{InstalledFlow, InstalledFlowReturnMethod};
pub use storage::{TokenStorage, NullStorage, MemoryStorage, DiskTokenStorage};
pub use authenticator::{Authenticator, Retry, GetToken};
pub use authenticator_delegate::{AuthenticatorDelegate, DefaultAuthenticatorDelegate, PollError,
PollInformation};
pub use helper::*;
pub use service_account::*;

#[cfg(feature = "with-serde-codegen")]
include!(concat!(env!("OUT_DIR"), "/lib.rs"));
38 changes: 0 additions & 38 deletions src/lib.rs.in

This file was deleted.

0 comments on commit 59584b2

Please sign in to comment.