From 876ae2e402eae3c4175bf0220ba0d02cda1eee8b Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 20 Jul 2022 13:04:03 +0200 Subject: [PATCH 1/2] Remove unused key from config file The `target/` directory is automatically detected now, so this has become redundant. --- fj.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fj.toml b/fj.toml index d0c069f90..eb26a979f 100644 --- a/fj.toml +++ b/fj.toml @@ -5,7 +5,3 @@ default_path = "models" # The default models that is loaded, if none is specified. If this is a relative # path, it should be relative to `default_path`. default_model = "test" - -# The `target/` directory, where compiled model libraries are located. By -# default, this is expected to be in the model directory. -target_dir = "target" From 05f715369c31d4b2580d543dbae5a50787079f7c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 20 Jul 2022 13:08:09 +0200 Subject: [PATCH 2/2] Remove support for overriding `target/` directory This was added as a workaround, to support Cargo workspaces. We are much smarter now about determining the target directory, so this is no longer necessary. --- crates/fj-app/src/config.rs | 1 - crates/fj-app/src/main.rs | 2 +- crates/fj-host/src/lib.rs | 9 +++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/fj-app/src/config.rs b/crates/fj-app/src/config.rs index 0d6b64069..94d6e8967 100644 --- a/crates/fj-app/src/config.rs +++ b/crates/fj-app/src/config.rs @@ -11,7 +11,6 @@ use serde::Deserialize; pub struct Config { pub default_path: Option, pub default_model: Option, - pub target_dir: Option, } impl Config { diff --git a/crates/fj-app/src/main.rs b/crates/fj-app/src/main.rs index 34c62a675..6982fec48 100644 --- a/crates/fj-app/src/main.rs +++ b/crates/fj-app/src/main.rs @@ -53,7 +53,7 @@ fn main() -> anyhow::Result<()> { })?; path.push(model); - let model = Model::from_path(path.clone(), config.target_dir) + let model = Model::from_path(path.clone()) .with_context(|| format!("Failed to load model: {}", path.display()))?; let parameters = args.parameters.unwrap_or_else(Parameters::empty); diff --git a/crates/fj-host/src/lib.rs b/crates/fj-host/src/lib.rs index 362d635f6..ad644be93 100644 --- a/crates/fj-host/src/lib.rs +++ b/crates/fj-host/src/lib.rs @@ -47,10 +47,7 @@ impl Model { /// Optionally, the target directory where plugin files are compiled to can /// be provided. If it is not provided, the target directory is assumed to /// be located within the model path. - pub fn from_path( - path: PathBuf, - target_dir: Option, - ) -> Result { + pub fn from_path(path: PathBuf) -> Result { let crate_dir = path.canonicalize()?; let metadata = cargo_metadata::MetadataCommand::new() @@ -63,8 +60,8 @@ impl Model { let lib_path = { let name = pkg.name.replace('-', "_"); let file = HostPlatform::lib_file_name(&name); - let target_dir = target_dir - .unwrap_or_else(|| metadata.target_directory.clone().into()); + let target_dir = + metadata.target_directory.clone().into_std_path_buf(); target_dir.join("debug").join(file) };