Exemple #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());
        }
Exemple #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);
            }
        }
Exemple #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);
        }
Exemple #4
0
 public void PendAdd(ILocalPath filePath)
 {
     if (!_tfsGateway.HasPendingChanges(filePath))
     {
         _tfsGateway.PendAdd(filePath);
     }
     _pendingFiles.Add(filePath.AsString());
 }
Exemple #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);
            }
        }
Exemple #6
0
        public void CheckoutForEdit(ILocalPath filePath)
        {
            if (!_tfsGateway.HasPendingChanges(filePath))
            {
                _tfsGateway.CheckoutForEdit(filePath);
            }

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