Beispiel #1
0
 public DiagnosticsListMessage([NotNull] IList<DiagnosticMessageView> diagnostics, FrameworkData frameworkData)
 {
     Diagnostics = diagnostics;
     Errors = diagnostics.Where(msg => msg.Severity == DiagnosticMessageSeverity.Error).ToList();
     Warnings = diagnostics.Where(msg => msg.Severity == DiagnosticMessageSeverity.Warning).ToList();
     Framework = frameworkData;
 }
 public DiagnosticsListMessage([NotNull] IList <DiagnosticMessage> diagnostics, FrameworkData frameworkData)
 {
     Diagnostics = diagnostics;
     Errors      = diagnostics.Where(msg => msg.Severity == DiagnosticMessageSeverity.Error).ToList();
     Warnings    = diagnostics.Where(msg => msg.Severity == DiagnosticMessageSeverity.Warning).ToList();
     Framework   = frameworkData;
 }
 public DiagnosticsListMessage(IList<DiagnosticMessage> diagnostics, FrameworkData frameworkData) :
     this(diagnostics.Select(msg => new DiagnosticMessageView(msg)).ToList(), frameworkData)
 {
     if (diagnostics == null)
     {
         throw new ArgumentNullException(nameof(diagnostics));
     }
 }
Beispiel #4
0
 public DiagnosticsListMessage(IList <DiagnosticMessage> diagnostics, FrameworkData frameworkData) :
     this(diagnostics.Select(msg => new DiagnosticMessageView(msg)).ToList(), frameworkData)
 {
     if (diagnostics == null)
     {
         throw new ArgumentNullException(nameof(diagnostics));
     }
 }
        public DiagnosticsListMessage(IList<DiagnosticMessageView> diagnostics, FrameworkData frameworkData)
        {
            if (diagnostics == null)
            {
                throw new ArgumentNullException(nameof(diagnostics));
            }

            Diagnostics = diagnostics;
            Errors = diagnostics.Where(msg => msg.Severity == DiagnosticMessageSeverity.Error).ToList();
            Warnings = diagnostics.Where(msg => msg.Severity == DiagnosticMessageSeverity.Warning).ToList();
            Framework = frameworkData;
        }
Beispiel #6
0
        public DiagnosticsListMessage(IList <DiagnosticMessageView> diagnostics, FrameworkData frameworkData)
        {
            if (diagnostics == null)
            {
                throw new ArgumentNullException(nameof(diagnostics));
            }

            Diagnostics = diagnostics;
            Errors      = diagnostics.Where(msg => msg.Severity == DiagnosticMessageSeverity.Error).ToList();
            Warnings    = diagnostics.Where(msg => msg.Severity == DiagnosticMessageSeverity.Warning).ToList();
            Framework   = frameworkData;
        }
Beispiel #7
0
        public ProjectState Resolve(string appPath,
                                    string configuration,
                                    bool triggerBuildOutputs,
                                    bool triggerDependencies,
                                    int protocolVersion,
                                    IList<string> currentSearchPaths)
        {
            var state = new ProjectState
            {
                Frameworks = new List<FrameworkData>(),
                Projects = new List<ProjectInfo>(),
                Diagnostics = new List<DiagnosticMessage>()
            };

            Project project;
            if (!Project.TryGetProject(appPath, out project, state.Diagnostics))
            {
                throw new InvalidOperationException($"Unable to find project.json in '{appPath}'");
            }

            if (triggerBuildOutputs)
            {
                // Trigger the build outputs for this project
                _compilationEngine.CompilationCache.NamedCacheDependencyProvider.Trigger(project.Name + "_BuildOutputs");
            }

            if (triggerDependencies)
            {
                _compilationEngine.CompilationCache.NamedCacheDependencyProvider.Trigger(project.Name + "_Dependencies");
            }

            state.Name = project.Name;
            state.Project = project;
            state.Configurations = project.GetConfigurations().ToList();
            state.Commands = project.Commands;

            var frameworks = new List<FrameworkName>(project.GetTargetFrameworks().Select(tf => tf.FrameworkName));

            if (!frameworks.Any())
            {
                frameworks.Add(VersionUtility.ParseFrameworkName(FrameworkNames.ShortNames.Dnx451));
            }

            var sourcesProjectWidesources = project.Files.SourceFiles.ToList();

            ResolveSearchPaths(state);

            foreach (var frameworkName in frameworks)
            {
                var dependencyInfo = ResolveProjectDependencies(project,
                                                                configuration,
                                                                frameworkName,
                                                                protocolVersion,
                                                                GetUpdatedSearchPaths(currentSearchPaths, state.ProjectSearchPaths));

                var dependencySources = new List<string>(sourcesProjectWidesources);

                var frameworkData = new FrameworkData
                {
                    ShortName = VersionUtility.GetShortFrameworkName(frameworkName),
                    FrameworkName = frameworkName.ToString(),
                    FriendlyName = _frameworkReferenceResolver.GetFriendlyFrameworkName(frameworkName),
                    RedistListPath = _frameworkReferenceResolver.GetFrameworkRedistListPath(frameworkName)
                };

                state.Frameworks.Add(frameworkData);

                // Add shared files from packages
                dependencySources.AddRange(dependencyInfo.ExportedSourcesFiles);

                // Add shared files from projects
                foreach (var reference in dependencyInfo.ProjectReferences)
                {
                    if (reference.Project == null)
                    {
                        continue;
                    }

                    // Only add direct dependencies as sources
                    if (!project.Dependencies.Any(d => string.Equals(d.Name, reference.Name, StringComparison.OrdinalIgnoreCase)))
                    {
                        continue;
                    }

                    dependencySources.AddRange(reference.Project.Files.SharedFiles);
                }

                var projectInfo = new ProjectInfo
                {
                    Path = appPath,
                    Configuration = configuration,
                    TargetFramework = frameworkData,
                    FrameworkName = frameworkName,
                    // TODO: This shouldn't be Roslyn specific compilation options
                    CompilationSettings = project.GetCompilerOptions(frameworkName, configuration)
                                                 .ToCompilationSettings(frameworkName),
                    SourceFiles = dependencySources,
                    DependencyInfo = dependencyInfo
                };

                state.Projects.Add(projectInfo);
            }

            return state;
        }
Beispiel #8
0
 public DiagnosticsListMessage([NotNull] IList<DiagnosticMessage> diagnostics, FrameworkData frameworkData)
     : this(diagnostics.Select(msg => new DiagnosticMessageView(msg)).ToList(), frameworkData)
 {
 }
Beispiel #9
0
 public DiagnosticsListMessage([NotNull] IList <DiagnosticMessage> diagnostics, FrameworkData frameworkData) :
     this(diagnostics.Select(msg => new DiagnosticMessageView(msg)).ToList(), frameworkData)
 {
 }