Skip to content

Commit b93f95b

Browse files
author
Ariel Ben-Yehuda
committed
feat: support not enabling aws default features
1 parent 01c683d commit b93f95b

File tree

8 files changed

+46
-29
lines changed

8 files changed

+46
-29
lines changed

.github/actions/rust-build/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ runs:
2020
if [ "${{ inputs.toolchain }}" != stable ]; then
2121
rm -fv Cargo.lock
2222
fi
23-
cargo build --all-features --verbose
23+
cargo build --verbose ${{ inputs.flags }}
2424
- name: Run tests
2525
shell: bash
26-
run: cargo test --all-features --verbose
26+
run: cargo test --verbose ${{ inputs.flags }}

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ jobs:
1010
toolchain:
1111
- "1.85" # Current MSRV due to Cargo MSRV feature
1212
- stable
13+
flags:
14+
- "--all-features"
15+
- "--no-default-features"
16+
- "--no-default-features --features=s3-no-defaults"
17+
- "--no-default-features --features=aws-metadata-no-defaults"
1318
env:
1419
RUST_BACKTRACE: 1
1520
steps:

Cargo.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@ edition = "2021"
99

1010
[dependencies]
1111
async-trait = "0.1"
12+
# not really an AWS crate so no need to disable default features
1213
aws-arn = { version = "0.3", optional = true }
13-
aws-config = { version = "1", optional = true }
14-
aws-sdk-s3 = { version = "1", optional = true }
14+
aws-config = { version = "1", optional = true, default-features = false }
15+
aws-sdk-s3 = { version = "1", optional = true, default-features = false }
1516
chrono = "0.4"
16-
futures = { version = "0.3", default-features = false }
17+
futures = { version = "0.3", default-features = false, features = ["alloc"] }
1718
libloading = "0.8"
18-
reqwest = { version = "0.12", default-features = false, optional = true, features = ["charset", "http2", "rustls-tls"] }
19+
reqwest = { version = "0.12", default-features = false, optional = true, features = ["charset", "http2"] }
1920
serde_json = "1"
2021
serde = { version = "1", features = ["derive"] }
2122
tempfile = "3"
2223
thiserror = "2"
23-
tokio = { version = "1", features = ["macros"], optional = true }
24+
tokio = { version = "1", features = ["fs", "macros", "rt", "sync", "time"] }
2425
tracing = "0.1"
2526
zip = { version = "3", default-features = false, features = ["deflate"] }
2627

@@ -38,5 +39,9 @@ name = 'simple'
3839

3940
[features]
4041
default = ["s3", "aws-metadata"]
41-
s3 = ["dep:aws-config", "dep:aws-sdk-s3", "dep:tokio"]
42-
aws-metadata = ["dep:reqwest", "dep:aws-config", "dep:aws-arn"]
42+
s3 = ["s3-no-defaults", "aws-config/default", "aws-sdk-s3/default"]
43+
# A version of the s3 feature that does not enable AWS default features
44+
s3-no-defaults = ["dep:aws-config", "dep:aws-sdk-s3"]
45+
aws-metadata = ["aws-metadata-no-defaults", "aws-config/default", "reqwest/rustls-tls"]
46+
# A version of the aws-metadata feature that does not enable AWS default features
47+
aws-metadata-no-defaults = ["dep:reqwest", "dep:aws-config", "dep:aws-arn"]

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ emit `tokio.PollCatchV1` events this way:
8989
}
9090
```
9191

92+
### Not enabling the AWS SDK / Reqwest default features
93+
94+
The `aws-metadata-no-defaults` and `s3-no-defaults` feature flags do not enable feature flags for the AWS SDK and `reqwest`.
95+
96+
If you want things to work, you'll need to enable features for these crates to allow at least a TLS provider. This can be used to use a TLS provider other than the default Rustls
97+
9298
## Decoder
9399

94100
The `decoder` directory in the Git repository contains a decoder that can be used to view JFR files, especially with PollCatch information.

src/metadata/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub struct ReportMetadata<'a> {
6060
pub reporting_interval: Duration,
6161
}
6262

63-
#[cfg(feature = "aws-metadata")]
63+
#[cfg(feature = "aws-metadata-no-defaults")]
6464
pub mod aws;
6565

6666
/// [private] dummy metadata to make testing easier

src/profiler.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
use crate::{
77
asprof::{self, AsProfError},
8-
metadata::{aws::AwsProfilerMetadataError, AgentMetadata, ReportMetadata},
8+
metadata::{AgentMetadata, ReportMetadata},
99
reporter::Reporter,
1010
};
1111
use std::{
@@ -311,7 +311,8 @@ enum TickError {
311311
#[error(transparent)]
312312
AsProf(#[from] AsProfError),
313313
#[error(transparent)]
314-
Metadata(#[from] AwsProfilerMetadataError),
314+
#[cfg(feature = "aws-metadata-no-defaults")]
315+
Metadata(#[from] crate::metadata::aws::AwsProfilerMetadataError),
315316
#[error("reporter: {0}")]
316317
Reporter(Box<dyn std::error::Error + Send>),
317318
#[error("broken clock: {0}")]

src/reporter/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::metadata::ReportMetadata;
1616

1717
pub mod local;
1818
pub mod multi;
19-
#[cfg(feature = "s3")]
19+
#[cfg(feature = "s3-no-defaults")]
2020
pub mod s3;
2121

2222
/// Abstraction around reporting profiler data.

0 commit comments

Comments
 (0)