зеркало из https://github.com/mono/SkiaSharp.git
Updated the docs scripts
This commit is contained in:
Родитель
1a6c51c9bd
Коммит
c82d3df609
114
build.cake
114
build.cake
|
@ -1,13 +1,14 @@
|
|||
// #addin nuget:https://ci.appveyor.com/nuget/cake-monoapitools-gunq9ba46ljl?package=Cake.MonoApiTools&version=2.0.0-preview2
|
||||
#addin nuget:?package=Cake.Xamarin&version=3.0.0
|
||||
#addin nuget:?package=Cake.XCode&version=4.0.0
|
||||
#addin nuget:?package=Cake.FileHelpers&version=3.0.0
|
||||
#addin nuget:?package=SharpCompress&version=0.22.0
|
||||
#addin nuget:?package=Newtonsoft.Json&version=11.0.2
|
||||
#addin nuget:https://ci.appveyor.com/nuget/cake-monoapitools-gunq9ba46ljl?package=Cake.MonoApiTools&version=2.0.0-preview2
|
||||
#addin nuget:https://ci.appveyor.com/nuget/nugetcomparer-mmjynpq6dcr9?package=Mono.ApiTools.NuGetDiff&version=1.0.0-preview-19&loaddependencies=true
|
||||
|
||||
// #tool nuget:?package=xunit.runner.console&version=2.4.0
|
||||
// #tool nuget:?package=mdoc&version=5.7.2
|
||||
|
||||
#reference "tools/SharpCompress/lib/net45/SharpCompress.dll"
|
||||
#reference "tools/Newtonsoft.Json/lib/net45/Newtonsoft.Json.dll"
|
||||
#tool "nuget:?package=xunit.runner.console&version=2.4.0"
|
||||
#tool "nuget:?package=mdoc&version=5.7.2"
|
||||
#tool "nuget:?package=vswhere&version=2.5.2"
|
||||
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
|
@ -19,6 +20,9 @@ using SharpCompress.Common;
|
|||
using SharpCompress.Readers;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Mono.ApiTools;
|
||||
using NuGet.Packaging;
|
||||
using NuGet.Versioning;
|
||||
|
||||
#load "cake/Utils.cake"
|
||||
|
||||
|
@ -47,6 +51,7 @@ DirectoryPath SKIA_PATH = MakeAbsolute(ROOT_PATH.Combine("externals/skia"));
|
|||
DirectoryPath ANGLE_PATH = MakeAbsolute(ROOT_PATH.Combine("externals/angle"));
|
||||
DirectoryPath HARFBUZZ_PATH = MakeAbsolute(ROOT_PATH.Combine("externals/harfbuzz"));
|
||||
DirectoryPath DOCS_PATH = MakeAbsolute(ROOT_PATH.Combine("docs/xml"));
|
||||
DirectoryPath PACKAGE_CACHE_PATH = MakeAbsolute(ROOT_PATH.Combine("externals/package_cache"));
|
||||
|
||||
DirectoryPath PROFILE_PATH = EnvironmentVariable ("USERPROFILE") ?? EnvironmentVariable ("HOME");
|
||||
DirectoryPath NUGET_PACKAGES = EnvironmentVariable ("NUGET_PACKAGES") ?? PROFILE_PATH.Combine (".nuget/packages");
|
||||
|
@ -63,6 +68,14 @@ if (string.IsNullOrEmpty (BUILD_NUMBER)) {
|
|||
BUILD_NUMBER = "0";
|
||||
}
|
||||
|
||||
var TRACKED_NUGETS = new Dictionary<string, Version> {
|
||||
{ "SkiaSharp", new Version (1, 57, 0) },
|
||||
{ "SkiaSharp.Views", new Version (1, 57, 0) },
|
||||
{ "SkiaSharp.Views.Forms", new Version (1, 57, 0) },
|
||||
{ "HarfBuzzSharp", new Version (1, 0, 0) },
|
||||
{ "SkiaSharp.HarfBuzz", new Version (1, 57, 0) },
|
||||
};
|
||||
|
||||
#load "cake/UtilsManaged.cake"
|
||||
#load "cake/BuildExternals.cake"
|
||||
#load "cake/UpdateDocs.cake"
|
||||
|
@ -169,10 +182,10 @@ Task ("tests")
|
|||
if (changed) {
|
||||
xdoc.Save (netCoreTestProj);
|
||||
}
|
||||
CleanDirectories ("./externals/packages/skiasharp*");
|
||||
CleanDirectories ("./externals/packages/harfbuzzsharp*");
|
||||
CleanDirectories ("./tests/packages/skiasharp*");
|
||||
CleanDirectories ("./tests/packages/harfbuzzsharp*");
|
||||
EnsureDirectoryExists ("./output/tests/netcore");
|
||||
RunMSBuildRestoreLocal (netCoreTestProj);
|
||||
RunMSBuildRestoreLocal (netCoreTestProj, "./tests/packages");
|
||||
RunNetCoreTests (netCoreTestProj, null);
|
||||
CopyFileToDirectory ("./tests/SkiaSharp.NetCore.Tests/TestResult.xml", "./output/tests/netcore");
|
||||
});
|
||||
|
@ -379,89 +392,6 @@ Task ("nuget")
|
|||
}
|
||||
});
|
||||
|
||||
// Task ("api-diff")
|
||||
// .Does (() =>
|
||||
// {
|
||||
// var ids = new List<string> {
|
||||
// "skiasharp",
|
||||
// // "skiasharp.views",
|
||||
// // "skiasharp.views.forms",
|
||||
// // "harfbuzzsharp",
|
||||
// // "skiasharp.harfbuzz",
|
||||
// };
|
||||
//
|
||||
// try {
|
||||
//
|
||||
// foreach (var nuget in ids) {
|
||||
// Information ($"Comparing the assemblies in '{nuget}'...");
|
||||
//
|
||||
// // find the latest version for this id
|
||||
// var version = "0.0";
|
||||
// var mdFile = DownloadFile ($"https://api.nuget.org/v3/registration3/{nuget.ToLower()}/index.json");
|
||||
// var mdObj = JObject.Parse (FileReadText (mdFile));
|
||||
// foreach (var package in mdObj ["items"] [0] ["items"]) {
|
||||
// var v = (string) package ["catalogEntry"] ["version"];
|
||||
// if (!v.Contains("-") && Version.Parse (v) > Version.Parse (version))
|
||||
// version = v;
|
||||
// }
|
||||
//
|
||||
// // download nugets
|
||||
// var tempPath = $"./externals/api-diff/{nuget}.{version}";
|
||||
// var oldDest = $"{tempPath}/{nuget}.{version}.nupkg";
|
||||
// if (!FileExists (oldDest)) {
|
||||
// CleanDirectories (tempPath);
|
||||
// EnsureDirectoryExists (tempPath);
|
||||
//
|
||||
// var url = $"https://api.nuget.org/v3-flatcontainer/{nuget}/{version}/{nuget}.{version}.nupkg";
|
||||
// DownloadFile (url, oldDest);
|
||||
// Unzip (oldDest, tempPath);
|
||||
// }
|
||||
//
|
||||
// // find the dlls
|
||||
// var oldDlls = GetFiles ($"{tempPath}/lib/*/*.dll");
|
||||
// var newDlls = GetFiles ($"./output/{nuget}/nuget/lib/*/*.dll");
|
||||
// var oldPlatforms = oldDlls.Select (p => $"{p.GetDirectory ().GetDirectoryName ()}/{p.GetFilename ()}".ToLower ()).ToArray ();
|
||||
// var newPlatforms = newDlls.Select (p => $"{p.GetDirectory ().GetDirectoryName ()}/{p.GetFilename ()}".ToLower ()).ToArray ();
|
||||
// var missing = oldPlatforms.Except (newPlatforms);
|
||||
// foreach (var miss in missing) {
|
||||
// Warning ($"The '{miss}' dll is missing from the new '{nuget}' package.");
|
||||
// }
|
||||
// var added = newPlatforms.Except (oldPlatforms);
|
||||
// foreach (var add in added) {
|
||||
// Warning ($"The '{add}' dll was added to the new '{nuget}' package.");
|
||||
// }
|
||||
// var intersection = newPlatforms.Intersect (oldPlatforms);
|
||||
//
|
||||
// // run the diff on each dll
|
||||
// var outPath = $"./output/{nuget}/api-diff";
|
||||
// EnsureDirectoryExists (outPath);
|
||||
// CleanDirectories (outPath);
|
||||
// foreach (var match in intersection) {
|
||||
// Information ($"Comparing the '{match}' assembly...");
|
||||
//
|
||||
// var assembly = (FilePath)$"{outPath}/{match}";
|
||||
// EnsureDirectoryExists (assembly.GetDirectory ());
|
||||
//
|
||||
// var oldApi = $"{outPath}/{match}.api-info.old.xml";
|
||||
// var newApi = $"{outPath}/{match}.api-info.new.xml";
|
||||
//
|
||||
// var pathToAssembly = $"lib/{match}";
|
||||
// MonoApiInfo ($"{tempPath}/{pathToAssembly}", oldApi);
|
||||
// MonoApiInfo ($"./output/{nuget}/nuget/{pathToAssembly}", newApi);
|
||||
//
|
||||
// MonoApiDiff (oldApi, newApi, $"{outPath}/{match}.api-info.diff.xml");
|
||||
// MonoApiHtmlColorized (oldApi, newApi, $"{outPath}/{match}.api-info.diff.html");
|
||||
// MonoApiMarkdownColorized (oldApi, newApi, $"{outPath}/{match}.api-info.diff.md");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// } catch (AggregateException ex) {
|
||||
// Error ("{0}", ex.InnerException);
|
||||
// } catch (Exception ex) {
|
||||
// Error ("{0}", ex);
|
||||
// }
|
||||
// });
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CLEAN - remove all the build artefacts
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Cake" version="0.29.0" />
|
||||
<package id="SharpCompress" version="0.22.0" />
|
||||
<package id="Newtonsoft.Json" version="11.0.2" />
|
||||
<package id="xunit.runner.console" version="2.4.0" />
|
||||
<package id="mdoc" version="5.7.2" />
|
||||
</packages>
|
||||
|
|
|
@ -1,159 +1,178 @@
|
|||
|
||||
void CreateFrameworks (DirectoryPath docsTempPath)
|
||||
void CopyChangelogs (DirectoryPath diffRoot, string id, string version)
|
||||
{
|
||||
// download all the versions from nuget so we can generate the docs
|
||||
var ids = new Dictionary<string, Version> {
|
||||
{ "skiasharp", new Version (1, 57, 0) },
|
||||
{ "skiasharp.views", new Version (1, 57, 0) },
|
||||
{ "skiasharp.views.forms", new Version (1, 57, 0) },
|
||||
{ "harfbuzzsharp", new Version (1, 0, 0) },
|
||||
{ "skiasharp.harfbuzz", new Version (1, 57, 0) },
|
||||
};
|
||||
var metadata = "https://api.nuget.org/v3/registration3/{0}/index.json";
|
||||
var download = "https://api.nuget.org/v3-flatcontainer/{0}/{1}/{0}.{1}.nupkg";
|
||||
|
||||
var packagesPath = ROOT_PATH.Combine ("externals/docs_packages");
|
||||
|
||||
// prepare the temp folder
|
||||
EnsureDirectoryExists (docsTempPath);
|
||||
CleanDirectories (docsTempPath.FullPath);
|
||||
|
||||
var xFrameworks = new XElement ("Frameworks");
|
||||
var xFrameworksDoc = new XDocument (xFrameworks);
|
||||
|
||||
foreach (var id in ids.Keys) {
|
||||
// get the versions for each nuget
|
||||
Information ($"Downloading information for ID: {id}...");
|
||||
var md = string.Format (metadata, id);
|
||||
var mdFile = DownloadFile (md);
|
||||
var mdObj = JObject.Parse (FileReadText (mdFile));
|
||||
var page = mdObj ["items"] [0];
|
||||
foreach (var package in page ["items"]) {
|
||||
var version = (string) package ["catalogEntry"] ["version"];
|
||||
// skip pre-release versions
|
||||
if (version.Contains("-") || Version.Parse (version) < ids [id])
|
||||
continue;
|
||||
|
||||
// download the assemblies
|
||||
Information ($"Downloading '{id}' version '{version}'...");
|
||||
var dest = packagesPath.Combine (id).Combine (version);
|
||||
var destFile = dest.CombineWithFilePath ($"{id}.{version}.nupkg");
|
||||
if (!FileExists (destFile)) {
|
||||
EnsureDirectoryExists (dest);
|
||||
DownloadFile (string.Format (download, id, version), destFile);
|
||||
Unzip (destFile, dest);
|
||||
}
|
||||
|
||||
// copy the assemblies into the temp folder
|
||||
ProcessNuGet (docsTempPath, id, version, dest, xFrameworks);
|
||||
}
|
||||
|
||||
// process the generated nugets as well
|
||||
var genVersion = GetVersion (id);
|
||||
var genDest = ROOT_PATH.Combine ("output").Combine (id).Combine ("nuget");
|
||||
ProcessNuGet (docsTempPath, id, genVersion, genDest, xFrameworks);
|
||||
}
|
||||
|
||||
xFrameworksDoc.Save ($"{docsTempPath}/frameworks.xml");
|
||||
}
|
||||
|
||||
void ProcessNuGet(DirectoryPath docsTempPath, string id, string version, DirectoryPath dest, XElement xFrameworks)
|
||||
{
|
||||
var xplat = new [] {
|
||||
"netstandard1.3",
|
||||
"portable-net45%2Bwin8%2Bwpa81%2Bwp8",
|
||||
"portable-net45%2Bxamarinmac%2Bxamarinios%2Bmonotouch%2Bmonoandroid%2Bwin8%2Bwpa81%2Bwp8%2Bxamarin.watchos%2Bxamarin.tvos",
|
||||
};
|
||||
|
||||
if (id == "skiasharp.views") {
|
||||
// copy platform-specific
|
||||
foreach (var dir in GetDirectories ($"{dest}/lib/*")) {
|
||||
var d = dir.GetDirectoryName ().ToLower ();
|
||||
var platform = "";
|
||||
if (d.StartsWith ("monoandroid")) {
|
||||
platform = "android";
|
||||
} else if (d.StartsWith ("net4")) {
|
||||
platform = "net";
|
||||
} else if (d.StartsWith ("uap")) {
|
||||
platform = "uwp";
|
||||
} else if (d.StartsWith ("xamarinios") || d.StartsWith ("xamarin.ios")) {
|
||||
platform = "ios";
|
||||
} else if (d.StartsWith ("xamarinmac") || d.StartsWith ("xamarin.mac")) {
|
||||
platform = "macos";
|
||||
} else if (d.StartsWith ("xamarintvos") || d.StartsWith ("xamarin.tvos")) {
|
||||
platform = "tvos";
|
||||
} else if (d.StartsWith ("xamarinwatchos") || d.StartsWith ("xamarin.watchos")) {
|
||||
platform = "watchos";
|
||||
} else if (d.StartsWith ("tizen")) {
|
||||
platform = "tizen";
|
||||
} else {
|
||||
throw new Exception ($"Unknown platform: {d}");
|
||||
}
|
||||
var moniker = $"{id.Replace (".", "-")}-{platform}-{version}";
|
||||
var o = docsTempPath.Combine (moniker);
|
||||
EnsureDirectoryExists (o);
|
||||
foreach (var f in GetFiles ($"{dir}/*.dll")) {
|
||||
CopyFileToDirectory (f, o);
|
||||
}
|
||||
xFrameworks.Add (
|
||||
new XElement ("Framework",
|
||||
new XAttribute ("Name", o.GetDirectoryName ()),
|
||||
new XAttribute ("Source", o.GetDirectoryName ())));
|
||||
}
|
||||
} else {
|
||||
// copy netstandard/portable
|
||||
var moniker = $"{id.Replace (".", "-")}-{version}";
|
||||
var o = docsTempPath.Combine (moniker);
|
||||
EnsureDirectoryExists (o);
|
||||
foreach (var x in xplat) {
|
||||
if (DirectoryExists ($"{dest}/lib/{x}")) {
|
||||
foreach (var f in GetFiles ($"{dest}/lib/{x}/*.dll")) {
|
||||
CopyFileToDirectory (f, o);
|
||||
}
|
||||
break;
|
||||
foreach (var (path, platform) in GetPlatformDirectories (diffRoot)) {
|
||||
// first, make sure to create markdown files for unchanged assemblies
|
||||
var xmlFiles = $"{path}/*.new.info.xml";
|
||||
foreach (var file in GetFiles (xmlFiles)) {
|
||||
var dll = file.GetFilenameWithoutExtension ().GetFilenameWithoutExtension ().GetFilenameWithoutExtension ();
|
||||
var md = $"{path}/{dll}.diff.md";
|
||||
if (!FileExists (md)) {
|
||||
var n = Environment.NewLine;
|
||||
var noChangesText = $"# API diff: {dll}{n}{n}## {dll}{n}{n}> No changes.{n}";
|
||||
FileWriteText (md, noChangesText);
|
||||
}
|
||||
}
|
||||
xFrameworks.Add (
|
||||
new XElement ("Framework",
|
||||
new XAttribute ("Name", o.GetDirectoryName ()),
|
||||
new XAttribute ("Source", o.GetDirectoryName ())));
|
||||
|
||||
// now copy the markdown files to the changelogs
|
||||
var mdFiles = $"{path}/*.diff.md";
|
||||
ReplaceTextInFiles (mdFiles, "<h4>", "> ");
|
||||
ReplaceTextInFiles (mdFiles, "</h4>", Environment.NewLine);
|
||||
foreach (var file in GetFiles (mdFiles)) {
|
||||
var dllName = file.GetFilenameWithoutExtension ().GetFilenameWithoutExtension ().GetFilenameWithoutExtension ();
|
||||
var changelogPath = (FilePath)$"./changelogs/{id}/{version}/{dllName}.md";
|
||||
EnsureDirectoryExists (changelogPath.GetDirectory ());
|
||||
CopyFile (file, changelogPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Task ("docs-api-diff")
|
||||
.Does (async () =>
|
||||
{
|
||||
var baseDir = "./output/api-diff";
|
||||
CleanDirectories (baseDir);
|
||||
|
||||
var comparer = await CreateNuGetDiffAsync ();
|
||||
comparer.SaveAssemblyApiInfo = true;
|
||||
comparer.SaveAssemblyMarkdownDiff = true;
|
||||
|
||||
foreach (var id in TRACKED_NUGETS.Keys) {
|
||||
Information ($"Comparing the assemblies in '{id}'...");
|
||||
|
||||
var version = GetVersion (id);
|
||||
var latestVersion = (await NuGetVersions.GetLatestAsync (id)).ToNormalizedString ();
|
||||
Debug ($"Version '{latestVersion}' is the latest version of '{id}'...");
|
||||
|
||||
// pre-cache so we can have better logs
|
||||
Debug ($"Caching version '{latestVersion}' of '{id}'...");
|
||||
await comparer.ExtractCachedPackageAsync (id, latestVersion);
|
||||
|
||||
// generate the diff and copy to the changelogs
|
||||
Debug ($"Running a diff on '{latestVersion}' vs '{version}' of '{id}'...");
|
||||
var diffRoot = $"{baseDir}/{id}";
|
||||
using (var reader = new PackageArchiveReader ($"./output/nugets/{id.ToLower ()}.{version}.nupkg")) {
|
||||
await comparer.SaveCompleteDiffToDirectoryAsync (id, latestVersion, reader, diffRoot);
|
||||
}
|
||||
CopyChangelogs (diffRoot, id, version);
|
||||
|
||||
Information ($"Diff complete of '{id}'.");
|
||||
}
|
||||
|
||||
// clean up after working
|
||||
CleanDirectories (baseDir);
|
||||
});
|
||||
|
||||
Task ("docs-api-diff-past")
|
||||
.Does (async () =>
|
||||
{
|
||||
var baseDir = "./output/api-diffs-past";
|
||||
CleanDirectories (baseDir);
|
||||
|
||||
var comparer = await CreateNuGetDiffAsync ();
|
||||
comparer.SaveAssemblyApiInfo = true;
|
||||
comparer.SaveAssemblyMarkdownDiff = true;
|
||||
|
||||
foreach (var id in TRACKED_NUGETS.Keys) {
|
||||
Information ($"Comparing the assemblies in '{id}'...");
|
||||
|
||||
var allVersions = await NuGetVersions.GetAllAsync (id);
|
||||
for (var idx = 0; idx < allVersions.Length; idx++) {
|
||||
// get the versions for the diff
|
||||
var version = allVersions [idx].ToNormalizedString ();
|
||||
var previous = idx == 0 ? null : allVersions [idx - 1].ToNormalizedString ();
|
||||
Information ($"Comparing version '{previous}' vs '{version}' of '{id}'...");
|
||||
|
||||
// pre-cache so we can have better logs
|
||||
Debug ($"Caching version '{version}' of '{id}'...");
|
||||
await comparer.ExtractCachedPackageAsync (id, version);
|
||||
if (previous != null) {
|
||||
Debug ($"Caching version '{previous}' of '{id}'...");
|
||||
await comparer.ExtractCachedPackageAsync (id, previous);
|
||||
}
|
||||
|
||||
// generate the diff and copy to the changelogs
|
||||
Debug ($"Running a diff on '{previous}' vs '{version}' of '{id}'...");
|
||||
var diffRoot = $"{baseDir}/{id}/{version}";
|
||||
await comparer.SaveCompleteDiffToDirectoryAsync (id, previous, version, diffRoot);
|
||||
CopyChangelogs (diffRoot, id, version);
|
||||
|
||||
Debug ($"Diff complete of version '{version}' of '{id}'.");
|
||||
}
|
||||
Information ($"Diff complete of '{id}'.");
|
||||
}
|
||||
|
||||
// clean up after working
|
||||
CleanDirectories (baseDir);
|
||||
});
|
||||
|
||||
Task ("docs-update-frameworks")
|
||||
.Does (() =>
|
||||
.Does (async () =>
|
||||
{
|
||||
var docsTempPath = MakeAbsolute (ROOT_PATH.Combine ("output/docs/temp"));
|
||||
// clear the temp dir
|
||||
var docsTempPath = "./output/docs/temp";
|
||||
EnsureDirectoryExists (docsTempPath);
|
||||
CleanDirectories (docsTempPath);
|
||||
|
||||
// create the frameworks folder from the released NuGets
|
||||
CreateFrameworks (docsTempPath);
|
||||
// get a comparer that will download the nugets
|
||||
var comparer = await CreateNuGetDiffAsync ();
|
||||
|
||||
// the reference folders to locate assemblies
|
||||
var refs = new List<DirectoryPath> ();
|
||||
if (IsRunningOnWindows ()) {
|
||||
var refAssemblies = "C:/Program Files (x86)/Microsoft Visual Studio/*/*/Common7/IDE/ReferenceAssemblies/Microsoft/Framework";
|
||||
refs.AddRange (GetDirectories ($"{refAssemblies}/MonoAndroid/v1.0"));
|
||||
refs.AddRange (GetDirectories ($"{refAssemblies}/MonoAndroid/v4.0.3"));
|
||||
refs.AddRange (GetDirectories ($"{refAssemblies}/Xamarin.iOS/v1.0"));
|
||||
refs.AddRange (GetDirectories ($"{refAssemblies}/Xamarin.TVOS/v1.0"));
|
||||
refs.AddRange (GetDirectories ($"{refAssemblies}/Xamarin.WatchOS/v1.0"));
|
||||
refs.AddRange (GetDirectories ($"{refAssemblies}/Xamarin.Mac/v2.0"));
|
||||
refs.AddRange (GetDirectories ("C:/Program Files (x86)/Windows Kits/10/References/Windows.Foundation.UniversalApiContract/1.0.0.0"));
|
||||
refs.AddRange (GetDirectories ($"{NUGET_PACKAGES}/xamarin.forms/{GetVersion ("Xamarin.Forms", "release")}/lib/*"));
|
||||
refs.AddRange (GetDirectories ($"{NUGET_PACKAGES}/tizen.net/{GetVersion ("Tizen.NET", "release")}/lib/*"));
|
||||
refs.AddRange (GetDirectories ($"{NUGET_PACKAGES}/opentk.glcontrol/{GetVersion ("OpenTK.GLControl", "release")}/lib/*"));
|
||||
// generate the temp frameworks.xml
|
||||
var xFrameworks = new XElement ("Frameworks");
|
||||
foreach (var id in TRACKED_NUGETS.Keys) {
|
||||
// get the versions
|
||||
Information ($"Comparing the assemblies in '{id}'...");
|
||||
var allVersions = await NuGetVersions.GetAllAsync (id, new NuGetVersions.Filter {
|
||||
MinimumVersion = new NuGetVersion (TRACKED_NUGETS [id])
|
||||
});
|
||||
|
||||
// add the current dev version to the mix
|
||||
var dev = new NuGetVersion (GetVersion (id));
|
||||
allVersions = allVersions.Union (new [] { dev }).ToArray ();
|
||||
|
||||
foreach (var version in allVersions) {
|
||||
Information ($"Downloading '{id}' version '{version}'...");
|
||||
// get the path to the nuget contents
|
||||
var packagePath = version == dev
|
||||
? $"./output/{id}/nuget"
|
||||
: await comparer.ExtractCachedPackageAsync (id, version);
|
||||
|
||||
foreach (var (path, platform) in GetPlatformDirectories ($"{packagePath}/lib")) {
|
||||
string moniker;
|
||||
if (platform == null)
|
||||
moniker = $"{id.ToLower ().Replace (".", "-")}-{version}";
|
||||
else
|
||||
moniker = $"{id.ToLower ().Replace (".", "-")}-{platform}-{version}";
|
||||
|
||||
// add the node to the frameworks.xml
|
||||
xFrameworks.Add (
|
||||
new XElement ("Framework",
|
||||
new XAttribute ("Name", moniker),
|
||||
new XAttribute ("Source", moniker)));
|
||||
|
||||
// copy the assemblies for the tool
|
||||
var o = $"{docsTempPath}/{moniker}";
|
||||
EnsureDirectoryExists (o);
|
||||
CopyFiles ($"{path}/*.dll", o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// save the frameworks.xml
|
||||
var fwxml = $"{docsTempPath}/frameworks.xml";
|
||||
var xdoc = new XDocument (xFrameworks);
|
||||
xdoc.Save (fwxml);
|
||||
|
||||
// generate doc files
|
||||
var refArgs = string.Join (" ", refs.Select (r => $"--lib=\"{r}\""));
|
||||
var fw = MakeAbsolute (docsTempPath.CombineWithFilePath ("frameworks.xml"));
|
||||
var refArgs = string.Join (" ", comparer.SearchPaths.Select (r => $"--lib=\"{r}\""));
|
||||
var fw = MakeAbsolute ((FilePath) fwxml);
|
||||
RunProcess (MDocPath, new ProcessSettings {
|
||||
Arguments = $"update --delete --out=\"{DOCS_PATH}\" -lang=DocId --frameworks={fw} {refArgs}",
|
||||
WorkingDirectory = docsTempPath
|
||||
});
|
||||
|
||||
// clean up after working
|
||||
CleanDirectories (docsTempPath.FullPath);
|
||||
CleanDirectories (docsTempPath);
|
||||
});
|
||||
|
||||
Task ("docs-format-docs")
|
||||
|
@ -250,6 +269,7 @@ Task ("docs-format-docs")
|
|||
});
|
||||
|
||||
Task ("update-docs")
|
||||
.IsDependentOn ("docs-api-diff")
|
||||
.IsDependentOn ("docs-update-frameworks")
|
||||
.IsDependentOn ("docs-format-docs")
|
||||
.Does (() =>
|
||||
|
|
|
@ -41,7 +41,7 @@ var RunMSBuildRestore = new Action<FilePath> ((solution) =>
|
|||
});
|
||||
});
|
||||
|
||||
var RunMSBuildRestoreLocal = new Action<FilePath> ((solution) =>
|
||||
var RunMSBuildRestoreLocal = new Action<FilePath, DirectoryPath> ((solution, packagesDir) =>
|
||||
{
|
||||
var dir = solution.GetDirectory ();
|
||||
MSBuild (solution, c => {
|
||||
|
@ -50,7 +50,7 @@ var RunMSBuildRestoreLocal = new Action<FilePath> ((solution) =>
|
|||
c.Targets.Add("Restore");
|
||||
c.Verbosity = VERBOSITY;
|
||||
c.Properties ["RestoreNoCache"] = new [] { "true" };
|
||||
c.Properties ["RestorePackagesPath"] = new [] { "./externals/packages" };
|
||||
c.Properties ["RestorePackagesPath"] = new [] { packagesDir.FullPath };
|
||||
c.PlatformTarget = PlatformTarget.MSIL;
|
||||
c.MSBuildPlatform = MSBuildPlatform.x86;
|
||||
if (!string.IsNullOrEmpty (MSBuildToolPath)) {
|
||||
|
@ -177,7 +177,7 @@ var CreateSamplesZip = new Action<DirectoryPath, DirectoryPath> ((samplesDirPath
|
|||
foreach (var file in GetFiles ($"{workingDir}/**/*")) {
|
||||
var abs = System.IO.Path.GetFullPath (toNativePath (file.FullPath));
|
||||
var absDir = System.IO.Path.GetDirectoryName (abs);
|
||||
var ext = System.IO.Path.GetExtension (abs).ToLowerInvariant ();
|
||||
var ext = System.IO.Path.GetExtension (abs).ToLower ();
|
||||
var rel = samplesUri.MakeRelativeUri (new Uri (abs)).ToString ();
|
||||
|
||||
if (ext == ".sln") {
|
||||
|
@ -194,7 +194,7 @@ var CreateSamplesZip = new Action<DirectoryPath, DirectoryPath> ((samplesDirPath
|
|||
var projectPath = System.IO.Path.GetFullPath (System.IO.Path.Combine (absDir, relProjectPath));
|
||||
if (!projectPath.StartsWith (samplesDir, StringComparison.OrdinalIgnoreCase)) {
|
||||
// skip the next line as it is the "EndProject" line
|
||||
guids.Add (m.Groups[2].Value. ToLowerInvariant ());
|
||||
guids.Add (m.Groups[2].Value. ToLower ());
|
||||
lines.RemoveAt (i);
|
||||
i--;
|
||||
lines.RemoveAt (i);
|
||||
|
@ -209,7 +209,7 @@ var CreateSamplesZip = new Action<DirectoryPath, DirectoryPath> ((samplesDirPath
|
|||
for (var i = 0; i < lines.Count; i++) {
|
||||
var line = lines [i];
|
||||
foreach (var guid in guids) {
|
||||
if (line.ToLowerInvariant ().Contains (guid)) {
|
||||
if (line.ToLower ().Contains (guid)) {
|
||||
lines.RemoveAt (i);
|
||||
i--;
|
||||
}
|
||||
|
@ -294,3 +294,96 @@ var CreateSamplesZip = new Action<DirectoryPath, DirectoryPath> ((samplesDirPath
|
|||
Zip (workingDir, outputDirPath.CombineWithFilePath ("samples.zip"));
|
||||
CleanDirectory (workingDir);
|
||||
});
|
||||
|
||||
IEnumerable<(DirectoryPath path, string platform)> GetPlatformDirectories (DirectoryPath rootDir)
|
||||
{
|
||||
var platformDirs = GetDirectories ($"{rootDir}/*");
|
||||
|
||||
// try find any cross-platform frameworks
|
||||
foreach (var dir in platformDirs) {
|
||||
var d = dir.GetDirectoryName ().ToLower ();
|
||||
if (d.StartsWith ("netstandard") || d.StartsWith ("portable")) {
|
||||
// we just want this single platform
|
||||
yield return (dir, null);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
// there were no cross-platform libraries, so process each platform
|
||||
foreach (var dir in platformDirs) {
|
||||
var d = dir.GetDirectoryName ().ToLower ();
|
||||
if (d.StartsWith ("monoandroid"))
|
||||
yield return (dir, "android");
|
||||
else if (d.StartsWith ("net4"))
|
||||
yield return (dir, "net");
|
||||
else if (d.StartsWith ("uap"))
|
||||
yield return (dir, "uwp");
|
||||
else if (d.StartsWith ("xamarinios") || d.StartsWith ("xamarin.ios"))
|
||||
yield return (dir, "ios");
|
||||
else if (d.StartsWith ("xamarinmac") || d.StartsWith ("xamarin.mac"))
|
||||
yield return (dir, "macos");
|
||||
else if (d.StartsWith ("xamarintvos") || d.StartsWith ("xamarin.tvos"))
|
||||
yield return (dir, "tvos");
|
||||
else if (d.StartsWith ("xamarinwatchos") || d.StartsWith ("xamarin.watchos"))
|
||||
yield return (dir, "watchos");
|
||||
else if (d.StartsWith ("tizen"))
|
||||
yield return (dir, "tizen");
|
||||
else
|
||||
throw new Exception ($"Unknown platform '{d}' found at '{dir}'.");
|
||||
}
|
||||
}
|
||||
|
||||
string[] referenceSearchPathsCache = null;
|
||||
string[] GetReferenceSearchPaths ()
|
||||
{
|
||||
if (referenceSearchPathsCache != null)
|
||||
return referenceSearchPathsCache;
|
||||
|
||||
var refs = new List<string> ();
|
||||
|
||||
if (IsRunningOnWindows ()) {
|
||||
var vs = VSWhereLatest (new VSWhereLatestSettings { Requires = "Component.Xamarin" });
|
||||
var referenceAssemblies = $"{vs}/Common7/IDE/ReferenceAssemblies/Microsoft/Framework";
|
||||
var pf = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
|
||||
refs.Add ($"{referenceAssemblies}/MonoTouch/v1.0");
|
||||
refs.Add ($"{referenceAssemblies}/MonoAndroid/v1.0");
|
||||
refs.Add ($"{referenceAssemblies}/MonoAndroid/v4.0.3");
|
||||
refs.Add ($"{referenceAssemblies}/Xamarin.iOS/v1.0");
|
||||
refs.Add ($"{referenceAssemblies}/Xamarin.TVOS/v1.0");
|
||||
refs.Add ($"{referenceAssemblies}/Xamarin.WatchOS/v1.0");
|
||||
refs.Add ($"{referenceAssemblies}/Xamarin.Mac/v2.0");
|
||||
refs.Add ($"{pf}/Windows Kits/10/References/Windows.Foundation.UniversalApiContract/1.0.0.0");
|
||||
refs.Add ($"{pf}/Windows Kits/10/References/Windows.Foundation.FoundationContract/1.0.0.0");
|
||||
refs.Add ($"{pf}/GtkSharp/2.12/lib");
|
||||
refs.Add ($"{vs}/Common7/IDE/PublicAssemblies");
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
|
||||
referenceSearchPathsCache = refs.ToArray ();
|
||||
return referenceSearchPathsCache;
|
||||
}
|
||||
|
||||
async Task<NuGetDiff> CreateNuGetDiffAsync ()
|
||||
{
|
||||
var comparer = new NuGetDiff ();
|
||||
comparer.SearchPaths.AddRange (GetReferenceSearchPaths ());
|
||||
comparer.PackageCache = PACKAGE_CACHE_PATH.FullPath;
|
||||
|
||||
var AddDep = new Func<string, string, Task> (async (id, platform) => {
|
||||
var version = GetVersion (id, "release");
|
||||
var root = await comparer.ExtractCachedPackageAsync(id, version);
|
||||
comparer.SearchPaths.Add(System.IO.Path.Combine(root, "lib", platform));
|
||||
});
|
||||
|
||||
await AddDep ("OpenTK.GLControl", "NET40");
|
||||
await AddDep ("Tizen.NET", "netstandard2.0");
|
||||
await AddDep ("Xamarin.Forms", "netstandard2.0");
|
||||
await AddDep ("Xamarin.Forms", "MonoAndroid10");
|
||||
await AddDep ("Xamarin.Forms", "Xamarin.iOS10");
|
||||
await AddDep ("Xamarin.Forms", "Xamarin.Mac");
|
||||
await AddDep ("Xamarin.Forms", "tizen40");
|
||||
await AddDep ("Xamarin.Forms", "uap10.0");
|
||||
|
||||
return comparer;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
angle/
|
||||
harfbuzz/
|
||||
packages/
|
||||
docs_packages/
|
||||
api-diff/
|
||||
package_cache/
|
||||
|
|
Загрузка…
Ссылка в новой задаче