public void ApplyProjectBuild(IComparable version, IProjectChangeDiff difference, bool isActiveContext, IProjectLogger logger)
        {
            Requires.NotNull(version, nameof(version));
            Requires.NotNull(difference, nameof(difference));
            Requires.NotNull(logger, nameof(logger));

            if (!difference.AnyChanges)
            {
                return;
            }

            difference = HandlerServices.NormalizeRenames(difference);
            difference = ResolveProjectBuildConflicts(version, difference);

            ApplyChangesToContext(difference, ImmutableStringDictionary <IImmutableDictionary <string, string> > .EmptyOrdinal, isActiveContext, logger);
        }
        public void ApplyProjectEvaluation(IComparable version, IProjectChangeDiff difference, IImmutableDictionary <string, IImmutableDictionary <string, string> > metadata, bool isActiveContext, IProjectLogger logger)
        {
            Requires.NotNull(version, nameof(version));
            Requires.NotNull(difference, nameof(difference));
            Requires.NotNull(metadata, nameof(metadata));
            Requires.NotNull(logger, nameof(logger));

            if (!difference.AnyChanges)
            {
                return;
            }

            difference = HandlerServices.NormalizeRenames(difference);
            EnqueueProjectEvaluation(version, difference);

            ApplyChangesToContext(difference, metadata, isActiveContext, logger);
        }
        /// <summary>
        ///     Applies the specified version of the project evaluation <see cref="IProjectChangeDiff"/> and metadata to the underlying
        ///     <see cref="IWorkspaceProjectContext"/>, indicating if the context is the currently active one.
        /// </summary>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="version"/> is <see langword="null"/>.
        ///     <para>
        ///         -or-
        ///     </para>
        ///     <paramref name="difference" /> is <see langword="null"/>.
        ///     <para>
        ///         -or-
        ///     </para>
        ///     <paramref name="previousMetadata" /> is <see langword="null"/>.
        ///     <para>
        ///         -or-
        ///     </para>
        ///     <paramref name="currentMetadata" /> is <see langword="null"/>.
        ///     <para>
        ///         -or-
        ///     </para>
        ///     <paramref name="logger" /> is <see langword="null"/>.
        /// </exception>
        public void ApplyProjectEvaluation(IComparable version, IProjectChangeDiff difference, IImmutableDictionary <string, IImmutableDictionary <string, string> > previousMetadata, IImmutableDictionary <string, IImmutableDictionary <string, string> > currentMetadata, bool isActiveContext, IProjectLogger logger)
        {
            Requires.NotNull(version, nameof(version));
            Requires.NotNull(difference, nameof(difference));
            Requires.NotNull(previousMetadata, nameof(previousMetadata));
            Requires.NotNull(currentMetadata, nameof(currentMetadata));
            Requires.NotNull(logger, nameof(logger));

            if (!difference.AnyChanges)
            {
                return;
            }

            IImmutableDictionary <string, string> renamedItems = difference.RenamedItems;

            difference = HandlerServices.NormalizeRenames(difference);
            EnqueueProjectEvaluation(version, difference);

            ApplyChangesToContext(difference, previousMetadata, currentMetadata, renamedItems, isActiveContext, logger, evaluation: true);
        }
Exemplo n.º 4
0
        public void Handle(IComparable version, IProjectChangeDescription projectChange, bool isActiveContext, IProjectLogger logger)
        {
            Requires.NotNull(version, nameof(version));
            Requires.NotNull(projectChange, nameof(projectChange));
            Requires.NotNull(logger, nameof(logger));

            VerifyInitialized();

            IProjectChangeDiff difference = HandlerServices.NormalizeRenames(projectChange.Difference);

            foreach (string includePath in difference.RemovedItems)
            {
                if (IsDynamicFile(includePath))
                {
                    RemoveFromContextIfPresent(includePath, logger);
                }
            }

            foreach (string includePath in difference.AddedItems)
            {
                if (IsDynamicFile(includePath))
                {
                    IImmutableDictionary <string, string> metadata = projectChange.After.Items.GetValueOrDefault(includePath, ImmutableStringDictionary <string> .EmptyOrdinal);

                    AddToContextIfNotPresent(includePath, metadata, logger);
                }
            }

            // We Remove then Add changed items to pick up the Linked metadata
            foreach (string includePath in difference.ChangedItems)
            {
                if (IsDynamicFile(includePath))
                {
                    IImmutableDictionary <string, string> metadata = projectChange.After.Items.GetValueOrDefault(includePath, ImmutableStringDictionary <string> .EmptyOrdinal);

                    RemoveFromContextIfPresent(includePath, logger);
                    AddToContextIfNotPresent(includePath, metadata, logger);
                }
            }
        }