コード例 #1
0
        public void Execute(IInstallerBuildContext context)
        {
            var path = _toFolder.Subpath(Constants.LatestTxt);

            context.Logger.Info($"Writting content for {path.AsString()}");
            context.FileSystemAdapter.WriteTextFileContent(path, _content);
        }
コード例 #2
0
        public void Execute(IInstallerBuildContext buildContext)
        {
            var sourceFolder = buildContext.BuildConfiguration.InstallerProjectPath
                               .Subpath("bin")
                               .Subpath("Debug");

            buildContext.BuildConfiguration.InstallerDeliveryFolder.Do(
                targetFolder =>
            {
                buildContext.Logger.Info($"Deliver installer to {targetFolder.AsString()}");

                if (_isCustomizedInstaller)
                {
                    targetFolder = targetFolder.Subpath("Customized");
                }
                else
                {
                    targetFolder = targetFolder.Subpath("Regular");
                }

                targetFolder = targetFolder.Subpath(_installerVersion.ToString());

                buildContext.FileSystemAdapter.CopyFolder(sourceFolder, targetFolder);
            });
        }
コード例 #3
0
 public void Execute(IInstallerBuildContext context)
 {
     context.Logger.Info($"Start download component from {_component.DistributionFolder.AsString()}");
     context.SourceControlAdapter.DownloadFolderContent(_component.DistributionFolder,
                                                        _toFolder.Subpath(_component.ComponentID),
                                                        context.Logger);
 }
コード例 #4
0
        public void Execute(IInstallerBuildContext context)
        {
            var zipFileFullPath = context.BuildConfiguration.InstallerProjectPath.Subpath(Constants.GGPFullBuildZip);

            context.Logger.Info($"Zipping folder {_sourceFolder.AsString()} to {zipFileFullPath.AsString()}");
            context.FileSystemAdapter.ZipFolderContent(_sourceFolder, zipFileFullPath);
        }
コード例 #5
0
        public void Execute(IInstallerBuildContext context)
        {
            var sourceControlFolder = context.BuildConfiguration.GGPApprovalSystemSourceCodeFolder;

            context.Logger.Info($"Get Latest for {sourceControlFolder.AsString()}");

            context.SourceControlAdapter.GetLatest(sourceControlFolder);
        }
コード例 #6
0
        public void Execute(IInstallerBuildContext buildContext)
        {
            var csprojFiles = buildContext.FileSystemAdapter.FindFiles(buildContext.BuildConfiguration.InstallerProjectPath, "*.csproj");

            if (csprojFiles.Length == 0)
            {
                throw new ApplicationException($"Can't find a project file in {buildContext.BuildConfiguration.InstallerProjectPath.AsString()}");
            }

            if (csprojFiles.Length > 1)
            {
                throw new ApplicationException($"Too many project files detected in {buildContext.BuildConfiguration.InstallerProjectPath.AsString()}");
            }


            var csProjFile = csprojFiles.First().AsString();

            buildContext.Logger.Info($"Compiling {csProjFile}");

            var buildRequestData = new Microsoft.Build.Execution.BuildRequestData(csProjFile,
                                                                                  buildContext.BuildConfiguration.GlobalProperties,
                                                                                  null,
                                                                                  new string[] { "Build" },
                                                                                  null);

            var buildParameters = new Microsoft.Build.Execution.BuildParameters()
            {
                Loggers = new Microsoft.Build.Framework.ILogger[] { new CompileActionLogger(buildContext.Logger) }
            };

            var buildResult = Microsoft.Build.Execution.BuildManager.DefaultBuildManager.Build(buildParameters, buildRequestData);

            if (buildResult.Exception != null)
            {
                buildContext.Logger.Exception("MSBuild exception: ", buildResult.Exception);
            }

            if (buildResult.OverallResult == Microsoft.Build.Execution.BuildResultCode.Failure)
            {
                throw new ApplicationException("Compile action failed! See previous errors for more details!");
            }
        }
コード例 #7
0
        public void Execute(IInstallerBuildContext context)
        {
            context.Logger.Info($"Clean up temp folder {_tempFolder.AsString()}");
            try
            {
                if (context.FileSystemAdapter.FolderExists(_tempFolder))
                {
                    context.FileSystemAdapter.DeleteFolder(_tempFolder);
                }
            }
            catch (Exception ex)
            {
                if (_throwIfFails)
                {
                    context.Logger.Exception($"Failed to delete temp folder {_tempFolder.AsString()}!", ex);
                    throw;
                }

                context.Logger.Warning($"Failed to delete temp folder {_tempFolder.AsString()}! Exception details: {ex.ToString()}");
            }
        }