Exemple #1
0
    static CompareSet GetExplicitAssembliesToCompare(string[] args)
    {
        var sourceIndex = Array.FindIndex(args, arg => arg == "--source");

        if (sourceIndex < 0)
        {
            throw new ApiComparerArgumentException("No target assemblies specified, please use --source {asm1};{asm2}...");
        }

        var targetIndex = Array.FindIndex(args, arg => arg == "--target");

        if (targetIndex < 0)
        {
            throw new ApiComparerArgumentException("No target assemblies specified, please use --target {asm1};{asm2}...");
        }

        var source = args[sourceIndex + 1];

        AssemblyGroup leftAsmGroup;

        string leftVersion;

        var compareName = "Custom";

        if (source.StartsWith("nuget:"))
        {
            var nugetName = source.Replace("nuget:", "").Trim();


            compareName = nugetName;

            var feeds = GetFeedsToUse(args);

            var nugetBrowser = new NuGetBrowser(feeds);

            var version = nugetBrowser.GetAllVersions(nugetName, args.Contains("--include-prerelease")).Max();

            var nugetDownloader = new NuGetDownloader(nugetName, feeds);

            leftVersion = version.ToString();

            leftAsmGroup = new AssemblyGroup(nugetDownloader.DownloadAndExtractVersion(leftVersion));
        }
        else
        {
            leftVersion = "TBD-Left";

            leftAsmGroup = new AssemblyGroup(source.Split(';').Select(Path.GetFullPath).ToList());
        }

        return(new CompareSet
        {
            Name = compareName,
            RightAssemblyGroup = new AssemblyGroup(args[targetIndex + 1].Split(';').Select(Path.GetFullPath).ToList()),
            LeftAssemblyGroup = leftAsmGroup,
            Versions = new VersionPair(leftVersion, "TBD-Right")
        });
    }
Exemple #2
0
    static CompareSet CreateCompareSet(List <string> feeds, string package, VersionPair versions)
    {
        var nugetDownloader = new NuGetDownloader(package, feeds);

        Console.Out.Write("Preparing {0}-{1}", package, versions);

        var leftAssemblyGroup  = new AssemblyGroup(nugetDownloader.DownloadAndExtractVersion(versions.LeftVersion));
        var rightAssemblyGroup = new AssemblyGroup(nugetDownloader.DownloadAndExtractVersion(versions.RightVersion));

        Console.Out.WriteLine(" done");

        return(new CompareSet
        {
            Name = package,
            RightAssemblyGroup = rightAssemblyGroup,
            LeftAssemblyGroup = leftAssemblyGroup,
            Versions = versions
        });
    }
Exemple #3
0
    static CompareSet CreateCompareSet(string package, VersionPair versions)
    {
        var nugetDownloader = new NuGetDownloader(package, new List<string> { "https://www.nuget.org/api/v2" });

        Console.Out.Write("Preparing {0}-{1}", package, versions);

        var leftAssemblyGroup = new AssemblyGroup(nugetDownloader.DownloadAndExtractVersion(versions.LeftVersion));
        var rightAssemblyGroup = new AssemblyGroup(nugetDownloader.DownloadAndExtractVersion(versions.RightVersion));

        Console.Out.WriteLine(" done");

        return new CompareSet
        {
            Name = package,
            RightAssemblyGroup = rightAssemblyGroup,
            LeftAssemblyGroup = leftAssemblyGroup,
            Versions = versions
        };
    }
Exemple #4
0
    private static CompareSet GetExplicitAssembliesToCompare(string[] args)
    {
        var sourceIndex = Array.FindIndex(args, arg => arg == "--source");

        if (sourceIndex < 0)
        {
            throw new Exception("No target assemblies specified, please use --source {asm1};{asm2}...");
        }

        var targetIndex = Array.FindIndex(args, arg => arg == "--target");

        if (targetIndex < 0)
        {
            throw new Exception("No target assemblies specified, please use --target {asm1};{asm2}...");
        }

        var source = args[sourceIndex + 1];

        AssemblyGroup leftAsmGroup;

        string leftVersion;

        var compareName = "Custom";

        if (source.StartsWith("nuget:"))
        {

            var nugetName = source.Replace("nuget:", "").Trim();

            compareName = nugetName;

            var feeds = GetFeedsToUse(args);

            var nugetBrowser = new NuGetBrowser(feeds);

            var version = nugetBrowser.GetAllVersions(nugetName,args.Contains("--include-prerelease")).Max();

            var nugetDownloader = new NuGetDownloader(nugetName, feeds);

            leftVersion = version.ToString();

            leftAsmGroup = new AssemblyGroup(nugetDownloader.DownloadAndExtractVersion(leftVersion));
        }
        else
        {
            leftVersion = "TBD-Left";

            leftAsmGroup = new AssemblyGroup(source.Split(';').Select(Path.GetFullPath).ToList());
        }

        return new CompareSet
        {
            Name = compareName,
            RightAssemblyGroup = new AssemblyGroup(args[targetIndex + 1].Split(';').Select(Path.GetFullPath).ToList()),
            LeftAssemblyGroup = leftAsmGroup,
            Versions = new VersionPair(leftVersion, "TBD-Right")

        };
    }