示例#1
0
        /// <summary>
        /// The constructor obtains the state information and the
        /// callback delegate.
        /// </summary>
        internal TaskExecutionState
        (
            TaskExecutionMode howToExecuteTask,
            Lookup lookupForInference,
            Lookup lookupForExecution,
            XmlElement taskXmlNode,
            ITaskHost hostObject,
            string projectFileOfTaskNode,
            string parentProjectFullFileName,
            string executionDirectory,
            int handleId,
            BuildEventContext buildEventContext
        )
        {
            ErrorUtilities.VerifyThrow(taskXmlNode != null, "Must have task node");

            this.howToExecuteTask = howToExecuteTask;
            this.lookupForInference = lookupForInference;
            this.lookupForExecution = lookupForExecution;
            this.hostObject = hostObject;
            this.projectFileOfTaskNode = projectFileOfTaskNode;
            this.parentProjectFullFileName = parentProjectFullFileName;
            this.executionDirectory = executionDirectory;
            this.handleId = handleId;
            this.buildEventContext = buildEventContext;
            this.taskXmlNode = taskXmlNode;
        }
示例#2
0
        /// <summary>
        /// Creates an instance of this class for the specified task.
        /// </summary>
        public TaskEngine
        (
            XmlElement taskNodeXmlElement,
            ITaskHost hostObject,
            string projectFileOfTaskNode,
            string parentProjectFullFileName,
            EngineLoggingServices loggingServices,
            int handleId,
            TaskExecutionModule parentModule,
            BuildEventContext targetBuildEventContext
        )
        {
            ErrorUtilities.VerifyThrow(taskNodeXmlElement != null, "Need to specify the task node.");
            ErrorUtilities.VerifyThrow(projectFileOfTaskNode != null, "Need to specify path of project.");
            ErrorUtilities.VerifyThrow(parentProjectFullFileName != null, "Need to specify name of project.");
            ErrorUtilities.VerifyThrow(loggingServices != null, "Need to specify the node logger.");

            this.taskNode = taskNodeXmlElement;
            this.taskClass = null;
            this.hostObject = hostObject;
            this.projectFileOfTaskNode = projectFileOfTaskNode;
            this.parentProjectFullFileName = parentProjectFullFileName;
            this.loggingServices = loggingServices;
            this.handleId = handleId;
            this.parentModule = parentModule;
            this.continueOnError = false;
            this.conditionAttribute = taskNode.Attributes[XMakeAttributes.condition];
            this.buildEventContext = targetBuildEventContext;
        }
示例#3
0
        internal void InitializeHostObjectSupportForNewSwitches(ITaskHost hostObject, ref string param)
        {
            var compilerOptionsHostObject = hostObject as ICompilerOptionsHostObject;

            if (compilerOptionsHostObject != null)
            {
                var commandLineBuilder = new CommandLineBuilderExtension();
                AddResponseFileCommandsForSwitchesSinceInitialReleaseThatAreNeededByTheHost(commandLineBuilder);
                param = "CompilerOptions";
                CheckHostObjectSupport(param, compilerOptionsHostObject.SetCompilerOptions(commandLineBuilder.ToString()));
            }
        }
示例#4
0
        /// <summary>
        /// Gets any host object applicable to this task name
        /// where the task appears within a target and project with the specified names.
        /// If no host object exists, returns null.
        /// </summary>
        public ITaskHost GetHostObject(string projectFile, string targetName, string taskName)
        {
            ErrorUtilities.VerifyThrowArgumentNull(projectFile, "projectFile");
            ErrorUtilities.VerifyThrowArgumentNull(targetName, "targetName");
            ErrorUtilities.VerifyThrowArgumentNull(taskName, "taskName");

            HostObjects hostObjects;

            if (_hostObjectMap == null || !_hostObjectMap.TryGetValue(projectFile, out hostObjects))
            {
                return(null);
            }

            ITaskHost hostObject = hostObjects.GetAnyMatchingHostObject(targetName, taskName);

            return(hostObject);
        }
示例#5
0
        private static void UpdateTaskOutProcess(string taskToken, TaskCommand taskCommand)
        {
            EndpointAddress     endpointAddress = new EndpointAddress(string.Format(CultureInfo.InvariantCulture, longRunningTaskAddressBase, taskToken));
            NetNamedPipeBinding binding         = new NetNamedPipeBinding();
            ITaskHost           host            = ChannelFactory <ITaskHost> .CreateChannel(binding, endpointAddress);

            IContextChannel channel = (IContextChannel)host;

            channel.OperationTimeout = TimeSpan.MaxValue;
            try
            {
                host.UpdateTask(taskCommand);
            }
            catch (Exception e)
            {
                GisEditor.LoggerManager.Log(LoggerLevel.Debug, e.Message, new ExceptionInfo(e));
            }
        }
示例#6
0
        public static bool Execute(string accountName,
                                   string accountKey,
                                   string connectionString,
                                   string containerName,
                                   string blobName,
                                   IBuildEngine buildengine,
                                   ITaskHost taskHost)
        {
            DeleteAzureBlob deleteAzureoBlob = new DeleteAzureBlob()
            {
                AccountName   = accountName,
                AccountKey    = accountKey,
                ContainerName = containerName,
                BlobName      = blobName,
                BuildEngine   = buildengine,
                HostObject    = taskHost
            };

            return(deleteAzureoBlob.Execute());
        }
示例#7
0
文件: Target.cs 项目: xen2/msbuild
        /// <summary>
        /// Executes a task within a target. This method initializes a task engine for the given task, and then executes the task
        /// using the engine.
        /// </summary>
        /// <param name="taskNode"></param>
        /// <param name="hostObject"></param>
        /// <returns>true, if successful</returns>
        internal bool ExecuteOneTask(XmlElement taskNode, ITaskHost hostObject)
        {
            string projectFileOfTaskNode = XmlUtilities.GetXmlNodeFile(taskNode, parentProject.FullFileName);
            BuildEventContext targetBuildEventContext = new BuildEventContext
                                (
                                    ParentProject.ProjectBuildEventContext.NodeId,
                                    this.id,
                                    ParentProject.ProjectBuildEventContext.ProjectContextId,
                                    ParentProject.ProjectBuildEventContext.TaskId
                                );
            int handleId = parentEngine.EngineCallback.CreateTaskContext(ParentProject,this, null, taskNode, 
                                                                            EngineCallback.inProcNode, targetBuildEventContext);
            TaskExecutionModule taskExecutionModule = parentEngine.NodeManager.TaskExecutionModule;
            TaskEngine taskEngine = new TaskEngine(taskNode, hostObject, parentProject.FullFileName, projectFileOfTaskNode, parentEngine.LoggingServices, handleId, taskExecutionModule, targetBuildEventContext);

            return taskEngine.ExecuteTask
                (
                    TaskExecutionMode.ExecuteTaskAndGatherOutputs,
                    new Lookup(parentProject.evaluatedItemsByName, parentProject.evaluatedProperties, ParentProject.ItemDefinitionLibrary)
                );
        }
示例#8
0
        public static string [] Execute(string accountName,
                                        string accountKey,
                                        string connectionString,
                                        string containerName,
                                        string filterBlobNames,
                                        IBuildEngine buildengine,
                                        ITaskHost taskHost)
        {
            ListAzureBlobs getAzureBlobList = new ListAzureBlobs()
            {
                AccountName     = accountName,
                AccountKey      = accountKey,
                ContainerName   = containerName,
                FilterBlobNames = filterBlobNames,
                BuildEngine     = buildengine,
                HostObject      = taskHost
            };

            getAzureBlobList.Execute();
            return(getAzureBlobList.BlobNames);
        }
示例#9
0
        public static Task <bool> ExecuteAsync(string accountName,
                                               string accountKey,
                                               string connectionString,
                                               string containerName,
                                               string blobName,
                                               string downloadDirectory,
                                               IBuildEngine buildengine,
                                               ITaskHost taskHost)
        {
            DownloadBlobFromAzure downloadBlobFromAzure = new DownloadBlobFromAzure()
            {
                AccountName       = accountName,
                AccountKey        = accountKey,
                ContainerName     = containerName,
                BlobName          = blobName,
                DownloadDirectory = downloadDirectory,
                BuildEngine       = buildengine,
                HostObject        = taskHost
            };

            return(downloadBlobFromAzure.ExecuteAsync());
        }
示例#10
0
        public static Task <bool> ExecuteAsync(string accountName,
                                               string accountKey,
                                               string connectionString,
                                               string containerName,
                                               string sourceBlobName,
                                               string destinationBlobName,
                                               IBuildEngine buildengine,
                                               ITaskHost taskHost)
        {
            CopyAzureBlobToBlob copyAzureBlobToBlob = new CopyAzureBlobToBlob()
            {
                AccountName         = accountName,
                AccountKey          = accountKey,
                ContainerName       = containerName,
                SourceBlobName      = sourceBlobName,
                DestinationBlobName = destinationBlobName,
                BuildEngine         = buildengine,
                HostObject          = taskHost
            };

            return(copyAzureBlobToBlob.ExecuteAsync());
        }
示例#11
0
        public static bool Execute(string accountName,
                                   string accountKey,
                                   string connectionString,
                                   string containerName,
                                   string blobName,
                                   string content,
                                   string contentType,
                                   IBuildEngine buildengine,
                                   ITaskHost taskHost)
        {
            PublishStringToAzureBlob publishStringToBlob = new PublishStringToAzureBlob()
            {
                AccountName   = accountName,
                AccountKey    = accountKey,
                ContainerName = containerName,
                BlobName      = blobName,
                Content       = content,
                ContentType   = contentType,
                BuildEngine   = buildengine,
                HostObject    = taskHost
            };

            return(publishStringToBlob.Execute());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ItemOccurenceProvider"/> class.
 /// </summary>
 /// <param name="lifetime">The lifetime.</param>
 /// <param name="taskHost">The task host.</param>
 /// <param name="shellLocks">The shell locks.</param>
 public ItemOccurenceProvider([NotNull] Lifetime lifetime, [NotNull] ITaskHost taskHost, [NotNull] IShellLocks shellLocks)
 {
   this.myLifetime = lifetime;
   this.myTaskHost = taskHost;
   this.myShellLocks = shellLocks;
 }
示例#13
0
 internal TaskExecutionStateHelper
     (
        TaskExecutionMode howToExecuteTask,
        Lookup lookupForInference,
        Lookup lookupForExecution,
        XmlElement taskXmlNode,
        ITaskHost hostObject,
        string projectFileOfTaskNode,
        string parentProjectFullFileName,
        string executionDirectory,
        int nodeProxyId
     )
     : base(howToExecuteTask,
         lookupForInference,
         lookupForExecution, 
         taskXmlNode,
         hostObject,
         projectFileOfTaskNode,
         parentProjectFullFileName,
         executionDirectory,
         nodeProxyId,
     null
     )
 {
     // Dont need to do anything
 }
示例#14
0
 public void RegisterHostObject(string projectFile, string targetName, string taskName, ITaskHost hostObject)
 {
     throw new NotImplementedException();
 }
示例#15
0
 public void RegisterHostObject (string projectFile, string targetName, string taskName, ITaskHost hostObject)
 {
         throw new NotImplementedException ();
 }
示例#16
0
        /// <summary>
        /// Register a host object for a particular task/target pair.
        /// Overwrites any existing host object.
        /// </summary>
        public void RegisterHostObject(string projectFile, string targetName, string taskName, ITaskHost hostObject)
        {
            ErrorUtilities.VerifyThrowArgumentNull(projectFile, "projectFile");
            ErrorUtilities.VerifyThrowArgumentNull(targetName, "targetName");
            ErrorUtilities.VerifyThrowArgumentNull(taskName, "taskName");

            // We can only set the host object to a non-null value if the affinity for the project is not out of proc, or if it is, it is only implicitly
            // out of proc, in which case it will become in-proc after this call completes.  See GetNodeAffinity.
            bool isExplicit;
            bool hasExplicitOutOfProcAffinity = (GetNodeAffinity(projectFile, out isExplicit) == NodeAffinity.OutOfProc) && (isExplicit == true);

            ErrorUtilities.VerifyThrowInvalidOperation(!hasExplicitOutOfProcAffinity || hostObject == null, "InvalidHostObjectOnOutOfProcProject");
            _hostObjectMap = _hostObjectMap ?? new Dictionary <string, HostObjects>(StringComparer.OrdinalIgnoreCase);

            HostObjects hostObjects;

            if (!_hostObjectMap.TryGetValue(projectFile, out hostObjects))
            {
                hostObjects = new HostObjects();
                _hostObjectMap[projectFile] = hostObjects;
            }

            hostObjects.RegisterHostObject(targetName, taskName, hostObject);
        }
示例#17
0
        private void RunTaskOutProcess(TaskPlugin plugin, string taskToken)
        {
            string          waitHandleId = Guid.NewGuid().ToString();
            EventWaitHandle waitHandle   = new EventWaitHandle(false, EventResetMode.ManualReset, waitHandleId);

            Task.Factory.StartNew(() =>
            {
                string address = string.Format(longRunningTaskAddressBase, taskToken);
#if GISEditorUnitTest
                string exePath = Assembly.GetExecutingAssembly().Location;
#else
                string exePath = Assembly.GetEntryAssembly().Location;
#endif
                string exeDirectory = Path.GetDirectoryName(exePath);

                ProcessStartInfo info = new ProcessStartInfo
                {
                    CreateNoWindow   = true,
                    WindowStyle      = ProcessWindowStyle.Hidden,
                    Arguments        = string.Format(CultureInfo.InvariantCulture, argumentFormatString, waitHandleId, address, callBackReceiverAddress, taskToken),
                    WorkingDirectory = exeDirectory,
                    FileName         = "GisEditorTaskHost"
                };

                Process hostProcess = Process.Start(info);
                waitHandle.WaitOne();

                EndpointAddress endpointAddress             = new EndpointAddress(string.Format(CultureInfo.InvariantCulture, longRunningTaskAddressBase, taskToken));
                NetNamedPipeBinding binding                 = new NetNamedPipeBinding();
                binding.ReaderQuotas.MaxBytesPerRead        = int.MaxValue;
                binding.ReaderQuotas.MaxDepth               = int.MaxValue;
                binding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
                binding.ReaderQuotas.MaxArrayLength         = int.MaxValue;
                binding.ReceiveTimeout         = TimeSpan.MaxValue;
                binding.MaxReceivedMessageSize = int.MaxValue;
                ITaskHost host           = ChannelFactory <ITaskHost> .CreateChannel(binding, endpointAddress);
                IContextChannel channel  = (IContextChannel)host;
                channel.OperationTimeout = TimeSpan.MaxValue;
                try
                {
                    string tempParameterPathFileName = Path.Combine(GisEditor.InfrastructureManager.TemporaryPath, "TaskParameters", taskToken + ".setting");
                    string tempParameterPathName     = Path.GetDirectoryName(tempParameterPathFileName);
                    if (File.Exists(tempParameterPathFileName))
                    {
                        File.Delete(tempParameterPathFileName);
                    }
                    else if (!Directory.Exists(tempParameterPathName))
                    {
                        Directory.CreateDirectory(tempParameterPathName);
                    }

                    using (var pluginStream = new MemoryStream())
                    {
                        BinaryFormatter serializer = new BinaryFormatter();
                        serializer.Serialize(pluginStream, plugin);
                        File.WriteAllBytes(tempParameterPathFileName, pluginStream.ToArray());
                    }

                    if (File.Exists(tempParameterPathFileName))
                    {
                        host.RunTask(Encoding.UTF8.GetBytes(tempParameterPathFileName));
                    }
                }
                catch (Exception e)
                {
                    GisEditor.LoggerManager.Log(LoggerLevel.Debug, e.Message, new ExceptionInfo(e));
                }
            });
        }
 public GotoWordIndexProvider([NotNull] Lifetime lifetime, [NotNull] ITaskHost taskHost, [NotNull] IShellLocks shellLocks)
 {
     myLifetime   = lifetime;
     myTaskHost   = taskHost;
     myShellLocks = shellLocks;
 }
示例#19
0
        /// <summary>
        /// Cleans up after running the task.
        /// </summary>
        void ITaskExecutionHost.CleanupForTask()
        {
            if (_resolver != null)
            {
                _resolver.RemoveHandler();
                _resolver = null;
            }

            _taskFactoryWrapper = null;

            // We must null this out because it could be a COM object (or any other ref-counted object) which needs to
            // be released.
            _taskHost = null;
            CleanupCancellationToken();

            ErrorUtilities.VerifyThrow(_taskInstance == null, "Task Instance should be null");
        }
示例#20
0
        /// <summary>
        /// Create a TaskExecutionState structure which contains all the information necessary
        /// to execute the task and send this information over to the TEM for task execution
        /// </summary>
        internal void SubmitNonIntrinsicTask
        (
            XmlElement taskNode,
            ITaskHost hostObject,
            ProjectBuildState buildContext
        )
        {
            if (!haveRunANonIntrinsicTask)
            {
                InitializeForRunningFirstNonIntrinsicTask();
                haveRunANonIntrinsicTask = true;
            }

            TaskExecutionMode executionMode = DetermineExecutionMode();

            // A TaskExecutionMode of ExecuteTaskAndGatherOutputs should have its messages logged in the context of the task and therefore should have a valid taskID
            // A TaskExecutionMode of InferOutputs or Invalid should have its messages logged in the context of the target and therefore should have an invalid taskID
            BuildEventContext buildEventContext = PrepareBuildEventContext(executionMode == TaskExecutionMode.ExecuteTaskAndGatherOutputs ? false: true);

            // Create the task execution context
            int handleId = parentEngine.EngineCallback.CreateTaskContext(parentProject, targetClass, buildContext,
                                                                         taskNode, EngineCallback.inProcNode, buildEventContext);

            // Create the task execution state
            TaskExecutionState taskState =
                new TaskExecutionState
                    (
                        executionMode,
                        lookupForInference,
                        lookupForExecution,
                        taskNode,
                        hostObject,
                        projectFileOfTaskNode,
                        parentProject.FullFileName,
                        parentProject.ProjectDirectory,
                        handleId,
                        buildEventContext
                    );

            // Send the request for task execution to the node
            parentEngine.NodeManager.ExecuteTask(taskState);
        }
示例#21
0
 public MonikerNameOrITaskHost(ITaskHost taskHost)
 {
     TaskHost   = taskHost;
     IsTaskHost = true;
 }
示例#22
0
文件: Target.cs 项目: nikson/msbuild
        /// <summary>
        /// Executes a task within a target. This method initializes a task engine for the given task, and then executes the task
        /// using the engine.
        /// </summary>
        /// <param name="taskNode"></param>
        /// <param name="hostObject"></param>
        /// <returns>true, if successful</returns>
        internal bool ExecuteOneTask(XmlElement taskNode, ITaskHost hostObject)
        {
            bool taskExecutedSuccessfully = false;

            string projectFileOfTaskNode = XmlUtilities.GetXmlNodeFile(taskNode, parentProject.FullFileName);
            BuildEventContext targetBuildEventContext = new BuildEventContext
                                (
                                    ParentProject.ProjectBuildEventContext.NodeId,
                                    this.id,
                                    ParentProject.ProjectBuildEventContext.ProjectContextId,
                                    ParentProject.ProjectBuildEventContext.TaskId
                                );
            int handleId = parentEngine.EngineCallback.CreateTaskContext(ParentProject,this, null, taskNode, 
                                                                            EngineCallback.inProcNode, targetBuildEventContext);
            TaskExecutionModule taskExecutionModule = parentEngine.NodeManager.TaskExecutionModule;
            TaskEngine taskEngine = new TaskEngine(taskNode, hostObject, parentProject.FullFileName, projectFileOfTaskNode, parentEngine.LoggingServices, handleId, taskExecutionModule, targetBuildEventContext);

            taskExecutedSuccessfully =
                taskEngine.ExecuteTask
                (
                    TaskExecutionMode.ExecuteTaskAndGatherOutputs,
                    new Lookup(parentProject.evaluatedItemsByName, parentProject.evaluatedProperties, ParentProject.ItemDefinitionLibrary)
                );

            return taskExecutedSuccessfully;
        }
 public LocateFileController([NotNull] Lifetime lifetime, [NotNull] ISolution solution,
                             [NotNull] IShellLocks locks, ITaskHost tasks, bool enableMulticore = false)
     : base(lifetime, solution, locks, tasks, enableMulticore)
 {
     Model.CaptionText.Value = "Enter file or folder name to locate:";
 }
示例#24
0
		public void RegisterHostObject (string projectFile, string targetName, string taskName, ITaskHost hostObject)
		{
			if (hostObject == null)
				throw new ArgumentNullException ("hostObject");
			var reg = GetHostRegistration (projectFile, targetName, taskName);
			if (reg != null)
				reg.HostObject = hostObject;
			else
				hosts.Add (new HostObjectRegistration () { ProjectFile = projectFile, TargetName = targetName, TaskName = taskName, HostObject = hostObject });
		}
示例#25
0
        /// <summary>
        /// Register a host object for a particular task/target pair.
        /// Overwrites any existing host object.
        /// </summary>
        public void RegisterHostObject(string projectFile, string targetName, string taskName, ITaskHost hostObject)
        {
/* Unmerged change from project 'Microsoft.Build (netcoreapp2.1)'
 * Before:
 *          ErrorUtilities.VerifyThrowArgumentNull(projectFile, "projectFile");
 *          ErrorUtilities.VerifyThrowArgumentNull(targetName, "targetName");
 * After:
 *          ErrorUtilities.VerifyThrowArgumentNull(projectFile, "projectFile));
 *          ErrorUtilities.VerifyThrowArgumentNull(targetName, "targetName));
 */
            ErrorUtilities.VerifyThrowArgumentNull(projectFile, nameof(projectFile));
            ErrorUtilities.VerifyThrowArgumentNull(targetName, nameof(targetName));
            ErrorUtilities.VerifyThrowArgumentNull(taskName, nameof(taskName));

            // We can only set the host object to a non-null value if the affinity for the project is not out of proc, or if it is, it is only implicitly
            // out of proc, in which case it will become in-proc after this call completes.  See GetNodeAffinity.
            bool isExplicit;
            bool hasExplicitOutOfProcAffinity = (GetNodeAffinity(projectFile, out isExplicit) == NodeAffinity.OutOfProc) && isExplicit;

            ErrorUtilities.VerifyThrowInvalidOperation(!hasExplicitOutOfProcAffinity || hostObject == null, "InvalidHostObjectOnOutOfProcProject");
            _hostObjectMap ??= new Dictionary <string, HostObjects>(StringComparer.OrdinalIgnoreCase);

            HostObjects hostObjects = GetHostObjectsFromMapByKeyOrCreateNew(projectFile);

            hostObjects.RegisterHostObject(targetName, taskName, hostObject);
        }
示例#26
0
        public void RegisterHostObject(string projectFile, string targetName, string taskName, ITaskHost hostObject)
        {
            if (hostObject == null)
            {
                throw new ArgumentNullException("hostObject");
            }
            var reg = GetHostRegistration(projectFile, targetName, taskName);

            if (reg != null)
            {
                reg.HostObject = hostObject;
            }
            else
            {
                hosts.Add(new HostObjectRegistration()
                {
                    ProjectFile = projectFile, TargetName = targetName, TaskName = taskName, HostObject = hostObject
                });
            }
        }
示例#27
0
        /// <summary>
        /// Builds the task specified by the XML.
        /// </summary>
        /// <param name="loggingContext">The logging context of the target</param>
        /// <param name="requestEntry">The build request entry being built</param>
        /// <param name="targetBuilderCallback">The target builder callback.</param>
        /// <param name="taskInstance">The task instance.</param>
        /// <param name="mode">The mode in which to execute tasks.</param>
        /// <param name="inferLookup">The lookup to be used for inference.</param>
        /// <param name="executeLookup">The lookup to be used during execution.</param>
        /// <returns>The result of running the task batch.</returns>
        /// <remarks>
        /// The ExecuteTask method takes a task as specified by XML and executes it.  This procedure is comprised 
        /// of the following steps:
        /// 1. Loading the Task from its containing assembly by looking it up in the task registry
        /// 2. Determining if the task is batched.  If it is, create the batches and execute each as if it were a non-batched task
        /// 3. If the task is not batched, execute it.
        /// 4. If the task was batched, hold on to its Lookup until all of the natches are done, then merge them.
        /// </remarks>
        public async Task<WorkUnitResult> ExecuteTask(TargetLoggingContext loggingContext, BuildRequestEntry requestEntry, ITargetBuilderCallback targetBuilderCallback, ProjectTargetInstanceChild taskInstance, TaskExecutionMode mode, Lookup inferLookup, Lookup executeLookup, CancellationToken cancellationToken)
        {
            ErrorUtilities.VerifyThrow(taskInstance != null, "Need to specify the task instance.");

            _buildRequestEntry = requestEntry;
            _targetBuilderCallback = targetBuilderCallback;
            _cancellationToken = cancellationToken;
            _targetChildInstance = taskInstance;

            // In the case of Intrinsic tasks, taskNode will end up null.  Currently this is how we distinguish
            // intrinsic from extrinsic tasks.
            _taskNode = taskInstance as ProjectTaskInstance;

            if (_taskNode != null && requestEntry.Request.HostServices != null)
            {
                _taskHostObject = requestEntry.Request.HostServices.GetHostObject(requestEntry.RequestConfiguration.Project.FullPath, loggingContext.Target.Name, _taskNode.Name);
            }

            _projectFullPath = requestEntry.RequestConfiguration.Project.FullPath;

            // this.handleId = handleId; No handles
            // this.parentModule = parentModule; No task execution module
            _continueOnError = ContinueOnError.ErrorAndStop;

            _targetLoggingContext = loggingContext;

            WorkUnitResult taskResult = new WorkUnitResult(WorkUnitResultCode.Failed, WorkUnitActionCode.Stop, null);
            if ((mode & TaskExecutionMode.InferOutputsOnly) == TaskExecutionMode.InferOutputsOnly)
            {
                taskResult = await ExecuteTask(TaskExecutionMode.InferOutputsOnly, inferLookup);
            }

            if ((mode & TaskExecutionMode.ExecuteTaskAndGatherOutputs) == TaskExecutionMode.ExecuteTaskAndGatherOutputs)
            {
                taskResult = await ExecuteTask(TaskExecutionMode.ExecuteTaskAndGatherOutputs, executeLookup);
            }

            return taskResult;
        }
示例#28
0
        public GotoWordIndexController([NotNull] Lifetime lifetime, [NotNull] ISolution solution,
                                       LibrariesFlag librariesFlag, [NotNull] IShellLocks locks, [NotNull] ITaskHost taskHost)
            : base(lifetime, solution, solution, librariesFlag, locks, taskHost, enableMulticore: false)
#endif
        {
            var manager = GotoByNameModelManager.GetInstance(solution);

            manager.ProcessModel <GotoWordModelInitializer>(Model, lifetime);
        }
示例#29
0
        internal void InitializeHostObjectSupportForNewSwitches(ITaskHost hostObject, ref string param)
        {
            var compilerOptionsHostObject = hostObject as ICompilerOptionsHostObject;

            if (compilerOptionsHostObject != null)
            {
                var commandLineBuilder = new CommandLineBuilderExtension();
                AddResponseFileCommandsForSwitchesSinceInitialReleaseThatAreNeededByTheHost(commandLineBuilder);
                param = "CompilerOptions";
                CheckHostObjectSupport(param, compilerOptionsHostObject.SetCompilerOptions(commandLineBuilder.ToString()));
            }
        }
示例#30
0
 /// <summary>
 /// Initialize to run a specific task.
 /// </summary>
 void ITaskExecutionHost.InitializeForTask(IBuildEngine2 buildEngine, TargetLoggingContext loggingContext, ProjectInstance projectInstance, string taskName, ElementLocation taskLocation, ITaskHost taskHost, bool continueOnError, AppDomainSetup appDomainSetup, bool isOutOfProc, CancellationToken cancellationToken)
 {
     _buildEngine = buildEngine;
     _projectInstance = projectInstance;
     _targetLoggingContext = loggingContext;
     _taskName = taskName;
     _taskLocation = taskLocation;
     _cancellationTokenRegistration = cancellationToken.Register(this.Cancel);
     _taskHost = taskHost;
     _continueOnError = continueOnError;
     _taskExecutionIdle.Set();
     this.AppDomainSetup = appDomainSetup;
     this.IsOutOfProc = isOutOfProc;
 }