new_export #82

Merged
Dandaedre merged 7 commits from new_export into main 2026-07-10 23:00:12 +02:00
13 changed files with 119 additions and 149 deletions

View File

@ -40,6 +40,7 @@ make = {path = "./crates/make"}
fast_class = {path = "./crates/fast_class"}
formatter = {path = "./crates/formatter"}
weaponry = {path = "./crates/weaponry"}
more_fields = {path = "./crates/more_fields"}
anyhow = "1.0.103"
toml = "1.1.2"
@ -54,4 +55,3 @@ glob = "0.3.3"
tokio = { version = "1.52.3", features = ["full"] }
dynfmt = { version = "0.1.5", features = ["curly"] }
pretty_assertions = "^1.4"

69
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,69 @@
// Don't forget to add http://192.168.1.37:8080/gitea-webhook/post as a gitea webhook
pipeline {
agent { label 'rust_no_docker' }
/* ===============
BEGIN USER CONFIG
================== */
environment {
DEPLOY_DIR = "/mnt/books/rust_doc/efo/" // Important, all books are in /mnt/book
MDBOOK_BUILD_DIR = "target/doc/"
}
stages {
stage('Checkout') {
steps {
checkout scm // Checkout intead of full clone
}
}
stage('Update') {
steps {
sh "rustup update"
// sh "rustup show"
}
}
/* ===============
END USER CONFIG
================== */
stage('Build Book') {
steps {
script {
if (env.BRANCH_NAME == 'origin/review' || env.BRANCH_NAME == 'review' || env.BRANCH_NAME == 'origin/dev-ci' || env.BRANCH_NAME == 'dev-ci') {
sh 'cargo test'
// sh 'cargo doc'
// sh 'echo "Deploying to ${DEPLOY_DIR}"'
// sh 'mkdir -p ${DEPLOY_DIR}'
// sh 'rsync -a --delete ${MDBOOK_BUILD_DIR}/ ${DEPLOY_DIR}'
} else if (env.BRANCH_NAME == 'origin/master' || env.BRANCH_NAME == 'master') {
sh 'cargo test'
// sh 'cargo doc'
// sh 'echo "Deploying to ${DEPLOY_DIR}"'
// sh 'mkdir -p ${DEPLOY_DIR}'
// sh 'rsync -a --delete ${MDBOOK_BUILD_DIR}/ ${DEPLOY_DIR}'
} else {
echo "Unknown branch: ${env.BRANCH_NAME} - skipping build."
}
}
}
}
}
post {
success {
publishChecks conclusion: 'SUCCESS', name: 'Build Successful', summary: 'The build was successful', text: 'The build was sucessful', title: 'Build Successful'
echo '✅ Build Deployed!'
}
failure {
publishChecks conclusion: 'FAILURE', name: 'Build Failed', summary: 'The build failed', text: 'The build was a failure', title: 'Build failed'
echo '❌Build Failed to Deploy'
}
unstable{
publishChecks conclusion: 'ACTION_REQUIRED', name: 'Build Unstable', summary: 'Unstable build', text: 'Unstable build', title: 'Build Unstable'
}
}
}

View File

@ -5,12 +5,10 @@
use clap::{Args, Parser, Subcommand};
use config::{
analysis::AnalysisConfig,
fast_tables::FastTableConfig,
formatter::FormatterConfig,
graph::GraphConfig,
make::{
MakeTargets, VerboseLevel, HELP_BLOCK_SELECTION, HELP_BUILD_TARGET_LIST,
HELP_VERBOSITY_LEVEL,
},
make::{MakeTargets, VerboseLevel, HELP_BLOCK_SELECTION},
statsolver::StatConfig,
tablegen::{Craft, TableArgs},
};
@ -48,6 +46,8 @@ pub enum Commands {
Format(FormatterConfig),
/// Generate analysis data
Analysis(AnalysisConfig),
/// Better Generation
BetterGen(FastTableConfig),
}
#[derive(Debug, Args)]
@ -99,18 +99,17 @@ pub struct Datagen {
// The make structs
#[derive(Args, Debug, Clone)]
// #[command(after_)]
/// The configuration struct for the PdfMaker
pub struct MakeConfig {
/// The filename to compile
pub filename: String,
/// Special target
#[arg(short, long, help = format!("Build with a special target. [{}]", HELP_BUILD_TARGET_LIST.as_str()))]
#[arg(short, long)]
pub target: Option<MakeTargets>,
/// The verbosity level
#[arg(short, long, default_value = "warning", help = format!("The verbosity level. [{}]",HELP_VERBOSITY_LEVEL.as_str()))]
#[arg(short, long, default_value = "warning")]
pub verbosity: VerboseLevel,
/// The progress bar style

View File

@ -5,5 +5,5 @@ edition = "2024"
[dependencies]
clap = {workspace = true}
phf = {workspace = true}
serde = {workspace = true}
phf = {workspace = true}

View File

@ -2,7 +2,7 @@
// File: config/src/graph.rs
//! The inner config for graph module
//!
use clap::Args;
use clap::{Args, ValueEnum};
use phf::phf_map;
use serde::{Deserialize, Serialize};
use std::{ops::Add, sync::LazyLock};
@ -11,7 +11,6 @@ use std::{ops::Add, sync::LazyLock};
/// The configuration struct for the Graph
pub struct GraphConfig {
/// Special target
#[arg(help = format!("The target to execute [{}]", *HELP_STR_TO_GRAPH))]
pub target: GraphTargetType,
/// Alternative origin
@ -50,7 +49,7 @@ static HELP_STR_TO_GRAPH: LazyLock<String> = LazyLock::new(|| {
targets.join(", ").to_string()
});
#[derive(Debug, Clone)]
#[derive(ValueEnum, Debug, Clone)]
/// All target type
pub enum GraphTargetType {
/// Load graph data from the classes
@ -62,6 +61,7 @@ pub enum GraphTargetType {
/// Initialize the connfig
Init,
}
impl From<&str> for GraphTargetType {
fn from(value: &str) -> Self {
if let Some(target) = STR_TO_GRAPH_TARGET_TYPE.get(&value.to_lowercase()).cloned() {

View File

@ -2,28 +2,9 @@
// File: config/src/make.rs
//! Makepdf generation structs
use phf::phf_map;
use clap::ValueEnum;
use std::{collections::HashMap, fmt::Debug, sync::LazyLock};
/// Convert str to verbosity level
static STR_TO_VERBOSITY: phf::Map<&'static str, VerboseLevel> = phf_map! {
"misc" =>VerboseLevel::Misc,
"box" => VerboseLevel::Box,
"context" => VerboseLevel::Context,
"info" => VerboseLevel::Info,
"warning" => VerboseLevel::Warning,
"error" => VerboseLevel::Error,
"critical" => VerboseLevel::Critical,
};
/// Convert str to build target
static STR_TO_BUILD_TARGET: phf::Map<&'static str, MakeTargets> = phf_map! {
"all" => MakeTargets::All,
"list" => MakeTargets::List,
"glossaries" => MakeTargets::Glossaries,
"clean" => MakeTargets::Clean,
};
/// List all blocktype
pub static HELP_BLOCK_SELECTION: LazyLock<String> = LazyLock::new(|| {
let mut targets = BLOCK_PROGRESSION
@ -34,27 +15,8 @@ pub static HELP_BLOCK_SELECTION: LazyLock<String> = LazyLock::new(|| {
targets.join(", ").to_string()
});
/// List all targets
pub static HELP_VERBOSITY_LEVEL: LazyLock<String> = LazyLock::new(|| {
let mut targets = STR_TO_VERBOSITY
.values()
.map(|v| format!("{:?}", v).to_lowercase())
.collect::<Vec<String>>();
targets.sort();
targets.join(", ").to_string()
});
/// List all targets
pub static HELP_BUILD_TARGET_LIST: LazyLock<String> = LazyLock::new(|| {
let targets = STR_TO_BUILD_TARGET
.values()
.map(|v| format!("{:?}", v).to_lowercase())
.collect::<Vec<String>>();
targets.join(", ").to_string()
});
/// The verbosity level
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
#[derive(ValueEnum, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum VerboseLevel {
/// Shouldn't be printed no matter what
None,
@ -70,23 +32,11 @@ pub enum VerboseLevel {
Warning,
/// Errors encountered requiring user input
Error,
/// Uncatachable errors
/// Uncatchable errors
Critical,
/// Literrally uncatchable things
Uncatchable,
}
impl From<&str> for VerboseLevel {
fn from(value: &str) -> Self {
if let Some(target) = STR_TO_VERBOSITY.get(&value.to_lowercase()).cloned() {
target
} else {
panic!(
"Invalid debug level {}. The debug level available are (from highest verbosity to lowest): [{:?}]",
value, HELP_VERBOSITY_LEVEL
)
}
}
}
/// All progress bar styles
pub static BLOCK_PROGRESSION: LazyLock<HashMap<String, String>> = LazyLock::new(|| {
@ -104,27 +54,9 @@ pub static BLOCK_PROGRESSION: LazyLock<HashMap<String, String>> = LazyLock::new(
m.insert("neo".to_string(), "▰═".to_string());
m
});
// Spinners
// ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▇ ▆ ▅ ▄ ▃ ▁
// ▉▊▋▌▍▎▏▎▍▌▋▊▉
// ▖ ▘ ▝ ▗
// ┤ ┘ ┴ └ ├ ┌ ┬ ┐
// ◢ ◣ ◤ ◥
// ◡◡ ⊙⊙ ◠◠
// ⣾⣽⣻⢿⡿⣟⣯⣷ ⠁⠂⠄⡀⢀⠠⠐⠈
// .tick_strings(&[
// "▹▹▹▹▹",
// "▸▹▹▹▹",
// "▹▸▹▹▹",
// "▹▹▸▹▹",
// "▹▹▹▸▹",
// "▹▹▹▹▸",
// "▪▪▪▪▪",
// ]),
//
/// List of all alternative targets
#[derive(Debug, Clone)]
#[derive(ValueEnum, Debug, Clone)]
pub enum MakeTargets {
/// Make all targets
All,
@ -135,16 +67,3 @@ pub enum MakeTargets {
/// Make the working directory clean
Clean,
}
impl From<&str> for MakeTargets {
fn from(value: &str) -> Self {
if let Some(target) = STR_TO_BUILD_TARGET.get(&value.to_lowercase()).cloned() {
target
} else {
panic!(
"Invalid build target {}. The build target available are [{:?}]",
value, HELP_BUILD_TARGET_LIST
)
}
}
}

View File

@ -2,13 +2,11 @@
// File: config/src/tablegen.rs
//! Table generation structs
use clap::Args;
use phf::phf_map;
use clap::{Args, ValueEnum};
use serde::Deserialize;
use std::sync::LazyLock;
/// An enumeration representing different target types.
#[derive(Debug, Clone)]
#[derive(ValueEnum, Debug, Clone)]
pub enum TableGenerationTarget {
/// Processes all classes
Classes,
@ -20,36 +18,6 @@ pub enum TableGenerationTarget {
All,
}
impl From<&str> for TableGenerationTarget {
fn from(value: &str) -> Self {
if let Some(target) = STR_TO_TARGET.get(value).cloned() {
target
} else {
panic!(
"Only the following target can be used: {}",
*HELP_STR_TO_TARGET_TABLES
)
}
}
}
/// A mapping of string representations to target types.
static STR_TO_TARGET: phf::Map<&'static str, TableGenerationTarget> = phf_map! {
"classes" => TableGenerationTarget::Classes,
"craft" => TableGenerationTarget::Craft,
"files" => TableGenerationTarget::Files,
"all" => TableGenerationTarget::All,
};
/// A help of all the table targets to be built
static HELP_STR_TO_TARGET_TABLES: LazyLock<String> = LazyLock::new(|| {
let mut targets = STR_TO_TARGET
.keys()
.map(|v| v.to_string())
.collect::<Vec<String>>();
targets.sort();
targets.join(", ").to_string()
});
/// Configuration options for processing TSV files and generating LaTeX tables.
#[derive(Debug, Args)]
pub struct TableArgs {
@ -58,8 +26,6 @@ pub struct TableArgs {
pub export: bool,
/// The kind of tables to operate on: classes, craft or files followed by a list of files
// #[arg(help = format!("The kind of tables to operate on : {}", "TODO: FIX"))]
#[arg(help = format!("The kind of tables to operate on : {}", *HELP_STR_TO_TARGET_TABLES))]
pub kind: TableGenerationTarget,
/// A vector of strings representing the names of TSV files to process.
pub filenames: Vec<String>,

View File

@ -23,6 +23,9 @@
//! The module is free of external dependencies except for `facet`, which provides
//! the procedural macro used for deriving serialisation support.
use anyhow::Result;
use cli_parser::Config;
use config::fast_tables::FastTableConfig;
use facet::Facet;
/// Represents a playable class in the game.
@ -124,9 +127,10 @@ pub trait Graphable {
fn to_graph(&self) -> String;
}
/// r[bulk.export]
pub fn add(left: u64, right: u64) -> u64 {
left + right
pub fn make_better_gen(args: &FastTableConfig, config: &Config) -> Result<()> {
let _ = args;
let _ = config;
todo!()
}
// Subcommands:
// dashboard [classes, alchemy, cooking, forge] --filter name=Archer

View File

@ -12,3 +12,4 @@ serde = {workspace = true}
csv = {workspace = true}
ron = {workspace = true}
glob = {workspace = true}
phf = {workspace = true}

View File

@ -291,34 +291,41 @@ impl LineType {
/// Decides all verbose levels, for output
pub(super) fn vlvl(&self) -> VerboseLevel {
match &self {
LineType::PageGen => VerboseLevel::None,
LineType::Empty => VerboseLevel::None,
LineType::LowPackageWarning(_) => VerboseLevel::Box,
LineType::BoxFullness(_) => VerboseLevel::Box,
LineType::Mode => VerboseLevel::Misc,
LineType::Info(_) => VerboseLevel::Misc,
LineType::StartingSequence => VerboseLevel::Misc,
LineType::EndSequence => VerboseLevel::Misc,
LineType::MPSConverter => VerboseLevel::Misc,
LineType::Chapter(_) => VerboseLevel::Context,
LineType::MissingReference(_) => VerboseLevel::Warning,
LineType::PdfTexVersion(_) => VerboseLevel::Misc,
LineType::Context(_) => VerboseLevel::Misc,
LineType::LaTexVersion => VerboseLevel::Misc,
LineType::WriteMode => VerboseLevel::Misc,
LineType::DocumentClass => VerboseLevel::Misc,
LineType::EnteringDocument(_) => VerboseLevel::Info,
LineType::Library(_) => VerboseLevel::Context,
LineType::PackageContext(_) => VerboseLevel::Warning,
LineType::Loading(_) => VerboseLevel::Context,
LineType::Unknown(_) => VerboseLevel::Uncatchable,
LineType::PageGen => VerboseLevel::None,
LineType::Output => VerboseLevel::Misc,
LineType::Log => VerboseLevel::Misc,
LineType::Empty => VerboseLevel::None,
LineType::GeometryResolution => VerboseLevel::Misc,
LineType::GeometryFound => VerboseLevel::Misc,
LineType::Transcript => VerboseLevel::Misc,
LineType::PackageWarning(_) => VerboseLevel::Warning,
LineType::LowPackageWarning(_) => VerboseLevel::Box,
LineType::BoxFullness(_) => VerboseLevel::Box,
LineType::EnteringDocument(_) => VerboseLevel::Info,
LineType::Library(_) => VerboseLevel::Context,
LineType::Chapter(_) => VerboseLevel::Context,
LineType::Loading(_) => VerboseLevel::Context,
LineType::MissingReference(_) => VerboseLevel::Warning,
LineType::PackageContext(_) => VerboseLevel::Warning,
LineType::Warning(_) => VerboseLevel::Warning,
LineType::PackageWarning(_) => VerboseLevel::Warning,
LineType::Unknown(_) => VerboseLevel::Uncatchable,
LineType::WarningPrs => VerboseLevel::Critical,
LineType::MissingReferencePrs => VerboseLevel::Critical,
LineType::BoxFullnessPrs => VerboseLevel::Critical,

View File

@ -5,6 +5,7 @@
#![warn(missing_docs)]
#![warn(clippy::missing_docs_in_private_items)]
use fast_class::make_better_gen;
// Workspace
use formatter::format_file;
use graphs::make_graphs;
@ -35,6 +36,7 @@ fn main() -> Result<()> {
Commands::Graphs(args) => make_graphs(&args, &config),
Commands::Format(args) => format_file(&args, &config),
Commands::Analysis(args) => Ok(launch_analysis(&args, &config)?), // Not using anyhow but a custom error
Commands::BetterGen(args) => make_better_gen(&args, &config),
}
}

View File

@ -10,7 +10,9 @@ anyhow = {workspace = true}
csv = {workspace = true}
dynfmt = {workspace = true}
glob = {workspace = true}
phf = {workspace = true}
regex = {workspace = true}
regex_static = {workspace = true}
serde = {workspace = true}
clap = {workspace = true}
phf = { version = "0.13.1", features = ["macros"] }

View File

@ -27,6 +27,7 @@ clap = {workspace = true}
fastrand = "2.4.1"
criterion = { version = "0.8" }
logos = "^0.16"
rayon = "1.11.0"
[[bench]]
name = "iter_creation"