Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ bazel_dep(name = "toolchains_llvm", version = "1.0.0", dev_dependency = True)
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)

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

git_override(
module_name = "hedron_compile_commands",
Expand Down
21 changes: 21 additions & 0 deletions ecsact/cli/commands/build/build_recipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,33 @@ static auto parse_sources( //
result.emplace_back(entry);
} else if(fetch) {
auto outdir = std::optional<std::string>{};
auto integrity = std::optional<std::string>{};
auto strip_prefix = std::optional<std::string>{};
auto paths = std::optional<std::vector<std::string>>{};
if(src["integrity"]) {
integrity = src["integrity"].as<std::string>();
if(integrity->empty()) {
integrity = {};
}
}
if(src["strip_prefix"]) {
strip_prefix = src["strip_prefix"].as<std::string>();
if(strip_prefix->empty()) {
strip_prefix = {};
}
}
if(src["paths"]) {
paths = src["paths"].as<std::vector<std::string>>();
}
if(src["outdir"]) {
outdir = src["outdir"].as<std::string>();
}
result.emplace_back(source_fetch{
.url = fetch.as<std::string>(),
.integrity = integrity,
.strip_prefix = strip_prefix,
.outdir = outdir,
.paths = paths,
});
} else if(path) {
auto src_path = fs::path{path.as<std::string>()};
Expand Down
8 changes: 6 additions & 2 deletions ecsact/cli/commands/build/build_recipe.hh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <string>
#include <unordered_map>
#include <variant>
#include <vector>
#include <span>
Expand Down Expand Up @@ -43,8 +44,11 @@ public:
};

struct source_fetch {
std::string url;
std::optional<std::string> outdir;
std::string url;
std::optional<std::string> integrity;
std::optional<std::string> strip_prefix;
std::optional<std::string> outdir;
std::optional<std::vector<std::string>> paths;
};

struct source_codegen {
Expand Down
14 changes: 14 additions & 0 deletions ecsact/cli/commands/build/recipe/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ cc_library(
],
)

cc_library(
name = "integrity",
copts = copts,
srcs = ["integrity.cc"],
hdrs = ["integrity.hh"],
deps = [
"@boringssl//:crypto",
],
)

cc_library(
name = "cook",
copts = copts,
Expand All @@ -32,8 +42,12 @@ cc_library(
"//conditions:default": [],
}),
deps = [
":integrity",
"//ecsact/cli:report",
"//ecsact/cli/detail:argv0",
"//ecsact/cli/detail:download",
"//ecsact/cli/detail:glob",
"//ecsact/cli/detail:archive",
"//ecsact/cli/commands/build:build_recipe",
"//ecsact/cli/commands/build:cc_compiler_config",
"//ecsact/cli/commands/build:cc_defines_gen",
Expand Down
Loading