public BuildScript Analyse(Autobuilder builder, bool auto) { if (!builder.ProjectsOrSolutionsToBuild.Any()) { return(BuildScript.Failure); } if (auto) { var notDotNetProject = builder.ProjectsOrSolutionsToBuild. SelectMany(p => Enumerators.Singleton(p).Concat(p.IncludedProjects)). OfType <Project>(). FirstOrDefault(p => !p.DotNetProject); if (notDotNetProject != null) { builder.Log(Severity.Info, "Not using .NET Core because of incompatible project {0}", notDotNetProject); return(BuildScript.Failure); } builder.Log(Severity.Info, "Attempting to build using .NET Core"); } return(WithDotNet(builder, dotNet => { var ret = GetInfoCommand(builder.Actions, dotNet); foreach (var projectOrSolution in builder.ProjectsOrSolutionsToBuild) { var cleanCommand = GetCleanCommand(builder.Actions, dotNet); cleanCommand.QuoteArgument(projectOrSolution.FullPath); var clean = cleanCommand.Script; var restoreCommand = GetRestoreCommand(builder.Actions, dotNet); restoreCommand.QuoteArgument(projectOrSolution.FullPath); var restore = restoreCommand.Script; var buildCommand = GetBuildCommand(builder, dotNet); buildCommand.QuoteArgument(projectOrSolution.FullPath); var build = buildCommand.Script; ret &= clean & BuildScript.Try(restore) & build; } return ret; })); }
private Lambda(ExpressionNodeInfo info, SimpleLambdaExpressionSyntax node) : this(info.SetKind(ExprKind.LAMBDA), node.Body, Enumerators.Singleton(node.Parameter)) { }
/// <summary> /// Performs a C# build analysis. /// </summary> /// <param name="options">Analysis options from the command line.</param> /// <param name="progress">Display of analysis progress.</param> public BuildAnalysis(Options options, IProgressMonitor progress) { progressMonitor = progress; sourceDir = new DirectoryInfo(options.SrcDir); progressMonitor.FindingFiles(options.SrcDir); allSources = sourceDir.GetFiles("*.cs", SearchOption.AllDirectories). Select(d => d.FullName). Where(d => !options.ExcludesFile(d)). ToArray(); var dllDirNames = options.DllDirs.Select(Path.GetFullPath); if (options.UseNuGet) { nuget = new NugetPackages(sourceDir.FullName); ReadNugetFiles(); dllDirNames = dllDirNames.Concat(Enumerators.Singleton(nuget.PackageDirectory)); } // Find DLLs in the .Net Framework if (options.ScanNetFrameworkDlls) { dllDirNames = dllDirNames.Concat(Runtime.Runtimes.Take(1)); } assemblyCache = new BuildAnalyser.AssemblyCache(dllDirNames, progress); // Analyse all .csproj files in the source tree. if (options.SolutionFile != null) { AnalyseSolution(options.SolutionFile); } else if (options.AnalyseCsProjFiles) { AnalyseProjectFiles(); } if (!options.AnalyseCsProjFiles) { usedReferences = new HashSet <string>(assemblyCache.AllAssemblies.Select(a => a.Filename)); } ResolveConflicts(); if (options.UseMscorlib) { UseReference(typeof(object).Assembly.Location); } // Output the findings foreach (var r in usedReferences) { progressMonitor.ResolvedReference(r); } foreach (var r in unresolvedReferences) { progressMonitor.UnresolvedReference(r.Key, r.Value); } progressMonitor.Summary( AllSourceFiles.Count(), ProjectSourceFiles.Count(), MissingSourceFiles.Count(), ReferenceFiles.Count(), UnresolvedReferences.Count(), conflictedReferences, succeededProjects + failedProjects, failedProjects); }