Skip to content

Commit 6ad5edd

Browse files
Reduce yup-oauth2 features
1 parent 77b4705 commit 6ad5edd

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

google-apis-common/Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@ serde_json = "1"
2727
serde_with = "3"
2828
tokio = { version = "1", features = ["time"] }
2929
url = "2"
30-
yup-oauth2 = { version = "12", optional = true }
30+
yup-oauth2 = { version = "12", default-features = false, optional = true }
31+
32+
[features]
33+
yup-oauth2 = ["dep:yup-oauth2"]
34+
yup-oauth2-service-account = ["yup-oauth2", "yup-oauth2/service-account"]
35+
aws-lc-rs = ["yup-oauth2?/aws-lc-rs"]
36+
ring = ["yup-oauth2?/ring"]

google-clis-common/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ mime = "0.3"
2121
serde = "1"
2222
serde_json = "1"
2323
strsim = "0.11"
24-
yup-oauth2 = "12"
24+
yup-oauth2 = { version = "12", default-features = false }

src/generator/templates/Cargo.toml.mako

+6-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ clap = "2"
3232
http-body-util = "0.1"
3333
% endif
3434
hyper = "1"
35-
hyper-rustls = { version = "0.27", default-features = false }
35+
hyper-rustls = { version = "0.27", default-features = false, features = ["http2", "rustls-native-certs", "native-tokio"] }
3636
hyper-util = "0.1"
3737
mime = "0.3"
3838
serde = { version = "1", features = ["derive"] }
@@ -47,7 +47,7 @@ tokio = { version = "1", features = ["full"] }
4747
% endif
4848
url = "2"
4949
utoipa = { version = "4", optional = true }
50-
yup-oauth2 = { version = "12", optional = true }
50+
yup-oauth2 = { version = "12", default-features = false, optional = true }
5151
5252
google-apis-common = { path = "../../google-apis-common", version = "7" }
5353
% if cargo.get('is_executable'):
@@ -71,7 +71,10 @@ version = "${util.crate_version()}"
7171

7272
% if not cargo.get('is_executable'):
7373
[features]
74-
default = ["yup-oauth2"]
74+
default = ["yup-oauth2", "ring"]
7575
utoipa = ["dep:utoipa"]
7676
yup-oauth2 = ["dep:yup-oauth2", "google-apis-common/yup-oauth2"]
77+
yup-oauth2-service-account = ["yup-oauth2", "yup-oauth2/service-account", "google-apis-common/yup-oauth2-service-account"]
78+
aws-lc-rs = ["yup-oauth2?/aws-lc-rs", "google-apis-common/aws-lc-rs", "hyper-rustls/aws-lc-rs"]
79+
ring = ["yup-oauth2?/ring", "google-apis-common/ring", "hyper-rustls/ring"]
7780
% endif

src/generator/templates/api/lib/lib.mako

+13-2
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,20 @@ let secret: yup_oauth2::ApplicationSecret = Default::default();
263263
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
264264
// retrieve them from storage.
265265
% endif
266-
let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
266+
let connector = hyper_rustls::HttpsConnectorBuilder::new()
267+
.with_native_roots()
268+
.unwrap()
269+
.https_only()
270+
.enable_http2()
271+
.build();
272+
273+
let executor = hyper_util::rt::TokioExecutor::new();
274+
let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
267275
secret,
268276
yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
277+
yup_oauth2::client::CustomHyperClientBuilder::from(
278+
hyper_util::client::legacy::Client::builder(executor).build(connector),
279+
),
269280
).build().await.unwrap();
270281
271282
let client = hyper_util::client::legacy::Client::builder(
@@ -276,7 +287,7 @@ let client = hyper_util::client::legacy::Client::builder(
276287
.with_native_roots()
277288
.unwrap()
278289
.https_or_http()
279-
.enable_http1()
290+
.enable_http2()
280291
.build()
281292
);
282293
let mut hub = ${hub_type}::new(client, auth);\

src/generator/templates/cli/main.rs.mako

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async fn main() {
3939
.with_native_roots()
4040
.unwrap()
4141
.https_or_http()
42-
.enable_http1()
42+
.enable_http2()
4343
.build();
4444

4545
match Engine::new(matches, connector).await {

0 commit comments

Comments
 (0)