public void GivenWorkloadManifestUpdateItCanUpdateAdvertisingManifests() { var testDir = _testAssetsManager.CreateTestDirectory().Path; var featureBand = "6.0.100"; var dotnetRoot = Path.Combine(testDir, "dotnet"); var installedManifests = new ManifestId[] { new ManifestId("test-manifest-1"), new ManifestId("test-manifest-2"), new ManifestId("test-manifest-3") }; // Write mock manifests var installedManifestDir = Path.Combine(testDir, "dotnet", "sdk-manifests", featureBand); var adManifestDir = Path.Combine(testDir, ".dotnet", "sdk-advertising", featureBand); Directory.CreateDirectory(installedManifestDir); Directory.CreateDirectory(adManifestDir); foreach (var manifest in installedManifests) { Directory.CreateDirectory(Path.Combine(installedManifestDir, manifest.ToString())); File.WriteAllText(Path.Combine(installedManifestDir, manifest.ToString(), _manifestFileName), GetManifestContent(new ManifestVersion("1.0.0"))); } var manifestDirs = installedManifests .Select(manifest => Path.Combine(installedManifestDir, manifest.ToString(), _manifestFileName)) .ToArray(); var workloadManifestProvider = new MockManifestProvider(manifestDirs); var nugetDownloader = new MockNuGetPackageDownloader(dotnetRoot, manifestDownload: true); var manifestUpdater = new WorkloadManifestUpdater(_reporter, workloadManifestProvider, nugetDownloader, testDir, testDir); manifestUpdater.UpdateAdvertisingManifestsAsync(true).Wait(); var expectedDownloadedPackages = installedManifests .Select(id => ((PackageId, NuGetVersion, DirectoryPath?, PackageSourceLocation))(new PackageId($"{id}.manifest-{featureBand}"), null, null, null)); nugetDownloader.DownloadCallParams.Should().BeEquivalentTo(expectedDownloadedPackages); }
public override int CompareTo(OrderDetail other) { return(ManifestId.CompareTo(other.ManifestId) + DSP_SEQ.CompareTo(other.DSP_SEQ) + ORD_NO.CompareTo(other.ORD_NO) + MDL_CNT.CompareTo(other.MDL_CNT) + MDL_NO.CompareTo(other.MDL_NO));// + WIN_CNT.CompareTo(other.WIN_CNT) + //BIN_NO.CompareTo(other.BIN_NO); }
public override int CompareTo(Stop other) { return(TRK_CDE.CompareTo(other.TRK_CDE) + ManifestId.CompareTo(other.ManifestId) + DisplaySeq.CompareTo(other.DisplaySeq) + CustomerId.CompareTo(other.CustomerId)); //throw new System.NotImplementedException(); }
public Manifest(List <ManifestFile> files, DepotId depotId, ManifestId manifestId, DateTime creationTime, ulong totalUncompressedSize, ulong totalCompressedSize) { Files = files; DepotId = depotId; ManifestId = manifestId; CreationTime = creationTime; TotalUncompressedSize = totalUncompressedSize; TotalCompressedSize = totalCompressedSize; }
public MultipleFilesHandler(SteamContentClient steamContentClient, Manifest manifest, AppId appId, DepotId depotId, ManifestId manifestId) { _steamContentClient = steamContentClient; Manifest = manifest; AppId = appId; DepotId = depotId; ManifestId = manifestId; }
public void GivenManagedInstallItCanInstallManifestVersion() { var(_, installer, nugetDownloader) = GetTestInstaller(manifestDownload: true); var featureBand = new SdkFeatureBand("6.0.100"); var manifestId = new ManifestId("test-manifest-1"); var manifestVersion = new ManifestVersion("5.0.0"); installer.InstallWorkloadManifest(manifestId, manifestVersion, featureBand); var mockNugetInstaller = nugetDownloader as MockNuGetPackageDownloader; mockNugetInstaller.DownloadCallParams.Count.Should().Be(1); mockNugetInstaller.DownloadCallParams[0].ShouldBeEquivalentTo((new PackageId($"{manifestId}.manifest-{featureBand}"), new NuGetVersion(manifestVersion.ToString()), null as DirectoryPath?)); }
public void GivenWorkloadManifestUpdateItCanCalculateUpdates() { var testDir = _testAssetsManager.CreateTestDirectory().Path; var featureBand = "6.0.100"; var dotnetRoot = Path.Combine(testDir, "dotnet"); var expectedManifestUpdates = new ManifestVersionUpdate[] { new ManifestVersionUpdate(new ManifestId("test-manifest-1"), new ManifestVersion("5.0.0"), featureBand, new ManifestVersion("7.0.0"), featureBand), new ManifestVersionUpdate(new ManifestId("test-manifest-2"), new ManifestVersion("3.0.0"), featureBand, new ManifestVersion("4.0.0"), featureBand) }; var expectedManifestNotUpdated = new ManifestId[] { new ManifestId("test-manifest-3"), new ManifestId("test-manifest-4") }; // Write mock manifests var installedManifestDir = Path.Combine(testDir, "dotnet", "sdk-manifests", featureBand); var adManifestDir = Path.Combine(testDir, ".dotnet", "sdk-advertising", featureBand); Directory.CreateDirectory(installedManifestDir); Directory.CreateDirectory(adManifestDir); foreach (ManifestVersionUpdate manifestUpdate in expectedManifestUpdates) { Directory.CreateDirectory(Path.Combine(installedManifestDir, manifestUpdate.ManifestId.ToString())); File.WriteAllText(Path.Combine(installedManifestDir, manifestUpdate.ManifestId.ToString(), _manifestFileName), GetManifestContent(manifestUpdate.ExistingVersion)); Directory.CreateDirectory(Path.Combine(adManifestDir, manifestUpdate.ManifestId.ToString())); File.WriteAllText(Path.Combine(adManifestDir, manifestUpdate.ManifestId.ToString(), _manifestFileName), GetManifestContent(manifestUpdate.NewVersion)); } foreach (var manifest in expectedManifestNotUpdated) { Directory.CreateDirectory(Path.Combine(installedManifestDir, manifest.ToString())); File.WriteAllText(Path.Combine(installedManifestDir, manifest.ToString(), _manifestFileName), GetManifestContent(new ManifestVersion("5.0.0"))); Directory.CreateDirectory(Path.Combine(adManifestDir, manifest.ToString())); File.WriteAllText(Path.Combine(adManifestDir, manifest.ToString(), _manifestFileName), GetManifestContent(new ManifestVersion("5.0.0"))); } var manifestDirs = expectedManifestUpdates.Select(manifest => manifest.ManifestId) .Concat(expectedManifestNotUpdated) .Select(manifest => Path.Combine(installedManifestDir, manifest.ToString(), _manifestFileName)) .ToArray(); var workloadManifestProvider = new MockManifestProvider(manifestDirs); var nugetDownloader = new MockNuGetPackageDownloader(dotnetRoot); var workloadResolver = WorkloadResolver.CreateForTests(workloadManifestProvider, dotnetRoot); var installationRepo = new MockInstallationRecordRepository(); var manifestUpdater = new WorkloadManifestUpdater(_reporter, workloadResolver, nugetDownloader, userProfileDir: Path.Combine(testDir, ".dotnet"), testDir, installationRepo); var manifestUpdates = manifestUpdater.CalculateManifestUpdates().Select(m => m.manifestUpdate); manifestUpdates.Should().BeEquivalentTo(expectedManifestUpdates); }
public async Task <Manifest> GetManifestAsync(AppId appId, DepotId depotId, ManifestId manifestId, CancellationToken cancellationToken = default) { await SteamClient.AwaitReadyAsync(cancellationToken); Exception lastEx = null; for (int i = 0; i < 30; i++) { SteamCdnClient steamCdnClient; try { steamCdnClient = await SteamCdnServerPool.GetClientAsync(); //await cdnClientWrapper.CdnClient.AuthenticateDepotAsync(depotId); var manifest = await steamCdnClient.DownloadManifestAsync(appId, depotId, manifestId); if (manifest.FilenamesEncrypted) { var depotKey = await steamCdnClient.GetDepotKeyAsync(depotId, appId); manifest.DecryptFilenames(depotKey); } return(manifest); } catch (SteamDepotAccessDeniedException) { throw; } catch (HttpRequestException ex) { lastEx = ex; } catch (Exception ex) { lastEx = ex; } } throw new SteamManifestDownloadException(lastEx); }
public async Task <Manifest> GetManifestAsync(AppId appId, DepotId depotId, ManifestId manifestId, CancellationToken cancellationToken = default) { await SteamClient.AwaitReadyAsync(cancellationToken); var pool = new SteamCdnServerPool(this, appId); try { var server = await pool.GetServerAsync(cancellationToken); var depotKey = await GetDepotKeyAsync(depotId, appId); var cdnKey = await pool.AuthenticateWithServerAsync(depotId, server); var manifest = await pool.CdnClient.DownloadManifestAsync(depotId, manifestId, server, cdnKey, depotKey, proxyServer : null); if (manifest.FilenamesEncrypted) { manifest.DecryptFilenames(depotKey); } pool.ReturnServer(server, isFaulty: false); return(manifest); } catch (SteamDepotAccessDeniedException) { throw; } catch (HttpRequestException ex) { throw new SteamManifestDownloadException(ex); } catch (Exception ex) { throw new SteamManifestDownloadException(ex); } }
public override bool Execute() { try { NugetPackage nupkg = new(WorkloadManifestPackage, Log); List <TaskItem> msis = new(); var manifestSeparator = ".Manifest-"; if (string.IsNullOrWhiteSpace(ManifestId)) { if ($"{nupkg.Id}".IndexOf(manifestSeparator, StringComparison.OrdinalIgnoreCase) == -1) { Log.LogError($"Unable to parse a manifest ID from package ID: '{nupkg.Id}'. Please provide the 'ManifestId' parameter."); } else { ManifestId = $"{nupkg.Id}".Substring(0, $"{nupkg.Id}".IndexOf(manifestSeparator)); } } if (string.IsNullOrWhiteSpace(SdkVersion)) { if ($"{nupkg.Id}".IndexOf(manifestSeparator, StringComparison.OrdinalIgnoreCase) == -1) { Log.LogError($"Unable to parse the SDK version from package ID: '{nupkg.Id}'. Please provide the 'SdkVersion' parameter."); } else { SdkVersion = $"{nupkg.Id}".Substring($"{nupkg.Id}".IndexOf(manifestSeparator) + manifestSeparator.Length); } } Log.LogMessage(MessageImportance.High, $"Generating workload manifest installer for {SdkFeatureBandVersion}"); // MSI ProductName defaults to the package title and fallback to the package ID with a warning. string productName = nupkg.Title; if (string.IsNullOrWhiteSpace(nupkg.Title)) { Log?.LogMessage(MessageImportance.High, $"'{WorkloadManifestPackage}' should have a non-empty title. The MSI ProductName will be set to the package ID instead."); productName = nupkg.Id; } // Extract once, but harvest multiple times because some generated attributes are platform dependent. string packageContentsDirectory = Path.Combine(PackageDirectory, $"{nupkg.Identity}"); nupkg.Extract(packageContentsDirectory, Enumerable.Empty <string>()); string packageContentsDataDirectory = Path.Combine(packageContentsDirectory, "data"); foreach (string platform in GenerateMsiBase.SupportedPlatforms) { // Extract the MSI template and add it to the list of source files. List <string> sourceFiles = new(); string msiSourcePath = Path.Combine(MsiDirectory, $"{nupkg.Id}", $"{nupkg.Version}", platform); sourceFiles.Add(EmbeddedTemplates.Extract("DependencyProvider.wxs", msiSourcePath)); sourceFiles.Add(EmbeddedTemplates.Extract("dotnethome_x64.wxs", msiSourcePath)); sourceFiles.Add(EmbeddedTemplates.Extract("ManifestProduct.wxs", msiSourcePath)); string EulaRtfPath = Path.Combine(msiSourcePath, "eula.rtf"); File.WriteAllText(EulaRtfPath, GenerateMsiBase.Eula.Replace("__LICENSE_URL__", nupkg.LicenseUrl)); EmbeddedTemplates.Extract("Variables.wxi", msiSourcePath); // Harvest the package contents and add it to the source files we need to compile. string packageContentWxs = Path.Combine(msiSourcePath, "PackageContent.wxs"); sourceFiles.Add(packageContentWxs); HarvestToolTask heat = new(BuildEngine, WixToolsetPath) { ComponentGroupName = GenerateMsiBase.PackageContentComponentGroupName, DirectoryReference = "ManifestIdDir", OutputFile = packageContentWxs, Platform = platform, SourceDirectory = packageContentsDataDirectory }; if (!heat.Execute()) { throw new Exception($"Failed to harvest package contents."); } // To support upgrades, the UpgradeCode must be stable withing a feature band. // For example, 6.0.101 and 6.0.108 will generate the same GUID for the same platform. var upgradeCode = Utils.CreateUuid(GenerateMsiBase.UpgradeCodeNamespaceUuid, $"{ManifestId};{SdkFeatureBandVersion};{platform}"); var productCode = Guid.NewGuid(); Log.LogMessage($"UC: {upgradeCode}, PC: {productCode}, {SdkFeatureBandVersion}, {SdkVersion}, {platform}"); string providerKeyName = $"{ManifestId},{SdkFeatureBandVersion},{platform}"; // Compile the MSI sources string candleIntermediateOutputPath = Path.Combine(IntermediateBaseOutputPath, "wixobj", $"{nupkg.Id}", $"{nupkg.Version}", platform); CompileToolTask candle = new(BuildEngine, WixToolsetPath) { // Candle expects the output path to end with a single '\' OutputPath = candleIntermediateOutputPath.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar, SourceFiles = sourceFiles, Arch = platform }; // Configure preprocessor definitions. string manufacturer = "Microsoft Corporation"; if (!string.IsNullOrWhiteSpace(nupkg.Authors) && (nupkg.Authors.IndexOf("Microsoft", StringComparison.OrdinalIgnoreCase) < 0)) { manufacturer = nupkg.Authors; } Log.LogMessage(MessageImportance.Low, $"Setting Manufacturer to '{manufacturer}'"); candle.PreprocessorDefinitions.Add($@"PackageId={nupkg.Id}"); candle.PreprocessorDefinitions.Add($@"PackageVersion={nupkg.Version}"); candle.PreprocessorDefinitions.Add($@"ProductVersion={MsiVersion}"); candle.PreprocessorDefinitions.Add($@"ProductCode={productCode}"); candle.PreprocessorDefinitions.Add($@"UpgradeCode={upgradeCode}"); // Override the default provider key candle.PreprocessorDefinitions.Add($@"DependencyProviderKeyName={providerKeyName}"); candle.PreprocessorDefinitions.Add($@"ProductName={productName}"); candle.PreprocessorDefinitions.Add($@"Platform={platform}"); candle.PreprocessorDefinitions.Add($@"SourceDir={packageContentsDataDirectory}"); candle.PreprocessorDefinitions.Add($@"Manufacturer={manufacturer}"); candle.PreprocessorDefinitions.Add($@"EulaRtf={EulaRtfPath}"); candle.PreprocessorDefinitions.Add($@"SdkFeatureBandVersion={SdkFeatureBandVersion}"); // The temporary installer in the SDK used lower invariants of the manifest ID. // We have to do the same to ensure the keypath generation produces stable GUIDs so that // the manifests/targets get the same component GUIDs. candle.PreprocessorDefinitions.Add($@"ManifestId={ManifestId.ToLowerInvariant()}"); // Compiler extension to process dependency provider authoring for package reference counting. candle.Extensions.Add("WixDependencyExtension"); if (!candle.Execute()) { throw new Exception($"Failed to compile MSI."); } // Link the MSI. The generated filename contains a the semantic version (excluding build metadata) and platform. // If the source package already contains a platform, e.g. an aliased package that has a RID, then we don't add // the platform again. string shortPackageName = Path.GetFileNameWithoutExtension(WorkloadManifestPackage); string outputFile = Path.Combine(OutputPath, shortPackageName + $"-{platform}.msi"); LinkToolTask light = new(BuildEngine, WixToolsetPath) { OutputFile = Path.Combine(OutputPath, outputFile), SourceFiles = Directory.EnumerateFiles(candleIntermediateOutputPath, "*.wixobj"), SuppressIces = this.SuppressIces }; // Add WiX extensions light.Extensions.Add("WixDependencyExtension"); light.Extensions.Add("WixUIExtension"); if (!light.Execute()) { throw new Exception($"Failed to link MSI."); } // Generate metadata used for CLI based installations. string msiPath = light.OutputFile; MsiProperties msiProps = new MsiProperties { InstallSize = MsiUtils.GetInstallSize(msiPath), Language = Convert.ToInt32(MsiUtils.GetProperty(msiPath, "ProductLanguage")), Payload = Path.GetFileName(msiPath), ProductCode = MsiUtils.GetProperty(msiPath, "ProductCode"), ProductVersion = MsiUtils.GetProperty(msiPath, "ProductVersion"), ProviderKeyName = $"{providerKeyName}", UpgradeCode = MsiUtils.GetProperty(msiPath, "UpgradeCode"), RelatedProducts = MsiUtils.GetRelatedProducts(msiPath) }; string msiJsonPath = Path.Combine(Path.GetDirectoryName(msiPath), Path.GetFileNameWithoutExtension(msiPath) + ".json"); File.WriteAllText(msiJsonPath, JsonSerializer.Serialize <MsiProperties>(msiProps)); TaskItem msi = new(light.OutputFile); msi.SetMetadata(Metadata.Platform, platform); msi.SetMetadata(Metadata.Version, nupkg.ProductVersion); msi.SetMetadata(Metadata.JsonProperties, msiJsonPath); msi.SetMetadata(Metadata.WixObj, candleIntermediateOutputPath); if (GenerateSwixAuthoring && IsSupportedByVisualStudio(platform)) { string swixPackageId = $"{nupkg.Id.ToString().Replace(ShortNames)}"; string swixProject = GenerateSwixPackageAuthoring(light.OutputFile, swixPackageId, platform); if (!string.IsNullOrWhiteSpace(swixProject)) { msi.SetMetadata(Metadata.SwixProject, swixProject); } } // Generate a .csproj to build a NuGet payload package to carry the MSI and JSON manifest msi.SetMetadata(Metadata.PackageProject, GeneratePackageProject(msi.ItemSpec, msiJsonPath, platform, nupkg)); msis.Add(msi); } Msis = msis.ToArray(); } catch (Exception e) { Log.LogErrorFromException(e); } return(!Log.HasLoggedErrors); }
private async void SubmitCommandRecieverAsync() { List <PalletItem> palletItems = new List <PalletItem>(); PalletItem pallet = null; PalletRequestModel palletRequestModel = null; var barCodeCollection = ConstantManager.Barcodes; PalletResponseModel palletResponseModel = null; try { Loader.StartLoading(); foreach (var item in barCodeCollection) { pallet = new PalletItem { Barcode = item.Barcode, ScanDate = DateTimeOffset.Now, }; foreach (var tag in ConstantManager.Tags) { pallet.Tags.Add(tag); } palletItems.Add(pallet); } palletRequestModel = new PalletRequestModel { Barcode = ManifestId.Split('-').LastOrDefault(), BuildDate = DateTimeOffset.Now, OwnerId = AppSettings.CompanyId, PalletId = _uuidManager.GetUuId(), ReferenceKey = "", StockLocation = StockLocation.PartnerId, StockLocationId = StockLocation.PartnerId, StockLocationName = StockLocation.FullName, }; foreach (var item in palletItems) { palletRequestModel.PalletItems.Add(item); } foreach (var item in ConstantManager.Tags) { palletRequestModel.Tags.Add(item); } palletResponseModel = new PalletResponseModel { Barcode = ManifestId.Split('-').LastOrDefault(), BuildDate = DateTimeOffset.Now, Container = null, CreatedDate = DateTimeOffset.Now, DataInfo = new Model.PrintPDF.DateInfo { }, Location = new Owner { }, Owner = new Owner { }, PalletId = palletRequestModel.PalletId, PalletItems = palletItems, ReferenceKey = string.Empty, StockLocation = new Owner { FullName = StockLocation.FullName, PartnerTypeName = StockLocation.PartnerTypeName }, TargetLocation = new Model.PrintPDF.TargetLocation { }, Tags = ConstantManager.Tags, }; var current = Connectivity.NetworkAccess; if (current == NetworkAccess.Internet) { var value = await _palletizeService.PostPalletAsync(palletRequestModel, AppSettings.SessionId, Configuration.NewPallet); } else { try { palletRequestModel.IsQueue = true; var RealmDb = Realm.GetInstance(RealmDbManager.GetRealmDbConfig()); RealmDb.Write(() => { RealmDb.Add(palletRequestModel, update: true); }); } catch (Exception ex) { Crashes.TrackError(ex); } } PrintPallet(); await _navigationService.NavigateAsync("PalletizeDetailView", new NavigationParameters { { "LoadInfo", palletResponseModel }, { "Contents", ConstantManager.Contents } }, animated : false); } catch (Exception ex) { Crashes.TrackError(ex); } finally { Loader.StopLoading(); palletItems = null; pallet = null; barCodeCollection = null; palletRequestModel = null; Cleanup(); } }
public void Validate() { Preconditions.NotNullOrWhitespace(ManifestId.ToString(), nameof(ManifestId)); }
public override int CompareTo(Order other) { return(ManifestId.CompareTo(other.ManifestId) + DSP_SEQ.CompareTo(other.DSP_SEQ) + ORD_NO.CompareTo(other.ORD_NO) + MDL_CNT.CompareTo(other.MDL_CNT) + MDL_NO.CompareTo(other.MDL_NO) + HEIGHT.CompareTo(other.HEIGHT) + WIDTH.CompareTo(other.WIDTH)); }
public DepotManifest(string branchName, ManifestId manifestId) { BranchName = branchName; ManifestId = manifestId; }
public SteamOsNotSupportedByAppException(AppId appId, DepotId depotId, ManifestId manifestId, SteamOs targetOs, IEnumerable <string> availableOs) : base($"App id = {appId}, depot id = {depotId}, manifest id = {manifestId} only supports OS {string.Join(", ", availableOs)} but not {targetOs}") { }
public void InstallWorkloadManifest(ManifestId manifestId, ManifestVersion manifestVersion, SdkFeatureBand sdkFeatureBand) => throw new System.NotImplementedException();