コード例 #1
0
        private static async Task RunFileGeneratorWithPackageEntries(IEnumerable <PackageVersionEntry> entries)
        {
            _latestMinors.Start();
            _comprehensive.Start();
            _strategyGenerator.Start();

            foreach (var entry in entries)
            {
                Version entryNetCoreMinVersion;
                if (!Version.TryParse(entry.MinVersionNetCore, out entryNetCoreMinVersion))
                {
                    entryNetCoreMinVersion = new Version("0.0.0.0");
                }

                var packageVersions = await NuGetPackageHelper.GetNugetPackageVersions(entry);

                var orderedPackageVersions =
                    packageVersions
                    .Distinct()
                    .Select(versionText => new Version(versionText))
                    .OrderBy(v => v.Major)
                    .ThenBy(v => v.Minor)
                    .ThenBy(v => v.Revision)
                    .ThenBy(v => v.Build)
                    .ToList();

                // Add the last for every minor
                var orderedLastMinorPackageVersions = orderedPackageVersions
                                                      .GroupBy(v => $"{v.Major}.{v.Minor}")
                                                      .Select(group => group.Max());

                var allNetFrameworkVersions = orderedPackageVersions
                                              .Where(v => v.CompareTo(entryNetCoreMinVersion) < 0)
                                              .Select(v => v.ToString());

                var allNetCoreVersions = orderedPackageVersions
                                         .Where(v => v.CompareTo(entryNetCoreMinVersion) >= 0)
                                         .Select(v => v.ToString());

                var lastMinorNetFrameworkVersions = orderedLastMinorPackageVersions
                                                    .Where(v => v.CompareTo(entryNetCoreMinVersion) < 0)
                                                    .Select(v => v.ToString());

                var lastMinorNetCoreVersions = orderedLastMinorPackageVersions
                                               .Where(v => v.CompareTo(entryNetCoreMinVersion) >= 0)
                                               .Select(v => v.ToString());

                _latestMinors.Write(entry, lastMinorNetFrameworkVersions, lastMinorNetCoreVersions);
                _comprehensive.Write(entry, allNetFrameworkVersions, allNetCoreVersions);
                _strategyGenerator.Write(entry, null, null);
            }

            _latestMinors.Finish();
            _comprehensive.Finish();
            _strategyGenerator.Finish();
        }
コード例 #2
0
        private static async Task RunFileGeneratorWithPackageEntries(FileGenerator fileGenerator, IEnumerable <PackageVersionEntry> entries)
        {
            fileGenerator.Start();

            foreach (PackageVersionEntry entry in entries)
            {
                var packageVersions = await NuGetPackageHelper.GetNugetPackageVersions(entry);

                fileGenerator.Write(integrationName: entry.IntegrationName, sampleProjectName: entry.SampleProjectName, packageVersions: packageVersions);
            }

            fileGenerator.Finish();
        }
コード例 #3
0
        private async Task RunFileGeneratorWithPackageEntries(IEnumerable <PackageVersionEntry> entries, Solution solution)
        {
            _latestMinors.Start();
            _latestMajors.Start();
            _latestSpecific.Start();
            _strategyGenerator.Start();

            foreach (var entry in entries)
            {
                var project = solution.GetProject(entry.SampleProjectName);
                var supportedTargetFrameworks = project
                                                .GetTargetFrameworks()
                                                .Select(x => (TargetFramework) new TargetFramework.TargetFrameworkTypeConverter().ConvertFrom(x));

                var requiresDockerDependency = project.RequiresDockerDependency();

                var packageVersions = await NuGetPackageHelper.GetNugetPackageVersions(entry);

                var orderedPackageVersions =
                    packageVersions
                    .Distinct()
                    .Select(versionText => new Version(versionText))
                    .OrderBy(v => v)
                    .ToList();

                var orderedWithFramework = (
                    from version in orderedPackageVersions
                    from framework in supportedTargetFrameworks
                    where IsSupported(entry, version.ToString(), framework)
                    select(version, framework))
                                           .ToList();

                // Add the last for every minor
                var latestMajors   = SelectMax(orderedWithFramework, v => v.Major).ToList();
                var latestMinors   = SelectMax(orderedWithFramework, v => $"{v.Major}.{v.Minor}").ToList();
                var latestSpecific = entry.SpecificVersions.Length == 0
                    ? latestMajors
                    : SelectPackagesFromGlobs(orderedWithFramework, entry.SpecificVersions).ToList();

                _latestMinors.Write(entry, latestMinors, requiresDockerDependency);
                _latestMajors.Write(entry, latestMajors, requiresDockerDependency);
                _latestSpecific.Write(entry, latestSpecific, requiresDockerDependency);

                _strategyGenerator.Write(entry, null, requiresDockerDependency);
            }

            _latestMinors.Finish();
            _latestMajors.Finish();
            _latestSpecific.Finish();
            _strategyGenerator.Finish();
        }
コード例 #4
0
        private async Task RunFileGeneratorWithPackageEntries(IEnumerable <PackageVersionEntry> entries, Solution solution)
        {
            _latestMinors.Start();
            _latestMajors.Start();
            _strategyGenerator.Start();

            foreach (var entry in entries)
            {
                var supportedTargetFrameworks = solution
                                                .GetProject(entry.SampleProjectName)
                                                .GetTargetFrameworks()
                                                .Select(x => (TargetFramework) new TargetFramework.TargetFrameworkTypeConverter().ConvertFrom(x));

                var packageVersions = await NuGetPackageHelper.GetNugetPackageVersions(entry);

                var orderedPackageVersions =
                    packageVersions
                    .Distinct()
                    .Select(versionText => new Version(versionText))
                    .OrderBy(v => v)
                    .ToList();

                var orderedWithFramework = (
                    from version in orderedPackageVersions
                    from framework in supportedTargetFrameworks
                    where IsSupported(entry, version.ToString(), framework)
                    select(version, framework))
                                           .ToList();

                // Always include some specific versions, to give us better coverage
                var alwaysIncludeVersions = entry.AlwaysIncludeVersions.Select(x => new Version(x));

                // Add the last for every minor
                var latestMinors = SelectMax(orderedWithFramework, v => $"{v.Major}.{v.Minor}", Array.Empty <Version>());
                var latestMajors = SelectMax(orderedWithFramework, v => v.Major, alwaysIncludeVersions);

                _latestMinors.Write(entry, latestMinors);
                _latestMajors.Write(entry, latestMajors);
                _strategyGenerator.Write(entry, null);
            }

            _latestMinors.Finish();
            _latestMajors.Finish();
            _strategyGenerator.Finish();
        }
コード例 #5
0
        private static async Task RunFileGeneratorWithPackageEntries(IEnumerable <PackageVersionEntry> entries)
        {
            _latestMinors.Start();
            _comprehensive.Start();
            _strategyGenerator.Start();

            foreach (var entry in entries)
            {
                var packageVersions = await NuGetPackageHelper.GetNugetPackageVersions(entry);

                var typedVersions =
                    packageVersions
                    .Select(versionText => new Version(versionText))
                    .OrderBy(v => v.Major)
                    .ThenBy(v => v.Minor)
                    .ThenBy(v => v.Revision)
                    .ThenBy(v => v.Build)
                    .ToList();

                var typicalTestVersions = new HashSet <string>();

                // Add the last for every minor

                var majorGroups = typedVersions.GroupBy(v => v.Major);

                foreach (var majorGroup in majorGroups)
                {
                    var minorGroups = majorGroup.GroupBy(v => v.Minor);
                    foreach (var minorGroup in minorGroups)
                    {
                        typicalTestVersions.Add(minorGroup.Last().ToString());
                    }
                }

                var allVersions = typedVersions.Select(v => v.ToString()).ToHashSet();
                _latestMinors.Write(entry, typicalTestVersions);
                _comprehensive.Write(entry, allVersions);
                _strategyGenerator.Write(entry, null);
            }

            _latestMinors.Finish();
            _comprehensive.Finish();
            _strategyGenerator.Finish();
        }