Skip to content
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

Resolve Mainframer version during build. #195

Merged
merged 1 commit into from Mar 1, 2018

Conversation

artem-zinnatullin
Copy link
Contributor

Copy link

@vanniktech vanniktech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@artem-zinnatullin
Copy link
Contributor Author

@vanniktech appreciate your interest and reviews 😽

@@ -14,7 +14,7 @@ use std::time::Instant;
use time::*;

fn main() {
println!(":: Mainframer v2.1.0\n");
println!(":: Mainframer v{}\n", env!("CARGO_PKG_VERSION"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it even work though? When runtime is packaged as a binary it exports environment variables itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env! is a macro that compiler executes at build time, CARGO_PKG_VERSION is an environment variable provided by cargo to rustc during the build, so as a result we get version inlined into the code and binary

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These native folks will steal your soul eventually, you know. Avoid blood-involved rituals at all costs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, will try

btw Kotlin might get macros support eventually

@artem-zinnatullin artem-zinnatullin merged commit 4f815c8 into development Mar 1, 2018
@artem-zinnatullin artem-zinnatullin deleted the az/no-hardcoded-version branch March 1, 2018 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants