From a4acae15800d792ab83cbef20a8b97c56ec47cfc Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Wed, 17 Jan 2024 14:15:24 +0100 Subject: [PATCH] restructuring complete --- .gitea/workflows/cargo-publish.yaml | 49 +++++++++++++-------------- .gitea/workflows/cargo.yaml | 12 +++---- Cargo.toml | 4 ++- members/libpt-bintols/src/hedu/mod.rs | 2 +- members/libpt-bintols/src/lib.rs | 1 + members/libpt-math/src/ccc/mod.rs | 2 -- members/libpt-math/src/lib.rs | 1 + src/hedu/mod.rs | 7 +++- src/lib.rs | 2 -- 9 files changed, 42 insertions(+), 38 deletions(-) diff --git a/.gitea/workflows/cargo-publish.yaml b/.gitea/workflows/cargo-publish.yaml index bf28f1f..ee85fd2 100644 --- a/.gitea/workflows/cargo-publish.yaml +++ b/.gitea/workflows/cargo-publish.yaml @@ -4,28 +4,27 @@ on: branches: - master -#jobs: -# format: -# name: cargo CI -# permissions: -# # Give the default GITHUB_TOKEN write permission to commit and push the -# # added or changed files to the repository. -# contents: write -# steps: -# - name: get repo -# uses: actions/checkout@v4 -# - name: install rust -# uses: dtolnay/rust-toolchain@stable -# - name: config custom registry -# run: | -# mkdir -p ~/.cargo/ -# echo -e '[registry] -# cscherr= "cscherr" -# -# [registries.cscherr] -# index = "sparse+https://git.cscherr.de/api/packages/PlexSheep/cargo/" -# ' > ~/.cargo/config.toml -# cat ~/.cargo/config.toml -# - name: publish crates on git.cscherr.de -# run: | -# cargo workspaces publish --registry cscherr +jobs: + format: + name: cargo CI + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write + steps: + - name: get repo + uses: actions/checkout@v4 + - name: install rust + uses: dtolnay/rust-toolchain@stable + - name: config custom registry + run: | + mkdir -p ~/.cargo/ + echo "" > ~/.cargo/config.toml + echo "[registry]" >> ~/.cargo/config.toml + echo 'cscherr = "cscherr"' >> ~/.cargo/config.toml + echo '[registries.cscherr]' >> ~/.cargo/config.toml + echo 'index = "https://git.cscherr.de/PlexSheep/_cargo-index.git"' >> ~/.cargo/config.toml + cat ~/.cargo/config.toml + - name: publish crates on git.cscherr.de + run: | + cargo workspaces publish --registry cscherr diff --git a/.gitea/workflows/cargo.yaml b/.gitea/workflows/cargo.yaml index 8b35209..1e95e1f 100644 --- a/.gitea/workflows/cargo.yaml +++ b/.gitea/workflows/cargo.yaml @@ -1,4 +1,4 @@ -name: Cargo Check, Format, Fix and Test +name: cargo devel CI on: push: branches: @@ -22,11 +22,11 @@ jobs: - name: config custom registry run: | mkdir -p ~/.cargo/ - echo -e '[registry]\n\ - cscherr= "cscherr"\n\ - - [registries.cscherr]\n\ - index = "sparse+https://git.cscherr.de/api/packages/PlexSheep/cargo/"' > ~/.cargo/config.toml + echo "" > ~/.cargo/config.toml + echo "[registry]" >> ~/.cargo/config.toml + echo 'cscherr = "cscherr"' >> ~/.cargo/config.toml + echo '[registries.cscherr]' >> ~/.cargo/config.toml + echo 'index = "https://git.cscherr.de/PlexSheep/_cargo-index.git"' >> ~/.cargo/config.toml cat ~/.cargo/config.toml - name: cargo check run: cargo check --all-features --all-targets diff --git a/Cargo.toml b/Cargo.toml index cea457b..f3347b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,7 +55,7 @@ math = [] log = [] bintols = [] net = [] -bin = ["bintols", "math", "dep:clap", "dep:clap-num", "dep:clap-verbosity-flag"] +bin = ["dep:clap", "dep:clap-num", "dep:clap-verbosity-flag"] [lib] name = "libpt" @@ -68,10 +68,12 @@ crate-type = [ [[bin]] name = "ccc" path = "src/ccc/mod.rs" +required-features = ["bin", "math"] [[bin]] name = "hedu" path = "src/hedu/mod.rs" +required-features = ["bin", "bintols"] [dependencies] diff --git a/members/libpt-bintols/src/hedu/mod.rs b/members/libpt-bintols/src/hedu/mod.rs index aab45f2..686dba8 100644 --- a/members/libpt-bintols/src/hedu/mod.rs +++ b/members/libpt-bintols/src/hedu/mod.rs @@ -6,7 +6,7 @@ //! This crate is currently empty. use anyhow::{bail, Result}; -use libpt_bintols::display::{bytes_to_bin, humanbytes}; +use crate::display::{bytes_to_bin, humanbytes}; use libpt_log::{debug, error, info, trace, warn}; use std::io::{prelude::*, BufReader, Read, SeekFrom}; diff --git a/members/libpt-bintols/src/lib.rs b/members/libpt-bintols/src/lib.rs index ca13f78..36aa2bb 100644 --- a/members/libpt-bintols/src/lib.rs +++ b/members/libpt-bintols/src/lib.rs @@ -25,3 +25,4 @@ pub const YOBI: u128 = 2u128.pow(80); // use libpt_core; pub mod datalayout; pub mod display; +pub mod hedu; diff --git a/members/libpt-math/src/ccc/mod.rs b/members/libpt-math/src/ccc/mod.rs index 3b538a6..84efe1f 100644 --- a/members/libpt-math/src/ccc/mod.rs +++ b/members/libpt-math/src/ccc/mod.rs @@ -19,8 +19,6 @@ #![warn(clippy::pedantic)] //// IMPORTS /////////////////////////////////////////////////////////////////////////////////////// -use libpt_log; -use libpt_math; //// TYPES ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/members/libpt-math/src/lib.rs b/members/libpt-math/src/lib.rs index c93077f..dbafa06 100644 --- a/members/libpt-math/src/lib.rs +++ b/members/libpt-math/src/lib.rs @@ -15,6 +15,7 @@ #![warn(clippy::pedantic)] //// IMPORTS /////////////////////////////////////////////////////////////////////////////////////// +pub mod ccc; //// TYPES ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/hedu/mod.rs b/src/hedu/mod.rs index 91fe487..5010a7b 100644 --- a/src/hedu/mod.rs +++ b/src/hedu/mod.rs @@ -13,7 +13,7 @@ //// IMPORTS /////////////////////////////////////////////////////////////////////////////////////// -use libpt::{hedu::*, log::*}; +use libpt::{log::*, bintols::hedu::*}; use clap::Parser; use clap_verbosity_flag::{InfoLevel, Verbosity}; @@ -88,6 +88,11 @@ pub struct Cli { /// If left empty or set as "-", the program will read from stdin. pub data_source: Option, } +impl Cli { + fn parse() -> Cli { + todo!() + } +} //// IMPLEMENTATION //////////////////////////////////////////////////////////////////////////////// diff --git a/src/lib.rs b/src/lib.rs index 1390701..8899a30 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,8 +12,6 @@ pub use libpt_bintols as bintols; pub use libpt_ccc as ccc; #[cfg(feature = "core")] pub use libpt_core as core; -#[cfg(feature = "hedu")] -pub use libpt_hedu as hedu; #[cfg(feature = "log")] pub use libpt_log as log; #[cfg(feature = "math")]