/// <summary> /// Create a build manifest for packages, blobs, and associated signing information /// </summary> /// <param name="log">MSBuild log helper</param> /// <param name="blobArtifacts">Collection of blobs</param> /// <param name="packageArtifacts">Collection of packages</param> /// <param name="assetManifestPath">Asset manifest file that should be written</param> /// <param name="manifestRepoName">Repository name</param> /// <param name="manifestBuildId">Azure devops build id</param> /// <param name="manifestBranch">Name of the branch that was built</param> /// <param name="manifestCommit">Commit that was built</param> /// <param name="manifestBuildData">Additional build data properties</param> /// <param name="isStableBuild">True if the build is stable, false otherwise.</param> /// <param name="publishingVersion">Publishing version in use.</param> /// <param name="isReleaseOnlyPackageVersion">True if this repo uses release-only package versions</param> /// <param name="signingInformationModel">Signing information.</param> public void CreateBuildManifest( IEnumerable <BlobArtifactModel> blobArtifacts, IEnumerable <PackageArtifactModel> packageArtifacts, string assetManifestPath, string manifestRepoName, string manifestBuildId, string manifestBranch, string manifestCommit, string[] manifestBuildData, bool isStableBuild, PublishingInfraVersion publishingVersion, bool isReleaseOnlyPackageVersion, SigningInformationModel signingInformationModel = null) { BuildModel model = CreateModel( blobArtifacts, packageArtifacts, manifestBuildId, manifestBuildData, manifestRepoName, manifestBranch, manifestCommit, isStableBuild, publishingVersion, isReleaseOnlyPackageVersion, signingInformationModel: signingInformationModel); _log.LogMessage(MessageImportance.High, $"Writing build manifest file '{assetManifestPath}'..."); _fileSystem.WriteToFile(assetManifestPath, model.ToXml().ToString(SaveOptions.DisableFormatting)); }
public string WriteSolution(IFileSystem fs, string script, IVisualStudioSolution solution, IList <ProjectItem> nestedItems = null) { if (nestedItems == null) { nestedItems = new List <ProjectItem>(); } var launcher = Path.Combine(fs.TempPath, "launcher-" + Guid.NewGuid().ToString() + ".sln"); if (fs.FileExists(launcher)) { fs.FileDelete(launcher); } var currentDir = fs.CurrentDirectory; var scriptcsPath = Path.Combine(fs.HostBin, "scriptcs.exe"); var scriptcsArgs = string.Format("{0} -debug -loglevel info", script); Root = new DirectoryInfo { Name = "Solution Items", FullPath = currentDir }; var projectGuid = Guid.NewGuid(); solution.AddScriptcsProject(scriptcsPath, currentDir, scriptcsArgs, false, projectGuid); GetDirectoryInfo(fs, currentDir, Root); AddDirectoryProject(solution, fs, Root, _nullGuid, nestedItems); solution.AddGlobal(projectGuid, nestedItems); fs.WriteToFile(launcher, solution.ToString()); return(launcher); }
public string WriteSolution(IFileSystem fs, string script, IVisualStudioSolution solution, IList<ProjectItem> nestedItems = null) { if (nestedItems == null) { nestedItems = new List<ProjectItem>(); } var launcher = Path.Combine(fs.TempPath, "launcher-" + Guid.NewGuid().ToString() + ".sln"); if (fs.FileExists(launcher)) { fs.FileDelete(launcher); } var currentDir = fs.CurrentDirectory; var scriptcsPath = Path.Combine(fs.HostBin, "scriptcs.exe"); var scriptcsArgs = string.Format("{0} -debug -loglevel info", script); _root = new DirectoryInfo { Name = "Solution Items", FullPath = currentDir}; var projectGuid = Guid.NewGuid(); solution.AddScriptcsProject(scriptcsPath, currentDir, scriptcsArgs, false, projectGuid); GetDirectoryInfo(fs, currentDir, _root); AddDirectoryProject(solution, fs, _root, _nullGuid, nestedItems); solution.AddGlobal(projectGuid, nestedItems); fs.WriteToFile(launcher, solution.ToString()); return launcher; }
public void Run() { RunImpl(); foreach (var entry in Content) { var fileInfo = fileSystem.GetFileInfo(Path.Combine(OutputDirectory, entry.Key)); if (!fileSystem.DirectoryExists(fileInfo.DirectoryPath)) { fileSystem.CreateDirectory(fileInfo.DirectoryPath); } fileSystem.WriteToFile(fileInfo.CompletePath, entry.Value); } }
public bool ExecuteTask(IFileSystem fileSystem, IBuildModelFactory buildModelFactory) { try { PublishingInfraVersion targetPublishingVersion = PublishingInfraVersion.Legacy; if (!string.IsNullOrEmpty(PublishingVersion)) { if (!Enum.TryParse(PublishingVersion, ignoreCase: true, out targetPublishingVersion)) { Log.LogError($"Could not parse '{PublishingVersion}' as a valid publishing infrastructure version."); return(false); } } var buildModel = buildModelFactory.CreateModelFromItems( Artifacts, ItemsToSign, StrongNameSignInfo, FileSignInfo, FileExtensionSignInfo, CertificatesSignInfo, BuildId, BuildData, RepoUri, RepoBranch, RepoCommit, IsStableBuild, targetPublishingVersion, IsReleaseOnlyPackageVersion); Log.LogMessage(MessageImportance.High, $"Writing build manifest file '{OutputPath}'..."); fileSystem.WriteToFile(OutputPath, buildModel.ToXml().ToString()); } catch (Exception e) { Log.LogErrorFromException(e, true); } return(!Log.HasLoggedErrors); }
public void Compose(string workingDirectory, StringBuilder builder = null) { if (string.IsNullOrWhiteSpace(ScriptLibrariesFile)) { return; } var packagesPath = Path.Combine(workingDirectory, _fileSystem.PackagesFolder); var packageScriptsPath = Path.Combine(packagesPath, ScriptLibrariesFile); if (!_fileSystem.DirectoryExists(packagesPath) || _fileSystem.FileExists(packageScriptsPath)) { return; } if (builder == null) { builder = new StringBuilder(); } var namespaces = new List <string>(); var references = new List <string>(); var packageReferences = _packageAssemblyResolver.GetPackages(workingDirectory); foreach (var reference in packageReferences) { ProcessPackage(packagesPath, reference, builder, references, namespaces); } foreach (var ns in namespaces) { builder.Insert(0, String.Format("using {0};{1}", ns, Environment.NewLine)); } foreach (var reference in references) { builder.Insert(0, String.Format("#r {0}{1}", reference, Environment.NewLine)); } _fileSystem.WriteToFile(packageScriptsPath, builder.ToString()); }
public string CreateBuildFile() { //create complile batch file _fileSystem.WriteToFile(GetBatchFileContents(), BatchfileCompilePath); return(BatchfileCompilePath); }
public void Execute(IFileSystem fileSystem) { fileSystem.WriteToFile(this.fullPath, this.contents); }