Skip to content

Commit

Permalink
feat: fetch archive, fetch integrity checks, and globbing (#104)
Browse files Browse the repository at this point in the history
closes #94 
closes #95 
closes #96
  • Loading branch information
zaucy authored Jun 1, 2024
1 parent 3a7ebca commit 88f6b34
Show file tree
Hide file tree
Showing 23 changed files with 922 additions and 101 deletions.
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

0 comments on commit 88f6b34

Please sign in to comment.