Skip to content

Commit

Permalink
Remove support for overriding target/ directory
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hannobraun committed Jul 20, 2022
1 parent 876ae2e commit 05f7153
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion crates/fj-app/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use serde::Deserialize;
pub struct Config {
pub default_path: Option<PathBuf>,
pub default_model: Option<PathBuf>,
pub target_dir: Option<PathBuf>,
}

impl Config {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
9 changes: 3 additions & 6 deletions crates/fj-host/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PathBuf>,
) -> Result<Self, Error> {
pub fn from_path(path: PathBuf) -> Result<Self, Error> {
let crate_dir = path.canonicalize()?;

let metadata = cargo_metadata::MetadataCommand::new()
Expand All @@ -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)
};

Expand Down

0 comments on commit 05f7153

Please sign in to comment.