public void PendDelete(ILocalPath path) { var serverPath = _workspace.GetServerItemForLocalItem(path.AsString()); _workspace.Get(new GetRequest(serverPath, RecursionType.Full, VersionSpec.Latest), GetOptions.None); _workspace.PendDelete(path.AsString(), RecursionType.Full); _pendingChanges.Add(path.AsString()); }
public void Execute(IBuildContext buildContext) { try { var fileSystemAdapter = buildContext.FileSystemAdapter; var logger = buildContext.Logger; logger.Info($"Checkout for edit: {_file}"); buildContext.SourceControlAdapter.CheckoutForEdit(_file); logger.Info($"Parsing xml file : {_file}"); var xmlDoc = XDocument.Parse(fileSystemAdapter.ReadAllText(_file)); logger.Info($"Update version to {_version} for xml file : {_file}"); var versionElement = xmlDoc.Root.Element(VERSION_ELEMENT); if (versionElement == null) { versionElement = new XElement(VERSION_ELEMENT); xmlDoc.Root.AddFirst(versionElement); } versionElement.Value = _version.ToString(); logger.Info($"Writting file : {_file}"); xmlDoc.Save(_file.AsString()); } catch (Exception ex) { throw new ApplicationException($"Failed to update version for file {_file}", ex); } }
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); }
public void PendAdd(ILocalPath filePath) { if (!_tfsGateway.HasPendingChanges(filePath)) { _tfsGateway.PendAdd(filePath); } _pendingFiles.Add(filePath.AsString()); }
public void TryGetLatest(ILocalPath localPath) { var workspace = GetWorkspace(); if (!workspace.IsLocalPathMapped(localPath.AsString())) { return; } var serverPath = workspace.GetServerItemForLocalItem(localPath.AsString()); var tfsItem = workspace.VersionControlServer.GetItems(serverPath, RecursionType.None).Items.FirstOrDefault(); if (tfsItem != null) { workspace.GetFullLatest(tfsItem.ServerItem); } }
public void CheckoutForEdit(ILocalPath filePath) { if (!_tfsGateway.HasPendingChanges(filePath)) { _tfsGateway.CheckoutForEdit(filePath); } _pendingFiles.Add(filePath.AsString()); }
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()}"); } }
private IEnumerable <IVisualStudioProject> ReadVisualStudioProjects(ILocalPath inFolder) { var projects = new List <IVisualStudioProject>(); foreach (var projectInSolution in _solutionFile.ProjectsInOrder.Where(p => p.ProjectType == SolutionProjectType.KnownToBeMSBuildFormat)) { if (!this.SolutionFoldersToIgnore.Contains(projectInSolution.ParentProjectGuid) && projectInSolution.AbsolutePath.StartsWith(inFolder.AsString(), StringComparison.OrdinalIgnoreCase)) { projects.Add(new VisualStudioProject(projectInSolution.AbsolutePath)); } } return(projects); }
private IEnumerable <string> FindReferencedAssemblies(ILocalPath folderContainingAssemblies, IEnumerable <string> allUsedReferences) { var allUsedReferencesDic = allUsedReferences.Distinct().ToDictionary(r => r, StringComparer.OrdinalIgnoreCase); var assemblies = new List <string>(); foreach (var file in Directory.EnumerateFiles(folderContainingAssemblies.AsString(), "*.dll", SearchOption.AllDirectories)) { if (allUsedReferencesDic.ContainsKey(file)) { assemblies.Add(file); } } return(assemblies); }
public void DeleteFolder(ILocalPath folder) { _fileSystemManager.DeleteFolder(folder.AsString()); }
public bool HasPendingChanges(ILocalPath filePath) { return(GetWorkspace().GetPendingChanges(filePath.AsString()).Any()); }
public void CheckoutForEdit(ILocalPath localFilePath) { GetWorkspace().PendEdit(localFilePath.AsString()); }
public string AsString() { return(_localPath.AsString()); }
public IServerPath GetServerPathFromLocalPath(ILocalPath localPath) { return(CreateServerPathDescriptor(GetWorkspace().GetServerItemForLocalItem(localPath.AsString()))); }
public void PendEdit(ILocalPath path) { _workspace.PendEdit(path.AsString()); _pendingChanges.Add(path.AsString()); }
public void PendAdd(ILocalPath filePath) { GetWorkspace().PendAdd(filePath.AsString()); }
public void WriteFileContent(ILocalPath localPath, byte[] content) { _fileSystemManager.WriteFileContent(localPath.AsString(), content); }
public string ReadAllText(ILocalPath filePath) { return(_fileSystemManager.ReadAllText(filePath.AsString())); }
public bool FileExists(ILocalPath fileLocalPath) { return(_fileSystemManager.FileExists(fileLocalPath.AsString())); }
public void DownloadFolderContent(IServerPath serverPath, ILocalPath localPath, ILogger logger) { _fileSystemManager.CopyFolderContent(serverPath.AsString(), localPath.AsString()); }
public void CopyFolder(ILocalPath sourceFolder, ILocalPath targetFolder) { _fileSystemManager.CopyFolderContent(sourceFolder.AsString(), targetFolder.AsString()); }
public void CheckoutForEdit(ILocalPath filePath) { File.SetAttributes(filePath.AsString(), FileAttributes.Normal); }
public ILocalPath[] FindFiles(ILocalPath folder, string filter) { return(Directory.EnumerateFiles(folder.AsString(), filter) .Select(f => new LocalPath(f)) .ToArray()); }
public void CopyFile(ILocalPath sourceFile, ILocalPath targetFile) { _fileSystemManager.CopyFile(sourceFile.AsString(), targetFile.AsString()); }
public bool FolderExists(ILocalPath folder) { return(_fileSystemManager.FolderExists(folder.AsString())); }
public void WriteAllText(ILocalPath filePath, string fileContent) { _fileSystemManager.WriteAllText(filePath.AsString(), fileContent); }
public void WriteTextFileContent(ILocalPath localPath, string content) { _fileSystemManager.WriteAllText(localPath.AsString(), content); }
public void DeleteFile(ILocalPath targetFile) { _fileSystemManager.DeleteFile(targetFile.AsString()); }
public void ZipFolderContent(ILocalPath sourceFolder, ILocalPath resultingZipFile) { _fileSystemManager.ZipFolderContent(sourceFolder.AsString(), resultingZipFile.AsString()); }