public void store_nativeonlyassets() { TestAsset simpleDependenciesAsset = _testAssetsManager .CopyTestAsset("UnmanagedStore") .WithSource(); var storeCommand = new ComposeStoreCommand(Log, simpleDependenciesAsset.TestRoot); var OutputFolder = Path.Combine(simpleDependenciesAsset.TestRoot, "outdir"); var WorkingDir = Path.Combine(simpleDependenciesAsset.TestRoot, "w"); NuGetConfigWriter.Write(simpleDependenciesAsset.TestRoot, NuGetConfigWriter.DotnetCoreMyGetFeed); storeCommand .Execute($"/p:RuntimeIdentifier={_runtimeRid}", $"/p:TargetFramework={_tfm}", $"/p:ComposeWorkingDir={WorkingDir}", $"/p:ComposeDir={OutputFolder}", $"/p:DoNotDecorateComposeDir=true") .Should() .Pass(); DirectoryInfo storeDirectory = new DirectoryInfo(OutputFolder); List <string> files_on_disk = new List <string> { "artifact.xml", $"runtime.{_runtimeRid}.microsoft.netcore.coredistools/1.0.1-prerelease-00001/runtimes/{_runtimeRid}/native/{_libPrefix}coredistools{FileConstants.DynamicLibSuffix}", $"runtime.{_runtimeRid}.microsoft.netcore.coredistools/1.0.1-prerelease-00001/runtimes/{_runtimeRid}/native/coredistools.h" }; storeDirectory.Should().OnlyHaveFiles(files_on_disk); }
public void compose_dependencies_noopt() { TestAsset simpleDependenciesAsset = _testAssetsManager .CopyTestAsset("TargetManifests") .WithSource(); var storeCommand = new ComposeStoreCommand(Log, simpleDependenciesAsset.TestRoot, "FluentAssertion.xml"); var OutputFolder = Path.Combine(simpleDependenciesAsset.TestRoot, "outdir"); var WorkingDir = Path.Combine(simpleDependenciesAsset.TestRoot, "w"); storeCommand .Execute($"/p:RuntimeIdentifier={_runtimeRid}", $"/p:TargetFramework={_tfm}", $"/p:ComposeDir={OutputFolder}", "/p:SkipOptimization=true", $"/p:ComposeWorkingDir={WorkingDir}", "/p:DoNotDecorateComposeDir=true", "/p:PreserveComposeWorkingDir=true", "/p:CreateProfilingSymbols=false") .Should() .Pass(); DirectoryInfo storeDirectory = new DirectoryInfo(OutputFolder); List <string> files_on_disk = new List <string> { "artifact.xml", "newtonsoft.json/9.0.1/lib/netstandard1.0/Newtonsoft.Json.dll", "fluentassertions/4.12.0/lib/netstandard1.3/FluentAssertions.Core.dll", "fluentassertions/4.12.0/lib/netstandard1.3/FluentAssertions.dll", "fluentassertions.json/4.12.0/lib/netstandard1.3/FluentAssertions.Json.dll" }; if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { // https://github.com/dotnet/core-setup/issues/2716 - an unintended native shim is getting published to the runtime store files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system.security.cryptography/1.0.1/runtimes/{_runtimeRid}/native/System.Security.Cryptography.Native{FileConstants.DynamicLibSuffix}"); } storeDirectory.Should().OnlyHaveFiles(files_on_disk); }
public void DotnetStoreWithPrunedPackages() { const string TargetFramework = "netcoreapp3.1"; TestAsset targetManifestsAsset = _testAssetsManager .CopyTestAsset("TargetManifests") .WithSource(); var outputFolder = Path.Combine(targetManifestsAsset.TestRoot, "o"); var workingDir = Path.Combine(targetManifestsAsset.TestRoot, "w"); var composeStore = new ComposeStoreCommand(Log, targetManifestsAsset.TestRoot, "PrunePackages.xml") .Execute( $"/p:TargetFramework={TargetFramework}", $"/p:RuntimeIdentifier={EnvironmentInfo.GetCompatibleRid(TargetFramework)}", $"/p:ComposeDir={outputFolder}", $"/p:ComposeWorkingDir={workingDir}", "/p:PreserveComposeWorkingDir=true", "/p:DoNotDecorateComposeDir=true", "/p:CreateProfilingSymbols=false" ); composeStore.Should().Pass(); new DirectoryInfo(outputFolder).GetDirectories() .Select(d => d.Name) .Should().BeEquivalentTo( "fluentassertions", "newtonsoft.json", "system.configuration.configurationmanager", "system.security.cryptography.protecteddata"); }
public void store_nativeonlyassets() { TestAsset simpleDependenciesAsset = _testAssetsManager .CopyTestAsset("UnmanagedStore") .WithSource(); var storeCommand = new ComposeStoreCommand(Log, simpleDependenciesAsset.TestRoot); var OutputFolder = Path.Combine(simpleDependenciesAsset.TestRoot, "outdir"); var WorkingDir = Path.Combine(simpleDependenciesAsset.TestRoot, "w"); storeCommand .Execute($"/p:RuntimeIdentifier={_runtimeRid}", $"/p:TargetFramework={_tfm}", $"/p:ComposeWorkingDir={WorkingDir}", $"/p:ComposeDir={OutputFolder}", $"/p:DoNotDecorateComposeDir=true", "/p:RestoreSources=https://dotnetfeed.blob.core.windows.net/dotnet-core/packages/index.json;https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json;https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;https://dotnet.myget.org/F/msbuild/api/v3/index.json;https://dotnet.myget.org/F/nuget-build/api/v3/index.json") .Should() .Pass(); DirectoryInfo storeDirectory = new DirectoryInfo(OutputFolder); List <string> files_on_disk = new List <string> { "artifact.xml", $"runtime.{_runtimeRid}.microsoft.netcore.coredistools/1.0.1-prerelease-00001/runtimes/{_runtimeRid}/native/{_libPrefix}coredistools{FileConstants.DynamicLibSuffix}", $"runtime.{_runtimeRid}.microsoft.netcore.coredistools/1.0.1-prerelease-00001/runtimes/{_runtimeRid}/native/coredistools.h" }; storeDirectory.Should().OnlyHaveFiles(files_on_disk); }
public void compose_dependencies_noopt() { TestAsset simpleDependenciesAsset = _testAssetsManager .CopyTestAsset("SimpleStore") .WithSource(); var storeCommand = new ComposeStoreCommand(Log, simpleDependenciesAsset.TestRoot, "SimpleStore.xml"); var OutputFolder = Path.Combine(simpleDependenciesAsset.TestRoot, "outdir"); var WorkingDir = Path.Combine(simpleDependenciesAsset.TestRoot, "w"); storeCommand .Execute($"/p:RuntimeIdentifier={_runtimeRid}", $"/p:TargetFramework={_tfm}", $"/p:ComposeDir={OutputFolder}", $"/p:DoNotDecorateComposeDir=true", "/p:SkipOptimization=true", $"/p:ComposeWorkingDir={WorkingDir}", "/p:PreserveComposeWorkingDir=true") .Should() .Pass(); DirectoryInfo storeDirectory = new DirectoryInfo(OutputFolder); List <string> files_on_disk = new List <string> { "artifact.xml", $"runtime.{_runtimeRid}.microsoft.netcore.coredistools/1.0.1-prerelease-00001/runtimes/{_runtimeRid}/native/{_libPrefix}coredistools{FileConstants.DynamicLibSuffix}", $"runtime.{_runtimeRid}.microsoft.netcore.coredistools/1.0.1-prerelease-00001/runtimes/{_runtimeRid}/native/coredistools.h", $"runtime.{_runtimeOs}.system.private.uri/4.4.0-beta-24821-02/runtimes/{_runtimeLibOs}/lib/netstandard1.0/System.Private.Uri.dll" }; if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && _testArch != "x86") { files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system/4.4.0-beta-24821-02/runtimes/{_runtimeRid}/native/System.Native.a"); files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system/4.4.0-beta-24821-02/runtimes/{_runtimeRid}/native/System.Native{FileConstants.DynamicLibSuffix}"); } storeDirectory.Should().OnlyHaveFiles(files_on_disk); }
public void compose_dependencies() { TestAsset simpleDependenciesAsset = _testAssetsManager .CopyTestAsset("SimpleStore") .WithSource(); var storeCommand = new ComposeStoreCommand(Log, simpleDependenciesAsset.TestRoot, "SimpleStore.xml"); var OutputFolder = Path.Combine(simpleDependenciesAsset.TestRoot, "outdir"); var WorkingDir = Path.Combine(simpleDependenciesAsset.TestRoot, "w"); storeCommand .Execute($"/p:RuntimeIdentifier={_runtimeRid}", $"/p:TargetFramework={_tfm}", $"/p:ComposeDir={OutputFolder}", $"/p:ComposeWorkingDir={WorkingDir}", "/p:DoNotDecorateComposeDir=true", "/p:PreserveComposeWorkingDir=true") .Should() .Pass(); DirectoryInfo storeDirectory = new DirectoryInfo(OutputFolder); List <string> files_on_disk = new List <string> { "artifact.xml", $"runtime.{_runtimeRid}.microsoft.netcore.coredistools/1.0.1-prerelease-00001/runtimes/{_runtimeRid}/native/{_libPrefix}coredistools{FileConstants.DynamicLibSuffix}", $"runtime.{_runtimeRid}.microsoft.netcore.coredistools/1.0.1-prerelease-00001/runtimes/{_runtimeRid}/native/coredistools.h" }; if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && _testArch != "x86") { files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system/4.4.0-beta-24821-02/runtimes/{_runtimeRid}/native/System.Native.a"); files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system/4.4.0-beta-24821-02/runtimes/{_runtimeRid}/native/System.Native{FileConstants.DynamicLibSuffix}"); } storeDirectory.Should().OnlyHaveFiles(files_on_disk); //valid artifact.xml var knownpackage = new HashSet <PackageIdentity>(); knownpackage.Add(new PackageIdentity("Microsoft.NETCore.Targets", NuGetVersion.Parse("1.2.0-beta-24821-02"))); knownpackage.Add(new PackageIdentity("System.Private.Uri", NuGetVersion.Parse("4.4.0-beta-24821-02"))); knownpackage.Add(new PackageIdentity("Microsoft.NETCore.CoreDisTools", NuGetVersion.Parse("1.0.1-prerelease-00001"))); knownpackage.Add(new PackageIdentity($"runtime.{_runtimeOs}.System.Private.Uri", NuGetVersion.Parse("4.4.0-beta-24821-02"))); knownpackage.Add(new PackageIdentity("Microsoft.NETCore.Platforms", NuGetVersion.Parse("1.2.0-beta-24821-02"))); knownpackage.Add(new PackageIdentity($"runtime.{_runtimeRid}.Microsoft.NETCore.CoreDisTools", NuGetVersion.Parse("1.0.1-prerelease-00001"))); if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && _testArch != "x86") { knownpackage.Add(new PackageIdentity("runtime.native.System", NuGetVersion.Parse("4.4.0-beta-24821-02"))); knownpackage.Add(new PackageIdentity($"runtime.{_runtimeRid}.runtime.native.System", NuGetVersion.Parse("4.4.0-beta-24821-02"))); } var artifact = Path.Combine(OutputFolder, "artifact.xml"); HashSet <PackageIdentity> packagescomposed = ParseStoreArtifacts(artifact); packagescomposed.Count.Should().Be(knownpackage.Count); foreach (var pkg in packagescomposed) { knownpackage.Should().Contain(elem => elem.Equals(pkg), "package {0}, version {1} was not expected to be stored", pkg.Id, pkg.Version); } }
public void compose_multifile() { TestAsset simpleDependenciesAsset = _testAssetsManager .CopyTestAsset("TargetManifests", "multifile") .WithSource(); var storeCommand = new ComposeStoreCommand(Log, simpleDependenciesAsset.TestRoot, "NewtonsoftFilterProfile.xml"); storeCommand.WorkingDirectory = simpleDependenciesAsset.Path; var OutputFolder = Path.Combine(simpleDependenciesAsset.TestRoot, "o"); var WorkingDir = Path.Combine(simpleDependenciesAsset.TestRoot, "w"); var additionalproj1 = Path.Combine(simpleDependenciesAsset.TestRoot, "NewtonsoftMultipleVersions.xml"); var additionalproj2 = Path.Combine(simpleDependenciesAsset.TestRoot, "FluentAssertion.xml"); storeCommand .Execute($"/p:RuntimeIdentifier={_runtimeRid}", $"/p:TargetFramework={_tfm}", $"/p:Additionalprojects={additionalproj1}%3b{additionalproj2}", $"/p:ComposeDir={OutputFolder}", $"/p:ComposeWorkingDir={WorkingDir}", "/p:DoNotDecorateComposeDir=true", "/p:CreateProfilingSymbols=false") .Should() .Pass(); DirectoryInfo storeDirectory = new DirectoryInfo(OutputFolder); List <string> files_on_disk = new List <string> { "artifact.xml", "newtonsoft.json/9.0.2-beta2/lib/netstandard1.1/Newtonsoft.Json.dll", "newtonsoft.json/9.0.1/lib/netstandard1.0/Newtonsoft.Json.dll", "fluentassertions/4.12.0/lib/netstandard1.3/FluentAssertions.Core.dll", "fluentassertions/4.12.0/lib/netstandard1.3/FluentAssertions.dll", "fluentassertions.json/4.12.0/lib/netstandard1.3/FluentAssertions.Json.dll", }; if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { // https://github.com/dotnet/core-setup/issues/2716 - an unintended native shim is getting published to the runtime store files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system.security.cryptography/1.0.1/runtimes/{_runtimeRid}/native/System.Security.Cryptography.Native{FileConstants.DynamicLibSuffix}"); } storeDirectory.Should().OnlyHaveFiles(files_on_disk); var knownpackage = new HashSet <PackageIdentity> { new PackageIdentity("Newtonsoft.Json", NuGetVersion.Parse("9.0.1")), new PackageIdentity("Newtonsoft.Json", NuGetVersion.Parse("9.0.2-beta2")), new PackageIdentity("FluentAssertions.Json", NuGetVersion.Parse("4.12.0")) }; var artifact = Path.Combine(OutputFolder, "artifact.xml"); var packagescomposed = ParseStoreArtifacts(artifact); packagescomposed.Count.Should().BeGreaterThan(0); foreach (var pkg in knownpackage) { packagescomposed.Should().Contain(elem => elem.Equals(pkg), "package {0}, version {1} was expected to be stored", pkg.Id, pkg.Version); } }
public void It_creates_profiling_symbols() { TestAsset targetManifestsAsset = _testAssetsManager .CopyTestAsset("TargetManifests") .WithSource(); var outputFolder = Path.Combine(targetManifestsAsset.TestRoot, "o"); var workingDir = Path.Combine(targetManifestsAsset.TestRoot, "w"); var composeStore = new ComposeStoreCommand(Log, targetManifestsAsset.TestRoot, "NewtonsoftFilterProfile.xml"); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { // clear the PATH on windows to ensure creating .ni.pdbs works without // being in a VS developer command prompt composeStore.WithEnvironmentVariable("PATH", string.Empty); } composeStore .Execute( $"/p:RuntimeIdentifier={_runtimeRid}", "/p:TargetFramework=netcoreapp2.0", $"/p:ComposeDir={outputFolder}", $"/p:ComposeWorkingDir={workingDir}", "/p:DoNotDecorateComposeDir=true", "/p:PreserveComposeWorkingDir=true") .Should() .Pass(); var symbolFileExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "ni.pdb" : ".map"; var symbolsFolder = new DirectoryInfo(Path.Combine(outputFolder, "symbols")); if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { // profiling symbols are not supported on OSX symbolsFolder.Should().NotExist(); return; } var newtonsoftSymbolsFolder = symbolsFolder.Sub("newtonsoft.json").Sub("9.0.1").Sub("lib").Sub("netstandard1.0"); newtonsoftSymbolsFolder.Should().Exist(); var newtonsoftSymbolsFiles = newtonsoftSymbolsFolder.GetFiles().ToArray(); newtonsoftSymbolsFiles.Length.Should().Be(1); newtonsoftSymbolsFiles[0].Name.Should().StartWith("Newtonsoft.Json").And.EndWith(symbolFileExtension); }
public void compose_multifile() { TestAsset simpleDependenciesAsset = _testAssetsManager .CopyTestAsset("TargetManifests", "multifile") .WithSource(); var storeCommand = new ComposeStoreCommand(Log, simpleDependenciesAsset.TestRoot, "NewtonsoftFilterProfile.xml"); var OutputFolder = Path.Combine(simpleDependenciesAsset.TestRoot, "o"); var WorkingDir = Path.Combine(simpleDependenciesAsset.TestRoot, "w"); var additonalproj1 = Path.Combine(simpleDependenciesAsset.TestRoot, "NewtonsoftMultipleVersions.xml"); var additonalproj2 = Path.Combine(simpleDependenciesAsset.TestRoot, "FluentAssertions.xml"); storeCommand .Execute($"/p:RuntimeIdentifier={_runtimeRid}", $"/p:TargetFramework={_tfm}", $"/p:Additionalprojects={additonalproj1}%3b{additonalproj2}", $"/p:ComposeDir={OutputFolder}", $"/p:ComposeWorkingDir={WorkingDir}", "/p:DoNotDecorateComposeDir=true", "/p:CreateProfilingSymbols=false") .Should() .Pass(); DirectoryInfo storeDirectory = new DirectoryInfo(OutputFolder); List <string> files_on_disk = new List <string> { "artifact.xml", @"newtonsoft.json/9.0.2-beta2/lib/netstandard1.1/Newtonsoft.Json.dll", @"newtonsoft.json/9.0.1/lib/netstandard1.0/Newtonsoft.Json.dll", @"fluentassertions.json/4.12.0/lib/netstandard1.3/FluentAssertions.Json.dll" }; storeDirectory.Should().HaveFiles(files_on_disk); var knownpackage = new HashSet <PackageIdentity>(); knownpackage.Add(new PackageIdentity("Newtonsoft.Json", NuGetVersion.Parse("9.0.1"))); knownpackage.Add(new PackageIdentity("Newtonsoft.Json", NuGetVersion.Parse("9.0.2-beta2"))); knownpackage.Add(new PackageIdentity("FluentAssertions.Json", NuGetVersion.Parse("4.12.0"))); var artifact = Path.Combine(OutputFolder, "artifact.xml"); var packagescomposed = ParseStoreArtifacts(artifact); packagescomposed.Count.Should().BeGreaterThan(0); foreach (var pkg in knownpackage) { packagescomposed.Should().Contain(elem => elem.Equals(pkg), "package {0}, version {1} was not expected to be stored", pkg.Id, pkg.Version); } }