当前位置: 首页>>代码示例>>C#>>正文


C# IIntegrationResult.BaseFromArtifactsDirectory方法代码示例

本文整理汇总了C#中IIntegrationResult.BaseFromArtifactsDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# IIntegrationResult.BaseFromArtifactsDirectory方法的具体用法?C# IIntegrationResult.BaseFromArtifactsDirectory怎么用?C# IIntegrationResult.BaseFromArtifactsDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IIntegrationResult的用法示例。


在下文中一共展示了IIntegrationResult.BaseFromArtifactsDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public virtual void Run(IIntegrationResult result)
        {
            string outputFile = result.BaseFromArtifactsDirectory(OutputFile);

            ProcessResult nunitResult = processExecutor.Execute(NewProcessInfo(outputFile, result));
            result.AddTaskResult(new ProcessTaskResult(nunitResult));
            if (File.Exists(outputFile))
            {
                result.AddTaskResult(new FileTaskResult(outputFile));
            }
            else
            {
                Log.Warning(string.Format("NUnit test output file {0} was not created", outputFile));
            }
        }
开发者ID:vardars,项目名称:ci-factory,代码行数:15,代码来源:NUnitTask.cs

示例2: Execute

        /// <summary>
        /// Execute the actual task functionality.
        /// </summary>
        /// <param name="result"></param>
        /// <returns>
        /// True if the task was successful, false otherwise.
        /// </returns>
        protected override bool Execute(IIntegrationResult result)
        {
            result.BuildProgressInformation.SignalStartRunTask(!string.IsNullOrEmpty(Description) ? Description : "Publishing build results");

            if (result.Succeeded || AlwaysPublish)
            {
                var srcDir = new DirectoryInfo(result.BaseFromWorkingDirectory(SourceDir));
                var pubDir = new DirectoryInfo(result.BaseFromArtifactsDirectory(PublishDir));
                Log.Debug("Publish directory is '{0}'", pubDir.FullName);
                Log.Debug("Source directory is '{0}'", srcDir.FullName);
                if (!srcDir.Exists)
                {
                    Log.Warning("Source directory '{0}' does not exist - cancelling task", srcDir.FullName);
                    var errorResult = new GeneralTaskResult(
                        false,
                        "Unable to find source directory '" + srcDir.FullName + "'");
                    result.AddTaskResult(errorResult);
                    return false;
                }

                if (!pubDir.Exists)
                {
                    Log.Info("Publish directory '{0}' does not exist - creating", pubDir.FullName);
                    pubDir.Create();
                }
                else
                {
                    if (CleanPublishDirPriorToCopy)
                    {
                        DeleteFolder(pubDir.FullName);
                        pubDir.Create();
                    }
                }

                if (UseLabelSubDirectory)
                    pubDir = pubDir.CreateSubdirectory(result.Label);

                RecurseSubDirectories(srcDir, pubDir, this.Recurse);

                switch (CleanUpMethod)
                {
                    case CleanupPolicy.NoCleaning:
                        break;

                    case CleanupPolicy.DeleteBuildsOlderThanXDays:
                        DeleteSubDirsOlderThanXDays(new DirectoryInfo(result.BaseFromArtifactsDirectory(PublishDir)).FullName,
                                                    CleanUpValue, result.BuildLogDirectory);
                        break;

                    case CleanupPolicy.KeepLastXBuilds:
                        KeepLastXSubDirs(new DirectoryInfo(result.BaseFromArtifactsDirectory(PublishDir)).FullName,
                                                    CleanUpValue, result.BuildLogDirectory);
                        break;

                    default:
                        throw new System.Exception(string.Format(System.Globalization.CultureInfo.CurrentCulture, "unmapped cleaning method choosen {0}", CleanUpMethod));
                }
            }

            return true;
        }
开发者ID:KevinFernandes,项目名称:CCNetEnhancedBuildPublisher,代码行数:68,代码来源:EnhancedBuildPublisher.cs

示例3: Execute

        /// <summary>
        /// Run the task.
        /// </summary>
        /// <param name="result"></param>
        protected override bool Execute(IIntegrationResult result)
        {
            result.BuildProgressInformation.SignalStartRunTask(!string.IsNullOrEmpty(Description) ? Description : "Running NCover reporting");

            // Make sure there is a root directory
            rootPath = BaseDirectory;
            if (string.IsNullOrEmpty(rootPath)) rootPath = result.WorkingDirectory;

            // Take a before snapshot of all the files
            var outputDirectory = new DirectoryInfo(RootPath(OutputDir, false));
            var oldFiles = GenerateOriginalFileList(outputDirectory);

            // Run the executable
            var processResult = TryToRun(CreateProcessInfo(result), result);
            result.AddTaskResult(new ProcessTaskResult(processResult));

            // Check for any new files and copy them to the artefact folder
            if (!processResult.Failed)
            {
                outputDirectory.Refresh();
                var newFiles = ListFileDifferences(oldFiles, outputDirectory);
                if (newFiles.Length > 0)
                {
                    // Copy all the new files over
                    var publishDir = Path.Combine(result.BaseFromArtifactsDirectory(result.Label), "NCover");
                    Log.Debug(string.Format("Copying {0} files to {1}", newFiles.Length, publishDir));

                    var index = outputDirectory.FullName.Length + 1;
                    foreach (FileInfo newFile in newFiles)
                    {
                        var fileInfo = new FileInfo(Path.Combine(publishDir, newFile.FullName.Substring(index)));
                        if (!fileInfo.Directory.Exists) fileInfo.Directory.Create();
                        newFile.CopyTo(fileInfo.FullName, true);
                    }
                }
            }

            return !processResult.Failed;
        }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:43,代码来源:NCoverReportTask.cs

示例4: Execute

        /// <summary>
        /// Executes the specified result.	
        /// </summary>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        protected override bool Execute(IIntegrationResult result)
        {
            result.BuildProgressInformation.SignalStartRunTask(!string.IsNullOrEmpty(Description) ? Description : "Executing NUnit");

            string outputFile = result.BaseFromArtifactsDirectory(OutputFile);

            ProcessResult nunitResult = executor.Execute(NewProcessInfo(outputFile, result));
            DeleteNUnitAgentProcesses();

            result.AddTaskResult(new ProcessTaskResult(nunitResult, true));
            if (File.Exists(outputFile))
            {
                result.AddTaskResult(new FileTaskResult(outputFile));
            }
            else
            {
                Log.Warning(string.Format(System.Globalization.CultureInfo.CurrentCulture,"NUnit test output file {0} was not created", outputFile));
            }
            return !nunitResult.Failed;
        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:26,代码来源:NUnitTask.cs

示例5: MoveFile

        /// <summary>
        /// Moves the file from its temporary (working) location to its final location.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="tempFile"></param>
        /// <returns></returns>
        /// <remarks>
        /// This method will also generate the correct name of the file and ensure
        /// the output directory exists.
        /// </remarks>
        private string MoveFile(IIntegrationResult result, string tempFile)
        {
            string actualFile = EnsureFileExtension(Path.Combine(result.Label, PackageName), ".zip");
            actualFile = result.BaseFromArtifactsDirectory(actualFile);
            if (File.Exists(actualFile))
            {
                DeleteFileWithRetry(actualFile);
            }

            string actualFolder = Path.GetDirectoryName(actualFile);
            if (!Directory.Exists(actualFolder))
            {
                Directory.CreateDirectory(actualFolder);
            }

            File.Move(tempFile, actualFile);

            if (!string.IsNullOrEmpty(OutputDirectory))
            {
                var basePath = OutputDirectory;
                if (!Path.IsPathRooted(basePath))
                {
                    basePath = Path.Combine(result.ArtifactDirectory, basePath);
                }

                // Create output directory if it doesn't exist
                if (!Directory.Exists(basePath))
                {
                    Log.Info(string.Format(
                        CultureInfo.CurrentCulture, "Creating output directory '{0}'", basePath));
                    Directory.CreateDirectory(basePath);
                }

                // Copy the file to the output directory (so it can be used by other tasks)
                Log.Info(string.Format(
                    CultureInfo.CurrentCulture, "Copying file to '{0}'", basePath));
                File.Copy(
                    actualFile,
                    EnsureFileExtension(Path.Combine(basePath, PackageName), ".zip"),
                    true);
            }

            return actualFile;
        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:54,代码来源:PackagePublisher.cs

示例6: AddToPackageList

        /// <summary>
        /// Add the package to the list of packages.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="listFile"></param>
        /// <param name="fileName"></param>
        /// <param name="numberOfFiles"></param>
        /// <remarks>
        /// This is to allow discoverability of packages. In future CruiseControl.Net will allow clients to download this
        /// list to see which packages are available.
        /// </remarks>
        private void AddToPackageList(IIntegrationResult result, string listFile, string fileName, int numberOfFiles)
        {
            XmlDocument listXml = new XmlDocument();

            // See if there is an existing list
            listFile = result.BaseFromArtifactsDirectory(listFile);
            if (File.Exists(listFile))
            {
                listXml.Load(listFile);
            }
            else
            {
                XmlElement rootElement = listXml.CreateElement("packages");
                listXml.AppendChild(rootElement);
            }

            // See if the entry already exists
            XmlElement packageElement = listXml.SelectSingleNode(
                string.Format(CultureInfo.CurrentCulture, "/packages/package[@name='{0}']", PackageName)) as XmlElement;
            if (packageElement == null)
            {
                packageElement = listXml.CreateElement("package");
                listXml.DocumentElement.AppendChild(packageElement);
                packageElement.SetAttribute("name", PackageName);
            }


            // Add the properties for the package
            var packageFile = new FileInfo(fileName);
            packageElement.SetAttribute("file", fileName);
            packageElement.SetAttribute("label", result.Label);
            packageElement.SetAttribute("time", DateTime.Now.ToString("s", CultureInfo.CurrentCulture));
            packageElement.SetAttribute("files", numberOfFiles.ToString(CultureInfo.CurrentCulture));
            packageElement.SetAttribute("size", packageFile.Length.ToString(CultureInfo.CurrentCulture));

            // Save the updated list
            var listDir = Path.GetDirectoryName(listFile);
            if (!Directory.Exists(listDir))
            {
                Directory.CreateDirectory(listDir);
            }

            listXml.Save(listFile);
        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:55,代码来源:PackagePublisher.cs

示例7: Execute

        protected override bool Execute(IIntegrationResult result)
        {
            result.BuildProgressInformation.SignalStartRunTask(!string.IsNullOrEmpty(Description) ? Description : "Publishing build results");

            if (result.Succeeded || AlwaysPublish)
            {
                DirectoryInfo srcDir = new DirectoryInfo(result.BaseFromWorkingDirectory(SourceDir));
                DirectoryInfo pubDir = new DirectoryInfo(result.BaseFromArtifactsDirectory(PublishDir));

                if (!pubDir.Exists)
                {
                    pubDir.Create();
                }
                else
                {
                    if (CleanPublishDirPriorToCopy)
                    {
                        DeleteFolder(pubDir.FullName);
                        pubDir.Create();
                    }
                }

                if (UseLabelSubDirectory)
                    pubDir = pubDir.CreateSubdirectory(result.Label);

                RecurseSubDirectories(srcDir, pubDir);

                switch (CleanUpMethod)
                {
                    case CleanupPolicy.NoCleaning:
                        break;

                    case CleanupPolicy.DeleteBuildsOlderThanXDays:
                        DeleteSubDirsOlderThanXDays(new DirectoryInfo(result.BaseFromArtifactsDirectory(PublishDir)).FullName,
                                                    CleanUpValue, result.BuildLogDirectory);
                        break;

                    case CleanupPolicy.KeepLastXBuilds:
                        KeepLastXSubDirs(new DirectoryInfo(result.BaseFromArtifactsDirectory(PublishDir)).FullName,
                                                    CleanUpValue, result.BuildLogDirectory);
                        break;

                    default:
                        throw new System.Exception(string.Format("unmapped cleaning method choosen {0}", CleanUpMethod));
                }
            }

            return true;
        }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:49,代码来源:BuildPublisher.cs

示例8: GetModificationFiles

 private string[] GetModificationFiles(IIntegrationResult result)
 {
     FileInfo fi = new FileInfo(Path.Combine(result.BaseFromArtifactsDirectory(OutputPath), Filename));
     string filespec = fi.Name.Remove(fi.Name.Length - fi.Extension.Length) + "*" + fi.Extension;
     return Directory.GetFiles(fi.DirectoryName,filespec);
 }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:6,代码来源:ModificationReaderTask.cs

示例9: Execute

        /// <summary>
        /// Run the task.
        /// </summary>
        /// <param name="result"></param>
        protected override bool Execute(IIntegrationResult result)
        {
            result.BuildProgressInformation.SignalStartRunTask(!string.IsNullOrEmpty(Description) ? Description : "Executing NDepend");

            // Make sure there is a root directory
            rootPath = BaseDirectory;
            if (string.IsNullOrEmpty(rootPath)) rootPath = result.WorkingDirectory;

            // Take a before snapshot of all the files
            var outputDirectory = RootPath(OutputDir, false);
            var oldFiles = GenerateOriginalFileList(outputDirectory);

            // Run the executable
            var info = this.CreateProcessInfo(result);
            var processResult = this.TryToRun(info, result);
            result.AddTaskResult(new ProcessTaskResult(processResult, false));
            if (processResult.TimedOut)
            {
                result.AddTaskResult(MakeTimeoutBuildResult(info));
            }
            
            if (Publish && processResult.Succeeded)
            {
                // Check for any new files
                var newFiles = ListFileDifferences(oldFiles, outputDirectory);

                if (newFiles.Length > 0)
                {
                    logger.Debug("Copying {0} new file(s)", newFiles.Length);

                    // Copy all the new files over
                    var publishDir = Path.Combine(result.BaseFromArtifactsDirectory(result.Label), "NDepend");
                    var oldLen = outputDirectory.Length + 1;
                    var lastDir = string.Empty;
                    foreach (var newFile in newFiles)
                    {
                        // Ensure the directory exists
                        var newPath = Path.Combine(publishDir, newFile.Substring(oldLen));
                        var newDir = Path.GetDirectoryName(newPath);
                        if (lastDir != newDir)
                        {
                            lastDir = newDir;
                            if (!fileSystem.DirectoryExists(newDir))
                            {
                                fileSystem.CreateDirectory(newDir);
                            }
                        }

                        // Copy the file and marge it if XML
                        if (fileSystem.FileExists(newFile))
                        {
                            fileSystem.Copy(newFile, newPath);
                            if (Path.GetExtension(newFile) == ".xml")
                            {
                                result.AddTaskResult(fileSystem.GenerateTaskResultFromFile(newFile));
                            }
                        }
                        else
                        {
                            logger.Warning("Unable to find file: " + newFile);
                        }
                    }
                }
            }

            return processResult.Succeeded;
        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:71,代码来源:NDependTask.cs

示例10: MoveFile

        /// <summary>
        /// Moves the file from its temporary (working) location to its final location.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="tempFile"></param>
        /// <returns></returns>
        /// <remarks>
        /// This method will also generate the correct name of the file.
        /// </remarks>
        private string MoveFile(IIntegrationResult result, string tempFile)
        {
            string actualFile = Path.Combine(result.Label, name);
            if (!actualFile.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase)) actualFile += ".zip";
            actualFile = result.BaseFromArtifactsDirectory(actualFile);
            if (File.Exists(actualFile)) DeleteFileWithRetry(actualFile);
            string actualFolder = Path.GetDirectoryName(actualFile);
            if (!Directory.Exists(actualFolder)) Directory.CreateDirectory(actualFolder);
            File.Move(tempFile, actualFile);

            if (!string.IsNullOrEmpty(OutputDirectory))
            {
                // Copy the file to the output directory (so it can be used by other tasks)
                var basePath = OutputDirectory;
                if (!Path.IsPathRooted(basePath)) basePath = Path.Combine(result.ArtifactDirectory, basePath);
                Log.Info(string.Format("Copying file to '{0}'", basePath));
                File.Copy(actualFile, Path.Combine(basePath, Name), true);
            }

            return actualFile;
        }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:30,代码来源:PackagePublisher.cs

示例11: ModificationFile

        private string ModificationFile(IIntegrationResult result)
        {
        	if (!AppendTimeStamp)
        		return Path.Combine(result.BaseFromArtifactsDirectory(OutputPath), Filename);

        	FileInfo fi = new FileInfo(Filename);
        	string dummy = Filename.Remove(Filename.Length - fi.Extension.Length, fi.Extension.Length);
        	string newFileName = string.Format(System.Globalization.CultureInfo.CurrentCulture,"{0}_{1}{2}", dummy, result.StartTime.ToString("yyyyMMddHHmmssfff", CultureInfo.CurrentCulture),
        	                                   fi.Extension);

        	return Path.Combine(result.BaseFromArtifactsDirectory(OutputPath), newFileName);
        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:12,代码来源:ModificationWriterTask.cs

示例12: Execute

        /// <summary>
        /// Run the task.
        /// </summary>
        /// <param name="result"></param>
        protected override bool Execute(IIntegrationResult result)
        {
            this.logger.Debug("Starting ANTS Performance Profiler task");
            result.BuildProgressInformation
                    .SignalStartRunTask(!string.IsNullOrEmpty(this.Description) ? this.Description : "Executing ANTS Performance Profiler");

            // Make sure there is a root directory
            this.rootPath = this.BaseDirectory;
            if (string.IsNullOrEmpty(this.rootPath))
            {
                this.rootPath = result.WorkingDirectory;
            }

            // Run the executable
            var info = this.CreateProcessInfo(result);
            var processResult = this.TryToRun(info, result);
            result.AddTaskResult(new ProcessTaskResult(processResult, false));
            if (processResult.TimedOut)
            {
                result.AddTaskResult(MakeTimeoutBuildResult(info));
            }

            // Publish the results
            if (this.PublishFiles) // && !processResult.Failed) - TODO: only publish files if successful
            {
                var publishDir = Path.Combine(result.BaseFromArtifactsDirectory(result.Label), "AntsPerformance");
                this.PublishFile(string.IsNullOrEmpty(this.OutputFile) ? defaultOutput : this.OutputFile, publishDir);
                this.PublishFile(this.SummaryCsvFile, publishDir);
                this.PublishFile(this.SummaryXmlFile, publishDir);
                this.PublishFile(this.SummaryHtmlFile, publishDir);
                this.PublishFile(this.CallTreeXmlFile, publishDir);
                this.PublishFile(this.CallTreeHtmlFile, publishDir);
                this.PublishFile(this.DataFile, publishDir);
            }

            return processResult.Succeeded;
        }
开发者ID:BiYiTuan,项目名称:CruiseControl.NET,代码行数:41,代码来源:AntsPerformanceProfilerTask.cs

示例13: Execute

        /// <summary>
        /// Run the task.
        /// </summary>
        /// <param name="result"></param>
        protected override bool Execute(IIntegrationResult result)
        {
            result.BuildProgressInformation.SignalStartRunTask(!string.IsNullOrEmpty(Description) ? Description : "Executing NDepend");

            // Make sure there is a root directory
            rootPath = BaseDirectory;
            if (string.IsNullOrEmpty(rootPath)) rootPath = result.WorkingDirectory;

            // Take a before snapshot of all the files
            var outputDirectory = RootPath(OutputDir, false);
            var oldFiles = GenerateOriginalFileList(outputDirectory);

            // Run the executable
            var processResult = TryToRun(CreateProcessInfo(result), result);
            result.AddTaskResult(new ProcessTaskResult(processResult, true));

            if (Publish && !processResult.Failed)
            {
                // Check for any new files
                var newFiles = ListFileDifferences(oldFiles, outputDirectory);

                if (newFiles.Length > 0)
                {
                    logger.Debug("Copying {0} new file(s)", newFiles.Length);

                    // Copy all the new files over
                    var publishDir = Path.Combine(result.BaseFromArtifactsDirectory(result.Label), "NDepend");
                    fileSystem.EnsureFolderExists(publishDir);
                    foreach (var newFile in newFiles)
                    {
                        fileSystem.Copy(newFile,
                            Path.Combine(publishDir,
                                Path.GetFileName(newFile)));

                        // Merge all XML files
                        if (Path.GetExtension(newFile) == ".xml")
                        {
                            result.AddTaskResult(fileSystem.GenerateTaskResultFromFile(newFile));
                        }
                    }
                }
            }

            return !processResult.Failed;
        }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:49,代码来源:NDependTask.cs

示例14: ModificationFile

 private string ModificationFile(IIntegrationResult result)
 {
     return Path.Combine(result.BaseFromArtifactsDirectory(OutputPath), Filename);
 }
开发者ID:vardars,项目名称:ci-factory,代码行数:4,代码来源:ModificationWriterTask.cs

示例15: SetEnvironmentVariables

 /// <summary>
 ///  Make sure this IIntegrationResult object has our environment variables set in it.
 ///  </summary>
 ///  <param name="environmentVariables">The collection of environment variables to be updated.</param>
 /// <param name="result">IntegrationResult for the command whose variables we are updating.</param>
 private void SetEnvironmentVariables(StringDictionary environmentVariables, IIntegrationResult result)
 {
     if (!string.IsNullOrEmpty(AccuRevHomeDir))
         environmentVariables["ACCUREV_HOME"] = result.BaseFromArtifactsDirectory(AccuRevHomeDir);
     if (!string.IsNullOrEmpty(AccuRevPrincipal))
         environmentVariables["ACCUREV_PRINCIPAL"] = AccuRevPrincipal;
 }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:12,代码来源:AccuRev.cs


注:本文中的IIntegrationResult.BaseFromArtifactsDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。