mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 10:04:12 +02:00
group by route
This commit is contained in:
parent
a00565cf65
commit
e982a12df5
18 changed files with 2153 additions and 446 deletions
File diff suppressed because one or more lines are too long
|
|
@ -3,35 +3,44 @@
|
|||
lib,
|
||||
writeTextDir,
|
||||
}: let
|
||||
inherit (builtins) head attrNames concatStringsSep replaceStrings;
|
||||
inherit (builtins) map head attrNames concatStringsSep replaceStrings;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
inherit (lib.lists) flatten last;
|
||||
module_name = name: version: "${name}_${replaceStrings ["."] ["_"] version}";
|
||||
matches_for = name: mapAttrsToList (version: data: ''("${name}", "${version}") => Some(("${data.prefix or ""}", ${module_name name version}::STATEMENTS)),'');
|
||||
imports_for = name: mapAttrsToList (version: _: ''mod ${module_name name version};'');
|
||||
routes_for = name: mapAttrsToList (version: _: "${module_name name version}::ROUTES");
|
||||
matches = flatten (mapAttrsToList matches_for packages);
|
||||
imports = flatten (mapAttrsToList imports_for packages);
|
||||
routes = flatten (mapAttrsToList routes_for packages);
|
||||
min_versions = mapAttrsToList (name: versions: ''("${name}", "${head (attrNames versions)}"),'') packages;
|
||||
max_versions = mapAttrsToList (name: versions: ''("${name}", "${last (attrNames versions)}"),'') packages;
|
||||
code = ''
|
||||
use crate::LoggingStatement;
|
||||
use crate::Route;
|
||||
|
||||
${concatStringsSep "\n" imports}
|
||||
|
||||
pub const MIN_VERSIONS: &[(&str, &str)] = &[
|
||||
${concatStringsSep "\n" min_versions}
|
||||
];
|
||||
${concatStringsSep "\n " min_versions}
|
||||
];
|
||||
|
||||
pub const MAX_VERSIONS: &[(&str, &str)] = &[
|
||||
${concatStringsSep "\n" max_versions}
|
||||
${concatStringsSep "\n " max_versions}
|
||||
];
|
||||
|
||||
pub fn get_statements_for(name: &str, version: &str) -> Option<(&'static str, &'static [LoggingStatement])> {
|
||||
match (name, version) {
|
||||
${concatStringsSep "\n" matches}
|
||||
${concatStringsSep "\n " matches}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn all_routes() -> impl Iterator<Item = &'static Route> {
|
||||
[
|
||||
${concatStringsSep ",\n " routes}
|
||||
].into_iter().flatten()
|
||||
}
|
||||
'';
|
||||
in
|
||||
writeTextDir "mod.rs" code
|
||||
|
|
|
|||
|
|
@ -14,5 +14,8 @@ in
|
|||
|
||||
cargoLock = {
|
||||
lockFile = ../logging-extractor/Cargo.lock;
|
||||
outputHashes = {
|
||||
"nextcloud-route-extractor-0.1.0" = "sha256-k2q33faXDUvqRGutp6ZYFcAGHo4AZBT5EjCz6owXIUA=";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ final: prev: let
|
|||
|
||||
serverPackages = importJSON ./versions.json;
|
||||
appVersions = import ./app-versions prev.lib;
|
||||
# packages = {
|
||||
# server = {"29" = serverPackages."29";};
|
||||
# inherit (appVersions) files_accesscontrol files_antivirus deck;
|
||||
# };
|
||||
# packages = {
|
||||
# server = {"29" = serverPackages."29";};
|
||||
# inherit (appVersions) files_accesscontrol files_antivirus deck;
|
||||
# };
|
||||
packages =
|
||||
{
|
||||
server = serverPackages;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue