tikv/tikv

Generate build info in cargo's build scripts

Open

#4,051 创建于 2019年1月10日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)Rust (15,922 star) (2,189 fork)batch import
component/builddifficulty/easyhelp wantedstatus/mentor

描述

Feature Request

Is your feature request related to a problem? Please describe: Currently, building a tikv-server needs a Makefile to collect git hash and others, otherwise tikv-server --version shows unknown. This means a proper build needs helps from the outside of cargo.

Describe the feature you'd like:

Instead of Makefile, we can collect these info in cargo's build script.

rustc-env=VAR=VALUE indicates that the specified environment variable will be added to the environment which the compiler is run within. The value can be then retrieved by the env! macro in the compiled crate. This is useful for embedding additional metadata in crate's code, such as the hash of Git HEAD or the unique identifier of a continuous integration server.

https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script

EDIT: we should use rustc-env instead of rustc-cfg.

贡献者指南