tikv/tikv

Generate build info in cargo's build scripts

开放

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

 (3 条评论) (0 个反应) (0 位负责人)Rust (2,189 个派生)batch import
component/builddifficulty/easyhelp wantedstatus/mentor

仓库指标

星标
 (15,922 个星标)
PR 合并指标
 (平均合并 28天 9小时) (30 天内合并 68 个 PR)

描述

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.

贡献者指南