Repository navigation
Dump pkg version & build date & commit hash if run with --version flag - #308
Conversation
|
How about this approach? |
…lag.
- The output format is `rls <version> (<commit hash> <build date>)`
- This embed approach is based on [rustup.rs][rustup]'s code.
- rustup.rs is licensed under same licenses (Apache 2.0/MIT),
so I think there is no license problem.
[rustup]: https://github.com/rust-lang-nursery/rustup.rs/tree/a1c6be19add9c99f8d8868ec384aa76057fe7f70
8be5005 to
123537b
Compare
nrc
left a comment
There was a problem hiding this comment.
Looks good, there's a few comments to address, but all minor.
| } | ||
|
|
||
| fn main() { | ||
| let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); |
There was a problem hiding this comment.
Sadly (and ironically), this means we will no longer be able to build the RLS inside the RLS (#290), but the fix is fairly straightforward
| use std::path::PathBuf; | ||
| use std::process::Command; | ||
|
|
||
| struct Ignore; |
There was a problem hiding this comment.
This seems unnecessary - just use an Option rather than a Result (or Result<String, ()>)
|
|
||
| let arg_count = ::std::env::args().count(); | ||
| if arg_count > 1 { | ||
| let args: Vec<String> = ::std::env::args().collect(); |
There was a problem hiding this comment.
nit: one could do this without collecting by using next on the args iterator. Not really necessary though.
| @@ -0,0 +1,6 @@ | |||
| use getopts::{Options, Matches}; | |||
There was a problem hiding this comment.
I think this file is an orphan and should be removed
| } | ||
|
|
||
| fn version() -> &'static str { | ||
| concat!(env!("CARGO_PKG_VERSION"), include_str!(concat!(env!("OUT_DIR"), "/commit-info.txt"))) |
There was a problem hiding this comment.
Should use Path::join rather than string concatenation of the path so that this works on Windows
There was a problem hiding this comment.
@nrc the argument for include_str! must be a string literal. So we cannot do it without const fn.
There was a problem hiding this comment.
Hmm, we could just open the file and read it rather than using include_str, but this is certainly nicer. I guess we can wait and see if someone breaks
|
@nrc I updated the changesets :) |
|
Thank you for the changes! |
rls <version> (<commit hash> <build date>).so I think there is no license problem.
Related Issues