Handle timestamp based versions in kruntime itself

- This is useful when testing privates of the runtime itself.
This commit is contained in:
David Fowler 2014-01-30 02:34:44 -08:00
parent 738ab055de
commit c616eaca6f
2 changed files with 36 additions and 2 deletions

View File

@ -341,8 +341,25 @@ functions
private static string GetProjectKTargets(string packagesDir)
{
Func<string, long> getVersion = version => {
var dash = version.LastIndexOf('-');
if(dash != -1)
{
var lastToken = version.Substring(dash + 1);
if(lastToken.StartsWith("t"))
{
return Int64.Parse(lastToken.Substring(1));
}
return Int64.Parse(lastToken);
}
return Int64.MaxValue;
};
var projectK = Directory.GetDirectories(packagesDir, "ProjectK*")
.Select(p => new { Path = p, Build = Int32.Parse(p.Substring(p.LastIndexOf('-') + 1)) })
.Select(p => new { Path = p, Build = getVersion(p) })
.OrderByDescending(p => p.Build)
.FirstOrDefault();

View File

@ -16,9 +16,26 @@ command=''
nuget-install package='ProjectK' outputDir='packages' extra='-pre' once='ProjectK-NuGet'
@{
Func<string, long> getVersion = version => {
var dash = version.LastIndexOf('-');
if(dash != -1)
{
var lastToken = version.Substring(dash + 1);
if(lastToken.StartsWith("t"))
{
return Int64.Parse(lastToken.Substring(1));
}
return Int64.Parse(lastToken);
}
return Int64.MaxValue;
};
string packagesDir = Path.Combine(Directory.GetCurrentDirectory(), "packages"),
projectKDir = Directory.EnumerateDirectories(packagesDir, "ProjectK*")
.OrderByDescending(p => Int32.Parse(p.Substring(p.LastIndexOf('-') + 1)))
.OrderByDescending(getVersion)
.First();
}