From 32bd8739bbec34bfbda4e618ace1beb424e8dbb8 Mon Sep 17 00:00:00 2001 From: Jacek Czaja Date: Thu, 9 Nov 2023 16:11:46 +0100 Subject: [PATCH 1/2] - Features added (so no GUID version exists) --- .github/workflows/building.yaml | 23 ++++++++++++++++++++++- Cargo.toml | 6 +++++- src/gui.rs | 1 + src/main.rs | 11 ++++++++--- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.github/workflows/building.yaml b/.github/workflows/building.yaml index 534c04f..4e361eb 100644 --- a/.github/workflows/building.yaml +++ b/.github/workflows/building.yaml @@ -39,7 +39,7 @@ jobs: path: etradeTaxReturnHelper build_and_test: - name: etradeTaxReturnHelper building + name: etradeTaxReturnHelper GUI building runs-on: ubuntu-latest steps: - name: Install system dependencies @@ -61,3 +61,24 @@ jobs: run: | cargo test + build_and_test_no_gui: + name: etradeTaxReturnHelper building + runs-on: ubuntu-latest + steps: + - name: Install system dependencies + run: | + sudo apt-get update + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Cargo build + env: + LIBRARY_PATH: ./ + run: | + cargo build --no-default-features --release + - name: Cargo test + env: + LIBRARY_PATH: ./ + run: | + cargo test diff --git a/Cargo.toml b/Cargo.toml index b70a112..b4551e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,10 @@ repository = "https://github.com/jczaja/e-trade-tax-return-pl-helper" homepage = "https://github.com/jczaja/e-trade-tax-return-pl-helper" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +default = ["gui"] +gui = ["fltk"] + [dependencies] pdf = "0.7.2" chrono = "0.4" @@ -21,4 +25,4 @@ clap = "~2.27.0" regex = "1.3.3" calamine = "0.22.1" wild = "2.2.0" -fltk = {version = "=1.3.24", features = ["fltk-bundled"]} +fltk = {version = "=1.3.24", features = ["fltk-bundled"], optional = true} diff --git a/src/gui.rs b/src/gui.rs index 8ce3d99..8ce0574 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "gui")] pub mod gui { pub use crate::logging::ResultExt; diff --git a/src/main.rs b/src/main.rs index a2f8d42..4082c24 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,10 +2,12 @@ use clap::{App, AppSettings, Arg}; use std::env; mod de; -mod gui; mod logging; mod pl; mod us; + +mod gui; + use etradeTaxReturnHelper::run_taxation; use logging::ResultExt; @@ -40,8 +42,11 @@ fn main() { // If there is no arguments then start GUI let args: Vec = env::args().collect(); if args.len() <= 1 { - gui::gui::run_gui(); - return; + #[cfg(feature = "gui")] + { + gui::gui::run_gui(); + return; + } } let myapp = App::new("etradeTaxHelper ".to_string() + VERSION) From ac0f263a270dcd802230935731de59289686855c Mon Sep 17 00:00:00 2001 From: Jacek Czaja Date: Thu, 9 Nov 2023 16:20:54 +0100 Subject: [PATCH 2/2] - Fix to workflow file after features introductions --- .github/workflows/building.yaml | 4 ++-- src/main.rs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/building.yaml b/.github/workflows/building.yaml index 4e361eb..e197659 100644 --- a/.github/workflows/building.yaml +++ b/.github/workflows/building.yaml @@ -76,9 +76,9 @@ jobs: env: LIBRARY_PATH: ./ run: | - cargo build --no-default-features --release + cargo build --release --no-default-features - name: Cargo test env: LIBRARY_PATH: ./ run: | - cargo test + cargo test --no-default-features diff --git a/src/main.rs b/src/main.rs index 4082c24..7577195 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,6 @@ use etradeTaxReturnHelper::run_taxation; use logging::ResultExt; // TODO: GUI : Error messages section (Redirecting to GUI the errors) -// TODO: Make GUI optional e.g. not needed for Linux if not available // TODO: GUI : choosing residency // TODO: Drag&Drop to work on MultiBrowser field