Changes to support reseting master to release
This commit is contained in:
parent
6f7e62201b
commit
f3d544bc1f
187
makefile.shade
187
makefile.shade
|
|
@ -6,44 +6,48 @@ use namespace='System'
|
||||||
use namespace='System.IO'
|
use namespace='System.IO'
|
||||||
use namespace='System.Collections.Generic'
|
use namespace='System.Collections.Generic'
|
||||||
use namespace='System.Net'
|
use namespace='System.Net'
|
||||||
|
use namespace='System.Linq'
|
||||||
use namespace='System.Text.RegularExpressions'
|
use namespace='System.Text.RegularExpressions'
|
||||||
use import="BuildEnv"
|
use import="BuildEnv"
|
||||||
|
|
||||||
default BASE_DIR='${Directory.GetCurrentDirectory()}'
|
functions
|
||||||
default TARGET_DIR='${Path.Combine(BASE_DIR, "artifacts", "build")}'
|
@{
|
||||||
|
static string BASE_DIR = Directory.GetCurrentDirectory();
|
||||||
var useHttps='${UseHttps(BASE_DIR)}'
|
static string TARGET_DIR = Path.Combine(BASE_DIR, "artifacts", "build");
|
||||||
var gitHubUriPrefix='${useHttps ? "https://github.com/aspnet/" : "git@github.com:aspnet/"}'
|
string[] repos = new[] {
|
||||||
var repos='${new[] {
|
// The repos list is topologically sorted based on build order
|
||||||
// The repos list is topologically sorted based on build order
|
"Configuration",
|
||||||
"Configuration",
|
"DataCommon",
|
||||||
"DataCommon",
|
"DataCommon.SQLite",
|
||||||
"DataCommon.SQLite",
|
"DataProtection",
|
||||||
"DataProtection",
|
"DependencyInjection",
|
||||||
"DependencyInjection",
|
"Options",
|
||||||
"Options",
|
"Logging",
|
||||||
"Logging",
|
"Testing",
|
||||||
"Testing",
|
"Diagnostics",
|
||||||
"Diagnostics",
|
"EntityFramework",
|
||||||
"EntityFramework",
|
"FileSystem",
|
||||||
"FileSystem",
|
"WebSocketAbstractions",
|
||||||
"WebSocketAbstractions",
|
"HttpAbstractions",
|
||||||
"HttpAbstractions",
|
"Hosting",
|
||||||
"Hosting",
|
"Helios",
|
||||||
"Helios",
|
"Identity",
|
||||||
"Identity",
|
"Razor",
|
||||||
"Razor",
|
"Routing",
|
||||||
"Routing",
|
"Mvc",
|
||||||
"Mvc",
|
"Scaffolding",
|
||||||
"Scaffolding",
|
"Security",
|
||||||
"Security",
|
"SignalR-Server",
|
||||||
"SignalR-Server",
|
"StaticFiles",
|
||||||
"StaticFiles",
|
"WebListener",
|
||||||
"WebListener",
|
"KestrelHttpServer",
|
||||||
"KestrelHttpServer",
|
"WebSockets",
|
||||||
"WebSockets",
|
"Entropy",
|
||||||
"Entropy",
|
};
|
||||||
}}'
|
|
||||||
|
static bool useHttps = UseHttps(BASE_DIR);
|
||||||
|
static string gitHubUriPrefix = useHttps ? "https://github.com/aspnet/" : "git@github.com:aspnet/";
|
||||||
|
}
|
||||||
|
|
||||||
@{
|
@{
|
||||||
var kBuildVersion = Environment.GetEnvironmentVariable("K_BUILD_VERSION");
|
var kBuildVersion = Environment.GetEnvironmentVariable("K_BUILD_VERSION");
|
||||||
|
|
@ -74,33 +78,7 @@ var repos='${new[] {
|
||||||
@{
|
@{
|
||||||
foreach(var repo in repos)
|
foreach(var repo in repos)
|
||||||
{
|
{
|
||||||
var repoUrl = gitHubUriPrefix + repo + ".git";
|
CloneOrUpdate(repo);
|
||||||
if(Directory.Exists(repo))
|
|
||||||
{
|
|
||||||
GitPull(repoUrl, "dev", repo);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (useHttps &&
|
|
||||||
!IsAccessible(repo))
|
|
||||||
{
|
|
||||||
Log.Warn(string.Format("The repo at '{0}' is not accessible. If you do not have access to this repository, skip the git prompt" +
|
|
||||||
" for credentials to skip cloning this repository. To avoid this prompt, re-clone the Universe repository over ssh.",
|
|
||||||
repoUrl));
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
GitClone(repoUrl, "dev");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Log.Warn(string.Format("Unable to clone repository at '{0}': {1}", repoUrl, ex.Message));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
GitConfig("bugtraq.url", "http://github.com/aspnet/" + repo + "/issues/%BUGID%", repo);
|
|
||||||
GitConfig("bugtraq.logregex", @"#(\d+)", repo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -132,32 +110,14 @@ var repos='${new[] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#init-release
|
#reset-master
|
||||||
var templatePath = '${Path.Combine(BASE_DIR, "build-template")}'
|
-// Resets master branch to release
|
||||||
var fileName = 'NuGet.Config'
|
for each='var repo in GetAllRepos()'
|
||||||
for each='var repo in repos'
|
-CloneOrUpdate(repo);
|
||||||
var targetFile = '${Path.Combine(Directory.GetCurrentDirectory(), repo, fileName)}'
|
|
||||||
var sourceFile = '${Path.Combine(Directory.GetCurrentDirectory(), templatePath, fileName)}'
|
|
||||||
var gitFolder = '${repo}'
|
var gitFolder = '${repo}'
|
||||||
|
git gitCommand='fetch origin'
|
||||||
-// get latest dev and create new release
|
git gitCommand='checkout origin/release -B master'
|
||||||
git gitCommand='checkout dev'
|
|
||||||
git gitCommand='pull origin dev'
|
|
||||||
git gitCommand='checkout -b release dev'
|
|
||||||
|
|
||||||
-// alter and commit release NuGet.Config
|
|
||||||
-File.Copy(sourceFile, targetFile, true);
|
|
||||||
update-file updateFile="${targetFile}"
|
|
||||||
-updateText = updateText.Replace("/F/aspnetvnext/", "/F/aspnetrelease/");
|
|
||||||
git gitCommand='add NuGet.Config'
|
|
||||||
git gitCommand='commit -m "Updating release Nuget.config"'
|
|
||||||
|
|
||||||
-// alter dev NuGet.Config and phantom merge release branch
|
|
||||||
git gitCommand='checkout dev'
|
|
||||||
git gitCommand='merge release'
|
|
||||||
-File.Copy(sourceFile, targetFile, true);
|
|
||||||
git gitCommand='add NuGet.Config'
|
|
||||||
git gitCommand='commit -m "Updating dev Nuget.config"'
|
|
||||||
|
|
||||||
#only-compile target='compile'
|
#only-compile target='compile'
|
||||||
@{
|
@{
|
||||||
|
|
@ -265,12 +225,12 @@ macro name='Exec' program='string' commandline='string' workingdir='string'
|
||||||
|
|
||||||
functions
|
functions
|
||||||
@{
|
@{
|
||||||
bool UseHttps(string directory)
|
static bool UseHttps(string directory)
|
||||||
{
|
{
|
||||||
var filename = Path.Combine(directory, ".git", "config");
|
var filename = Path.Combine(directory, ".git", "config");
|
||||||
if (!File.Exists(filename))
|
if (!File.Exists(filename))
|
||||||
{
|
{
|
||||||
Log.Warn(string.Format("Unable to find '{0}' file", filename));
|
Console.WriteLine("Unable to find '{0}' file", filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -280,7 +240,7 @@ functions
|
||||||
|
|
||||||
// Perform equivalent of `git config remote.origin.url` but directly
|
// Perform equivalent of `git config remote.origin.url` but directly
|
||||||
// read config file to get value.
|
// read config file to get value.
|
||||||
string ReadOriginUrl(string filename)
|
static string ReadOriginUrl(string filename)
|
||||||
{
|
{
|
||||||
// Subsection portion of configuration name is case-sensitive; rest
|
// Subsection portion of configuration name is case-sensitive; rest
|
||||||
// of name is case-insensitive.
|
// of name is case-insensitive.
|
||||||
|
|
@ -313,7 +273,7 @@ functions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Warn(string.Format("Unable to parse '{0}' file", filename));
|
Console.WriteLine("Unable to parse '{0}' file", filename);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -347,4 +307,49 @@ functions
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IEnumerable<string> GetAllRepos()
|
||||||
|
{
|
||||||
|
var nonDefaultRepos = new[]
|
||||||
|
{
|
||||||
|
"KRuntime",
|
||||||
|
"Claims",
|
||||||
|
"DataAnnotations",
|
||||||
|
"SqlClient",
|
||||||
|
"MusicStore"
|
||||||
|
};
|
||||||
|
return Enumerable.Concat(repos, nonDefaultRepos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CloneOrUpdate(string repo)
|
||||||
|
{
|
||||||
|
var repoUrl = gitHubUriPrefix + repo + ".git";
|
||||||
|
|
||||||
|
if(Directory.Exists(repo))
|
||||||
|
{
|
||||||
|
GitPull(repoUrl, "dev", repo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (useHttps &&
|
||||||
|
!IsAccessible(repo))
|
||||||
|
{
|
||||||
|
Log.Warn(string.Format("The repo at '{0}' is not accessible. If you do not have access to this repository, skip the git prompt" +
|
||||||
|
" for credentials to skip cloning this repository. To avoid this prompt, re-clone the Universe repository over ssh.",
|
||||||
|
repoUrl));
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GitClone(repoUrl, "dev");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warn(string.Format("Unable to clone repository at '{0}': {1}", repoUrl, ex.Message));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GitConfig("bugtraq.url", "http://github.com/aspnet/" + repo + "/issues/%BUGID%", repo);
|
||||||
|
GitConfig("bugtraq.logregex", @"#(\d+)", repo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue