Пример #1
0
        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());
        }
Пример #2
0
        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);
            }
        }
Пример #3
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);
        }
Пример #4
0
 public void PendAdd(ILocalPath filePath)
 {
     if (!_tfsGateway.HasPendingChanges(filePath))
     {
         _tfsGateway.PendAdd(filePath);
     }
     _pendingFiles.Add(filePath.AsString());
 }
Пример #5
0
        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);
            }
        }
Пример #6
0
        public void CheckoutForEdit(ILocalPath filePath)
        {
            if (!_tfsGateway.HasPendingChanges(filePath))
            {
                _tfsGateway.CheckoutForEdit(filePath);
            }

            _pendingFiles.Add(filePath.AsString());
        }
Пример #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()}");
            }
        }
Пример #8
0
        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);
        }
Пример #9
0
        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);
        }
Пример #10
0
 public void DeleteFolder(ILocalPath folder)
 {
     _fileSystemManager.DeleteFolder(folder.AsString());
 }
Пример #11
0
 public bool HasPendingChanges(ILocalPath filePath)
 {
     return(GetWorkspace().GetPendingChanges(filePath.AsString()).Any());
 }
Пример #12
0
 public void CheckoutForEdit(ILocalPath localFilePath)
 {
     GetWorkspace().PendEdit(localFilePath.AsString());
 }
Пример #13
0
 public string AsString()
 {
     return(_localPath.AsString());
 }
Пример #14
0
 public IServerPath GetServerPathFromLocalPath(ILocalPath localPath)
 {
     return(CreateServerPathDescriptor(GetWorkspace().GetServerItemForLocalItem(localPath.AsString())));
 }
Пример #15
0
 public void PendEdit(ILocalPath path)
 {
     _workspace.PendEdit(path.AsString());
     _pendingChanges.Add(path.AsString());
 }
Пример #16
0
 public void PendAdd(ILocalPath filePath)
 {
     GetWorkspace().PendAdd(filePath.AsString());
 }
Пример #17
0
 public void WriteFileContent(ILocalPath localPath, byte[] content)
 {
     _fileSystemManager.WriteFileContent(localPath.AsString(), content);
 }
Пример #18
0
 public string ReadAllText(ILocalPath filePath)
 {
     return(_fileSystemManager.ReadAllText(filePath.AsString()));
 }
Пример #19
0
 public bool FileExists(ILocalPath fileLocalPath)
 {
     return(_fileSystemManager.FileExists(fileLocalPath.AsString()));
 }
Пример #20
0
 public void DownloadFolderContent(IServerPath serverPath, ILocalPath localPath, ILogger logger)
 {
     _fileSystemManager.CopyFolderContent(serverPath.AsString(), localPath.AsString());
 }
Пример #21
0
 public void CopyFolder(ILocalPath sourceFolder, ILocalPath targetFolder)
 {
     _fileSystemManager.CopyFolderContent(sourceFolder.AsString(), targetFolder.AsString());
 }
Пример #22
0
 public void CheckoutForEdit(ILocalPath filePath)
 {
     File.SetAttributes(filePath.AsString(), FileAttributes.Normal);
 }
Пример #23
0
 public ILocalPath[] FindFiles(ILocalPath folder, string filter)
 {
     return(Directory.EnumerateFiles(folder.AsString(), filter)
            .Select(f => new LocalPath(f))
            .ToArray());
 }
Пример #24
0
 public void CopyFile(ILocalPath sourceFile, ILocalPath targetFile)
 {
     _fileSystemManager.CopyFile(sourceFile.AsString(), targetFile.AsString());
 }
Пример #25
0
 public bool FolderExists(ILocalPath folder)
 {
     return(_fileSystemManager.FolderExists(folder.AsString()));
 }
Пример #26
0
 public void WriteAllText(ILocalPath filePath, string fileContent)
 {
     _fileSystemManager.WriteAllText(filePath.AsString(), fileContent);
 }
Пример #27
0
 public void WriteTextFileContent(ILocalPath localPath, string content)
 {
     _fileSystemManager.WriteAllText(localPath.AsString(), content);
 }
Пример #28
0
 public void DeleteFile(ILocalPath targetFile)
 {
     _fileSystemManager.DeleteFile(targetFile.AsString());
 }
Пример #29
0
 public void ZipFolderContent(ILocalPath sourceFolder, ILocalPath resultingZipFile)
 {
     _fileSystemManager.ZipFolderContent(sourceFolder.AsString(), resultingZipFile.AsString());
 }