mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-02-23 15:50:00 +01:00
imp(serde):use proc_macros and serde-derive
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.
This commit is contained in:
26
src/build.rs
26
src/build.rs
@@ -1,26 +0,0 @@
|
||||
#[cfg(feature = "with-serde-codegen")]
|
||||
mod inner {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "with-serde-codegen"))]
|
||||
mod inner {
|
||||
pub fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
inner::main()
|
||||
}
|
||||
43
src/lib.rs
43
src/lib.rs
@@ -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;
|
||||
//!
|
||||
@@ -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"));
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#[cfg(feature = "nightly")]
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
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::*;
|
||||
Reference in New Issue
Block a user