feat(registry,daemon): honour If-None-Match; allow offline deps resolution
This commit is contained in:
1 parent
c6436a8010
commit
fdfab9277b
8 files changed
+140
-19
No files matched your search
+18
-9
@@ -576,7 +576,8 @@ make_resolve_options(const DaemonOptions &options) {
|
||||
|
||||
// Resolves and materializes declared dependencies without building, returning the lock context.
|
||||
std::string deps_project(const DaemonOptions &options, std::string_view profile_name,
|
||||
std::optional<CompilerFamily> compiler_override, std::string_view member) {
|
||||
std::optional<CompilerFamily> compiler_override, std::string_view member,
|
||||
bool offline) {
|
||||
auto effective_result = resolve_member_options(options, member);
|
||||
if (!effective_result) {
|
||||
return error_response(std::format("deps: {}", effective_result.error()));
|
||||
@@ -603,6 +604,7 @@ std::string deps_project(const DaemonOptions &options, std::string_view profile_
|
||||
if (!resolve_options) {
|
||||
return error_response(std::format("deps: {}", resolve_options.error()));
|
||||
}
|
||||
resolve_options->offline = offline;
|
||||
auto resolved = Package::resolve_and_materialize_dependencies(evaluated->context, *merged,
|
||||
*resolve_options);
|
||||
if (!resolved) {
|
||||
@@ -1243,7 +1245,6 @@ std::string_view action_kind_label(Graph::ActionKind kind) noexcept {
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
|
||||
// Reports the bounded compile arguments of one target's compilation units.
|
||||
std::string target_flags_project(const DaemonOptions &options, std::string_view profile_name,
|
||||
std::optional<CompilerFamily> compiler_override,
|
||||
@@ -1262,9 +1263,9 @@ std::string target_flags_project(const DaemonOptions &options, std::string_view
|
||||
if (!graph) {
|
||||
return error_response(graph.error());
|
||||
}
|
||||
if (std::ranges::none_of(
|
||||
graph->targets,
|
||||
[&](const Graph::ResolvedTargetSummary &node) { return node.name == target_name; })) {
|
||||
if (std::ranges::none_of(graph->targets, [&](const Graph::ResolvedTargetSummary &node) {
|
||||
return node.name == target_name;
|
||||
})) {
|
||||
return error_response(std::format("target_flags: unknown target '{}'", target_name));
|
||||
}
|
||||
|
||||
@@ -2351,7 +2352,15 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
|
||||
return {compdb_export_project(options, profile_name, compiler_override, member), false};
|
||||
}
|
||||
if (*name == "deps") {
|
||||
return {deps_project(options, profile_name, compiler_override, member), false};
|
||||
bool offline = false;
|
||||
if (const auto entry = object->find("offline"); entry != object->end()) {
|
||||
const auto *value = std::get_if<bool>(&entry->second.value);
|
||||
if (value == nullptr) {
|
||||
return {error_response("\"offline\" must be a boolean"), false};
|
||||
}
|
||||
offline = *value;
|
||||
}
|
||||
return {deps_project(options, profile_name, compiler_override, member, offline), false};
|
||||
}
|
||||
if (*name == "install") {
|
||||
InstallRequest install_request;
|
||||
@@ -2454,9 +2463,9 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
|
||||
return {error_response("\"target\" must be a bounded non-empty string"), false};
|
||||
}
|
||||
if (*name == "target_info") {
|
||||
return {target_info_project(options, profile_name, compiler_override, *value,
|
||||
member),
|
||||
false};
|
||||
return {
|
||||
target_info_project(options, profile_name, compiler_override, *value, member),
|
||||
false};
|
||||
}
|
||||
std::string file_filter;
|
||||
if (const auto file_entry = object->find("file"); file_entry != object->end()) {
|
||||
|
||||
Reference in new issue
Block a user