Skip to content

Commit

Permalink
fix(core): avoid storing hash details for empty fileset
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Dec 12, 2024
1 parent ecba861 commit cdc9ae7
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions packages/nx/src/native/tasks/hash_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,23 @@ impl HashPlanner {
file_set.starts_with("{projectRoot}/") || file_set.starts_with("!{projectRoot}/")
});

let project_file_set_inputs = project_file_set_inputs(project_name, project_file_sets);
// let workspace_file_set_inputs = workspace_file_set_inputs(workspace_file_sets);
let workspace_file_set_inputs = match workspace_file_sets.is_empty() {
true => vec![],
false => vec![workspace_file_set_inputs(workspace_file_sets)],
let project_file_set_inputs = if project_file_sets.is_empty() {
vec![
HashInstruction::ProjectConfiguration(project_name.to_string()),
HashInstruction::TsConfiguration(project_name.to_string()),
]
} else {
vec![
project_file_set_inputs(project_name, project_file_sets),
HashInstruction::ProjectConfiguration(project_name.to_string()),
HashInstruction::TsConfiguration(project_name.to_string()),
]
};

let workspace_file_set_inputs = if workspace_file_sets.is_empty() {
vec![]
} else {
vec![workspace_file_set_inputs(workspace_file_sets)]
};
let runtime_and_env_inputs = self_inputs.iter().filter_map(|i| match i {
Input::Runtime(runtime) => Some(HashInstruction::Runtime(runtime.to_string())),
Expand Down Expand Up @@ -430,15 +442,11 @@ fn find_external_dependency_node_name<'a>(
}
}

fn project_file_set_inputs(project_name: &str, file_sets: Vec<&str>) -> Vec<HashInstruction> {
vec![
HashInstruction::ProjectFileSet(
project_name.to_string(),
file_sets.iter().map(|f| f.to_string()).collect(),
),
HashInstruction::ProjectConfiguration(project_name.to_string()),
HashInstruction::TsConfiguration(project_name.to_string()),
]
fn project_file_set_inputs(project_name: &str, file_sets: Vec<&str>) -> HashInstruction {
HashInstruction::ProjectFileSet(
project_name.to_string(),
file_sets.iter().map(|f| f.to_string()).collect(),
)
}

fn workspace_file_set_inputs(file_sets: Vec<&str>) -> HashInstruction {
Expand Down

0 comments on commit cdc9ae7

Please sign in to comment.