Skip to content

Commit 88f6b34

Browse files
authored
feat: fetch archive, fetch integrity checks, and globbing (#104)
closes #94 closes #95 closes #96
1 parent 3a7ebca commit 88f6b34

File tree

23 files changed

+922
-101
lines changed

23 files changed

+922
-101
lines changed

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ bazel_dep(name = "toolchains_llvm", version = "1.0.0", dev_dependency = True)
3333
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
3434

3535
bazel_dep(name = "xxhash", version = "0.8.2")
36+
bazel_dep(name = "boringssl", version = "0.0.0-20240530-2db0eb3")
3637

3738
git_override(
3839
module_name = "hedron_compile_commands",

ecsact/cli/commands/build/build_recipe.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,33 @@ static auto parse_sources( //
204204
result.emplace_back(entry);
205205
} else if(fetch) {
206206
auto outdir = std::optional<std::string>{};
207+
auto integrity = std::optional<std::string>{};
208+
auto strip_prefix = std::optional<std::string>{};
209+
auto paths = std::optional<std::vector<std::string>>{};
210+
if(src["integrity"]) {
211+
integrity = src["integrity"].as<std::string>();
212+
if(integrity->empty()) {
213+
integrity = {};
214+
}
215+
}
216+
if(src["strip_prefix"]) {
217+
strip_prefix = src["strip_prefix"].as<std::string>();
218+
if(strip_prefix->empty()) {
219+
strip_prefix = {};
220+
}
221+
}
222+
if(src["paths"]) {
223+
paths = src["paths"].as<std::vector<std::string>>();
224+
}
207225
if(src["outdir"]) {
208226
outdir = src["outdir"].as<std::string>();
209227
}
210228
result.emplace_back(source_fetch{
211229
.url = fetch.as<std::string>(),
230+
.integrity = integrity,
231+
.strip_prefix = strip_prefix,
212232
.outdir = outdir,
233+
.paths = paths,
213234
});
214235
} else if(path) {
215236
auto src_path = fs::path{path.as<std::string>()};

ecsact/cli/commands/build/build_recipe.hh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <string>
4+
#include <unordered_map>
45
#include <variant>
56
#include <vector>
67
#include <span>
@@ -43,8 +44,11 @@ public:
4344
};
4445

4546
struct source_fetch {
46-
std::string url;
47-
std::optional<std::string> outdir;
47+
std::string url;
48+
std::optional<std::string> integrity;
49+
std::optional<std::string> strip_prefix;
50+
std::optional<std::string> outdir;
51+
std::optional<std::vector<std::string>> paths;
4852
};
4953

5054
struct source_codegen {

ecsact/cli/commands/build/recipe/BUILD.bazel

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ cc_library(
1616
],
1717
)
1818

19+
cc_library(
20+
name = "integrity",
21+
copts = copts,
22+
srcs = ["integrity.cc"],
23+
hdrs = ["integrity.hh"],
24+
deps = [
25+
"@boringssl//:crypto",
26+
],
27+
)
28+
1929
cc_library(
2030
name = "cook",
2131
copts = copts,
@@ -32,8 +42,12 @@ cc_library(
3242
"//conditions:default": [],
3343
}),
3444
deps = [
45+
":integrity",
3546
"//ecsact/cli:report",
3647
"//ecsact/cli/detail:argv0",
48+
"//ecsact/cli/detail:download",
49+
"//ecsact/cli/detail:glob",
50+
"//ecsact/cli/detail:archive",
3751
"//ecsact/cli/commands/build:build_recipe",
3852
"//ecsact/cli/commands/build:cc_compiler_config",
3953
"//ecsact/cli/commands/build:cc_defines_gen",

0 commit comments

Comments
 (0)