private void ApplyConfigTransforms(string sourceFile, string suffix, IFileOperationsExecuter fileOps,
                                           HashSet <string> alreadyRun)
        {
            if (!suffix.EndsWith(".config", StringComparison.OrdinalIgnoreCase))
            {
                suffix = suffix + ".config";
            }

            // Update the extension of the found config to the suffix extensions
            string transformFile = Path.ChangeExtension(sourceFile, suffix);

            // Try and find the transform config to apply to the source file
            if ((fileOps.FileExists(transformFile) &&
                 !string.Equals(sourceFile, transformFile, StringComparison.InvariantCultureIgnoreCase)) &&
                !alreadyRun.Contains(transformFile))
            {
                alreadyRun.Add(transformFile);

                var transformExePath = Path.Combine(fileOps.GetBaseWorkingDirectory(),
                                                    @"ExtTemp\WindowsSDK\Resources\ctt.exe");

                if (!fileOps.FileExists(transformExePath))
                {
                    throw new FileNotFoundException("ctt.exe could not be found on the agent.", transformExePath);
                }

                // Get all the arguments that form the executable transform task
                var arguments = BuildArguments(sourceFile, transformFile);

                LogInformation("Performing XDT transform...");

                // Call the transform executable for the file
                ExecuteCommandLine(transformExePath, arguments);
            }
        }
            public RemoteTemporaryFile(IFileOperationsExecuter fileOps, ILogSink log)
            {
                this.fileOps = fileOps;
                this.log     = log;

                string workingDirectory = fileOps.GetBaseWorkingDirectory();
                string fileName         = Guid.NewGuid().ToString("n");

                this.Path = fileOps.CombinePath(workingDirectory, fileName);
            }
        private static string GetBuildMasterExecutionBaseWorkingDirectory(IFileOperationsExecuter agent, IOperationExecutionContext context)
        {
            if (agent == null)
            {
                throw new ArgumentNullException(nameof(agent));
            }
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var relativePath = "_E" + context.ExecutionId;

            return(agent.CombinePath(agent.GetBaseWorkingDirectory(), relativePath));
        }
Exemple #4
0
 public static string GetFullRepositoryPath(this IGitRepository repo, IFileOperationsExecuter agent)
 {
     return(agent.CombinePath(agent.GetBaseWorkingDirectory(), "GitRepositories", repo.RepositoryPath));
 }
Exemple #5
0
 public static string GetFullRepositoryPath(this IGitRepository repo, IFileOperationsExecuter agent)
 {
     return agent.CombinePath(agent.GetBaseWorkingDirectory(), "GitRepositories", repo.RepositoryPath);
 }