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

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