diff --git a/.yarn/versions/41ec5248.yml b/.yarn/versions/41ec5248.yml new file mode 100644 index 00000000000..1f2a5d9c201 --- /dev/null +++ b/.yarn/versions/41ec5248.yml @@ -0,0 +1,9 @@ +releases: + "@moonrepo/cli": patch + "@moonrepo/core-linux-arm64-gnu": patch + "@moonrepo/core-linux-arm64-musl": patch + "@moonrepo/core-linux-x64-gnu": patch + "@moonrepo/core-linux-x64-musl": patch + "@moonrepo/core-macos-arm64": patch + "@moonrepo/core-macos-x64": patch + "@moonrepo/core-windows-x64-msvc": patch diff --git a/crates/cli/src/commands/check.rs b/crates/cli/src/commands/check.rs index 72ad1152600..e2f0bade75c 100644 --- a/crates/cli/src/commands/check.rs +++ b/crates/cli/src/commands/check.rs @@ -4,9 +4,9 @@ use clap::Args; use moon::generate_project_graph; use moon_common::Id; use moon_project::Project; +use moon_target::TargetLocator; use moon_workspace::Workspace; use starbase::system; -use std::env; use std::sync::Arc; use tracing::trace; @@ -45,7 +45,7 @@ pub async fn check( } else if args.ids.is_empty() { trace!("Loading from path"); - projects.push(project_graph.get_from_path(env::current_dir().unwrap())?); + projects.push(project_graph.get_from_path(None)?); } else { trace!( "Running for specific projects: {}", @@ -67,7 +67,7 @@ pub async fn check( for project in projects { for task in project.get_tasks()? { if task.is_build_type() || task.is_test_type() { - targets.push(task.target.id.clone()); + targets.push(TargetLocator::Qualified(task.target.clone())); } } } diff --git a/crates/cli/src/commands/generate.rs b/crates/cli/src/commands/generate.rs index 9aa2eccbecf..4745a2f6fcd 100644 --- a/crates/cli/src/commands/generate.rs +++ b/crates/cli/src/commands/generate.rs @@ -11,7 +11,6 @@ use moon_workspace::Workspace; use rustc_hash::FxHashMap; use starbase::{system, AppResult}; use starbase_styles::color; -use std::env; use std::fmt::Display; use tracing::{debug, warn}; @@ -314,7 +313,6 @@ fn gather_variables( pub async fn generate(args: ArgsRef, workspace: ResourceRef) { let generator = CodeGenerator::new(&workspace.root, &workspace.config.generator); let theme = create_theme(); - let cwd = env::current_dir().into_diagnostic()?; // This is a special case for creating a new template with the generator itself! if args.template { @@ -364,7 +362,7 @@ pub async fn generate(args: ArgsRef, workspace: ResourceRef, workspace: ResourceRef, workspace: ResourceRef, + target: Option, #[arg(long, help = "Print the graph in DOT format")] dot: bool, @@ -24,11 +24,10 @@ pub async fn dep_graph(args: ArgsRef, workspace: ResourceMut) { }; let theme = create_theme(); - let working_dir = env::current_dir().expect("Failed to determine working directory."); + let working_dir = env::current_dir().map_err(|_| WorkspaceError::MissingWorkingDir)?; let dest_path = PathBuf::from(&args.dest); let dest_dir = if args.dest == "." { working_dir diff --git a/crates/cli/src/commands/run.rs b/crates/cli/src/commands/run.rs index 50ff5803bfe..17e344a8429 100644 --- a/crates/cli/src/commands/run.rs +++ b/crates/cli/src/commands/run.rs @@ -9,6 +9,7 @@ use moon_action_context::{ActionContext, ProfileType}; use moon_action_pipeline::Pipeline; use moon_common::is_test_env; use moon_project_graph::ProjectGraph; +use moon_target::TargetLocator; use moon_utils::is_ci; use moon_workspace::Workspace; use rustc_hash::FxHashSet; @@ -22,8 +23,8 @@ const HEADING_DEBUGGING: &str = "Debugging"; #[derive(Args, Clone, Debug, Default)] pub struct RunArgs { - #[arg(required = true, help = "List of targets (scope:task) to run")] - pub targets: Vec, + #[arg(required = true, help = "List of targets to run")] + pub targets: Vec, #[arg( long, @@ -103,7 +104,7 @@ pub fn is_local(args: &RunArgs) -> bool { } pub async fn run_target( - target_ids: &[String], + target_locators: &[TargetLocator], args: &RunArgs, concurrency: Option, workspace: &Workspace, @@ -142,8 +143,8 @@ pub async fn run_target( } // Run targets, optionally based on affected files - let primary_targets = dep_builder.run_targets_by_id( - target_ids, + let primary_targets = dep_builder.run_targets_by_locator( + target_locators, if should_run_affected { Some(&touched_files) } else { @@ -152,7 +153,7 @@ pub async fn run_target( )?; if primary_targets.is_empty() { - let targets_list = map_list(target_ids, |id| color::label(id)); + let targets_list = map_list(target_locators, |id| color::label(id)); if should_run_affected { let status_list = if args.status.is_empty() { @@ -192,7 +193,7 @@ pub async fn run_target( // Process all tasks in the graph let context = ActionContext { affected_only: should_run_affected, - initial_targets: FxHashSet::from_iter(target_ids.to_owned()), + initial_targets: FxHashSet::from_iter(target_locators.to_owned()), interactive: args.interactive, passthrough_args: args.passthrough.to_owned(), primary_targets: FxHashSet::from_iter(primary_targets), diff --git a/crates/cli/src/commands/task.rs b/crates/cli/src/commands/task.rs index dd9d9a07e3a..ed5c8d532f0 100644 --- a/crates/cli/src/commands/task.rs +++ b/crates/cli/src/commands/task.rs @@ -2,7 +2,7 @@ use clap::Args; use console::Term; use miette::{miette, IntoDiagnostic}; use moon::build_project_graph; -use moon_target::Target; +use moon_target::{Target, TargetScope}; use moon_terminal::{ExtendedTerm, Label}; use moon_workspace::Workspace; use starbase::system; @@ -19,15 +19,15 @@ pub struct TaskArgs { #[system] pub async fn task(args: ArgsRef, workspace: ResourceMut) { - let Some(project_locator) = args.target.scope_id.clone() else { + let TargetScope::Project(project_locator) = &args.target.scope else { return Err(miette!("A project ID is required.")); }; let mut project_graph_builder = build_project_graph(workspace).await?; - project_graph_builder.load(&project_locator).await?; + project_graph_builder.load(project_locator).await?; let project_graph = project_graph_builder.build().await?; - let project = project_graph.get(&project_locator)?; + let project = project_graph.get(project_locator)?; let task = project.get_task(&args.target.task_id)?; if args.json { diff --git a/crates/cli/tests/dep_graph_test.rs b/crates/cli/tests/dep_graph_test.rs index 97cdd69b439..b4cc902b775 100644 --- a/crates/cli/tests/dep_graph_test.rs +++ b/crates/cli/tests/dep_graph_test.rs @@ -42,6 +42,25 @@ fn focused_by_target() { assert_snapshot!(assert.output()); } +#[test] +fn focused_by_task_in_cwd() { + let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); + + let sandbox = create_sandbox_with_config( + "tasks", + Some(workspace_config), + Some(toolchain_config), + Some(tasks_config), + ); + + let assert = sandbox.run_moon(|cmd| { + cmd.arg("dep-graph").arg("--dot").arg("lint"); + cmd.current_dir(sandbox.path().join("basic")); + }); + + assert_snapshot!(assert.output()); +} + #[test] fn includes_dependencies_when_focused() { let (workspace_config, toolchain_config, tasks_config) = get_tasks_fixture_configs(); diff --git a/crates/cli/tests/snapshots/dep_graph_test__focused_by_task_in_cwd.snap b/crates/cli/tests/snapshots/dep_graph_test__focused_by_task_in_cwd.snap new file mode 100644 index 00000000000..97327f0d549 --- /dev/null +++ b/crates/cli/tests/snapshots/dep_graph_test__focused_by_task_in_cwd.snap @@ -0,0 +1,18 @@ +--- +source: crates/cli/tests/dep_graph_test.rs +expression: assert.output() +--- +digraph { + 0 [ label="SyncWorkspace" style=filled, shape=oval, fillcolor=gray, fontcolor=black] + 1 [ label="SetupNodeTool(18.0.0)" style=filled, shape=oval, fillcolor=gray, fontcolor=black] + 2 [ label="InstallNodeDeps(18.0.0)" style=filled, shape=oval, fillcolor=gray, fontcolor=black] + 3 [ label="SyncNodeProject(basic)" style=filled, shape=oval, fillcolor=gray, fontcolor=black] + 4 [ label="RunTarget(basic:lint)" style=filled, shape=oval, fillcolor=gray, fontcolor=black] + 2 -> 1 [ arrowhead=box, arrowtail=box] + 3 -> 1 [ arrowhead=box, arrowtail=box] + 4 -> 2 [ arrowhead=box, arrowtail=box] + 4 -> 3 [ arrowhead=box, arrowtail=box] +} + + + diff --git a/crates/core/action-context/src/lib.rs b/crates/core/action-context/src/lib.rs index e4f76c2e635..3ae5fd0955a 100644 --- a/crates/core/action-context/src/lib.rs +++ b/crates/core/action-context/src/lib.rs @@ -1,6 +1,6 @@ use clap::ValueEnum; use moon_common::path::WorkspaceRelativePathBuf; -use moon_target::Target; +use moon_target::{Target, TargetLocator}; use rustc_hash::{FxHashMap, FxHashSet}; use serde::{Deserialize, Serialize}; use std::path::PathBuf; @@ -31,7 +31,7 @@ impl TargetState { pub struct ActionContext { pub affected_only: bool, - pub initial_targets: FxHashSet, + pub initial_targets: FxHashSet, pub interactive: bool, @@ -62,8 +62,8 @@ impl ActionContext { } // :task == scope:task - for initial_target in &self.initial_targets { - if target.is_all_task(initial_target) { + for locator in &self.initial_targets { + if target.is_all_task(locator.as_str()) { return true; } } diff --git a/crates/core/action-pipeline/src/processor.rs b/crates/core/action-pipeline/src/processor.rs index 7761ed8113c..4a099f08047 100644 --- a/crates/core/action-pipeline/src/processor.rs +++ b/crates/core/action-pipeline/src/processor.rs @@ -168,7 +168,7 @@ pub async fn process_action( ActionNode::RunTarget(runtime, target) | ActionNode::RunInteractiveTarget(runtime, target) | ActionNode::RunPersistentTarget(runtime, target) => { - let project = local_project_graph.get(target.scope_id.as_ref().unwrap())?; + let project = local_project_graph.get(target.get_project_id().unwrap())?; local_emitter.emit(Event::TargetRunning { target }).await?; diff --git a/crates/core/dep-graph/src/dep_builder.rs b/crates/core/dep-graph/src/dep_builder.rs index 384a2dd072f..fa199c1162e 100644 --- a/crates/core/dep-graph/src/dep_builder.rs +++ b/crates/core/dep-graph/src/dep_builder.rs @@ -7,7 +7,7 @@ use moon_platform::{PlatformManager, Runtime}; use moon_project::Project; use moon_project_graph::ProjectGraph; use moon_query::{build_query, Criteria}; -use moon_target::{Target, TargetError, TargetScope}; +use moon_target::{Target, TargetError, TargetLocator, TargetScope}; use moon_task::Task; use petgraph::graph::NodeIndex; use petgraph::Graph; @@ -386,35 +386,30 @@ impl<'ws> DepGraphBuilder<'ws> { Ok(indexes) } - pub fn run_targets_by_id( + pub fn run_targets_by_locator( &mut self, - target_ids: &[String], + target_locators: &[TargetLocator], touched_files: Option<&TouchedFilePaths>, ) -> miette::Result> { let mut qualified_targets = vec![]; - let mut project_targets = vec![]; - - for target_id in target_ids { - // Target (with possible scope) provided - if target_id.contains(':') { - qualified_targets - .extend(self.run_target(Target::parse(target_id)?, touched_files)?.0); - // Task name provided, find closest project - } else { - project_targets.push(target_id); - } - } + let mut project = None; + + for locator in target_locators { + let result = match locator { + TargetLocator::Qualified(target) => self.run_target(target, touched_files)?, + TargetLocator::TaskFromWorkingDir(task_id) => { + if project.is_none() { + project = Some(self.project_graph.get_from_path(None)?); + } - if !project_targets.is_empty() { - let cwd = std::env::current_dir().unwrap(); - let project = self.project_graph.get_from_path(&cwd)?; + self.run_target( + Target::new(&project.as_ref().unwrap().id, task_id)?, + touched_files, + )? + } + }; - for target_id in project_targets { - qualified_targets.extend( - self.run_target(Target::new(&project.id, target_id)?, touched_files)? - .0, - ); - } + qualified_targets.extend(result.0); } Ok(qualified_targets) diff --git a/crates/core/moon/src/lib.rs b/crates/core/moon/src/lib.rs index d61d95bfa23..133add9662a 100644 --- a/crates/core/moon/src/lib.rs +++ b/crates/core/moon/src/lib.rs @@ -140,6 +140,7 @@ pub async fn create_project_graph_context(workspace: &Workspace) -> ProjectGraph inherited_tasks: &workspace.tasks_config, toolchain_config: &workspace.toolchain_config, vcs: Some(&workspace.vcs), + working_dir: &workspace.working_dir, workspace_config: &workspace.config, workspace_root: &workspace.root, }; diff --git a/crates/core/runner/src/runner.rs b/crates/core/runner/src/runner.rs index 54d60ef92f2..7ed140d6705 100644 --- a/crates/core/runner/src/runner.rs +++ b/crates/core/runner/src/runner.rs @@ -410,7 +410,7 @@ impl<'a> Runner<'a> { } } TargetScope::Project(project_locator) => { - if let Some(owner_id) = &task.target.scope_id { + if let Some(owner_id) = task.target.get_project_id() { if owner_id == project_locator && is_matching_task { return Ok(true); } diff --git a/nextgen/process/src/command_inspector.rs b/nextgen/process/src/command_inspector.rs index 5b16b465da3..dd286ca2c2b 100644 --- a/nextgen/process/src/command_inspector.rs +++ b/nextgen/process/src/command_inspector.rs @@ -184,7 +184,7 @@ impl<'cmd> CommandInspector<'cmd> { let command_line = self.get_command_line(); let workspace_root = env::var("MOON_WORKSPACE_ROOT") .map(PathBuf::from) - .unwrap_or_else(|_| env::current_dir().unwrap()); + .unwrap_or_else(|_| env::current_dir().unwrap_or_default()); if self.command.print_command { println!( diff --git a/nextgen/project-graph/src/project_graph.rs b/nextgen/project-graph/src/project_graph.rs index 35de9d67b84..c06508c90db 100644 --- a/nextgen/project-graph/src/project_graph.rs +++ b/nextgen/project-graph/src/project_graph.rs @@ -50,8 +50,11 @@ pub struct ProjectGraph { /// Cache of query results, mapped by query input to project IDs. query_cache: OnceMap>, + /// The current working directory. + pub working_dir: PathBuf, + /// Workspace root, required for expansion. - workspace_root: PathBuf, + pub workspace_root: PathBuf, } impl ProjectGraph { @@ -62,6 +65,7 @@ impl ProjectGraph { graph, nodes, projects: Arc::new(RwLock::new(FxHashMap::default())), + working_dir: workspace_root.to_owned(), workspace_root: workspace_root.to_owned(), query_cache: OnceMap::new(), check_boundaries: false, @@ -147,8 +151,8 @@ impl ProjectGraph { /// Find and return a project based on the initial path location. /// This will attempt to find the closest matching project source. - pub fn get_from_path>(&self, starting_file: P) -> miette::Result> { - let current_file = starting_file.as_ref(); + pub fn get_from_path(&self, starting_file: Option<&Path>) -> miette::Result> { + let current_file = starting_file.unwrap_or(&self.working_dir); let file = if current_file == self.workspace_root { Path::new(".") diff --git a/nextgen/project-graph/src/project_graph_builder.rs b/nextgen/project-graph/src/project_graph_builder.rs index 855ebcab846..8e02337e838 100644 --- a/nextgen/project-graph/src/project_graph_builder.rs +++ b/nextgen/project-graph/src/project_graph_builder.rs @@ -43,6 +43,7 @@ pub struct ProjectGraphBuilderContext<'app> { pub inherited_tasks: &'app InheritedTasksManager, pub toolchain_config: &'app ToolchainConfig, pub vcs: Option<&'app BoxedVcs>, + pub working_dir: &'app Path, pub workspace_config: &'app WorkspaceConfig, pub workspace_root: &'app Path, } @@ -180,6 +181,8 @@ impl<'app> ProjectGraphBuilder<'app> { let mut graph = ProjectGraph::new(self.graph, nodes, context.workspace_root); + graph.working_dir = context.working_dir.to_owned(); + graph.check_boundaries = !is_test_env() && context.workspace_config.experiments.task_output_boundaries; diff --git a/nextgen/project-graph/tests/project_graph_test.rs b/nextgen/project-graph/tests/project_graph_test.rs index 59c352fc85d..380722c6b97 100644 --- a/nextgen/project-graph/tests/project_graph_test.rs +++ b/nextgen/project-graph/tests/project_graph_test.rs @@ -82,6 +82,7 @@ impl GraphContainer { inherited_tasks: &self.inherited_tasks, toolchain_config: &self.toolchain_config, vcs: self.vcs.as_ref(), + working_dir: &self.workspace_root, workspace_config: &self.workspace_config, workspace_root: &self.workspace_root, } @@ -179,7 +180,7 @@ mod project_graph { assert_eq!( graph - .get_from_path(sandbox.path().join("c/moon.yml")) + .get_from_path(Some(&sandbox.path().join("c/moon.yml"))) .unwrap() .id, "c" @@ -193,7 +194,7 @@ mod project_graph { let graph = generate_project_graph_from_sandbox(sandbox.path()).await; graph - .get_from_path(sandbox.path().join("z/moon.yml")) + .get_from_path(Some(&sandbox.path().join("z/moon.yml"))) .unwrap(); } diff --git a/nextgen/target/src/lib.rs b/nextgen/target/src/lib.rs index 06f9e682681..d8b2e108b06 100644 --- a/nextgen/target/src/lib.rs +++ b/nextgen/target/src/lib.rs @@ -1,7 +1,9 @@ mod target; mod target_error; +mod target_locator; mod target_scope; pub use target::*; pub use target_error::*; +pub use target_locator::*; pub use target_scope::*; diff --git a/nextgen/target/src/target.rs b/nextgen/target/src/target.rs index faaf9acb2fd..63720706016 100644 --- a/nextgen/target/src/target.rs +++ b/nextgen/target/src/target.rs @@ -23,7 +23,6 @@ pub static TARGET_PATTERN: Lazy = Lazy::new(|| { pub struct Target { pub id: String, pub scope: TargetScope, - pub scope_id: Option, pub task_id: Id, } @@ -42,7 +41,6 @@ impl Target { Ok(Target { id: Target::format(&scope, task_id), scope, - scope_id: Some(Id::raw(scope_id)), task_id: Id::new(task_id).map_err(handle_error)?, }) } @@ -56,7 +54,6 @@ impl Target { Ok(Target { id: Target::format(TargetScope::OwnSelf, task_id), scope: TargetScope::OwnSelf, - scope_id: None, task_id: Id::new(task_id) .map_err(|_| TargetError::InvalidFormat(format!("~:{task_id}")))?, }) @@ -83,9 +80,6 @@ impl Target { return Err(TargetError::InvalidFormat(target_id.to_owned()).into()); }; - let handle_error = |_| TargetError::InvalidFormat(target_id.to_owned()); - - let mut scope_id = None; let scope = match matches.name("scope") { Some(value) => match value.as_str() { "" => TargetScope::All, @@ -93,10 +87,8 @@ impl Target { "~" => TargetScope::OwnSelf, id => { if let Some(tag) = id.strip_prefix('#') { - scope_id = Some(Id::new(tag).map_err(handle_error)?); TargetScope::Tag(Id::raw(tag)) } else { - scope_id = Some(Id::new(id).map_err(handle_error)?); TargetScope::Project(Id::raw(id)) } } @@ -104,12 +96,12 @@ impl Target { None => TargetScope::All, }; - let task_id = Id::new(matches.name("task").unwrap().as_str()).map_err(handle_error)?; + let task_id = Id::new(matches.name("task").unwrap().as_str()) + .map_err(|_| TargetError::InvalidFormat(target_id.to_owned()))?; Ok(Target { id: target_id.to_owned(), scope, - scope_id, task_id, }) } @@ -129,6 +121,20 @@ impl Target { false } + + pub fn get_project_id(&self) -> Option<&Id> { + match &self.scope { + TargetScope::Project(id) => Some(id), + _ => None, + } + } + + pub fn get_tag_id(&self) -> Option<&Id> { + match &self.scope { + TargetScope::Tag(id) => Some(id), + _ => None, + } + } } impl Default for Target { @@ -136,7 +142,6 @@ impl Default for Target { Target { id: "~:unknown".into(), scope: TargetScope::OwnSelf, - scope_id: None, task_id: Id::raw("unknown"), } } diff --git a/nextgen/target/src/target_locator.rs b/nextgen/target/src/target_locator.rs new file mode 100644 index 00000000000..ea2b1f84bfb --- /dev/null +++ b/nextgen/target/src/target_locator.rs @@ -0,0 +1,63 @@ +use crate::target::Target; +use moon_common::Id; +use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; +use std::str::FromStr; + +#[derive(Clone, Debug, Eq, Hash, PartialEq)] +pub enum TargetLocator { + Qualified(Target), // scope:task_id + TaskFromWorkingDir(Id), // task_id +} + +impl TargetLocator { + pub fn as_str(&self) -> &str { + self.as_ref() + } +} + +impl AsRef for TargetLocator { + fn as_ref(&self) -> &TargetLocator { + self + } +} + +impl AsRef for TargetLocator { + fn as_ref(&self) -> &str { + match self { + Self::Qualified(target) => target.as_str(), + Self::TaskFromWorkingDir(id) => id.as_str(), + } + } +} + +impl FromStr for TargetLocator { + type Err = miette::Report; + + fn from_str(value: &str) -> Result { + Ok(if value.contains(':') { + TargetLocator::Qualified(Target::parse(value)?) + } else { + TargetLocator::TaskFromWorkingDir(Id::new(value)?) + }) + } +} + +impl<'de> Deserialize<'de> for TargetLocator { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value = String::deserialize(deserializer)?; + + TargetLocator::from_str(&value).map_err(de::Error::custom) + } +} + +impl Serialize for TargetLocator { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_str(self.as_str()) + } +} diff --git a/nextgen/target/tests/target_test.rs b/nextgen/target/tests/target_test.rs index 9cc5f2cef74..91136ac756f 100644 --- a/nextgen/target/tests/target_test.rs +++ b/nextgen/target/tests/target_test.rs @@ -73,7 +73,6 @@ fn parse_ids() { Target { id: String::from("foo:build"), scope: TargetScope::Project(Id::raw("foo")), - scope_id: Some(Id::raw("foo")), task_id: Id::raw("build"), } ); @@ -86,7 +85,6 @@ fn parse_deps_scope() { Target { id: String::from("^:build"), scope: TargetScope::Deps, - scope_id: None, task_id: Id::raw("build"), } ); @@ -111,7 +109,6 @@ fn parse_self_scope() { Target { id: String::from("~:build"), scope: TargetScope::OwnSelf, - scope_id: None, task_id: Id::raw("build"), } ); @@ -124,7 +121,6 @@ fn parse_self_when_no_colon() { Target { id: String::from("~:build"), scope: TargetScope::OwnSelf, - scope_id: None, task_id: Id::raw("build"), } ); @@ -149,7 +145,6 @@ fn parse_all_scopes() { Target { id: String::from(":build"), scope: TargetScope::All, - scope_id: None, task_id: Id::raw("build"), } ); @@ -174,7 +169,6 @@ fn parse_node_package() { Target { id: String::from("@scope/foo:build"), scope: TargetScope::Project(Id::raw("@scope/foo")), - scope_id: Some(Id::raw("@scope/foo")), task_id: Id::raw("build"), } ); @@ -187,7 +181,6 @@ fn parse_slashes() { Target { id: String::from("foo/sub:build/esm"), scope: TargetScope::Project(Id::raw("foo/sub")), - scope_id: Some(Id::raw("foo/sub")), task_id: Id::raw("build/esm"), } ); diff --git a/nextgen/task/src/task.rs b/nextgen/task/src/task.rs index 912fcd2bcb0..4c6fa65120f 100644 --- a/nextgen/task/src/task.rs +++ b/nextgen/task/src/task.rs @@ -99,7 +99,7 @@ impl Task { /// Return a cache directory for this task, relative from the cache root. pub fn get_cache_dir(&self) -> PathBuf { - PathBuf::from(self.target.scope_id.as_ref().unwrap().as_str()).join(self.id.as_str()) + PathBuf::from(self.target.get_project_id().unwrap().as_str()).join(self.id.as_str()) } /// Return true if this task is affected based on touched files. diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 999119b870b..32db7728580 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -10,6 +10,12 @@ - More accurately monitors signals (ctrl+c) and shutdowns. - Tasks can now be configured with a timeout. +## Unreleased + +#### 🚀 Updates + +- Updated `moon dep-graph` to support a task in closest project, similar to `moon run`. + ## 1.14.2 #### 🐞 Fixes