Skip to content

Commit 0d6667d

Browse files
authored
fix(core): avoid storing hash details for empty fileset (#29316)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
1 parent 99700c0 commit 0d6667d

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

packages/nx/src/native/tasks/hash_planner.rs

+23-21
Original file line numberDiff line numberDiff line change
@@ -332,19 +332,36 @@ impl HashPlanner {
332332
file_set.starts_with("{projectRoot}/") || file_set.starts_with("!{projectRoot}/")
333333
});
334334

335-
let project_file_set_inputs = project_file_set_inputs(project_name, project_file_sets);
336-
// let workspace_file_set_inputs = workspace_file_set_inputs(workspace_file_sets);
337-
let workspace_file_set_inputs = match workspace_file_sets.is_empty() {
338-
true => vec![],
339-
false => vec![workspace_file_set_inputs(workspace_file_sets)],
335+
let project_inputs = if project_file_sets.is_empty() {
336+
vec![
337+
HashInstruction::ProjectConfiguration(project_name.to_string()),
338+
HashInstruction::TsConfiguration(project_name.to_string()),
339+
]
340+
} else {
341+
vec![
342+
HashInstruction::ProjectFileSet(
343+
project_name.to_string(),
344+
project_file_sets.iter().map(|f| f.to_string()).collect(),
345+
),
346+
HashInstruction::ProjectConfiguration(project_name.to_string()),
347+
HashInstruction::TsConfiguration(project_name.to_string()),
348+
]
349+
};
350+
351+
let workspace_file_set_inputs = if workspace_file_sets.is_empty() {
352+
vec![]
353+
} else {
354+
vec![HashInstruction::WorkspaceFileSet(
355+
workspace_file_sets.iter().map(|f| f.to_string()).collect(),
356+
)]
340357
};
341358
let runtime_and_env_inputs = self_inputs.iter().filter_map(|i| match i {
342359
Input::Runtime(runtime) => Some(HashInstruction::Runtime(runtime.to_string())),
343360
Input::Environment(env) => Some(HashInstruction::Environment(env.to_string())),
344361
_ => None,
345362
});
346363

347-
project_file_set_inputs
364+
project_inputs
348365
.into_iter()
349366
.chain(workspace_file_set_inputs)
350367
.chain(runtime_and_env_inputs)
@@ -429,18 +446,3 @@ fn find_external_dependency_node_name<'a>(
429446
None
430447
}
431448
}
432-
433-
fn project_file_set_inputs(project_name: &str, file_sets: Vec<&str>) -> Vec<HashInstruction> {
434-
vec![
435-
HashInstruction::ProjectFileSet(
436-
project_name.to_string(),
437-
file_sets.iter().map(|f| f.to_string()).collect(),
438-
),
439-
HashInstruction::ProjectConfiguration(project_name.to_string()),
440-
HashInstruction::TsConfiguration(project_name.to_string()),
441-
]
442-
}
443-
444-
fn workspace_file_set_inputs(file_sets: Vec<&str>) -> HashInstruction {
445-
HashInstruction::WorkspaceFileSet(file_sets.iter().map(|f| f.to_string()).collect())
446-
}

0 commit comments

Comments
 (0)