Add a way to exclude repositories from having the src folder deleted

This commit is contained in:
Victor Hurdugaci 2016-03-17 10:40:52 -07:00
parent ab72ba5056
commit 1567a40629
1 changed files with 20 additions and 1 deletions

View File

@ -30,6 +30,7 @@ functions
// Doesn't build on Mono since their contracts don't match
string[] repositories = GetRepositoriesToBuild().ToArray();
string[] noSrcRepositoryExclude = GetNoSrcDeleteRepositories().ToArray();
static bool useHttps = UseHttps(BASE_DIR);
static string gitHubUriPrefix = useHttps ? "https://github.com/aspnet/" : "git@github.com:aspnet/";
@ -204,7 +205,14 @@ var buildTarget = "compile"
@{
foreach (var repo in GetRepositoriesToBuild())
{
RemoveSrcFolder(repo);
if (!noSrcRepositoryExclude.Contains(repo))
{
RemoveSrcFolder(repo);
}
else
{
Console.WriteLine("Keeping the sources for " + repo + " because it's explicitly excluded");
}
}
}
@ -933,6 +941,17 @@ functions
return reposToBuild.ToList();
}
static IEnumerable<string> GetNoSrcDeleteRepositories()
{
var repositoryExclude = Environment.GetEnvironmentVariable("KOREBUILD_NOSRC_EXCLUDE");
if (string.IsNullOrEmpty(repositoryExclude))
{
return new string[0];
}
return repositoryExclude.Split(new string[] {","}, StringSplitOptions.RemoveEmptyEntries);
}
static IList<IGrouping<int, string>> GetBuildGraph()
{