Esempio n. 1
0
        private static void Main(CommandLineArguments args)
        {
            var cache = new LocalPackageCache(Path.GetFullPath(ConfigurationManager.AppSettings["NuGetPackagesPath"]));
            var httpDataProvider = new HttpDataProvider(new DirectoryInfo("HttpCache"));

            var sources = new IFeatureTableSource[] {
                new GeneralInfoTableSource(
                    cache,
                    httpDataProvider,
                    new LicenseResolver(httpDataProvider, new Uri(ConfigurationManager.AppSettings["LicensesJsonUrl"]))
                ),
                new NetFxSupportTableSource(cache),
                new FeatureTestTableSource(new FeatureTestRunner())
            };
            var outputs = new IResultOutput[] {
                new HtmlOutput(new DirectoryInfo(ConfigurationManager.AppSettings["HtmlTemplatesPath"])),
                new JsonOutput()
            };

            var outputDirectory = new DirectoryInfo(args.OutputPath ?? ConfigurationManager.AppSettings["OutputPath"]);
            if (!outputDirectory.Exists)
                outputDirectory.Create();

            var assemblyPaths = GetAssemblyPaths();
            var results = assemblyPaths.Select(path => {
                ConsoleEx.Write(ConsoleColor.White, "Running " + Path.GetFileName(path) + ":");
                var assembly = Assembly.LoadFrom(path);

                var tables = sources.SelectMany(s => s.GetTables(assembly)).ToArray();
                CalculateTotal(tables.Single(t => t.Key == MetadataKeys.GeneralInfoTable), tables);

                var outputNamePrefix = assembly.GetName().Name.SubstringAfter(AssemblyNamePrefix);
                var result = new ResultForAssembly(assembly, tables, outputNamePrefix);

                ConsoleEx.WriteLine(ConsoleColor.Green, " OK");
                return result;
            }).ToArray();

            Console.WriteLine();
            ConsoleEx.WriteLine(ConsoleColor.White, "Creating outputs:");
            foreach (var output in outputs) {
                output.Write(outputDirectory, results, args.WatchTemplates);
            }

            if (args.WatchTemplates) {
                Console.WriteLine();
                ConsoleEx.WriteLine(ConsoleColor.White, "Auto-updating outputs if templates change.");
                ConsoleEx.WriteLine(ConsoleColor.White, "Press [Enter] to stop.");
                Console.ReadLine();
            }

            foreach (var output in outputs) {
                output.Dispose();
            }

            Console.WriteLine();
            ConsoleEx.WriteLine(ConsoleColor.Green, "Completed.");
        }
 public NetFxSupportTableSource(LocalPackageCache packageCache)
 {
     this.packageCache = packageCache;
 }