Skip to content

Commit

Permalink
It can be only one level deep for some reason ...
Browse files Browse the repository at this point in the history
With:
   cargo run --features 'sic_image_engine/imageproc-ops' -- -i resources/1x1_a.png -o target/o.png
It now works though; even on stable! yay!

Seems that that is regarded as a feature:
- rust-lang/cargo#2851 (comment)
  • Loading branch information
foresterre committed May 11, 2020
1 parent a57a620 commit 2360a22
Show file tree
Hide file tree
Showing 17 changed files with 348 additions and 68 deletions.
307 changes: 299 additions & 8 deletions Cargo.lock

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ categories = ["multimedia::images", "command-line-utilities"]

[workspace]
members = [
"components/sic_cli",
"components/sic_cli_ops",
"components/sic_core",
"components/sic_image_engine",
Expand All @@ -29,22 +28,26 @@ members = [
]

[dependencies]
sic_cli = { path = "components/sic_cli", version = "0.11" }

anyhow = "1.0"
sic_cli_ops = { path = "components/sic_cli_ops" }
sic_core = { path = "components/sic_core" }
sic_io = { path = "components/sic_io" }
sic_image_engine = { path = "components/sic_image_engine" }
sic_parser = { path = "components/sic_parser"}

anyhow = "1.0.28"
atty = "0.2.14"
clap = "2.32.0"
inflate = "0.4.5"
globwalk = "0.8.0"

[dev-dependencies]
sic_core = { path = "components/sic_core", version = "0.11" }
sic_core = { path = "components/sic_core" }
clap = "2.33.0" # for examples/gen_completions.rs
parameterized = "0.1.1"

[build-dependencies]
flate2 = "1.0.14"

[[bin]]
name = "sic"
path = "src/main.rs"

[features]
output-test-images = []

Expand Down
24 changes: 0 additions & 24 deletions components/sic_cli/Cargo.toml

This file was deleted.

8 changes: 4 additions & 4 deletions components/sic_cli_ops/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ license-file = "../../LICENSE"
repository = "https://github.com/foresterre/sic"

[dependencies]
sic_image_engine = { path = "../../components/sic_image_engine", version = "0.11" }
sic_parser = { path = "../../components/sic_parser", version = "0.11" }
sic_image_engine = { path = "../../components/sic_image_engine" }
sic_parser = { path = "../../components/sic_parser" }

clap = "2.33.0"
strum = "0.18.0"
strum_macros = "0.18.0"
thiserror = "1.0.16"

[dev-dependencies]
sic_cli = { path = "../../components/sic_cli", version = "0.11.0-dev" } # careful! potential circular dependency!
sic_testing = { path = "../../components/sic_testing", version = "0.11" }
sic_cli = { version = "0.11.0-dev" } # careful! potential circular dependency!
sic_testing = { path = "../../components/sic_testing" }
9 changes: 6 additions & 3 deletions components/sic_image_engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ license-file = "../../LICENSE"
repository = "https://github.com/foresterre/sic"

[dependencies]
sic_core = { path = "../sic_core", version = "0.11" }
sic_io = { path = "../sic_io", version = "0.11" }
sic_core = { path = "../sic_core" }
sic_io = { path = "../sic_io" }

strum = "0.18.0"
strum_macros = "0.18.0"
thiserror = "1.0.16"

imageproc = {version = "0.20.0", optional = true }

[dev-dependencies]
sic_testing = { path = "../sic_testing", version = "0.11" }
sic_testing = { path = "../sic_testing" }

[features]
imageproc-ops = ["imageproc"]
output-test-images = []
6 changes: 6 additions & 0 deletions components/sic_image_engine/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ pub struct ImageEngine {

impl ImageEngine {
pub fn new(image: DynamicImage) -> Self {
if cfg!(feature = "imageproc-ops") {
dbg!("yay!");
} else {
dbg!("awww...");
}

Self {
environment: Box::from(Env::default()),
image: Box::from(image),
Expand Down
4 changes: 2 additions & 2 deletions components/sic_io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ license-file = "../../LICENSE"
repository = "https://github.com/foresterre/sic"

[dependencies]
sic_core = { path = "../sic_core", version = "0.11" }
sic_core = { path = "../sic_core"}

thiserror = "1.0.16"

[dev-dependencies]
sic_testing = { path = "../sic_testing", version = "0.11" }
sic_testing = { path = "../sic_testing" }
6 changes: 3 additions & 3 deletions components/sic_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ license-file = "../../LICENSE"
repository = "https://github.com/foresterre/sic"

[dependencies]
sic_core = { path = "../sic_core", version = "0.11" }
sic_image_engine = { path = "../sic_image_engine", version = "0.11" }
sic_core = { path = "../sic_core"}
sic_image_engine = { path = "../sic_image_engine" }

pest = "2.1.2"
pest_derive = "2.0.1"
thiserror = "1.0.16"

[dev-dependencies]
sic_testing = { path = "../sic_testing", version = "0.11" }
sic_testing = { path = "../sic_testing" }
parameterized = "0.1.1"
2 changes: 1 addition & 1 deletion components/sic_testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ license-file = "../../LICENSE"
repository = "https://github.com/foresterre/sic"

[dependencies]
sic_core = { path = "../sic_core", version = "0.11" }
sic_core = { path = "../sic_core" }
parameterized = "0.1.1"
2 changes: 1 addition & 1 deletion components/sic_cli/src/cli.rs → src/cli/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use sic_cli_ops::build_ast_from_matches;
use sic_cli_ops::operations::{IndexTree, OperationId};
use sic_io::load::FrameIndex;

use crate::config::{
use crate::cli::config::{
validate_jpeg_quality, Config, ConfigBuilder, InputOutputModeType, SelectedLicenses,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fn naive_find_common_dir<P: AsRef<Path>, I: IntoIterator<Item = P> + Clone>(
}

// The intention of this function is to remove a common root path from a given path.
pub(in crate::common_dir) fn unroot(root: &Path, path: &Path) -> PathBuf {
pub(in crate::cli::common_dir) fn unroot(root: &Path, path: &Path) -> PathBuf {
let root_len = root.components().count();

path.components()
Expand Down
4 changes: 2 additions & 2 deletions components/sic_cli/src/config.rs → src/cli/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::cli::arg_names::{ARG_INPUT, ARG_MODE, ARG_OUTPUT};
use crate::common_dir::CommonDir;
use crate::cli::app::arg_names::{ARG_INPUT, ARG_MODE, ARG_OUTPUT};
use crate::cli::common_dir::CommonDir;
use anyhow::bail;
use clap::ArgMatches;
use sic_image_engine::engine::Instr;
Expand Down
2 changes: 1 addition & 1 deletion components/sic_cli/src/license.rs → src/cli/license.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use inflate::inflate_bytes;

use anyhow::anyhow;

use crate::config::SelectedLicenses;
use crate::cli::config::SelectedLicenses;

pub struct LicenseTexts<'a> {
pub(crate) this_software: &'a str,
Expand Down
2 changes: 1 addition & 1 deletion components/sic_cli/src/lib.rs → src/cli/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod cli;
pub mod app;
pub mod common_dir;
pub mod config;
pub mod license;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use sic_io::format::{
use sic_io::load;
use sic_io::save;

use crate::config::{Config, InputOutputMode, InputOutputModeType, PathVariant};
use crate::license::LicenseTexts;
use crate::license::PrintTextFor;
use crate::cli::config::{Config, InputOutputMode, InputOutputModeType, PathVariant};
use crate::cli::license::LicenseTexts;
use crate::cli::license::PrintTextFor;

pub fn run_with_devices<'c>(
in_and_output: InputOutputMode,
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod cli;
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use sic_cli::cli::build_app_config;
use sic_cli::config::InputOutputMode;
use sic_cli::license::LicenseTexts;
use sic_cli::pipeline::{run_display_licenses, run_with_devices};
use sic::cli::app::build_app_config;
use sic::cli::config::InputOutputMode;
use sic::cli::license::LicenseTexts;
use sic::cli::pipeline::{run_display_licenses, run_with_devices};

const LICENSE_SELF: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/LICENSE",));
const LICENSE_DEPS: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/compressed_dep_licenses"));
Expand All @@ -12,7 +12,7 @@ const HELP_OPERATIONS_AVAILABLE: &str =
const VERSION: &str = env!("CARGO_PKG_VERSION");

fn main() -> anyhow::Result<()> {
let app = sic_cli::cli::cli(VERSION, ABOUT, HELP_OPERATIONS_AVAILABLE);
let app = sic::cli::app::cli(VERSION, ABOUT, HELP_OPERATIONS_AVAILABLE);
let matches = app.get_matches();

let license_display = matches.is_present("license") || matches.is_present("dep_licenses");
Expand Down

0 comments on commit 2360a22

Please sign in to comment.