Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
aea5a444
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aea5a444
编写于
6月 10, 2016
作者:
T
Tomas Matousek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Generalize the version update script, add support for LKG
上级
40784492
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
58 addition
and
62 deletion
+58
-62
build/scripts/update_dependencies.csx
build/scripts/update_dependencies.csx
+48
-62
dependencies.xml
dependencies.xml
+10
-0
未找到文件。
build/scripts/
fxupdate
.csx
→
build/scripts/
update_dependencies
.csx
浏览文件 @
aea5a444
#r "System.Net.Http.dll"
#r "System.Xml.Linq"
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using System.Xml.Linq;
var knownRepos = new[] { "coreclr", "corefx", "projectk-tfs", "symreader" };
bool lkg = Args.Remove("/lkg");
bool help = Args.Remove("/help") || Args.Remove("/?");
if (
Args.Count < 1
)
if (
help || Args.Count > 0
)
{
Console.Error.WriteLine("Usage: fxupdate <Roslyn branch> [/c:<repo>=<commit-sha1>]");
Console.Error.WriteLine($"Where <repo> is name of a repo: {string.Join(", ", knownRepos)}");
return 1;
}
string roslynBranch = Args[0];
var commits =
Args.Skip(1).Where(a => a.StartsWith("/c:")).Select(a => a.Substring("/c:".Length)).
ToDictionary(k => k.Split('=')[0].Trim(), k => k.Split('=')[1].Trim(), StringComparer.OrdinalIgnoreCase);
string unknownRepo = commits.Keys.FirstOrDefault(k => !knownRepos.Contains(k));
if (unknownRepo != null)
{
Console.Error.WriteLine($"Unknown repo: {unknownRepo}");
Console.Error.WriteLine("Usage: fxupdate [/help] [/lkg]");
Console.Error.WriteLine();
Console.Error.WriteLine($"/lkg ... if specified the script uses the package versions specified in LKG_Packages.txt files in dotnet/versions repo");
return 1;
}
string GetScriptPath([CallerFilePath]string path = null) => path;
string roslynRoot = Path.GetFullPath(Path.Combine(GetScriptPath(), "..", "..", ".."));
string coreFxChannel, coreClrChannel, symReaderChannel, projectkChannel;
switch (roslynBranch)
{
case "master":
case "future-stabilization":
coreFxChannel = coreClrChannel = projectkChannel = symReaderChannel = "master";
break;
case "stabilization":
coreFxChannel = coreClrChannel = projectkChannel = "release/1.0.0";
symReaderChannel = "netcore1.0";
break;
default:
Console.Error.WriteLine($"Error: Unexpected branch name: '{roslynBranch}'.");
return 2;
}
// fetch latest CoreCLR and CoreFX package versions:
string specPath = Path.Combine(roslynRoot, "dependencies.xml");
var spec = XDocument.Load(specPath);
var repos = spec.Element("dependencies").Elements("repo");
var client = new HttpClient();
IEnumerable<KeyValuePair<string, string>> ParsePackageVersions(string content) =>
...
...
@@ -79,8 +53,7 @@ string GetCommonVersionSuffix(IEnumerable<KeyValuePair<string, string>> packages
async Task<string> DownloadPackageList(string repo, string channel)
{
string versionsUrl = "https://raw.githubusercontent.com/dotnet/versions";
string commit = commits.ContainsKey(repo) ? "blob/" + commits[repo] : "master";
string url = $"{versionsUrl}/{commit}/build-info/dotnet/{repo}/{channel}/Latest_Packages.txt";
string url = $"{versionsUrl}/master/build-info/dotnet/{repo}/{channel}/{(lkg ? "LKG" : "Latest")}_Packages.txt";
try
{
...
...
@@ -96,25 +69,30 @@ async Task<string> DownloadPackageList(string repo, string channel)
}
}
Write("Downloading list of CoreFX packages...");
var coreFXPackages = ParsePackageVersions(await DownloadPackageList("corefx", coreFxChannel));
var coreFXVersionSuffix = GetCommonVersionSuffix(coreFXPackages);
WriteLine($"Done. Version suffix: {coreFXVersionSuffix}");
var allPackages = new List<KeyValuePair<string, string>>();
var suffixes = new List<KeyValuePair<string, string>>();
Write("Downloading list of ProjectK packages ...");
var projectkPackages = ParsePackageVersions(await DownloadPackageList("projectk-tfs", projectkChannel));
WriteLine("Done.");
foreach (var repo in repos)
{
string name = repo.Attribute("name").Value;
string channel = repo.Attribute("channel").Value;
string commonVersionSuffix = repo.Attribute("commonVersionSuffix")?.Value;
Write("Downloading list of CoreCLR packages ...");
var coreClrPackages = ParsePackageVersions(await DownloadPackageList("coreclr", coreClrChannel));
var coreClrVersionSuffix = GetCommonVersionSuffix(coreClrPackages);
WriteLine($"Done. Version suffix: {coreClrVersionSuffix}");
WriteLine($"Downloading list of '{name}' packages...");
var packages = ParsePackageVersions(await DownloadPackageList(name, channel)).ToArray();
Write("Downloading list of SymReader packages ...");
var symReaderPackages = ParsePackageVersions(await DownloadPackageList("symreader", symReaderChannel));
WriteLine("Done.");
WriteLine($" Found {packages.Length} packages.");
var packages = coreFXPackages.Concat(projectkPackages).Concat(coreClrPackages).Concat(symReaderPackages).ToArray();
if (commonVersionSuffix != null)
{
var suffix = GetCommonVersionSuffix(packages);
suffixes.Add(new KeyValuePair<string, string>(commonVersionSuffix, suffix));
WriteLine($" Version suffix: '{suffix}'");
}
allPackages.AddRange(packages);
WriteLine("Done.");
}
WriteLine("Updating project.json files ...");
...
...
@@ -127,7 +105,7 @@ void UpdateProjectJsonFiles(string root)
string originalText = File.ReadAllText(filePath);
string text = originalText;
foreach (var package in
p
ackages)
foreach (var package in
allP
ackages)
{
// only update pre-release versions
text = Regex.Replace(
...
...
@@ -154,19 +132,26 @@ UpdateProjectJsonFiles(Path.Combine(roslynRoot, "build"));
WriteLine("Done.");
WriteLine("Updating VSL.Versions.targets ...");
void UpdateTargetsFile(string path)
{
Write("Updating VSL.Versions.targets ... ");
string originalText = File.ReadAllText(path);
string newText = originalText;
newText = UpdateVersionElement(newText, "CoreFXVersionSuffix", coreFXVersionSuffix);
newText = UpdateVersionElement(newText, "CoreClrVersionSuffix", coreClrVersionSuffix);
foreach (var suffix in suffixes)
{
newText = UpdateVersionElement(newText, suffix.Key, suffix.Value);
}
if (originalText != newText)
{
File.WriteAllText(path, newText);
Console.WriteLine("UPDATED");
}
else
{
Console.WriteLine("OK");
}
}
...
...
@@ -178,7 +163,8 @@ string UpdateVersionElement(string text, string elementName, string newValue)
$"<{elementName}>{newValue}</{elementName}>");
}
UpdateTargetsFile(Path.Combine(roslynRoot, "build", "Targets", "VSL.Versions.targets"));
WriteLine("Done.");
if (suffixes.Count > 0)
{
UpdateTargetsFile(Path.Combine(roslynRoot, "build", "Targets", "VSL.Versions.targets"));
}
dependencies.xml
0 → 100644
浏览文件 @
aea5a444
<!--
Lists dotnet repos containing packages this repo depends on.
The latest and LKG versions of these dependencies are maintained on github.com/dotnet/versions.
-->
<dependencies>
<repo
name=
"corefx"
channel=
"master"
commonVersionSuffix=
"CoreFXVersionSuffix"
/>
<repo
name=
"coreclr"
channel=
"master"
commonVersionSuffix=
"CoreClrVersionSuffix"
/>
<repo
name=
"projectk-tfs"
channel=
"master"
/>
<repo
name=
"symreader"
channel=
"master"
/>
</dependencies>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录