/// <summary> /// Given a build request try to find the target that caused it to come into being /// </summary> private TargetIdWrapper FindParentTargetForBuildRequest ( EngineCallback engineCallback, BuildRequest triggeringBuildRequest, out BuildRequest parentTriggeringRequest ) { parentTriggeringRequest = null; // If request is non-external and generated due to IBuildEngine call try // to find the target that caused the IBuildEngine call if (triggeringBuildRequest.IsGeneratedRequest && !triggeringBuildRequest.IsExternalRequest) { ExecutionContext executionContext = engineCallback.GetExecutionContextFromHandleId(triggeringBuildRequest.HandleId); // If the parent context is not a routing context than we can // get the parent target from it if (executionContext is TaskExecutionContext) { return(new TargetIdWrapper(((TaskExecutionContext)executionContext).ParentTarget)); } // If the parent context if a routing context the parent target is not available // on the current node, so store the request instead else { parentTriggeringRequest = triggeringBuildRequest; } } // If the request is external to the node - store the request since the parent target // is not available else if (triggeringBuildRequest.IsExternalRequest) { parentTriggeringRequest = triggeringBuildRequest; } else { requestedByHost = true; } return(null); }
/// <summary> /// Given a build request try to find the target that caused it to come into being /// </summary> private TargetIdWrapper FindParentTargetForBuildRequest ( EngineCallback engineCallback, BuildRequest triggeringBuildRequest, out BuildRequest parentTriggeringRequest ) { parentTriggeringRequest = null; // If request is non-external and generated due to IBuildEngine call try // to find the target that caused the IBuildEngine call if (triggeringBuildRequest.IsGeneratedRequest && !triggeringBuildRequest.IsExternalRequest) { ExecutionContext executionContext = engineCallback.GetExecutionContextFromHandleId(triggeringBuildRequest.HandleId); // If the parent context is not a routing context than we can // get the parent target from it if (executionContext is TaskExecutionContext) { return new TargetIdWrapper(((TaskExecutionContext)executionContext).ParentTarget); } // If the parent context if a routing context the parent target is not available // on the current node, so store the request instead else { parentTriggeringRequest = triggeringBuildRequest; } } // If the request is external to the node - store the request since the parent target // is not available else if (triggeringBuildRequest.IsExternalRequest) { parentTriggeringRequest = triggeringBuildRequest; } else { requestedByHost = true; } return null; }