-
Notifications
You must be signed in to change notification settings - Fork 524
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
ecs-settings-applier: conditional compilation #1008
ecs-settings-applier: conditional compilation #1008
Conversation
74b557b
to
23e9bf7
Compare
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.
Nice find with rustc-cfg! Is it possible to do the conditionalizing at a higher level than the run function, so the whole crate isn't compiled? We know we're not including this binary, so it feels silly to build it, even if it wouldn't do anything when run. (It'd get rid of the warnings too...)
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.
Makes sense.
I was trying to find something like this, too. I was thinking at the workspace level, but I did not find anything that could conditionally leave the crate out of the workspace. |
I couldn't find anything with a quick look, but what if we put all of the code in a module and A couple thoughts around options:
|
I think I like this one better than symlinks. We'll still end up building the crate as empty, but it'll get rid of the warnings at least. |
23e9bf7
to
f386163
Compare
This commit will compile ecs-settings-applier with a no-op body when any variant other than aws-ecs-1 is used. This allows for the top-level `cargo make` targets like `unit-tests` to function properly for all variants.
f386163
to
0366b80
Compare
@tjkirch GitHub doesn't show the diff well, but |
Description of changes:
This commit will compile ecs-settings-applier with a no-op body when any variant other than aws-ecs-1 is used. This allows for the top-level
cargo make
targets likeunit-tests
to function properly for all variants.Testing done:
cargo check
with a variety of differentVARIANT
values provided, ensuring that cargo only rebuilds when the variant changes and builds the appropriate codecargo make unit-tests
with-e BUILDSYS_VARIANT
set to different variants, ensuring that compilation does not fail.Note:
rustc
warns for unused imports, constants, structs, and functions when a variant other thanaws-ecs-1
is used. If we want to reduce the set of warnings, I'd appreciate suggestions on the best way to conditionally define those items (other than sprinkling#[cfg(variant="aws-ecs-1")]
all over the place).Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.