protected virtual bool Run() { var currentDirectory = Directory.GetCurrentDirectory(); var rootRepositoryDirectory = VersionResolver.GetRootRepositoryDirectoryOf(currentDirectory); Log($"{nameof(BaseGit)}.{nameof(Run)}: current directory = {currentDirectory}, root repository directory = {rootRepositoryDirectory}"); var rawDependencies = JsonConvert.DeserializeObject <CompileDependencies>(File.ReadAllText(DependencyFile)); var userDefinedDependencies = readUserDefinedDependencies(); var userDefinedAuthentication = readUserDefinedAuth(); var dependencies = MergeDependencies(rawDependencies, userDefinedDependencies, userDefinedAuthentication); Names = dependencies.Select(d => $@"{d.OutputFolder}\build.xml").ToArray(); try { IndentLevel++; using (var myRepository = new Repository(rootRepositoryDirectory.FullName)) { foreach (var dependency in dependencies) { if (dependency.UseGit) { var cloneOptions = new CloneOptions() { CredentialsProvider = (_url, _user, _cred) => dependency.GetCredentials(Authentication) }; if (dependency.Branch == "autoversioning") { HandleAutoVersioning(myRepository, rawDependencies.ShortName, dependency, cloneOptions); } else { HandleFixedVersioning(dependency, cloneOptions); } } else { Log($"Dependency {dependency} does not use a remote repository"); } } } } finally { IndentLevel--; } return(true); }
public void TestVesionResolver_SearchForRepositoryRootFolder() { Trace.WriteLine(VersionResolver.GetRootRepositoryDirectoryOf(Directory.GetCurrentDirectory())); }