public void UpdateProject()

in src/StructuredLogger/Construction/Construction.cs [841:912]


        public void UpdateProject(Project project, ProjectStartedEventArgs args)
        {
            if (project.Name == null && args != null)
            {
                project.StartTime = args.Timestamp;
                project.Name = Intern(Path.GetFileName(args.ProjectFile));
                project.ProjectFile = Intern(args.ProjectFile);
                project.EntryTargets = string.IsNullOrWhiteSpace(args.TargetNames)
                    ? ImmutableArray<string>.Empty
                    : stringTable.InternList(TextUtilities.SplitSemicolonDelimitedList(args.TargetNames));
                project.TargetsText = args.TargetNames;

                var evaluationId = BuildEventContext.InvalidEvaluationId;
                if (args.BuildEventContext.EvaluationId > BuildEventContext.InvalidEvaluationId)
                {
                    evaluationId = args.BuildEventContext.EvaluationId;
                }
                else if (args.ParentProjectBuildEventContext != null && args.ParentProjectBuildEventContext.EvaluationId > BuildEventContext.InvalidEvaluationId)
                {
                    evaluationId = args.ParentProjectBuildEventContext.EvaluationId;
                }

                project.EvaluationId = evaluationId;
                if (evaluationId != BuildEventContext.InvalidEvaluationId)
                {
                    project.EvaluationText = Intern("id:" + evaluationId);
                }

                project.GlobalProperties = stringTable.InternStringDictionary(args.GlobalProperties) ?? ImmutableDictionary<string, string>.Empty;

                // Pre-create folder before starting the fill on the background thread.
                Folder globalNode = null;
                if (args.GlobalProperties != null)
                {
                    globalNode = GetOrCreateGlobalPropertiesFolder(project, project.GlobalProperties);
                }

                Folder targetsNode = null;
                Folder itemFolder = null;
                Folder propertyFolder = null;
                if (!string.IsNullOrEmpty(args.TargetNames))
                {
                    targetsNode = project.GetOrCreateNodeWithName<Folder>(Strings.EntryTargets);
                }

                if (args.Items != null)
                {
                    itemFolder = project.GetOrCreateNodeWithName<Folder>(Strings.Items, addAtBeginning: true);
                }

                if (args.Properties != null)
                {
                    propertyFolder = project.GetOrCreateNodeWithName<Folder>(Strings.Properties, addAtBeginning: true);
                }

                bgJobPool.Add(new System.Threading.Tasks.Task(() =>
                {
                    if (args.GlobalProperties != null && globalNode != null)
                    {
                        AddProperties(globalNode, args.GlobalProperties, project);
                    }

                    if (!string.IsNullOrEmpty(args.TargetNames))
                    {
                        AddEntryTargets(targetsNode, project);
                    }

                    AddProperties(propertyFolder, project, args.Properties);
                    AddItems(itemFolder, project, args.Items);
                }));
            }
        }