Execute() public method

public Execute ( ) : bool
return bool
Beispiel #1
0
        public override bool Execute()
        {
            AppDomain domain = null;
            bool      success;

            if (!Path.IsPathRooted(ToolPath))
            {
                ToolPath = Path.Combine(Path.GetDirectoryName(BuildEngine.ProjectFileOfTaskNode), ToolPath);
            }

            if (!Path.IsPathRooted(BuildTaskPath))
            {
                BuildTaskPath = Path.Combine(Path.GetDirectoryName(BuildEngine.ProjectFileOfTaskNode), BuildTaskPath);
            }

            try
            {
                domain = GetAntlrTaskAppDomain();
                AntlrClassGenerationTaskInternal wrapper = CreateBuildTaskWrapper(domain);
                success = wrapper.Execute();

                if (success)
                {
                    _generatedCodeFiles.AddRange(wrapper.GeneratedCodeFiles.Select(file => (ITaskItem) new TaskItem(file)));
                }

                foreach (BuildMessage message in wrapper.BuildMessages)
                {
                    ProcessBuildMessage(message);
                }
            }
            catch (Exception exception)
            {
                if (IsFatalException(exception))
                {
                    throw;
                }

                ProcessExceptionAsBuildMessage(exception);
                success = false;
            }
            finally
            {
                if (domain != null && domain != _sharedAppDomain)
                {
                    AppDomain.Unload(domain);
                }
            }

            return(success);
        }
Beispiel #2
0
        public override bool Execute()
        {
            bool success;

            //System.Threading.Thread.Sleep(20000);

            if (!Path.IsPathRooted(ToolPath))
            {
                ToolPath = Path.Combine(Path.GetDirectoryName(BuildEngine.ProjectFileOfTaskNode), ToolPath);
            }

            if (!Path.IsPathRooted(BuildTaskPath))
            {
                BuildTaskPath = Path.Combine(Path.GetDirectoryName(BuildEngine.ProjectFileOfTaskNode), BuildTaskPath);
            }

            try
            {
                AntlrClassGenerationTaskInternal wrapper = CreateBuildTaskWrapper();
                success = wrapper.Execute();

                if (success)
                {
                    _generatedCodeFiles.AddRange(wrapper.GeneratedCodeFiles.Select(file => (ITaskItem) new TaskItem(file)));
                }

                foreach (BuildMessage message in wrapper.BuildMessages)
                {
                    ProcessBuildMessage(message);
                }
            }
            catch (Exception exception)
            {
                if (IsFatalException(exception))
                {
                    throw;
                }

                ProcessExceptionAsBuildMessage(exception);
                success = false;
            }

            return(success);
        }