public void NotBeforeAndAfterVersion() { var nuget = new NuGetPackages() { new NuGetPackage() { Id = "Test", Version = "1.0.1" }, new NuGetPackage() { Id = "Test2", Version = "0.0.9" } }; var unsafePacks = new UnsafePackages() { new UnsafePackage() { Id = "Test", Before = "1.0.1", After = "0.0.9" }, new UnsafePackage() { Id = "Test2", Before = "1.0.1", After = "0.0.9" } }; var result = new DecisionMaker().Evaluate(nuget, unsafePacks); Assert.AreEqual(0, result.Count()); }
public void NotAtVersion() { var nuget = new NuGetPackages() { new NuGetPackage() { Id = "Test", Version = "1.0.0" } }; var unsafePacks = new UnsafePackages() { new UnsafePackage() { Id = "Test", Version = "1.0.1" } }; var result = new DecisionMaker().Evaluate(nuget, unsafePacks); Assert.AreEqual(0, result.Count()); }
public void AfterOrAtVersion() { var nuget = new NuGetPackages() { new NuGetPackage() { Id = "Test", Version = "1.0.0" }, new NuGetPackage() { Id = "Test2", Version = "1.0.0" } }; var unsafePacks = new UnsafePackages() { new UnsafePackage() { Id = "Test", AfterOrAt = "1.0.0" }, new UnsafePackage() { Id = "Test2", AfterOrAt = "0.0.9" } }; var result = new DecisionMaker().Evaluate(nuget, unsafePacks); Assert.AreEqual(2, result.Count()); }
public void BeforeAndAfterVersion() { var nuget = new NuGetPackages() { new NuGetPackage() { Id = "Test", Version = "1.0.0" } }; var unsafePacks = new UnsafePackages() { new UnsafePackage() { Id = "Test", Before = "1.0.1", After = "0.0.9" } }; var result = new DecisionMaker().Evaluate(nuget, unsafePacks); Assert.AreEqual(1, result.Count()); }
public D3D12RHIModule(TargetRules Rules) : base(Rules) { ModuleName = "D3D12RHI"; SourceFileSearchDir = "D3D12RHI"; ModuleOutputType = ModuleDef.ModuleType.LIB; IncludeDirectories.Add("Source/Core"); SolutionFolderPath = "Engine/Modules/RHI"; UseCorePCH = false; PCH = "D3D12RHIPCH"; ModuleOutputType = ModuleDef.ModuleType.ModuleDLL; UseUnity = true; ThirdPartyModules.Add("Dx12Build"); ThirdPartyModules.Add("OpenVRBuild"); ThirdPartyModules.Add("PixBuild"); ThirdPartyModules.Add("nvapiBuild"); NuGetPackages.Add("WinPixEventRuntime"); UnsupportedPlatforms.Add("Win64_VK"); UnsupportedPlatforms.Add("Linux"); UnsupportedPlatforms.Add("Android"); string Win64 = "win64"; StaticLibraries.Add(new LibDependency("d3d12.lib", Win64)); StaticLibraries.Add(new LibDependency("dxguid.lib", Win64)); StaticLibraries.Add(new LibDependency("dxgi.lib", Win64)); StaticLibraries.Add(new LibDependency("d3dcompiler.lib", Win64)); if (Rules.Win_SupportsRT()) { StaticLibraries.Add(new LibDependency("dxcompiler.lib", Win64)); } }
public override bool Execute() { PackageIdentity[] latestPackages = NuGetPackages .Select(item => { using (var reader = new PackageArchiveReader(item.GetMetadata("FullPath"))) { return(reader.GetIdentity()); } }) .GroupBy(identity => identity.Id) .Select(g => g.OrderBy(id => id.Version).Last()) .OrderBy(id => id.Id) .ToArray(); var additionalAssets = (AdditionalAssetDirs ?? new string[0]) .Where(Directory.Exists) .Where(dir => Directory.GetDirectories(dir).Count() > 0) .Select(dir => new { Name = new DirectoryInfo(dir).Name + "Version", Version = new DirectoryInfo(Directory.EnumerateDirectories(dir).OrderBy(s => s).Last()).Name }).ToArray(); Directory.CreateDirectory(Path.GetDirectoryName(OutputPath)); using (var outStream = File.Open(OutputPath, FileMode.Create)) using (var sw = new StreamWriter(outStream, new UTF8Encoding(false))) { sw.WriteLine(@"<?xml version=""1.0"" encoding=""utf-8""?>"); sw.WriteLine(@"<Project ToolsVersion=""14.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"); sw.WriteLine(@" <PropertyGroup>"); foreach (PackageIdentity packageIdentity in latestPackages) { string propertyName = GetPropertyName(packageIdentity.Id); sw.WriteLine($" <{propertyName}>{packageIdentity.Version}</{propertyName}>"); } foreach (var extraProp in ExtraProperties ?? Enumerable.Empty <ITaskItem>()) { string propertyName = extraProp.GetMetadata("Identity"); sw.WriteLine($" <{propertyName}>{extraProp.GetMetadata("Version")}</{propertyName}>"); } foreach (var additionalAsset in additionalAssets) { sw.WriteLine($" <{additionalAsset.Name}>{additionalAsset.Version}</{additionalAsset.Name}>"); } sw.WriteLine(@" </PropertyGroup>"); if (IncludeCreationTimeProperty) { sw.WriteLine(@" <PropertyGroup>"); sw.WriteLine($@" <{CreationTimePropertyName}>{DateTime.UtcNow.Ticks}</{CreationTimePropertyName}>"); sw.WriteLine(@" </PropertyGroup>"); } sw.WriteLine(@"</Project>"); } return(true); }
public List <KeyValuePair <NuGetPackage, UnsafePackage> > Evaluate(NuGetPackages packages, UnsafePackages unsafePackages) { return(packages .SelectMany(p => unsafePackages.Where(u => u.Is(p)) .Select(u => new KeyValuePair <NuGetPackage, UnsafePackage>(p, u) ) ).ToList()); }
public List<KeyValuePair<NuGetPackage, UnsafePackage>> Evaluate(NuGetPackages packages, UnsafePackages unsafePackages) { return packages .SelectMany(p => unsafePackages.Where(u => u.Is(p)) .Select(u => new KeyValuePair<NuGetPackage, UnsafePackage>(p, u) ) ).ToList(); }
public List <KeyValuePair <NuGetPackage, UnsafePackage> > Evaluate(NuGetPackages packages, UnsafePackages unsafePackages) { var result = new List <KeyValuePair <NuGetPackage, UnsafePackage> >(); foreach (var package in packages) { foreach (var unsafePackage in unsafePackages.Where(u => u.Is(package))) { result.Add(new KeyValuePair <NuGetPackage, UnsafePackage>(package, unsafePackage)); } } return(result); }
public void Test_NuGet_NugetPackages_GetPackageMetadataAsync() { NuGetPackages.NugetClient = new NuGetClient(); NuGetPackages np = new NuGetPackages(); List <string> package_ids = new List <string>() { "Xamarin.AndroidX.Legacy.Support.V13", "Xamarin.Google.Guava.ListenableFuture", "Xamarin.AndroidX.Annotations", "Xamarin.AndroidX.Activity", "Xamarin.AndroidX.NonExistentPackage", }; List <NuGetPackage> result = np.GetPackageSearchMetadataForPackageNamesAsync(package_ids) .Result; System.IO.Directory.CreateDirectory ( $"nuget-client-api/NugetPackages/" ); string timestamp = System.DateTime.Now.ToString("yyyyMMdd-HHmmssff"); string json = null; json = Newtonsoft.Json.JsonConvert.SerializeObject ( result, Newtonsoft.Json.Formatting.Indented ); System.IO.File.WriteAllText ( $"nuget-client-api/NugetPackages/PackageSearchMetadata-{timestamp}.json", json ); //#if MSTEST //Assert.IsNotNull(search); //#elif NUNIT //Assert.NotNull(search); //#elif XUNIT //Assert.NotNull(search); //#endif return; }
public override bool Execute() { PackageIdentity[] latestPackages = NuGetPackages .Select(item => { using (var reader = new PackageArchiveReader(item.GetMetadata("FullPath"))) { return(reader.GetIdentity()); } }) .GroupBy(identity => identity.Id) .Select(g => g.OrderBy(id => id.Version).Last()) .OrderBy(id => id.Id) .ToArray(); Directory.CreateDirectory(Path.GetDirectoryName(OutputPath)); var invalidElementNameCharRegex = new Regex(@"(^|[^A-Za-z0-9])(?<FirstPartChar>.)"); using (var outStream = File.Open(OutputPath, FileMode.Create)) using (var sw = new StreamWriter(outStream, new UTF8Encoding(false))) { sw.WriteLine(@"<?xml version=""1.0"" encoding=""utf-8""?>"); sw.WriteLine(@"<Project ToolsVersion=""14.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"); sw.WriteLine(@" <PropertyGroup>"); foreach (PackageIdentity packageIdentity in latestPackages) { string formattedId = invalidElementNameCharRegex.Replace( packageIdentity.Id, match => match.Groups?["FirstPartChar"].Value.ToUpperInvariant() ?? string.Empty); string propertyName = $"{formattedId}PackageVersion"; sw.WriteLine($" <{propertyName}>{packageIdentity.Version}</{propertyName}>"); } sw.WriteLine(@" </PropertyGroup>"); sw.WriteLine(@"</Project>"); } return(true); }
public void BeforeVersion() { var nuget = new NuGetPackages() { new NuGetPackage() { Id = "Test", Version = "1.0.0-alpha1" } }; var unsafePacks = new UnsafePackages() { new UnsafePackage() { Id = "Test", Before = "1.0.1" } }; var result = new DecisionMaker().Evaluate(nuget, unsafePacks); Assert.AreEqual(1, result.Count()); }
private static void LoadNuGetVersions(EFVersion efVersion, string packageId) { // get NuGet packages with that package id HttpResponseMessage responseMessage = httpClient.GetAsync(string.Format(NUGET_URL, packageId)).GetAwaiter().GetResult(); string jsonString = responseMessage.Content.ReadAsStringAsync().GetAwaiter().GetResult(); NuGetPackages nugetPackages = NuGetPackages.FromJson(jsonString); string id = packageId.ToLower(); // get their versions List <string> result = nugetPackages.Data .Where(x => x.Title.ToLower() == id) .SelectMany(x => x.Versions) .OrderBy(v => v.VersionVersion) .Select(v => v.VersionVersion) .ToList(); // find the major.minor versions List <string> majorVersions = result.Select(v => string.Join(".", v.Split('.').Take(2))).OrderBy(v => v).Distinct().ToList(); // do the trivial mapping of the full version to the full display name foreach (string v in result) { NuGetPackageDisplay.Add(new NuGetDisplay(efVersion, packageId, v, v, string.Join(".", v.Split('.').Take(2)))); } // figure out which one is the latest in the major.minor set and add its mapping foreach (string v in majorVersions) { NuGetPackageDisplay.Add(new NuGetDisplay(efVersion, packageId, result.FindLast(x => x.StartsWith($"{v}.")), $"{v}.Latest", v)); } // figure out which is the overall latest and map it NuGetPackageDisplay.Add(new NuGetDisplay(efVersion, packageId, result.FindLast(x => !x.EndsWith(".Latest")), "Latest", majorVersions.Last())); // tuck it away EFPackageVersions.Add(efVersion, NuGetPackageDisplay.Where(p => p.EFVersion == efVersion).Select(p => p.DisplayVersion).ToList()); }
public override bool Execute() { PackageIdentity[] latestPackages = NuGetPackages .Select(item => { using (var reader = new PackageArchiveReader(item.GetMetadata("FullPath"))) { return(reader.GetIdentity()); } }) .Concat(ExtraPackageIdentities) .GroupBy(identity => identity.Id) .Select(g => g.OrderBy(id => id.Version).Last()) .OrderBy(id => id.Id) .ToArray(); Directory.CreateDirectory(Path.GetDirectoryName(OutputPath)); using (var outStream = File.Open(OutputPath, FileMode.Create)) using (var sw = new StreamWriter(outStream, new UTF8Encoding(false))) { sw.WriteLine(@"<?xml version=""1.0"" encoding=""utf-8""?>"); sw.WriteLine(@"<Project ToolsVersion=""14.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"); sw.WriteLine(@" <PropertyGroup>"); foreach (PackageIdentity packageIdentity in latestPackages) { string propertyName = GetPropertyName(packageIdentity.Id); sw.WriteLine($" <{propertyName}>{packageIdentity.Version}</{propertyName}>"); } sw.WriteLine(@" </PropertyGroup>"); sw.WriteLine(@"</Project>"); } return(true); }