-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring and adding aws_sdk_unstable
to RUSTFLAG on one of the kotlin test
#2804
base: main
Are you sure you want to change the base?
Conversation
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt
Outdated
Show resolved
Hide resolved
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt
Outdated
Show resolved
Hide resolved
…en/core/testutil/Rust.kt Co-authored-by: Zelda Hessler <zelda.hessler@pm.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll lose something by making all tests run with --cfg aws_sdk_unstable
. Specifically, we won't be able to unit test without that enabled anymore.
Rather than apply it to everything, we should make it possible to add additional compiler flags when calling compileAndTest
, and then update some key/relevant unit tests to test it both ways.
Ok, I made the unstable features optional. Features are enabled by default, but it can be turned off by passing |
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt
Outdated
Show resolved
Hide resolved
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt
Outdated
Show resolved
Hide resolved
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt
Outdated
Show resolved
Hide resolved
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt
Outdated
Show resolved
Hide resolved
…en/core/testutil/Rust.kt Co-authored-by: John DiSanti <johndisanti@gmail.com>
…en/core/testutil/Rust.kt Co-authored-by: John DiSanti <johndisanti@gmail.com>
I think it's ready. |
private const val allFeature = "--all-features" | ||
|
||
fun cargoTest(enableUnstable: Boolean): String { | ||
return func("cargo test", allFeature, enableUnstable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this isn't quite doing what is expected by the enableUnstable
flag since it adds --all-features
rather than the individual features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since only features that can be enabled are protected behind feature gate, I thought it was accurate. I changed the name to enableAllFeatures
I also added a function that accepts array of string as an argument; In this case, you can specified individual features.
e.g.
// enable features specified in the array
// e.g.
// ```kotlin
// cargoCheck(["serde-serialize", "serde-deserialize"])
// // cargo check --features serde-serialize serde-deserialize
// ```
fun cargoCheck(featuresToEnable?: Array<String>): String {
return func("cargo check", allFeature, enableAllFeatures)
}
30e6db0
to
7d80faf
Compare
So i got an error:
Is this something to do with the connection? |
2694ec0
to
2647de9
Compare
Let's run the test again. |
It seems like I'm not the only one running into https://github.com/awslabs/smithy-rs/actions/runs/5476687598/jobs/9975777528?pr=2829
|
#2804 (comment) It's fixed. |
} catch (e: Exception) { | ||
// cargo fmt errors are useless, ignore | ||
} | ||
|
||
|
||
// Clean `RUSTFLAGS` because in CI we pass in `--deny warnings` and | ||
// we still generate test code with warnings. | ||
// TODO(https://github.com/smithy-lang/smithy-rs/issues/3194) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove this comment?
I added a function that create a map which cleans up rustflag as well.
…degen/core/testutil/Rust.kt
all fixed. |
Motivation and Context
This is a sub-PR of #2615
It adds
aws_sdk_unstable
flag to one of the kotlin test.Description
--cfg aws_sdk_unstable
tocodegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt
Testing
NA
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.