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

feat: add detailed version information #1202

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ivan-aksamentov
Copy link
Member

This adds CLI args to display more information about Nextclade version and build environment.

  • --version-detailed (-W) shows single-line detailed information, for example:

    2.14.0 (Debug; Dirty; Commit d532ea3a; Branch v3; Committed on 2023-07-17 17:50:05 +00:00; Built on 2023-07-17 17:59:28 +00:00)
    
  • --version-full (-X) shows even more information in multi-line format, for example:

    Version               2.14.0
    Debug                 true
    Dirty                 true
    Branch                v3
    Tag                   
    Commit                d532ea3a
    Committed on          2023-07-17 17:50:05 +00:00
    Built on              2023-07-17 17:59:28 +00:00
    Build OS              linux-x86_64
    Rust version          rustc 1.70.0 (90c541806 2023-05-31)
    Rust channel          1.70.0-x86_64-unknown-linux-gnu
    
  • --version-json (-Y) shows the same information as --version-full, but in JSON format (suitable for machine processing)

    {
      "version": "2.14.0",
      "is_debug": true,
      "git_is_clean": false,
      "git_branch": "v3",
      "git_tag": "",
      "git_commit": "d532ea3a",
      "git_commit_date": "2023-07-17 17:50:05 +00:00",
      "build_time": "2023-07-17 17:59:28 +00:00",
      "build_os": "linux-x86_64",
      "rust_version": "rustc 1.70.0 (90c541806 2023-05-31)",
      "rust_channel": "1.70.0-x86_64-unknown-linux-gnu"
    }

Notes:

  • "debug" means that the program is compiled without --release flag
  • "dirty" means that there were uncommitted git changes during build

This functionality required adding additional build step (build.rs file).

This adds CLI args to display more information about Nextclade version and build environment.

 - `--version-detailed` (`-W`) shows single-line detailed information, for example:

   ```
   2.14.0 (Debug; Dirty; Commit d532ea3; Branch v3; Committed on 2023-07-17 17:50:05 +00:00; Built on 2023-07-17 17:59:28 +00:00)
   ```

 - `--version-full` (`-X`) shows even more information in multi-line format, for example:
   ```
   Version               2.14.0
   Debug                 true
   Dirty                 true
   Branch                v3
   Tag                   
   Commit                d532ea3
   Committed on          2023-07-17 17:50:05 +00:00
   Built on              2023-07-17 17:59:28 +00:00
   Build OS              linux-x86_64
   Rust version          rustc 1.70.0 (90c541806 2023-05-31)
   Rust channel          1.70.0-x86_64-unknown-linux-gnu
   ```

 - `--version-json` (`-Y`) shows the same information as `--version-full`, but in JSON format (suitable for machine processing)

   ```json
   {
     "version": "2.14.0",
     "is_debug": true,
     "git_is_clean": false,
     "git_branch": "v3",
     "git_tag": "",
     "git_commit": "d532ea3a",
     "git_commit_date": "2023-07-17 17:50:05 +00:00",
     "build_time": "2023-07-17 17:59:28 +00:00",
     "build_os": "linux-x86_64",
     "rust_version": "rustc 1.70.0 (90c541806 2023-05-31)",
     "rust_channel": "1.70.0-x86_64-unknown-linux-gnu"
   }
   ```

Notes:
 - "debug" means that the program is compiled without `--release` flag
 - "dirty" means that there were uncommitted git changes during build
 

This functionality required adding additional build step (`build.rs` file).
@vercel
Copy link

vercel bot commented Jul 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nextclade 🛑 Canceled (Inspect) Jul 17, 2023 6:43pm

@ivan-aksamentov
Copy link
Member Author

This approach using shadow-rs package, which depends on the entire libgit of all things, might be a bit of an overkill though. It does not compile on wasm and even on linxux-musl. So needs some more thoughts.

@corneliusroemer
Copy link
Member

This is rad :) I think it's ok if it doesn't build on wasm and some linux distributions. It's entirely optional and mostly for internal use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants