예제 #1
0
        /// <inheritdoc />
        /// <exception cref="NotSupportedException">Building events for WPF on Mac is not implemented.</exception>
        public override async Task Extract(string referenceAssembliesLocation)
        {
            var results = await NuGetPackageHelper.DownloadPackageFilesAndFolder(new[] { ReferenceNuGet }, new[] { ReferenceFramework }, packageOutputDirectory : _filePath).ConfigureAwait(false);

            Input.SupportGroup = results.SupportGroup;

            SetFiles(results);
        }
        public async Task MultipleDirectoryCase()
        {
            // NetCore contains multiple directories that match.
            var package    = new[] { new PackageIdentity("Microsoft.NETCore.App", new NuGetVersion("2.0.0")) };
            var frameworks = new[] { FrameworkConstants.CommonFrameworks.NetCoreApp20 };

            var result = (await NuGetPackageHelper
                          .DownloadPackageFilesAndFolder(package, frameworks, packageOutputDirectory: _packageDirectory)
                          .ConfigureAwait(false));
        }
예제 #3
0
        public async Task CanGetNetCoreApp20()
        {
            var package    = new[] { new PackageIdentity("Microsoft.NETCore.App", new NuGetVersion("2.0.0")) };
            var frameworks = new[] { FrameworkConstants.CommonFrameworks.NetCoreApp20 };

            var result = await NuGetPackageHelper
                         .DownloadPackageFilesAndFolder(package, frameworks, packageOutputDirectory : TestUtilities.GetPackageDirectory())
                         .ConfigureAwait(false);

            var includeFiles = result.IncludeGroup.GetAllFileNames().ToList();

            includeFiles.ShouldNotBeEmpty();
            includeFiles.Where(x => x.EndsWith(".dll")).ShouldNotBeEmpty();
        }
예제 #4
0
        private static string GetWindowsInstallationDirectory(bool includePreRelease)
        {
            return(_windowsInstallationDirectory.GetOrAdd(
                       includePreRelease,
                       incPreRelease =>
            {
                return Task.Run(
                    async() =>
                {
                    var results = await NuGetPackageHelper.DownloadPackageFilesAndFolder(
                        new[] { VSWherePackageIdentity },
                        new[] { new NuGetFramework("Any") },
                        packageFolders: new[] { PackagingConstants.Folders.Tools },
                        getDependencies: false).ConfigureAwait(false);

                    var fileName = results.IncludeGroup.GetAllFileNames().FirstOrDefault(x => x.EndsWith("vswhere.exe", StringComparison.InvariantCultureIgnoreCase));

                    if (fileName == null)
                    {
                        throw new ReferenceLocationNotFoundException("Cannot find visual studio installation, due to vswhere not being installed correctly.");
                    }

                    var parameters = new StringBuilder("-latest -nologo -property installationPath -format value");

                    if (incPreRelease)
                    {
                        parameters.Append(" -prerelease");
                    }

                    using (var process = new Process())
                    {
                        process.StartInfo.FileName = fileName;
                        process.StartInfo.Arguments = parameters.ToString();
                        process.StartInfo.UseShellExecute = false;
                        process.StartInfo.RedirectStandardOutput = true;

                        process.Start();

                        // To avoid deadlocks, always read the output stream first and then wait.
                        var output = process.StandardOutput.ReadToEnd().Replace(Environment.NewLine, string.Empty);
                        process.WaitForExit();

                        return output;
                    }
                }).ConfigureAwait(false).GetAwaiter().GetResult();
            }));
        }
예제 #5
0
        public async Task IntegrationTestAssemblyTest()
        {
            using (var memoryStream = new MemoryStream())
            {
                var input = await NuGetPackageHelper.DownloadPackageFilesAndFolder(new[] { new PackageIdentity("NETStandard.Library", new NuGetVersion("2.0.0")) }).ConfigureAwait(false);

                using (var streamWriter = new StreamWriter(memoryStream, Encoding.UTF8, 1024, true))
                {
                    await ObservablesForEventGenerator.ExtractEventsFromAssemblies(streamWriter, input, FrameworkConstants.CommonFrameworks.NetStandard20).ConfigureAwait(false);
                }

                memoryStream.Flush();

                memoryStream.Position = 0;
                using (var sr = new StreamReader(memoryStream))
                {
                    var contents = sr.ReadToEnd();

                    contents.ShouldNotBeEmpty();
                }
            }
        }
예제 #6
0
        private static async Task GetAndCheckTizenPackage()
        {
            var package    = new[] { new PackageIdentity("Tizen.NET.API4", new NuGetVersion("4.0.1.14152")) };
            var frameworks = new[] { FrameworkConstants.CommonFrameworks.NetStandard20 };

            var testPackageLocation = TestUtilities.GetPackageDirectory();

            var result = await NuGetPackageHelper
                         .DownloadPackageFilesAndFolder(package, frameworks, packageOutputDirectory : testPackageLocation)
                         .ConfigureAwait(false);

            var includeFiles = result.IncludeGroup.GetAllFileNames().ToList();
            var actualFiles  = includeFiles.Where(x => x.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase)).ToList();

            includeFiles.ShouldNotBeEmpty();
            actualFiles.ShouldNotBeEmpty();

            Assert.True(actualFiles.All(File.Exists));

            var actualFileNames = actualFiles.Select(Path.GetFileName).ToList();

            ExpectedTizenFiles.ShouldHaveSameContents(actualFileNames);
        }
예제 #7
0
 /// <summary>
 /// Extracts the data using the specified target framework.
 /// </summary>
 /// <param name="targetFrameworks">The target framework to extract in order of priority.</param>
 /// <param name="packages">The packages to extract the information from.</param>
 /// <param name="packageOutputDirectory">Directory for the packages, if null a random path in the temp folder will be used.</param>
 /// <returns>A task to monitor the progress.</returns>
 public async Task Extract(IReadOnlyCollection <NuGetFramework> targetFrameworks, IReadOnlyCollection <LibraryRange> packages, string?packageOutputDirectory)
 {
     Input = await NuGetPackageHelper.DownloadPackageFilesAndFolder(packages, targetFrameworks, packageOutputDirectory : packageOutputDirectory).ConfigureAwait(false);
 }