1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/openeuler-stratovirt

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Это зеркальный репозиторий, синхронизируется ежедневно с исходного репозитория.
В этом репозитории не указан файл с открытой лицензией (LICENSE). При использовании обратитесь к конкретному описанию проекта и его зависимостям в коде.
Клонировать/Скачать
build.rs 1.6 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Keqian Zhu Отправлено 2 лет назад a1544c5
// Copyright (c) 2023 Huawei Technologies Co.,Ltd. All rights reserved.
//
// StratoVirt is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan
// PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.
use std::{env, fs::File, io::Write, path::Path, process::Command};
fn get_git_commit() -> String {
println!("cargo:rerun-if-changed=../.git/HEAD");
println!("cargo:rerun-if-changed=../.git/refs");
println!("cargo:rerun-if-changed=build.rs");
let output = Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output();
match output {
Ok(o) if o.status.success() => {
String::from_utf8(o.stdout).expect("Failed to read git commit id")
}
Ok(o) => {
println!("Get git commit id failed with status: {}", o.status);
String::from("unknown")
}
Err(e) => {
println!("Get git commit id failed: {:?}", e);
String::from("unknown")
}
}
}
fn main() {
let commit = get_git_commit();
// Save commit id to pkg build out directory.
let path = Path::new(&env::var("OUT_DIR").unwrap()).join("GIT_COMMIT");
let mut file = File::create(path).unwrap();
file.write_all(commit.as_bytes()).unwrap();
}

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/openeuler-stratovirt.git
git@gitlife.ru:oschina-mirror/openeuler-stratovirt.git
oschina-mirror
openeuler-stratovirt
openeuler-stratovirt
master