Skip to content

Commit

Permalink
Update related test case
Browse files Browse the repository at this point in the history
  • Loading branch information
JaynieBai committed Jul 19, 2023
1 parent 51fcd86 commit 5e66010
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ProjectTargetElement_Tests
[Fact]
public void AddTargetInvalidName()
{
Assert.Throws<ArgumentException>(() =>
Assert.Throws<InvalidProjectFileException>(() =>
{
ProjectRootElement project = ProjectRootElement.Create();
project.CreateTargetElement("@#$invalid@#$");
Expand Down
6 changes: 3 additions & 3 deletions src/Build/BackEnd/Components/RequestBuilder/TargetBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ private async Task ProcessTargetStack(ITaskBuilder taskBuilder)
_requestEntry.RequestConfiguration.Project.Targets.ContainsKey(targetName),
currentTargetEntry.ReferenceLocation,
"TargetDoesNotExist",
currentTargetEntry.Name);
targetName);

// If we already have results for this target which were not skipped, we can ignore it. In
// addition, we can also ignore its before and after targets -- if this target has already run,
Expand All @@ -435,7 +435,7 @@ private async Task ProcessTargetStack(ITaskBuilder taskBuilder)
_targetsToBuild.Pop();

// Push our after targets, if any. Our parent is the parent of the target after which we are running.
IList<TargetSpecification> afterTargets = _requestEntry.RequestConfiguration.Project.GetTargetsWhichRunAfter(currentTargetEntry.Name);
IList<TargetSpecification> afterTargets = _requestEntry.RequestConfiguration.Project.GetTargetsWhichRunAfter(targetName);
bool didPushTargets = await PushTargets(afterTargets, currentTargetEntry.ParentEntry, currentTargetEntry.Lookup, currentTargetEntry.ErrorTarget, currentTargetEntry.StopProcessingOnCompletion, TargetBuiltReason.AfterTargets);

// If we have after targets, the last one to run will inherit the stopProcessing flag and we will reset ours. If we didn't push any targets, then we shouldn't clear the
Expand All @@ -456,7 +456,7 @@ private async Task ProcessTargetStack(ITaskBuilder taskBuilder)
// happen if our current target was supposed to stop processing AND we had no after targets, then our last before target should
// inherit the stop processing flag and we will reset it.
// Our parent is the target before which we run, just like a depends-on target.
IList<TargetSpecification> beforeTargets = _requestEntry.RequestConfiguration.Project.GetTargetsWhichRunBefore(currentTargetEntry.Name);
IList<TargetSpecification> beforeTargets = _requestEntry.RequestConfiguration.Project.GetTargetsWhichRunBefore(targetName);
bool pushedTargets = await PushTargets(beforeTargets, currentTargetEntry, currentTargetEntry.Lookup, currentTargetEntry.ErrorTarget, stopProcessingStack, TargetBuiltReason.BeforeTargets);
if (beforeTargets.Count != 0 && pushedTargets)
{
Expand Down

0 comments on commit 5e66010

Please sign in to comment.