8 个版本

0.1.7 2023年2月3日
0.1.6 2022年11月1日
0.1.5 2022年9月29日
0.1.0 2022年2月23日

#20#sbom

每月下载 27 次

Apache-2.0

58KB
1K SLoC

gitbom-rs

"Rust 中 GitBOM 的实验性实现"

注意:此项目仍在开发中,不适合任何非实验性使用

什么是 GitBOM?

引用 GitBOM 网站

GitBOM is a minimalistic scheme for build tools to:
1. Build a compact artifact tree, tracking every source code file incorporated into each build artifact
2. Embed a unique, content addressable reference for that artifact tree, the GitBOM identifier, into the artifact at build time

更多信息,请参阅 网站GitBOM 资源列表

什么是 gitbom-rs?

gitbom-rs 是 Rust 中 gitBOM 的实验性实现。这是一个重要的学习练习,并将为未来 gitBOM 的实现(无论是 Rust 还是其他语言)提供信息

C 绑定

(待办事项 - 改进此流程)

此项目包含 gitoid 包中某些功能的实验性 C API。目的是允许任何可以使用 C 绑定的语言能够使用此 API 来使用此包中的函数。

我们使用 cbindgen 生成公共 C API 的 C 头文件。

$ cargo install --force cbindgen
$ cd gitoid
$ cbindgen --config ../cbindgen.toml --crate gitoid --output gitoid.h

打开 gitoid.h 文件(这是需要改进的主要部分 - 我们不应该需要手动编辑此文件)。

在文件顶部,你应该看到这些行

/**
 * @file
 * @brief "GitBom"
 */


#ifndef gitbom_h
#define gitbom_h

将这些行添加到这些行中 #define NUM_HASH_BYTES 32(不要编辑文件中的任何其他内容!)

/**
 * @file
 * @brief "GitBom"
 */


#ifndef gitbom_h
#define gitbom_h
#define NUM_HASH_BYTES 32

保存并关闭。

C 绑定的测试在 gitoid/test/c/test.c 中。要运行这些测试

$ cargo build
$ cd gitoid
$ make

依赖项

~3MB
~86K SLoC