Родитель
5fa2039742
Коммит
3d8ee55f82
43
build.cake
43
build.cake
|
@ -5,7 +5,7 @@
|
|||
#addin nuget:?package=Cake.XCode&version=4.0.0
|
||||
#addin nuget:?package=Newtonsoft.Json&version=9.0.1
|
||||
#addin nuget:?package=YamlDotNet&version=4.2.1
|
||||
|
||||
#addin nuget:?package=Xamarin.Nuget.Validator&version=1.1.1
|
||||
|
||||
var TARGET = Argument ("target", Argument ("t", Argument ("Target", "build")));
|
||||
|
||||
|
@ -313,4 +313,45 @@ Task ("build").Does (() =>
|
|||
BuildGroups (BUILD_GROUPS, BUILD_NAMES.ToList (), buildTargets, GIT_PATH, GIT_BRANCH, GIT_PREVIOUS_COMMIT, GIT_COMMIT, FORCE_BUILD, podRepoUpdate);
|
||||
});
|
||||
|
||||
Task("nuget-validation")
|
||||
.Does(()=>
|
||||
{
|
||||
//setup validation options
|
||||
var options = new Xamarin.Nuget.Validator.NugetValidatorOptions()
|
||||
{
|
||||
Copyright = "© Microsoft Corporation. All rights reserved.",
|
||||
Author = "Microsoft",
|
||||
Owner = "Microsoft",
|
||||
NeedsProjectUrl = true,
|
||||
NeedsLicenseUrl = true,
|
||||
ValidateRequireLicenseAcceptance = true,
|
||||
ValidPackageNamespace = new [] { "Xamarin", "Mono", "SkiaSharp", "HarfBuzzSharp", "mdoc" },
|
||||
};
|
||||
|
||||
var nupkgFiles = GetFiles ("./**/output/*.nupkg");
|
||||
|
||||
Information ("Found ({0}) Nuget's to validate", nupkgFiles.Count ());
|
||||
|
||||
foreach (var nupkgFile in nupkgFiles)
|
||||
{
|
||||
Information ("Verifiying Metadata of {0}", nupkgFile.GetFilename ());
|
||||
|
||||
var result = Xamarin.Nuget.Validator.NugetValidator.Validate(MakeAbsolute(nupkgFile).FullPath, options);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
Information ("Metadata validation failed for: {0} \n\n", nupkgFile.GetFilename ());
|
||||
Information (string.Join("\n ", result.ErrorMessages));
|
||||
throw new Exception ($"Invalid Metadata for: {nupkgFile.GetFilename ()}");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Information ("Metadata validation passed for: {0}", nupkgFile.GetFilename ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
RunTarget (TARGET);
|
||||
|
|
Загрузка…
Ссылка в новой задаче